Reset lod bias on GL when rendering textures internally

This commit is contained in:
baldurk
2024-12-05 13:31:23 +00:00
parent 4bc41a6296
commit 9d698acbf4
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -1345,11 +1345,18 @@ GLReplay::TextureSamplerState GLReplay::SetSamplerParams(GLenum target, GLuint t
GL.glGetTextureParameterivEXT(texname, target, eGL_TEXTURE_WRAP_T, (GLint *)&ret.wrapT);
GL.glGetTextureParameterivEXT(texname, target, eGL_TEXTURE_WRAP_R, (GLint *)&ret.wrapR);
GL.glGetTextureParameterivEXT(texname, target, eGL_TEXTURE_COMPARE_MODE, (GLint *)&ret.compareMode);
if(!IsGLES)
GL.glGetTextureParameterfvEXT(texname, target, eGL_TEXTURE_LOD_BIAS, &ret.lodBias);
// disable depth comparison
GLenum compareMode = eGL_NONE;
GL.glTextureParameterivEXT(texname, target, eGL_TEXTURE_COMPARE_MODE, (GLint *)&compareMode);
// disable LOD bias, we control our own sampling
float lodBias = 0.0f;
if(!IsGLES)
GL.glTextureParameterfvEXT(texname, target, eGL_TEXTURE_LOD_BIAS, &lodBias);
// always want to clamp
GLenum param = eGL_CLAMP_TO_EDGE;
GL.glTextureParameterivEXT(texname, target, eGL_TEXTURE_WRAP_S, (GLint *)&param);
@@ -1394,6 +1401,8 @@ void GLReplay::RestoreSamplerParams(GLenum target, GLuint texname, TextureSample
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);
if(!IsGLES)
GL.glTextureParameterfvEXT(texname, target, eGL_TEXTURE_LOD_BIAS, &state.lodBias);
}
void GLReplay::FillWithDiscardPattern(DiscardType type, GLuint framebuffer, GLsizei numAttachments,
+1
View File
@@ -358,6 +358,7 @@ private:
GLenum wrapT = eGL_CLAMP_TO_EDGE;
GLenum wrapR = eGL_CLAMP_TO_EDGE;
GLenum compareMode = eGL_NONE;
float lodBias = 0.0f;
};
// sets the desired parameters, and returns the previous ones ready to restore