renderer_gl: Fix disabled cubemap texture units (#2159)

Disabled texture units on OpenGL always use a null 2D texture, but there are
cases where the null texture should be a null cubemap rather than a 2D
texture to match the active texture binding state.

Fixes some errors that occur in `OpenGLState::Apply()` found
in Brain Age: Concentration Training.
This commit is contained in:
Wunk 2026-05-28 06:42:02 -07:00 committed by GitHub
parent 56f738eb06
commit 4e4c7e687b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -666,8 +666,21 @@ void RasterizerOpenGL::SyncTextureUnits(const Framebuffer* framebuffer) {
// If the texture unit is disabled unbind the corresponding gl unit // If the texture unit is disabled unbind the corresponding gl unit
if (!texture.enabled) { if (!texture.enabled) {
const Surface& null_surface = res_cache.GetSurface(VideoCore::NULL_SURFACE_ID); switch (texture.config.type.Value()) {
state.texture_units[texture_index].texture_2d = null_surface.Handle(); case TextureType::TextureCube:
case TextureType::ShadowCube: {
state.texture_units[texture_index].texture_2d =
res_cache.GetSurface(VideoCore::NULL_SURFACE_CUBE_ID).Handle();
state.texture_units[texture_index].target = GL_TEXTURE_CUBE_MAP;
break;
}
default: {
state.texture_units[texture_index].texture_2d =
res_cache.GetSurface(VideoCore::NULL_SURFACE_ID).Handle();
state.texture_units[texture_index].target = GL_TEXTURE_2D;
break;
}
}
continue; continue;
} }