Updates for new linker (merged varying/uniform vars).
authorBrian <brian@yutani.localnet.net>
Thu, 14 Dec 2006 20:59:25 +0000 (13:59 -0700)
committerBrian <brian@yutani.localnet.net>
Thu, 14 Dec 2006 20:59:25 +0000 (13:59 -0700)
src/mesa/shader/shaderobjects.c

index f805e2cebd37760b188a53701d167e0c8cce6a89..976fa0aa312647c0b795c33bec70fef690461efd 100644 (file)
 #include "context.h"
 #include "hash.h"
 #include "macros.h"
+#include "program.h"
 #include "shaderobjects.h"
 #include "shaderobjects_3dlabs.h"
 #include "slang_link.h"
 
+#define NEW_SLANG 1
 
 #if FEATURE_ARB_shader_objects
 
@@ -380,8 +382,8 @@ uniform(GLint location, GLsizei count, const GLvoid *values, GLenum type,
 #if NEW_SLANG
    if (ctx->ShaderObjects.Linked) {
       struct gl_linked_program *linked = ctx->ShaderObjects.Linked;
-      if (location >= 0 && location < linked->NumUniforms) {
-         GLfloat *v = linked->Uniforms[location].Value;
+      if (location >= 0 && location < linked->Uniforms->NumParameters) {
+         GLfloat *v = linked->Uniforms->ParameterValues[location];
          const GLfloat *fValues = (const GLfloat *) values; /* XXX */
          GLint i;
          if (type == GL_FLOAT_VEC4)
@@ -396,10 +398,10 @@ uniform(GLint location, GLsizei count, const GLvoid *values, GLenum type,
          return;
       }
    }
-#endif
-
+#else
    if (!(**pro).WriteUniform(pro, location, count, values, type))
       _mesa_error(ctx, GL_INVALID_OPERATION, caller);
+#endif
 }
 
 
@@ -850,10 +852,12 @@ _mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB * name)
    GET_CURRENT_CONTEXT(ctx);
 
    if (ctx->ShaderObjects.Linked) {
-      struct gl_linked_program *linked = ctx->ShaderObjects.Linked;
+      const struct gl_linked_program *linked = ctx->ShaderObjects.Linked;
       GLuint loc;
-      for (loc = 0; loc < linked->NumUniforms; loc++) {
-         if (!strcmp(linked->Uniforms[loc].Name, name)) {
+      for (loc = 0; loc < linked->Uniforms->NumParameters; loc++) {
+         const struct gl_program_parameter *u
+            = linked->Uniforms->Parameters + loc;
+         if (u->Type == PROGRAM_UNIFORM && !strcmp(u->Name, name)) {
             return loc;
          }
       }