diff options
author | Younes Manton <[email protected]> | 2009-12-06 16:44:11 -0500 |
---|---|---|
committer | Younes Manton <[email protected]> | 2009-12-06 16:44:11 -0500 |
commit | 447dddb93d8dc2551ef7a9c43004237c7a8dd2dd (patch) | |
tree | de18c6e4c2b071923345bcc1fa876459c4148a70 /src/mesa/shader/nvprogram.c | |
parent | 9e8ab2e7c1b8ff5279d4247b8690c9bfc57f7e02 (diff) | |
parent | c574f515f0aa20ccc3841cf61a6124bc5996e7b2 (diff) |
Merge branch 'master' into pipe-video
Conflicts:
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
src/gallium/auxiliary/vl/vl_shader_build.c
Diffstat (limited to 'src/mesa/shader/nvprogram.c')
-rw-r--r-- | src/mesa/shader/nvprogram.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index 471a7358a2f..fd6cbb0f409 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -47,6 +47,7 @@ #include "prog_instruction.h" #include "nvfragparse.h" #include "nvvertparse.h" +#include "arbprogparse.h" #include "nvprogram.h" @@ -595,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; @@ -627,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) { @@ -643,6 +656,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)"); } |