/*
* Mesa 3-D graphics library
- * Version: 6.0
+ * Version: 6.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
parse_program_single_item (GLcontext * ctx, GLubyte ** inst,
struct arb_program *Program, GLint * state_tokens)
{
- if (Program->type == GL_FRAGMENT_PROGRAM_ARB)
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB)
state_tokens[0] = STATE_FRAGMENT_PROGRAM;
else
state_tokens[0] = STATE_VERTEX_PROGRAM;
state_tokens[2] = parse_integer (inst, Program);
/* Check state_tokens[2] against the number of ENV parameters available */
- if (((Program->type == GL_FRAGMENT_PROGRAM_ARB) &&
+ if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) &&
(state_tokens[2] >= (GLint) ctx->Const.MaxFragmentProgramEnvParams))
||
- ((Program->type == GL_VERTEX_PROGRAM_ARB) &&
+ ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) &&
(state_tokens[2] >= (GLint) ctx->Const.MaxVertexProgramEnvParams))) {
_mesa_set_program_error (ctx, Program->Position,
"Invalid Program Env Parameter");
state_tokens[2] = parse_integer (inst, Program);
/* Check state_tokens[2] against the number of LOCAL parameters available */
- if (((Program->type == GL_FRAGMENT_PROGRAM_ARB) &&
+ if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) &&
(state_tokens[2] >= (GLint) ctx->Const.MaxFragmentProgramLocalParams))
||
- ((Program->type == GL_VERTEX_PROGRAM_ARB) &&
+ ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) &&
(state_tokens[2] >= (GLint) ctx->Const.MaxVertexProgramLocalParams))) {
_mesa_set_program_error (ctx, Program->Position,
"Invalid Program Local Parameter");
GLint err = 0;
*is_generic = 0;
- if (Program->type == GL_FRAGMENT_PROGRAM_ARB) {
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
switch (*(*inst)++) {
case FRAGMENT_ATTRIB_COLOR:
err = parse_color_type (ctx, inst, Program, &coord);
switch (*(*inst)++) {
case FRAGMENT_RESULT_COLOR:
/* for frag programs, this is FRAGMENT_RESULT_COLOR */
- if (Program->type == GL_FRAGMENT_PROGRAM_ARB) {
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
*binding = FRAG_OUTPUT_COLR;
*binding_idx = 0;
}
case FRAGMENT_RESULT_DEPTH:
/* for frag programs, this is FRAGMENT_RESULT_DEPTH */
- if (Program->type == GL_FRAGMENT_PROGRAM_ARB) {
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
*binding = FRAG_OUTPUT_DEPR;
*binding_idx = 2;
}
GLuint end_idx = parse_integer (inst, Program);
out_of_range = 0;
- if (Program->type == GL_FRAGMENT_PROGRAM_ARB) {
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
if (((state_tokens[1] == STATE_ENV)
&& (end_idx >= ctx->Const.MaxFragmentProgramEnvParams))
|| ((state_tokens[1] == STATE_LOCAL)
}
/* Make sure we haven't blown past our parameter limits */
- if (((Program->type == GL_VERTEX_PROGRAM_ARB) &&
+ if (((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) &&
(Program->Base.NumParameters >=
ctx->Const.MaxVertexProgramLocalParams))
- || ((Program->type == GL_FRAGMENT_PROGRAM_ARB)
+ || ((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB)
&& (Program->Base.NumParameters >=
ctx->Const.MaxFragmentProgramLocalParams))) {
_mesa_set_program_error (ctx, Program->Position,
temp_var->type = vt_temp;
- if (((Program->type == GL_FRAGMENT_PROGRAM_ARB) &&
+ if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) &&
(Program->Base.NumTemporaries >=
ctx->Const.MaxFragmentProgramTemps))
- || ((Program->type == GL_VERTEX_PROGRAM_ARB)
+ || ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB)
&& (Program->Base.NumTemporaries >=
ctx->Const.MaxVertexProgramTemps))) {
_mesa_set_program_error (ctx, Program->Position,
case OPTION:
switch (*inst++) {
case ARB_PRECISION_HINT_FASTEST:
- Program->HintPrecisionFastest = 1;
+ Program->PrecisionOption = GL_FASTEST;
break;
case ARB_PRECISION_HINT_NICEST:
- Program->HintPrecisionNicest = 1;
+ Program->PrecisionOption = GL_NICEST;
break;
case ARB_FOG_EXP:
- Program->HintFogExp = 1;
+ Program->FogOption = GL_EXP;
break;
case ARB_FOG_EXP2:
- Program->HintFogExp2 = 1;
+ Program->FogOption = GL_EXP2;
break;
case ARB_FOG_LINEAR:
- Program->HintFogLinear = 1;
+ Program->FogOption = GL_LINEAR;
break;
case ARB_POSITION_INVARIANT:
- if (Program->type == GL_VERTEX_PROGRAM_ARB)
+ if (Program->Base.Target == GL_VERTEX_PROGRAM_ARB)
Program->HintPositionInvariant = 1;
break;
}
case INSTRUCTION:
Program->Position = parse_position (&inst);
- if (Program->type == GL_FRAGMENT_PROGRAM_ARB) {
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
/* Check the instruction count
* XXX: Does END count as an instruction?
}
/* Finally, tag on an OPCODE_END instruction */
- if (Program->type == GL_FRAGMENT_PROGRAM_ARB) {
+ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
Program->FPInstructions =
(struct fp_instruction *) _mesa_realloc (Program->FPInstructions,
Program->Base.NumInstructions*sizeof(struct fp_instruction),
program->OutputsWritten = 0;
program->Position = 0;
program->MajorVersion = program->MinorVersion = 0;
- program->HintPrecisionFastest =
- program->HintPrecisionNicest =
- program->HintFogExp2 =
- program->HintFogExp =
- program->HintFogLinear = program->HintPositionInvariant = 0;
+ program->PrecisionOption = GL_DONT_CARE;
+ program->FogOption = GL_NONE;
+ program->HintPositionInvariant = GL_FALSE;
for (a = 0; a < MAX_TEXTURE_IMAGE_UNITS; a++)
program->TexturesUsed[a] = 0;
program->NumAluInstructions =
else {
switch (*inst++) {
case FRAGMENT_PROGRAM:
- program->type = GL_FRAGMENT_PROGRAM_ARB;
+ program->Base.Target = GL_FRAGMENT_PROGRAM_ARB;
break;
case VERTEX_PROGRAM:
- program->type = GL_VERTEX_PROGRAM_ARB;
+ program->Base.Target = GL_VERTEX_PROGRAM_ARB;
break;
}
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Brian Paul
+ * Michal Krol
*/
*/
struct arb_program
{
- GLuint type; /* FRAGMENT_PROGRAM_ARB or VERTEX_PROGRAM_ARB */
-
- struct program Base;
+ struct program Base;
struct program_parameter_list *Parameters;
- GLuint InputsRead;
- GLuint OutputsWritten;
+ GLuint InputsRead;
+ GLuint OutputsWritten;
- GLuint Position; /* Just used for error reporting while parsing */
- GLuint MajorVersion;
- GLuint MinorVersion;
+ GLuint Position; /* Just used for error reporting while parsing */
+ GLuint MajorVersion;
+ GLuint MinorVersion;
- /* ARB_vertex_program specifics */
- struct vp_instruction *VPInstructions;
+ /* ARB_vertex_program specifics */
+ struct vp_instruction *VPInstructions;
- /* Options currently recognized by the parser */
- /* ARB_fp */
- GLboolean HintPrecisionFastest;
- GLboolean HintPrecisionNicest;
- GLboolean HintFogExp2;
- GLboolean HintFogExp;
- GLboolean HintFogLinear;
+ /* Options currently recognized by the parser */
+ /* ARB_fp */
+ GLenum PrecisionOption; /* GL_DONT_CARE, GL_NICEST or GL_FASTEST */
+ GLenum FogOption; /* GL_NONE, GL_LINEAR, GL_EXP or GL_EXP2 */
- /* ARB_fp & _vp */
- GLboolean HintPositionInvariant;
+ /* ARB_fp & _vp */
+ GLboolean HintPositionInvariant;
- /* ARB_fragment_program sepecifics */
- struct fp_instruction *FPInstructions;
+ /* ARB_fragment_program sepecifics */
+ struct fp_instruction *FPInstructions;
GLuint TexturesUsed[MAX_TEXTURE_IMAGE_UNITS];
GLuint NumAluInstructions;
GLuint NumTexInstructions;
extern GLuint
_mesa_parse_arb_program( GLcontext *ctx, const GLubyte *str, GLsizei len,
- struct arb_program *Program );
+ struct arb_program *Program );
-
#endif