- 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
}
+/**
+ * \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
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 */
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (index == 0 || index >= VERT_ATTRIB_MAX) {
+ if (index == 0 || index >= MAX_VERTEX_PROGRAM_ATTRIBS) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribfvARB(index)");
return;
}
break;
case GL_CURRENT_VERTEX_ATTRIB_ARB:
FLUSH_CURRENT(ctx, 0);
- COPY_4V(params, ctx->Current.Attrib[index]);
+ COPY_4V(params, ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]);
break;
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
if (!ctx->Extensions.ARB_vertex_buffer_object) {
compares the value with its REVISION value. If they do not match, the loader is not up
to date.
*/
-.emtcode REVISION 0x07
+.emtcode REVISION 0x08
/* program type */
.emtcode FRAGMENT_PROGRAM 0x01
stateModMatNum
integer;
+/*
+ From ARB_draw_buffers:
+ <optOutputColorNum> ::= ""
+ | "[" <OutputColorNum> "]"
+*/
+optOutputColorNum
+ optOutputColorNum_1 .or .true .emit 0x00;
+optOutputColorNum_1
+ lbracket_ne .and outputColorNum .and rbracket;
+
+/*
+ From ARB_draw_buffers:
+ <outputColorNum> ::= <integer> from 0 to MAX_DRAW_BUFFERS_ARB-1
+*/
+outputColorNum
+ integer;
+
/*
<optTexCoordNum> ::= ""
| "[" <texCoordNum> "]"
vp_resultBinding .error RESULT_EXPECTED;
/*
+ From ARB_draw_buffers:
fragment program
- <resultBinding> ::= "result" "." "color"
+ <resultBinding> ::= "result" "." "color" <optOutputColorNum>
| "result" "." "depth"
vertex program
vp_resultBinding
"result" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
fp_resultBinding_1
- "color" .emit FRAGMENT_RESULT_COLOR .or
+ fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or
"depth" .emit FRAGMENT_RESULT_DEPTH;
+fp_resultBinding_2
+ "color" .and optOutputColorNum;
vp_resultBinding_1
.if (ARB_position_invariant == 0x00) "position" .emit VERTEX_RESULT_POSITION .or
resultColBinding .emit VERTEX_RESULT_COLOR .or
* \author Michal Krol
*/
+
".syntax program;\n"
-".emtcode REVISION 0x07\n"
+".emtcode REVISION 0x08\n"
".emtcode FRAGMENT_PROGRAM 0x01\n"
".emtcode VERTEX_PROGRAM 0x02\n"
".emtcode OPTION 0x01\n"
" lbracket_ne .and stateModMatNum .and rbracket;\n"
"stateModMatNum\n"
" integer;\n"
+"optOutputColorNum\n"
+" optOutputColorNum_1 .or .true .emit 0x00;\n"
+"optOutputColorNum_1\n"
+" lbracket_ne .and outputColorNum .and rbracket;\n"
+" \n"
+"outputColorNum\n"
+" integer;\n"
"optTexCoordNum\n"
" optTexCoordNum_1 .or .true .emit 0x00;\n"
"optTexCoordNum_1\n"
"vp_resultBinding\n"
" \"result\" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;\n"
"fp_resultBinding_1\n"
-" \"color\" .emit FRAGMENT_RESULT_COLOR .or\n"
+" fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or\n"
" \"depth\" .emit FRAGMENT_RESULT_DEPTH;\n"
+"fp_resultBinding_2\n"
+" \"color\" .and optOutputColorNum;\n"
"vp_resultBinding_1\n"
" .if (ARB_position_invariant == 0x00) \"position\" .emit VERTEX_RESULT_POSITION .or\n"
" resultColBinding .emit VERTEX_RESULT_COLOR .or\n"
"e_charordigit\n"
" 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n"
""
+