Fix textures not getting displayed when using GL_COMPARE_REF_TO_TEXTURE

This commit adds the GL_TEXTURE_COMPARE_MODE parameter to the
TextureSamplerState struct, and sets its value to GL_NONE in
SetSamplerState. This fixes the issue of depth textures that use
GL_COMPARE_REF_TO_TEXTURE being displayed as solid black or white
in the texture viewer.
This commit is contained in:
Sofie Brouwer
2019-03-08 15:39:56 +00:00
committed by Baldur Karlsson
parent 40dab34a8f
commit 8f163be2dd
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -1168,6 +1168,11 @@ GLReplay::TextureSamplerState GLReplay::SetSamplerParams(GLenum target, GLuint t
GL.glGetTextureParameterivEXT(texname, target, eGL_TEXTURE_MAG_FILTER, (GLint *)&ret.magFilter);
GL.glGetTextureParameterivEXT(texname, target, eGL_TEXTURE_WRAP_S, (GLint *)&ret.wrapS);
GL.glGetTextureParameterivEXT(texname, target, eGL_TEXTURE_WRAP_T, (GLint *)&ret.wrapT);
GL.glGetTextureParameterivEXT(texname, target, eGL_TEXTURE_COMPARE_MODE, (GLint *)&ret.compareMode);
// disable depth comparison
GLenum compareMode = eGL_NONE;
GL.glTextureParameterivEXT(texname, target, eGL_TEXTURE_COMPARE_MODE, (GLint *)&compareMode);
// always want to clamp
GLenum param = eGL_CLAMP_TO_EDGE;
@@ -1210,6 +1215,7 @@ void GLReplay::RestoreSamplerParams(GLenum target, GLuint texname, TextureSample
GL.glTextureParameterivEXT(texname, target, eGL_TEXTURE_WRAP_T, (GLint *)&state.wrapT);
GL.glTextureParameterivEXT(texname, target, eGL_TEXTURE_MIN_FILTER, (GLint *)&state.minFilter);
GL.glTextureParameterivEXT(texname, target, eGL_TEXTURE_MAG_FILTER, (GLint *)&state.magFilter);
GL.glTextureParameterivEXT(texname, target, eGL_TEXTURE_COMPARE_MODE, (GLint *)&state.compareMode);
}
bool GLReplay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample,
+1
View File
@@ -295,6 +295,7 @@ private:
GLenum magFilter = eGL_NEAREST;
GLenum wrapS = eGL_CLAMP_TO_EDGE;
GLenum wrapT = eGL_CLAMP_TO_EDGE;
GLenum compareMode = eGL_NONE;
};
// sets the desired parameters, and returns the previous ones ready to restore