prog parse: Handle GL_VERTEX_PROGRAM_ARB in glLoadProgramNV
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 2 Nov 2009 22:10:38 +0000 (14:10 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 7 Nov 2009 23:54:33 +0000 (15:54 -0800)
src/mesa/shader/nvprogram.c

index 80ed410c244e99425212e62c9ad742cc5cfe6c2b..fd6cbb0f40972c11b8cf49d535d041fa422f0a19 100644 (file)
@@ -596,6 +596,12 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
+   if (!ctx->Extensions.NV_vertex_program
+       && !ctx->Extensions.NV_fragment_program) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV()");
+      return;
+   }
+
    if (id == 0) {
       _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(id)");
       return;
@@ -628,7 +634,13 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
          }
          _mesa_HashInsert(ctx->Shared->Programs, id, vprog);
       }
-      _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog);
+
+      if (ctx->Extensions.ARB_vertex_program
+         && (strncmp((char *) program, "!!ARB", 5) == 0)) {
+        _mesa_parse_arb_vertex_program(ctx, target, program, len, vprog);
+      } else {
+        _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog);
+      }
    }
    else if (target == GL_FRAGMENT_PROGRAM_NV
             && ctx->Extensions.NV_fragment_program) {