summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/arbprogparse.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-10-04 14:40:05 +0000
committerBrian Paul <[email protected]>2004-10-04 14:40:05 +0000
commitbe76b7fe1e09ae52204f6225331355414c05f91d (patch)
tree61aea1c988cb214a1ada8534c59ec09eb9845628 /src/mesa/shader/arbprogparse.c
parent00fb3a054a7499a9db6f87088356bee5c4e8f135 (diff)
ARB_fp support for GL_ARB_draw_buffers (Karl Rasche)
Diffstat (limited to 'src/mesa/shader/arbprogparse.c')
-rw-r--r--src/mesa/shader/arbprogparse.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index 5b5924c739c..ae85a93ecf9 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -146,7 +146,7 @@ __extension__ static char arb_grammar_text[] =
- changed and merged V_* and F_* opcode values to OP_*.
- added GL_ARB_fragment_program_shadow specific tokens (michal)
*/
-#define REVISION 0x07
+#define REVISION 0x08
/* program type */
#define FRAGMENT_PROGRAM 0x01
@@ -826,6 +826,28 @@ parse_generic_attrib_num(GLcontext *ctx, GLubyte ** inst,
/**
+ * \param color The index of the color buffer to write into
+ * \return 0 on sucess, 1 on error
+ */
+static GLuint
+parse_output_color_num (GLcontext * ctx, GLubyte ** inst,
+ struct arb_program *Program, GLuint * color)
+{
+ GLint i = parse_integer (inst, Program);
+
+ if ((i < 0) || (i >= (int)ctx->Const.MaxDrawBuffers)) {
+ _mesa_set_program_error (ctx, Program->Position,
+ "Invalid draw buffer index");
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid draw buffer index");
+ return 1;
+ }
+
+ *color = (GLuint) i;
+ return 0;
+}
+
+
+/**
* \param coord The texture unit index
* \return 0 on sucess, 1 on error
*/
@@ -1558,13 +1580,20 @@ static GLuint
parse_result_binding (GLcontext * ctx, GLubyte ** inst, GLuint * binding,
GLuint * binding_idx, struct arb_program *Program)
{
- GLuint b;
+ GLuint b, out_color;
switch (*(*inst)++) {
case FRAGMENT_RESULT_COLOR:
/* for frag programs, this is FRAGMENT_RESULT_COLOR */
if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
+ /* This gets result of the color buffer we're supposed to
+ * draw into
+ */
+ parse_output_color_num(ctx, inst, Program, &out_color);
+
*binding = FRAG_OUTPUT_COLR;
+
+ /* XXX: We're ignoring the color buffer for now. */
*binding_idx = 0;
}
/* for vtx programs, this is VERTEX_RESULT_POSITION */