Permalink
Browse files

Add some debug asserts, useful for debugging shader mismatches locall…

…y (though haven't found any..)
  • Loading branch information...
hrydgard committed Nov 30, 2017
1 parent 39fc2c8 commit 7b2ad5fe722e0e9e98d34da5f6ddc0e2acb7c9d6
Showing with 15 additions and 5 deletions.
  1. +5 −0 GPU/GLES/ShaderManagerGLES.cpp
  2. +5 −5 GPU/GPUState.h
  3. +5 −0 GPU/Vulkan/ShaderManagerVulkan.cpp
@@ -845,6 +845,11 @@ LinkedShader *ShaderManagerGLES::ApplyFragmentShader(ShaderID VSID, Shader *vs,
shaderSwitchDirtyUniforms_ = 0;
if (ls == nullptr) {
_dbg_assert_(G3D, FSID.Bit(FS_BIT_LMODE) == VSID.Bit(VS_BIT_LMODE));
_dbg_assert_(G3D, FSID.Bit(FS_BIT_DO_TEXTURE) == VSID.Bit(VS_BIT_DO_TEXTURE));
_dbg_assert_(G3D, FSID.Bit(FS_BIT_ENABLE_FOG) == VSID.Bit(VS_BIT_ENABLE_FOG));
_dbg_assert_(G3D, FSID.Bit(FS_BIT_FLATSHADE) == VSID.Bit(VS_BIT_FLATSHADE));
// Check if we can link these.
ls = new LinkedShader(VSID, vs, FSID, fs, vs->UseHWTransform());
ls->use(VSID, lastShader_);
View
@@ -60,7 +60,7 @@ struct GPUgstate {
lightEnable[4],
clipEnable,
cullfaceEnable,
textureMapEnable,
textureMapEnable, // 0x1E GE_CMD_TEXTUREMAPENABLE
fogEnable,
ditherEnable,
alphaBlendEnable,
@@ -116,8 +116,8 @@ struct GPUgstate {
materialspecularcoef, // 0x5B
ambientcolor, // 0x5C
ambientalpha, // 0x5D
lmode, // 0x5E
ltype[4], // 0x5F-0x62
lmode, // 0x5E GE_CMD_LIGHTMODE
ltype[4], // 0x5F-0x62 GE_CMD_LIGHTTYPEx
lpos[12], // 0x63-0x6E
ldir[12], // 0x6F-0x7A
latt[12], // 0x7B-0x86
@@ -141,7 +141,7 @@ struct GPUgstate {
texsize[8], // 0xB8-BF
texmapmode, // 0xC0
texshade, // 0xC1
texmode, // 0xC2
texmode, // 0xC2 GE_CMD_TEXMODE
texformat, // 0xC3
loadclut, // 0xC4
clutformat, // 0xC5
@@ -158,7 +158,7 @@ struct GPUgstate {
texlodslope, // 0xD0
padxxxxxx, // 0xD1
framebufpixformat, // 0xD2
clearmode, // 0xD3
clearmode, // 0xD3 GE_CMD_CLEARMODE
scissor1,
scissor2,
minz,
@@ -239,6 +239,11 @@ void ShaderManagerVulkan::GetShaders(int prim, u32 vertType, VulkanVertexShader
FSID = lastFSID_;
}
_dbg_assert_(G3D, FSID.Bit(FS_BIT_LMODE) == VSID.Bit(VS_BIT_LMODE));
_dbg_assert_(G3D, FSID.Bit(FS_BIT_DO_TEXTURE) == VSID.Bit(VS_BIT_DO_TEXTURE));
_dbg_assert_(G3D, FSID.Bit(FS_BIT_ENABLE_FOG) == VSID.Bit(VS_BIT_ENABLE_FOG));
_dbg_assert_(G3D, FSID.Bit(FS_BIT_FLATSHADE) == VSID.Bit(VS_BIT_FLATSHADE));
// Just update uniforms if this is the same shader as last time.
if (lastVShader_ != nullptr && lastFShader_ != nullptr && VSID == lastVSID_ && FSID == lastFSID_) {
*vshader = lastVShader_;

0 comments on commit 7b2ad5f

Please sign in to comment.