aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/shader/arbprogram.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-12-22 17:33:44 +0000
committermarha <marha@users.sourceforge.net>2009-12-22 17:33:44 +0000
commitb729d9e1cc1c60e415da24143cabcbaccb525ed7 (patch)
tree54fc81d1a046dc5ec6f4aa2a2d8a2ad015c423fd /mesalib/src/mesa/shader/arbprogram.c
parent0695dfb71ca6fe132d15a4d0890e8a868183adf9 (diff)
downloadvcxsrv-b729d9e1cc1c60e415da24143cabcbaccb525ed7.tar.gz
vcxsrv-b729d9e1cc1c60e415da24143cabcbaccb525ed7.tar.bz2
vcxsrv-b729d9e1cc1c60e415da24143cabcbaccb525ed7.zip
Updated to mesa_7_6_1_rc1
Diffstat (limited to 'mesalib/src/mesa/shader/arbprogram.c')
-rw-r--r--mesalib/src/mesa/shader/arbprogram.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/mesalib/src/mesa/shader/arbprogram.c b/mesalib/src/mesa/shader/arbprogram.c
index 4d8cff070..eb537cd1b 100644
--- a/mesalib/src/mesa/shader/arbprogram.c
+++ b/mesalib/src/mesa/shader/arbprogram.c
@@ -37,6 +37,8 @@
#include "main/mtypes.h"
#include "arbprogram.h"
#include "arbprogparse.h"
+#include "nvfragparse.h"
+#include "nvvertparse.h"
#include "program.h"
@@ -428,36 +430,66 @@ void GLAPIENTRY
_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
const GLvoid *string)
{
+ struct gl_program *base;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ if (!ctx->Extensions.ARB_vertex_program
+ && !ctx->Extensions.ARB_fragment_program) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramStringARB()");
+ return;
+ }
+
if (format != GL_PROGRAM_FORMAT_ASCII_ARB) {
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)");
return;
}
+ /* The first couple cases are complicated. The same enum value is used for
+ * ARB and NV vertex programs. If the target is a vertex program, parse it
+ * using the ARB grammar if the string starts with "!!ARB" or if
+ * NV_vertex_program is not supported.
+ */
if (target == GL_VERTEX_PROGRAM_ARB
- && ctx->Extensions.ARB_vertex_program) {
+ && ctx->Extensions.ARB_vertex_program
+ && ((strncmp(string, "!!ARB", 5) == 0)
+ || !ctx->Extensions.NV_vertex_program)) {
struct gl_vertex_program *prog = ctx->VertexProgram.Current;
_mesa_parse_arb_vertex_program(ctx, target, string, len, prog);
-
- if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify)
- ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base );
+
+ base = & prog->Base;
+ }
+ else if ((target == GL_VERTEX_PROGRAM_ARB
+ || target == GL_VERTEX_STATE_PROGRAM_NV)
+ && ctx->Extensions.NV_vertex_program) {
+ struct gl_vertex_program *prog = ctx->VertexProgram.Current;
+ _mesa_parse_nv_vertex_program(ctx, target, string, len, prog);
+
+ base = & prog->Base;
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
struct gl_fragment_program *prog = ctx->FragmentProgram.Current;
_mesa_parse_arb_fragment_program(ctx, target, string, len, prog);
- if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify)
- ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base );
+ base = & prog->Base;
+ }
+ else if (target == GL_FRAGMENT_PROGRAM_NV
+ && ctx->Extensions.NV_fragment_program) {
+ struct gl_fragment_program *prog = ctx->FragmentProgram.Current;
+ _mesa_parse_nv_fragment_program(ctx, target, string, len, prog);
+
+ base = & prog->Base;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)");
return;
}
+
+ if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify)
+ ctx->Driver.ProgramStringNotify( ctx, target, base );
}