mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-30 08:24:05 +00:00
Fix some of PVS-Studio warnings.
This commit is contained in:
parent
46c65776a0
commit
78c89fbbfd
|
@ -258,7 +258,6 @@ void Debugger::_fillTriInfo(TriInfo & _info)
|
|||
_info.fill_color = gDP.fillColor;
|
||||
_info.blend_color = gDP.blendColor;
|
||||
_info.env_color = gDP.envColor;
|
||||
_info.fill_color = gDP.fillColor;
|
||||
_info.prim_color = gDP.primColor;
|
||||
_info.primDepthZ = gDP.primDepth.z;
|
||||
_info.primDepthDeltaZ = gDP.primDepth.deltaZ;
|
||||
|
|
|
@ -199,6 +199,7 @@ void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent)
|
|||
|
||||
switch (m_pCurrent->type) {
|
||||
case F3D:
|
||||
case Turbo3D:
|
||||
F3D_Init();
|
||||
m_hwlSupported = true;
|
||||
break;
|
||||
|
@ -262,10 +263,6 @@ void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent)
|
|||
F3DAM_Init();
|
||||
m_hwlSupported = true;
|
||||
break;
|
||||
case Turbo3D:
|
||||
F3D_Init();
|
||||
m_hwlSupported = true;
|
||||
break;
|
||||
case ZSortp:
|
||||
ZSort_Init();
|
||||
m_hwlSupported = true;
|
||||
|
|
|
@ -37,9 +37,6 @@ namespace graphics {
|
|||
u32 noiseFormatBytes;
|
||||
|
||||
virtual ~FramebufferTextureFormats() {}
|
||||
|
||||
protected:
|
||||
virtual void init() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1576,43 +1576,29 @@ namespace opengl {
|
|||
switch (format)
|
||||
{
|
||||
case GL_RED:
|
||||
case GL_RED_INTEGER:
|
||||
case GL_STENCIL_INDEX:
|
||||
case GL_DEPTH_COMPONENT:
|
||||
case GL_LUMINANCE:
|
||||
components = 1;
|
||||
break;
|
||||
case GL_RG:
|
||||
case GL_RG_INTEGER:
|
||||
case GL_DEPTH_STENCIL:
|
||||
components = 2;
|
||||
break;
|
||||
case GL_RGB:
|
||||
case GL_BGR:
|
||||
components = 3;
|
||||
break;
|
||||
case GL_RGBA:
|
||||
case GL_BGRA:
|
||||
components = 4;
|
||||
break;
|
||||
case GL_RED_INTEGER:
|
||||
components = 1;
|
||||
break;
|
||||
case GL_RG_INTEGER:
|
||||
components = 2;
|
||||
break;
|
||||
case GL_RGB_INTEGER:
|
||||
case GL_BGR_INTEGER:
|
||||
components = 3;
|
||||
break;
|
||||
case GL_RGBA:
|
||||
case GL_BGRA:
|
||||
case GL_RGBA_INTEGER:
|
||||
case GL_BGRA_INTEGER:
|
||||
components = 4;
|
||||
break;
|
||||
case GL_STENCIL_INDEX:
|
||||
case GL_DEPTH_COMPONENT:
|
||||
components = 1;
|
||||
break;
|
||||
case GL_DEPTH_STENCIL:
|
||||
components = 2;
|
||||
break;
|
||||
case GL_LUMINANCE:
|
||||
components = 1;
|
||||
break;
|
||||
default:
|
||||
components = -1;
|
||||
}
|
||||
|
@ -1625,15 +1611,11 @@ namespace opengl {
|
|||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
case GL_SHORT:
|
||||
case GL_HALF_FLOAT:
|
||||
bytesPerPixel = components * 2;
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
case GL_INT:
|
||||
bytesPerPixel = components * 4;
|
||||
break;
|
||||
case GL_HALF_FLOAT:
|
||||
bytesPerPixel = components * 2;
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
bytesPerPixel = components * 4;
|
||||
break;
|
||||
|
|
|
@ -251,21 +251,14 @@ struct FramebufferTextureFormatsGLES2 : public graphics::FramebufferTextureForma
|
|||
return _glinfo.isGLES2;
|
||||
}
|
||||
|
||||
FramebufferTextureFormatsGLES2(const GLInfo & _glinfo):
|
||||
m_glinfo(_glinfo)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
protected:
|
||||
void init() override
|
||||
FramebufferTextureFormatsGLES2(const GLInfo & _glinfo)
|
||||
{
|
||||
monochromeInternalFormat = GL_RGB;
|
||||
monochromeFormat = GL_RGB;
|
||||
monochromeType = GL_UNSIGNED_SHORT_5_6_5;
|
||||
monochromeFormatBytes = 2;
|
||||
|
||||
if (Utils::isExtensionSupported(m_glinfo, "GL_OES_depth_texture")) {
|
||||
if (Utils::isExtensionSupported(_glinfo, "GL_OES_depth_texture")) {
|
||||
depthInternalFormat = GL_DEPTH_COMPONENT;
|
||||
depthFormatBytes = 4;
|
||||
} else {
|
||||
|
@ -276,7 +269,7 @@ protected:
|
|||
depthFormat = GL_DEPTH_COMPONENT;
|
||||
depthType = GL_UNSIGNED_INT;
|
||||
|
||||
if (Utils::isExtensionSupported(m_glinfo, "GL_OES_rgb8_rgba8")) {
|
||||
if (Utils::isExtensionSupported(_glinfo, "GL_OES_rgb8_rgba8")) {
|
||||
colorInternalFormat = GL_RGBA;
|
||||
colorFormat = GL_RGBA;
|
||||
colorType = GL_UNSIGNED_BYTE;
|
||||
|
@ -294,9 +287,6 @@ protected:
|
|||
noiseType = GL_UNSIGNED_BYTE;
|
||||
noiseFormatBytes = 1;
|
||||
}
|
||||
|
||||
private:
|
||||
const GLInfo & m_glinfo;
|
||||
};
|
||||
|
||||
struct FramebufferTextureFormatsGLES3 : public graphics::FramebufferTextureFormats
|
||||
|
@ -305,16 +295,9 @@ struct FramebufferTextureFormatsGLES3 : public graphics::FramebufferTextureForma
|
|||
return _glinfo.isGLESX && !_glinfo.isGLES2;
|
||||
}
|
||||
|
||||
FramebufferTextureFormatsGLES3(const GLInfo & _glinfo):
|
||||
m_glinfo(_glinfo)
|
||||
FramebufferTextureFormatsGLES3(const GLInfo & _glinfo)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
protected:
|
||||
void init() override
|
||||
{
|
||||
if (m_glinfo.renderer == Renderer::Adreno530) {
|
||||
if (_glinfo.renderer == Renderer::Adreno530) {
|
||||
colorInternalFormat = GL_RGBA32F;
|
||||
colorFormat = GL_RGBA;
|
||||
colorType = GL_FLOAT;
|
||||
|
@ -361,8 +344,6 @@ protected:
|
|||
noiseType = GL_UNSIGNED_BYTE;
|
||||
noiseFormatBytes = 1;
|
||||
}
|
||||
|
||||
const GLInfo & m_glinfo;
|
||||
};
|
||||
|
||||
struct FramebufferTextureFormatsOpenGL : public graphics::FramebufferTextureFormats
|
||||
|
@ -372,12 +353,6 @@ struct FramebufferTextureFormatsOpenGL : public graphics::FramebufferTextureForm
|
|||
}
|
||||
|
||||
FramebufferTextureFormatsOpenGL()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
protected:
|
||||
void init() override
|
||||
{
|
||||
colorInternalFormat = GL_RGBA8;
|
||||
colorFormat = GL_RGBA;
|
||||
|
|
|
@ -191,6 +191,7 @@ namespace opengl {
|
|||
|
||||
class CachedVertexAttribArray {
|
||||
public:
|
||||
CachedVertexAttribArray() = default;
|
||||
void enableVertexAttribArray(u32 _index, bool _enable);
|
||||
void reset();
|
||||
|
||||
|
|
|
@ -1644,9 +1644,6 @@ void LLETriangle::draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData)
|
|||
if (_zbuffer)
|
||||
gSP.geometryMode |= G_ZBUFFER;
|
||||
|
||||
if (vtxCount < 3)
|
||||
return;
|
||||
|
||||
GraphicsDrawer & drawer = dwnd().getDrawer();
|
||||
|
||||
for (u32 i = 0; i < vtxCount - 2; ++i) {
|
||||
|
|
|
@ -2277,7 +2277,8 @@ void F5INDI_MoveWord(u32 _w0, u32 _w1)
|
|||
static
|
||||
void F5INDI_SetOtherMode(u32 w0, u32 w1)
|
||||
{
|
||||
u32 mask = (s32)0x80000000 >> _SHIFTR(w0, 0, 5);
|
||||
//u32 mask = (s32)0x80000000 >> _SHIFTR(w0, 0, 5); // unspecified behaviour
|
||||
u32 mask = static_cast<u32>(s32(0x80000000) / (1 << _SHIFTR(w0, 0, 5)));
|
||||
mask >>= _SHIFTR(w0, 8, 5);
|
||||
|
||||
const u32 A0 = _SHIFTR(w0, 16, 3);
|
||||
|
|
|
@ -127,7 +127,7 @@ void StoreMatrix( f32 mtx[4][4], u32 address )
|
|||
s16 integer[4][4];
|
||||
u16 fraction[4][4];
|
||||
} *n64Mat = (struct _N64Matrix *)&RDRAM[address];
|
||||
|
||||
|
||||
for (u32 i = 0; i < 4; i++) {
|
||||
for (u32 j = 0; j < 4; j++) {
|
||||
const auto element = GetIntMatrixElement(mtx[i][j]);
|
||||
|
@ -509,8 +509,6 @@ void ZSortBOSS_Lighting( u32 _w0, u32 _w1 )
|
|||
tdest >>= 1;
|
||||
|
||||
u32 r4 = _w0 << 7;
|
||||
assert(r4 >= 0);
|
||||
|
||||
u32 r9 = DMEM[0x944];
|
||||
assert(r9 == 0);
|
||||
|
||||
|
@ -540,11 +538,11 @@ void ZSortBOSS_Lighting( u32 _w0, u32 _w1 )
|
|||
//DMEM[(cdest++)^3] = (u8)(vtx.g * 255.0f);
|
||||
//DMEM[(cdest++)^3] = (u8)(vtx.b * 255.0f);
|
||||
//DMEM[(cdest++)^3] = (u8)(vtx.a * 255.0f);
|
||||
|
||||
|
||||
((s16*)DMEM)[(tdest++)^1] = (s16)vtx.s;
|
||||
((s16*)DMEM)[(tdest++)^1] = (s16)vtx.t;
|
||||
}
|
||||
|
||||
|
||||
LOG(LOG_VERBOSE, "ZSortBOSS_Lighting (0x%08x, 0x%08x)", _w0, _w1);
|
||||
}
|
||||
|
||||
|
@ -784,7 +782,8 @@ void ZSortBOSS_UpdateMask( u32 _w0, u32 _w1 )
|
|||
|
||||
void ZSortBOSS_SetOtherMode_L( u32 _w0, u32 _w1 )
|
||||
{
|
||||
u32 mask = (s32)0x80000000 >> (_w0 & 0x1f);
|
||||
//u32 mask = (s32)0x80000000 >> (_w0 & 0x1f); // unspecified behaviour
|
||||
u32 mask = static_cast<u32>(s32(0x80000000) / (1 << (_w0 & 0x1f)));
|
||||
mask >>= (_w0 >> 8) & 0x1f;
|
||||
gDP.otherMode.l = (gDP.otherMode.l & ~mask) | _w1;
|
||||
|
||||
|
@ -799,7 +798,8 @@ void ZSortBOSS_SetOtherMode_L( u32 _w0, u32 _w1 )
|
|||
|
||||
void ZSortBOSS_SetOtherMode_H( u32 _w0, u32 _w1 )
|
||||
{
|
||||
u32 mask = (s32)0x80000000 >> (_w0 & 0x1f);
|
||||
//u32 mask = (s32)0x80000000 >> (_w0 & 0x1f); // unspecified behaviour
|
||||
u32 mask = static_cast<u32>(s32(0x80000000) / (1 << (_w0 & 0x1f)));
|
||||
mask >>= (_w0 >> 8) & 0x1f;
|
||||
gDP.otherMode.h = (gDP.otherMode.h & ~mask) | _w1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user