From 4ac9c80e5beea26e13ccf12ce6bd9ee051c229f5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Feb 2010 16:49:35 -0700 Subject: mesa: change ctx->Driver.ProgramStringNotify() to return GLboolean GL_TRUE indicates that the driver accepts the program. GL_FALSE indicates the program can't be compiled/translated by the driver for some reason (too many resources used, etc). Propogate this result up to the GL API: set GL_INVALID_OPERATION error if glProgramString() was called. Set shader program link status to GL_FALSE if glLinkProgram() was called. At this point, drivers still don't do any program checking and always return GL_TRUE. --- src/mesa/main/dd.h | 10 +++++++--- src/mesa/main/texenvprogram.c | 11 +++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 6705c901dd5..d98a14e09c4 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -581,9 +581,13 @@ struct dd_function_table { struct gl_program * (*NewProgram)(GLcontext *ctx, GLenum target, GLuint id); /** Delete a program */ void (*DeleteProgram)(GLcontext *ctx, struct gl_program *prog); - /** Notify driver that a program string has been specified. */ - void (*ProgramStringNotify)(GLcontext *ctx, GLenum target, - struct gl_program *prog); + /** + * Notify driver that a program string (and GPU code) has been specified + * or modified. Return GL_TRUE or GL_FALSE to indicate if the program is + * supported by the driver. + */ + GLboolean (*ProgramStringNotify)(GLcontext *ctx, GLenum target, + struct gl_program *prog); /** Query if program can be loaded onto hardware */ GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target, diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 499b7330d0a..414607e2288 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1535,8 +1535,15 @@ create_new_program(GLcontext *ctx, struct state_key *key, /* Notify driver the fragment program has (actually) changed. */ if (ctx->Driver.ProgramStringNotify) { - ctx->Driver.ProgramStringNotify( ctx, GL_FRAGMENT_PROGRAM_ARB, - &p.program->Base ); + GLboolean ok = ctx->Driver.ProgramStringNotify(ctx, + GL_FRAGMENT_PROGRAM_ARB, + &p.program->Base); + /* Driver should be able to handle any texenv programs as long as + * the driver correctly reported max number of texture units correctly, + * etc. + */ + ASSERT(ok); + (void) ok; /* silence unused var warning */ } if (DISASSEM) { -- cgit v1.2.3