Browse Source

glgsg: Fix some ShaderMatSpec erroneously being marked as unused

rdb 5 years ago
parent
commit
c9ad586dd3
2 changed files with 20 additions and 5 deletions
  1. 11 1
      panda/src/gles2gsg/gles2gsg.h
  2. 9 4
      panda/src/glstuff/glShaderContext_src.cxx

+ 11 - 1
panda/src/gles2gsg/gles2gsg.h

@@ -251,7 +251,17 @@ typedef char GLchar;
 #define GL_ACTIVE_RESOURCES 0x92F5
 #define GL_MAX_NAME_LENGTH 0x92F6
 #define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7
-#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8
+#define GL_NAME_LENGTH 0x92F9
+#define GL_TYPE 0x92FA
+#define GL_ARRAY_SIZE 0x92FB
+#define GL_OFFSET 0x92FC
+#define GL_BLOCK_INDEX 0x92FD
+#define GL_ARRAY_STRIDE 0x92FE
+#define GL_MATRIX_STRIDE 0x92FF
+#define GL_IS_ROW_MAJOR 0x9300
+#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301
+#define GL_BUFFER_BINDING 0x9302
+#define GL_BUFFER_DATA_SIZE 0x9303
 #define GL_NUM_ACTIVE_VARIABLES 0x9304
 #define GL_ACTIVE_VARIABLES 0x9305
 #define GL_LOCATION 0x930E

+ 9 - 4
panda/src/glstuff/glShaderContext_src.cxx

@@ -81,11 +81,16 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext
       glgsg->_glGetProgramInterfaceiv(_glsl_program, GL_UNIFORM, GL_ACTIVE_RESOURCES, &num_active_uniforms);
 
       for (GLint i = 0; i < num_active_uniforms; ++i) {
-        GLenum prop = GL_LOCATION;
-        GLint location;
-        glgsg->_glGetProgramResourceiv(_glsl_program, GL_UNIFORM, i, 1, &prop, 1, nullptr, &location);
+        GLenum props[2] = {GL_LOCATION, GL_ARRAY_SIZE};
+        GLint values[2];
+        glgsg->_glGetProgramResourceiv(_glsl_program, GL_UNIFORM, i, 2, props, 2, nullptr, values);
+        GLint location = values[0];
         if (location >= 0) {
-          set_uniform_location(location, location);
+          GLint array_size = values[1];
+          while (array_size--) {
+            set_uniform_location(location, location);
+            ++location;
+          }
         }
       }
       _remap_uniform_locations = true;