瀏覽代碼

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.
rdb 4 年之前
父節點
當前提交
5cad0eb973
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      panda/src/glstuff/glShaderContext_src.cxx

+ 5 - 2
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);