mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +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.fill_color = gDP.fillColor;
|
||||||
_info.blend_color = gDP.blendColor;
|
_info.blend_color = gDP.blendColor;
|
||||||
_info.env_color = gDP.envColor;
|
_info.env_color = gDP.envColor;
|
||||||
_info.fill_color = gDP.fillColor;
|
|
||||||
_info.prim_color = gDP.primColor;
|
_info.prim_color = gDP.primColor;
|
||||||
_info.primDepthZ = gDP.primDepth.z;
|
_info.primDepthZ = gDP.primDepth.z;
|
||||||
_info.primDepthDeltaZ = gDP.primDepth.deltaZ;
|
_info.primDepthDeltaZ = gDP.primDepth.deltaZ;
|
||||||
|
|
|
@ -199,6 +199,7 @@ void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent)
|
||||||
|
|
||||||
switch (m_pCurrent->type) {
|
switch (m_pCurrent->type) {
|
||||||
case F3D:
|
case F3D:
|
||||||
|
case Turbo3D:
|
||||||
F3D_Init();
|
F3D_Init();
|
||||||
m_hwlSupported = true;
|
m_hwlSupported = true;
|
||||||
break;
|
break;
|
||||||
|
@ -262,10 +263,6 @@ void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent)
|
||||||
F3DAM_Init();
|
F3DAM_Init();
|
||||||
m_hwlSupported = true;
|
m_hwlSupported = true;
|
||||||
break;
|
break;
|
||||||
case Turbo3D:
|
|
||||||
F3D_Init();
|
|
||||||
m_hwlSupported = true;
|
|
||||||
break;
|
|
||||||
case ZSortp:
|
case ZSortp:
|
||||||
ZSort_Init();
|
ZSort_Init();
|
||||||
m_hwlSupported = true;
|
m_hwlSupported = true;
|
||||||
|
|
|
@ -37,9 +37,6 @@ namespace graphics {
|
||||||
u32 noiseFormatBytes;
|
u32 noiseFormatBytes;
|
||||||
|
|
||||||
virtual ~FramebufferTextureFormats() {}
|
virtual ~FramebufferTextureFormats() {}
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void init() = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1576,43 +1576,29 @@ namespace opengl {
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
case GL_RED:
|
case GL_RED:
|
||||||
|
case GL_RED_INTEGER:
|
||||||
|
case GL_STENCIL_INDEX:
|
||||||
|
case GL_DEPTH_COMPONENT:
|
||||||
|
case GL_LUMINANCE:
|
||||||
components = 1;
|
components = 1;
|
||||||
break;
|
break;
|
||||||
case GL_RG:
|
case GL_RG:
|
||||||
|
case GL_RG_INTEGER:
|
||||||
|
case GL_DEPTH_STENCIL:
|
||||||
components = 2;
|
components = 2;
|
||||||
break;
|
break;
|
||||||
case GL_RGB:
|
case GL_RGB:
|
||||||
case GL_BGR:
|
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_RGB_INTEGER:
|
||||||
case GL_BGR_INTEGER:
|
case GL_BGR_INTEGER:
|
||||||
components = 3;
|
components = 3;
|
||||||
break;
|
break;
|
||||||
|
case GL_RGBA:
|
||||||
|
case GL_BGRA:
|
||||||
case GL_RGBA_INTEGER:
|
case GL_RGBA_INTEGER:
|
||||||
case GL_BGRA_INTEGER:
|
case GL_BGRA_INTEGER:
|
||||||
components = 4;
|
components = 4;
|
||||||
break;
|
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:
|
default:
|
||||||
components = -1;
|
components = -1;
|
||||||
}
|
}
|
||||||
|
@ -1625,15 +1611,11 @@ namespace opengl {
|
||||||
break;
|
break;
|
||||||
case GL_UNSIGNED_SHORT:
|
case GL_UNSIGNED_SHORT:
|
||||||
case GL_SHORT:
|
case GL_SHORT:
|
||||||
|
case GL_HALF_FLOAT:
|
||||||
bytesPerPixel = components * 2;
|
bytesPerPixel = components * 2;
|
||||||
break;
|
break;
|
||||||
case GL_UNSIGNED_INT:
|
case GL_UNSIGNED_INT:
|
||||||
case GL_INT:
|
case GL_INT:
|
||||||
bytesPerPixel = components * 4;
|
|
||||||
break;
|
|
||||||
case GL_HALF_FLOAT:
|
|
||||||
bytesPerPixel = components * 2;
|
|
||||||
break;
|
|
||||||
case GL_FLOAT:
|
case GL_FLOAT:
|
||||||
bytesPerPixel = components * 4;
|
bytesPerPixel = components * 4;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -251,21 +251,14 @@ struct FramebufferTextureFormatsGLES2 : public graphics::FramebufferTextureForma
|
||||||
return _glinfo.isGLES2;
|
return _glinfo.isGLES2;
|
||||||
}
|
}
|
||||||
|
|
||||||
FramebufferTextureFormatsGLES2(const GLInfo & _glinfo):
|
FramebufferTextureFormatsGLES2(const GLInfo & _glinfo)
|
||||||
m_glinfo(_glinfo)
|
|
||||||
{
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void init() override
|
|
||||||
{
|
{
|
||||||
monochromeInternalFormat = GL_RGB;
|
monochromeInternalFormat = GL_RGB;
|
||||||
monochromeFormat = GL_RGB;
|
monochromeFormat = GL_RGB;
|
||||||
monochromeType = GL_UNSIGNED_SHORT_5_6_5;
|
monochromeType = GL_UNSIGNED_SHORT_5_6_5;
|
||||||
monochromeFormatBytes = 2;
|
monochromeFormatBytes = 2;
|
||||||
|
|
||||||
if (Utils::isExtensionSupported(m_glinfo, "GL_OES_depth_texture")) {
|
if (Utils::isExtensionSupported(_glinfo, "GL_OES_depth_texture")) {
|
||||||
depthInternalFormat = GL_DEPTH_COMPONENT;
|
depthInternalFormat = GL_DEPTH_COMPONENT;
|
||||||
depthFormatBytes = 4;
|
depthFormatBytes = 4;
|
||||||
} else {
|
} else {
|
||||||
|
@ -276,7 +269,7 @@ protected:
|
||||||
depthFormat = GL_DEPTH_COMPONENT;
|
depthFormat = GL_DEPTH_COMPONENT;
|
||||||
depthType = GL_UNSIGNED_INT;
|
depthType = GL_UNSIGNED_INT;
|
||||||
|
|
||||||
if (Utils::isExtensionSupported(m_glinfo, "GL_OES_rgb8_rgba8")) {
|
if (Utils::isExtensionSupported(_glinfo, "GL_OES_rgb8_rgba8")) {
|
||||||
colorInternalFormat = GL_RGBA;
|
colorInternalFormat = GL_RGBA;
|
||||||
colorFormat = GL_RGBA;
|
colorFormat = GL_RGBA;
|
||||||
colorType = GL_UNSIGNED_BYTE;
|
colorType = GL_UNSIGNED_BYTE;
|
||||||
|
@ -294,9 +287,6 @@ protected:
|
||||||
noiseType = GL_UNSIGNED_BYTE;
|
noiseType = GL_UNSIGNED_BYTE;
|
||||||
noiseFormatBytes = 1;
|
noiseFormatBytes = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
const GLInfo & m_glinfo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FramebufferTextureFormatsGLES3 : public graphics::FramebufferTextureFormats
|
struct FramebufferTextureFormatsGLES3 : public graphics::FramebufferTextureFormats
|
||||||
|
@ -305,16 +295,9 @@ struct FramebufferTextureFormatsGLES3 : public graphics::FramebufferTextureForma
|
||||||
return _glinfo.isGLESX && !_glinfo.isGLES2;
|
return _glinfo.isGLESX && !_glinfo.isGLES2;
|
||||||
}
|
}
|
||||||
|
|
||||||
FramebufferTextureFormatsGLES3(const GLInfo & _glinfo):
|
FramebufferTextureFormatsGLES3(const GLInfo & _glinfo)
|
||||||
m_glinfo(_glinfo)
|
|
||||||
{
|
{
|
||||||
init();
|
if (_glinfo.renderer == Renderer::Adreno530) {
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void init() override
|
|
||||||
{
|
|
||||||
if (m_glinfo.renderer == Renderer::Adreno530) {
|
|
||||||
colorInternalFormat = GL_RGBA32F;
|
colorInternalFormat = GL_RGBA32F;
|
||||||
colorFormat = GL_RGBA;
|
colorFormat = GL_RGBA;
|
||||||
colorType = GL_FLOAT;
|
colorType = GL_FLOAT;
|
||||||
|
@ -361,8 +344,6 @@ protected:
|
||||||
noiseType = GL_UNSIGNED_BYTE;
|
noiseType = GL_UNSIGNED_BYTE;
|
||||||
noiseFormatBytes = 1;
|
noiseFormatBytes = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GLInfo & m_glinfo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FramebufferTextureFormatsOpenGL : public graphics::FramebufferTextureFormats
|
struct FramebufferTextureFormatsOpenGL : public graphics::FramebufferTextureFormats
|
||||||
|
@ -372,12 +353,6 @@ struct FramebufferTextureFormatsOpenGL : public graphics::FramebufferTextureForm
|
||||||
}
|
}
|
||||||
|
|
||||||
FramebufferTextureFormatsOpenGL()
|
FramebufferTextureFormatsOpenGL()
|
||||||
{
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void init() override
|
|
||||||
{
|
{
|
||||||
colorInternalFormat = GL_RGBA8;
|
colorInternalFormat = GL_RGBA8;
|
||||||
colorFormat = GL_RGBA;
|
colorFormat = GL_RGBA;
|
||||||
|
|
|
@ -191,6 +191,7 @@ namespace opengl {
|
||||||
|
|
||||||
class CachedVertexAttribArray {
|
class CachedVertexAttribArray {
|
||||||
public:
|
public:
|
||||||
|
CachedVertexAttribArray() = default;
|
||||||
void enableVertexAttribArray(u32 _index, bool _enable);
|
void enableVertexAttribArray(u32 _index, bool _enable);
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|
|
@ -1644,9 +1644,6 @@ void LLETriangle::draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData)
|
||||||
if (_zbuffer)
|
if (_zbuffer)
|
||||||
gSP.geometryMode |= G_ZBUFFER;
|
gSP.geometryMode |= G_ZBUFFER;
|
||||||
|
|
||||||
if (vtxCount < 3)
|
|
||||||
return;
|
|
||||||
|
|
||||||
GraphicsDrawer & drawer = dwnd().getDrawer();
|
GraphicsDrawer & drawer = dwnd().getDrawer();
|
||||||
|
|
||||||
for (u32 i = 0; i < vtxCount - 2; ++i) {
|
for (u32 i = 0; i < vtxCount - 2; ++i) {
|
||||||
|
|
|
@ -2277,7 +2277,8 @@ void F5INDI_MoveWord(u32 _w0, u32 _w1)
|
||||||
static
|
static
|
||||||
void F5INDI_SetOtherMode(u32 w0, u32 w1)
|
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);
|
mask >>= _SHIFTR(w0, 8, 5);
|
||||||
|
|
||||||
const u32 A0 = _SHIFTR(w0, 16, 3);
|
const u32 A0 = _SHIFTR(w0, 16, 3);
|
||||||
|
|
|
@ -509,8 +509,6 @@ void ZSortBOSS_Lighting( u32 _w0, u32 _w1 )
|
||||||
tdest >>= 1;
|
tdest >>= 1;
|
||||||
|
|
||||||
u32 r4 = _w0 << 7;
|
u32 r4 = _w0 << 7;
|
||||||
assert(r4 >= 0);
|
|
||||||
|
|
||||||
u32 r9 = DMEM[0x944];
|
u32 r9 = DMEM[0x944];
|
||||||
assert(r9 == 0);
|
assert(r9 == 0);
|
||||||
|
|
||||||
|
@ -784,7 +782,8 @@ void ZSortBOSS_UpdateMask( u32 _w0, u32 _w1 )
|
||||||
|
|
||||||
void ZSortBOSS_SetOtherMode_L( 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;
|
mask >>= (_w0 >> 8) & 0x1f;
|
||||||
gDP.otherMode.l = (gDP.otherMode.l & ~mask) | _w1;
|
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 )
|
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;
|
mask >>= (_w0 >> 8) & 0x1f;
|
||||||
gDP.otherMode.h = (gDP.otherMode.h & ~mask) | _w1;
|
gDP.otherMode.h = (gDP.otherMode.h & ~mask) | _w1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user