ARB_fp support for GL_ARB_draw_buffers (Karl Rasche)
This commit is contained in:
@@ -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
|
||||
@@ -825,6 +825,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 */
|
||||
|
||||
@@ -107,7 +107,7 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
|
||||
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;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
|
||||
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) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
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
|
||||
@@ -2063,6 +2063,23 @@ stateOptModMatNum_1
|
||||
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> "]"
|
||||
@@ -2305,8 +2322,9 @@ vp_OUTPUT_statement
|
||||
vp_resultBinding .error RESULT_EXPECTED;
|
||||
|
||||
/*
|
||||
From ARB_draw_buffers:
|
||||
fragment program
|
||||
<resultBinding> ::= "result" "." "color"
|
||||
<resultBinding> ::= "result" "." "color" <optOutputColorNum>
|
||||
| "result" "." "depth"
|
||||
|
||||
vertex program
|
||||
@@ -2321,8 +2339,10 @@ fp_resultBinding
|
||||
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
|
||||
|
||||
@@ -28,8 +28,9 @@
|
||||
* \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"
|
||||
@@ -1007,6 +1008,13 @@
|
||||
" 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"
|
||||
@@ -1101,8 +1109,10 @@
|
||||
"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"
|
||||
@@ -1342,3 +1352,4 @@
|
||||
"e_charordigit\n"
|
||||
" 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n"
|
||||
""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user