From 5cad0eb973d1cbff7b659a425c9b8541819c3792 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 28 Nov 2021 13:59:21 +0100 Subject: [PATCH] glgsg: Don't use simple RAM image in shaders for non-sampler2D types Simple RAM images are always 2D right now, so this would otherwise cause an error. --- panda/src/glstuff/glShaderContext_src.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index e0db33e350..450fb69367 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -2952,10 +2952,13 @@ update_shader_texture_bindings(ShaderContext *prev) { // Bindless texturing wasn't supported or didn't work, so let's just bind // the texture normally. + // Note that simple RAM images are always 2-D for now, so to avoid errors, + // we must load the real texture if this is not for a sampler2D. + bool force = (spec._desired_type != Texture::TT_2d_texture); #ifndef OPENGLES if (multi_bind) { // Multi-bind case. - if (!_glgsg->update_texture(gtc, false)) { + if (!_glgsg->update_texture(gtc, force)) { textures[i] = 0; } else { gtc->set_active(true); @@ -2975,7 +2978,7 @@ update_shader_texture_bindings(ShaderContext *prev) { { // Non-multibind case. _glgsg->set_active_texture_stage(i); - if (!_glgsg->update_texture(gtc, false)) { + if (!_glgsg->update_texture(gtc, force)) { continue; } _glgsg->apply_texture(gtc);