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

index 471a7358a2f4bc3aa34c275ad4739281cc80624b..80ed410c244e99425212e62c9ad742cc5cfe6c2b 100644 (file)
@@ -47,6 +47,7 @@
 #include "prog_instruction.h"
 #include "nvfragparse.h"
 #include "nvvertparse.h"
+#include "arbprogparse.h"
 #include "nvprogram.h"
 
 
@@ -643,6 +644,20 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
       }
       _mesa_parse_nv_fragment_program(ctx, target, program, len, fprog);
    }
+   else if (target == GL_FRAGMENT_PROGRAM_ARB
+            && ctx->Extensions.ARB_fragment_program) {
+      struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
+      if (!fprog || prog == &_mesa_DummyProgram) {
+         fprog = (struct gl_fragment_program *)
+            ctx->Driver.NewProgram(ctx, target, id);
+         if (!fprog) {
+            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
+            return;
+         }
+         _mesa_HashInsert(ctx->Shared->Programs, id, fprog);
+      }
+      _mesa_parse_arb_fragment_program(ctx, target, program, len, fprog);
+   }
    else {
       _mesa_error(ctx, GL_INVALID_ENUM, "glLoadProgramNV(target)");
    }