summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-04-13 11:09:55 -0700
committerIan Romanick <ian.d.romanick@intel.com>2011-06-13 15:35:55 -0700
commitff07695e19239769b552ff2a97e6eb7db406993d (patch)
tree81d933170cb72a6cf6edc40da52ca5f6df1ecef9 /src
parentfc23cc06af90b5945de2c1f5e045b2b93f5ee70b (diff)
mesa: Add support for the ARB_fragment_program part of ARB_draw_buffers.
Fixes fbo-drawbuffers-arbfp. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34321 Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (cherry picked from commit 28cec9e832b716b84c11ddabfcee74e0daf6ec49)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/program/program_parse.y29
-rw-r--r--src/mesa/program/program_parser.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
index 784ea28c17a..1fa2b6674ee 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -2064,6 +2064,34 @@ optResultFaceType:
? VERT_RESULT_COL0
: FRAG_RESULT_COLOR;
}
+ | '[' INTEGER ']'
+ {
+ if (state->mode == ARB_vertex) {
+ yyerror(& @1, state, "invalid program result name");
+ YYERROR;
+ } else {
+ if (!state->option.DrawBuffers) {
+ /* From the ARB_draw_buffers spec (same text exists
+ * for ATI_draw_buffers):
+ *
+ * If this option is not specified, a fragment
+ * program that attempts to bind
+ * "result.color[n]" will fail to load, and only
+ * "result.color" will be allowed.
+ */
+ yyerror(& @1, state,
+ "result.color[] used without "
+ "`OPTION ARB_draw_buffers' or "
+ "`OPTION ATI_draw_buffers'");
+ YYERROR;
+ } else if ($2 >= state->MaxDrawBuffers) {
+ yyerror(& @1, state,
+ "result.color[] exceeds MAX_DRAW_BUFFERS_ARB");
+ YYERROR;
+ }
+ $$ = FRAG_RESULT_DATA0 + $2;
+ }
+ }
| FRONT
{
if (state->mode == ARB_vertex) {
@@ -2681,6 +2709,7 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st
state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
state->MaxLights = ctx->Const.MaxLights;
state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
+ state->MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
diff --git a/src/mesa/program/program_parser.h b/src/mesa/program/program_parser.h
index d689eef7958..8e5aaee95e5 100644
--- a/src/mesa/program/program_parser.h
+++ b/src/mesa/program/program_parser.h
@@ -173,6 +173,7 @@ struct asm_parser_state {
unsigned MaxClipPlanes;
unsigned MaxLights;
unsigned MaxProgramMatrices;
+ unsigned MaxDrawBuffers;
/*@}*/
/**