From 44e018c09e7aeba9fd9f4c380da224bd6622c470 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 Feb 2009 13:42:08 -0700 Subject: mesa: add TexShadow field to prog_instruction If the instruction is TEX/TXP/TXL/etc the TexShadow field will be true if the instruction is a texture fetch with shadow compare. --- src/mesa/shader/arbprogparse.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/mesa/shader/arbprogparse.c') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 2e0fc3694a..62edb7f595 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -3104,6 +3104,9 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, break; } + if (shadow_tex) + fp->TexShadow = 1; + /* Don't test the first time a particular sampler is seen. Each time * after that, make sure the shadow state is the same. */ -- cgit v1.2.3 From 8d475822e6e19fa79719c856a2db5b6a205db1b9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 28 Feb 2009 11:49:46 -0700 Subject: mesa: rename, reorder FRAG_RESULT_x tokens s/FRAG_RESULT_DEPR/FRAG_RESULT_DEPTH/ s/FRAG_RESULT_COLR/FRAG_RESULT/COLOR/ Remove FRAG_RESULT_COLH (NV half-precision) output since we never used it. Next, we might merge the COLOR and DATA outputs (COLOR0, COLOR1, etc). --- src/mesa/drivers/dri/i915/i915_fragprog.c | 4 +-- src/mesa/drivers/dri/i965/brw_wm.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_fp.c | 8 ++--- src/mesa/drivers/dri/i965/brw_wm_state.c | 2 +- src/mesa/drivers/dri/r300/r300_fragprog.c | 4 +-- src/mesa/drivers/dri/r300/r500_fragprog.c | 4 +-- src/mesa/drivers/dri/r300/radeon_nqssadce.c | 2 +- src/mesa/drivers/dri/r300/radeon_program_pair.c | 4 +-- src/mesa/main/mtypes.h | 7 ++--- src/mesa/main/texenvprogram.c | 6 ++-- src/mesa/shader/arbprogparse.c | 4 +-- src/mesa/shader/nvfragparse.c | 40 ++++++++----------------- src/mesa/shader/nvfragparse.h | 5 ---- src/mesa/shader/prog_debug.c | 12 +++----- src/mesa/shader/program.c | 6 ++-- src/mesa/shader/programopt.c | 6 ++-- src/mesa/shader/slang/slang_codegen.c | 4 +-- src/mesa/shader/slang/slang_link.c | 2 +- src/mesa/state_tracker/st_atom_pixeltransfer.c | 4 +-- src/mesa/state_tracker/st_cb_drawpixels.c | 10 +++---- src/mesa/state_tracker/st_program.c | 10 +++---- src/mesa/swrast/s_context.c | 2 +- src/mesa/swrast/s_fragprog.c | 12 ++++---- 23 files changed, 68 insertions(+), 92 deletions(-) (limited to 'src/mesa/shader/arbprogparse.c') diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index f091d600c3..52f09a4b1b 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -180,9 +180,9 @@ get_result_vector(struct i915_fragment_program *p, switch (inst->DstReg.File) { case PROGRAM_OUTPUT: switch (inst->DstReg.Index) { - case FRAG_RESULT_COLR: + case FRAG_RESULT_COLOR: return UREG(REG_TYPE_OC, 0); - case FRAG_RESULT_DEPR: + case FRAG_RESULT_DEPTH: p->depth_written = 1; return UREG(REG_TYPE_OD, 0); default: diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 10f38e02a4..06a6f3f0f4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -198,7 +198,7 @@ static void brw_wm_populate_key( struct brw_context *brw, ctx->Color.AlphaEnabled) lookup |= IZ_PS_KILL_ALPHATEST_BIT; - if (fp->program.Base.OutputsWritten & (1<program.Base.OutputsWritten & (1<Aux = (i<<1); if (c->fp_fragcolor_emitted) { - outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); + outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR); last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), 0, outcolor, payload_r0_depth, outdepth); inst->Aux = (i<<1); @@ -892,7 +892,7 @@ static void emit_fb_write( struct brw_wm_compile *c ) if (c->fp->program.Base.OutputsWritten & (1 << FRAG_RESULT_DATA0)) outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0); else - outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); + outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR); inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), 0, outcolor, payload_r0_depth, outdepth); @@ -928,7 +928,7 @@ static void validate_dst_regs( struct brw_wm_compile *c, { if (inst->DstReg.File == PROGRAM_OUTPUT) { GLuint idx = inst->DstReg.Index; - if (idx == FRAG_RESULT_COLR) + if (idx == FRAG_RESULT_COLOR) c->fp_fragcolor_emitted = 1; } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 3c3b3473d6..f7ea756fb0 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -103,7 +103,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) /* as far as we can tell */ key->computes_depth = - (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) != 0; + (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) != 0; /* _NEW_COLOR */ key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 8d030c63fb..32182bb667 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -356,8 +356,8 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) static void nqssadce_init(struct nqssadce_state* s) { - s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW; - s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W; + s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW; + s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W; } diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 926ddd5964..07a2a7b17c 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -298,8 +298,8 @@ static void insert_WPOS_trailer(struct r500_fragment_program_compiler *compiler) static void nqssadce_init(struct nqssadce_state* s) { - s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW; - s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W; + s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW; + s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W; } static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg) diff --git a/src/mesa/drivers/dri/r300/radeon_nqssadce.c b/src/mesa/drivers/dri/r300/radeon_nqssadce.c index 97ce016c99..a083c3d243 100644 --- a/src/mesa/drivers/dri/r300/radeon_nqssadce.c +++ b/src/mesa/drivers/dri/r300/radeon_nqssadce.c @@ -191,7 +191,7 @@ static void process_instruction(struct nqssadce_state* s) if (inst->Opcode != OPCODE_KIL) { if (s->Descr->RewriteDepthOut) { - if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPR) + if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPTH) rewrite_depth_out(inst); } diff --git a/src/mesa/drivers/dri/r300/radeon_program_pair.c b/src/mesa/drivers/dri/r300/radeon_program_pair.c index 58bc0d5843..365e7c1722 100644 --- a/src/mesa/drivers/dri/r300/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/radeon_program_pair.c @@ -778,10 +778,10 @@ static void fill_dest_into_pair(struct pair_state *s, struct radeon_pair_instruc struct prog_instruction *inst = s->Program->Instructions + ip; if (inst->DstReg.File == PROGRAM_OUTPUT) { - if (inst->DstReg.Index == FRAG_RESULT_COLR) { + if (inst->DstReg.Index == FRAG_RESULT_COLOR) { pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & WRITEMASK_XYZ; pair->Alpha.OutputWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); - } else if (inst->DstReg.Index == FRAG_RESULT_DEPR) { + } else if (inst->DstReg.Index == FRAG_RESULT_DEPTH) { pair->Alpha.DepthWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); } } else { diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 22add9d975..f17b9e1e71 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -268,10 +268,9 @@ typedef enum */ typedef enum { - FRAG_RESULT_COLR = 0, - FRAG_RESULT_COLH = 1, - FRAG_RESULT_DEPR = 2, - FRAG_RESULT_DATA0 = 3, + FRAG_RESULT_DEPTH = 0, + FRAG_RESULT_COLOR = 1, + FRAG_RESULT_DATA0 = 2, FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS) } gl_frag_result; diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index d2a9e35dd5..51c13a563d 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1098,7 +1098,7 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit) rgb_shift) dest = get_temp( p ); else - dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); + dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR); /* Emit the RGB and A combine ops */ @@ -1278,7 +1278,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, p.program->Base.Parameters = _mesa_new_parameter_list(); p.program->Base.InputsRead = 0; - p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLR; + p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR; for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) p.src_texture[unit] = undef; @@ -1313,7 +1313,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, } cf = get_source( &p, SRC_PREVIOUS, 0 ); - out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLR ); + out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR ); if (key->separate_specular) { /* Emit specular add. diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 62edb7f595..ccc0318a53 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1688,7 +1688,7 @@ parse_result_binding(GLcontext *ctx, const GLubyte **inst, */ parse_output_color_num(ctx, inst, Program, &out_color); ASSERT(out_color < MAX_DRAW_BUFFERS); - *outputReg = FRAG_RESULT_COLR; + *outputReg = FRAG_RESULT_COLOR; } else { /* for vtx programs, this is VERTEX_RESULT_POSITION */ @@ -1699,7 +1699,7 @@ parse_result_binding(GLcontext *ctx, const GLubyte **inst, case FRAGMENT_RESULT_DEPTH: if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { /* for frag programs, this is FRAGMENT_RESULT_DEPTH */ - *outputReg = FRAG_RESULT_DEPR; + *outputReg = FRAG_RESULT_DEPTH; } else { /* for vtx programs, this is VERTEX_RESULT_COLOR */ diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 20e4781372..37418ffb6e 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -384,18 +384,12 @@ static const char *InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS + 1] = { "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL }; + static const char *OutputRegisters[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS + 1] = { - "COLR", "COLH", - /* These are only allows for register combiners */ - /* - "TEX0", "TEX1", "TEX2", "TEX3", - */ - "DEPR", NULL + "DEPR", "COLR", "DATA0", NULL }; - - /**********************************************************************/ /** @@ -828,7 +822,6 @@ static GLboolean Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum) { GLubyte token[100]; - GLint j; /* Match "o[" */ if (!Parse_String(parseState, "o[")) @@ -839,19 +832,19 @@ Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum) RETURN_ERROR; /* try to match an output register name */ - for (j = 0; OutputRegisters[j]; j++) { - if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) { - static GLuint bothColors = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_COLH); - *outputRegNum = j; - parseState->outputsWritten |= (1 << j); - if ((parseState->outputsWritten & bothColors) == bothColors) { - RETURN_ERROR1("Illegal to write to both o[COLR] and o[COLH]"); - } - break; - } + if (_mesa_strcmp((char *) token, "COLR") == 0 || + _mesa_strcmp((char *) token, "COLH") == 0) { + /* note that we don't distinguish between COLR and COLH */ + *outputRegNum = FRAG_RESULT_COLOR; + parseState->outputsWritten |= (1 << FRAG_RESULT_COLOR); } - if (!OutputRegisters[j]) + else if (_mesa_strcmp((char *) token, "DEPR") == 0) { + *outputRegNum = FRAG_RESULT_DEPTH; + parseState->outputsWritten |= (1 << FRAG_RESULT_DEPTH); + } + else { RETURN_ERROR1("Invalid output register name"); + } /* Match ']' */ if (!Parse_String(parseState, "]")) @@ -1826,10 +1819,3 @@ _mesa_nv_fragment_input_register_name(GLuint i) return InputRegisters[i]; } - -const char * -_mesa_nv_fragment_output_register_name(GLuint i) -{ - ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS); - return OutputRegisters[i]; -} diff --git a/src/mesa/shader/nvfragparse.h b/src/mesa/shader/nvfragparse.h index de45cf543d..ac97921080 100644 --- a/src/mesa/shader/nvfragparse.h +++ b/src/mesa/shader/nvfragparse.h @@ -44,9 +44,4 @@ _mesa_print_nv_fragment_program(const struct gl_fragment_program *program); extern const char * _mesa_nv_fragment_input_register_name(GLuint i); - -extern const char * -_mesa_nv_fragment_output_register_name(GLuint i); - - #endif diff --git a/src/mesa/shader/prog_debug.c b/src/mesa/shader/prog_debug.c index 7bcb2ef734..35ce37d5ce 100644 --- a/src/mesa/shader/prog_debug.c +++ b/src/mesa/shader/prog_debug.c @@ -222,20 +222,16 @@ _mesa_GetProgramRegisterfvMESA(GLenum target, "glGetProgramRegisterfvMESA(registerName)"); return; } - else if (_mesa_strcmp(reg, "o[COLR]") == 0) { + else if (_mesa_strcmp(reg, "o[COLR]") == 0 || + _mesa_strcmp(reg, "o[COLH]") == 0) { /* Fragment output color */ ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, - FRAG_RESULT_COLR, v); - } - else if (_mesa_strcmp(reg, "o[COLH]") == 0) { - /* Fragment output color */ - ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, - FRAG_RESULT_COLH, v); + FRAG_RESULT_COLOR, v); } else if (_mesa_strcmp(reg, "o[DEPR]") == 0) { /* Fragment output depth */ ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, - FRAG_RESULT_DEPR, v); + FRAG_RESULT_DEPTH, v); } else { /* try user-defined identifiers */ diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 00655f0288..2e5632710e 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -738,7 +738,7 @@ _mesa_combine_programs(GLcontext *ctx, /* Connect color outputs of fprogA to color inputs of fprogB, via a * new temporary register. */ - if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) && + if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) && (progB_inputsRead & FRAG_BIT_COL0)) { GLint tempReg = _mesa_find_free_register(newProg, PROGRAM_TEMPORARY); if (tempReg < 0) { @@ -748,7 +748,7 @@ _mesa_combine_programs(GLcontext *ctx, } /* replace writes to result.color[0] with tempReg */ replace_registers(newInst, lenA, - PROGRAM_OUTPUT, FRAG_RESULT_COLR, + PROGRAM_OUTPUT, FRAG_RESULT_COLOR, PROGRAM_TEMPORARY, tempReg); /* replace reads from the input color with tempReg */ replace_registers(newInst + lenA, lenB, @@ -758,7 +758,7 @@ _mesa_combine_programs(GLcontext *ctx, /* compute combined program's InputsRead */ inputsB = progB_inputsRead; - if (progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) { + if (progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) { inputsB &= ~(1 << FRAG_ATTRIB_COL0); } newProg->InputsRead = progA->InputsRead | inputsB; diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index 56f1eb832e..05d9bdf7ec 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -171,7 +171,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) if (inst->Opcode == OPCODE_END) break; if (inst->DstReg.File == PROGRAM_OUTPUT && - inst->DstReg.Index == FRAG_RESULT_COLR) { + inst->DstReg.Index == FRAG_RESULT_COLOR) { /* change the instruction to write to colorTemp w/ clamping */ inst->DstReg.File = PROGRAM_TEMPORARY; inst->DstReg.Index = colorTemp; @@ -249,7 +249,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) /* LRP result.color.xyz, fogFactorTemp.xxxx, colorTemp, fogColorRef; */ inst->Opcode = OPCODE_LRP; inst->DstReg.File = PROGRAM_OUTPUT; - inst->DstReg.Index = FRAG_RESULT_COLR; + inst->DstReg.Index = FRAG_RESULT_COLOR; inst->DstReg.WriteMask = WRITEMASK_XYZ; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = fogFactorTemp; @@ -264,7 +264,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) /* MOV result.color.w, colorTemp.x; # copy alpha */ inst->Opcode = OPCODE_MOV; inst->DstReg.File = PROGRAM_OUTPUT; - inst->DstReg.Index = FRAG_RESULT_COLR; + inst->DstReg.Index = FRAG_RESULT_COLOR; inst->DstReg.WriteMask = WRITEMASK_W; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = colorTemp; diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 5e2ce0ce3a..ee24e2e138 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -450,8 +450,8 @@ _slang_output_index(const char *name, GLenum target) { NULL, 0 } }; static const struct output_info fragOutputs[] = { - { "gl_FragColor", FRAG_RESULT_COLR }, - { "gl_FragDepth", FRAG_RESULT_DEPR }, + { "gl_FragColor", FRAG_RESULT_COLOR }, + { "gl_FragDepth", FRAG_RESULT_DEPTH }, { "gl_FragData", FRAG_RESULT_DATA0 }, { NULL, 0 } }; diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index bcabe71bfa..f98434892b 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -686,7 +686,7 @@ _slang_link(GLcontext *ctx, /* check that gl_FragColor and gl_FragData are not both written to */ if (shProg->FragmentProgram) { GLbitfield outputsWritten = shProg->FragmentProgram->Base.OutputsWritten; - if ((outputsWritten & ((1 << FRAG_RESULT_COLR))) && + if ((outputsWritten & ((1 << FRAG_RESULT_COLOR))) && (outputsWritten >= (1 << FRAG_RESULT_DATA0))) { link_error(shProg, "Fragment program cannot write both gl_FragColor" " and gl_FragData[].\n"); diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index ce872458e3..05b69c9d00 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -212,7 +212,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key) inst[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; fp->Base.InputsRead = (1 << FRAG_ATTRIB_TEX0); - fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLR); + fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLOR); fp->Base.SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */ if (key->scaleAndBias) { @@ -400,7 +400,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key) { struct prog_instruction *last = &inst[ic - 1]; last->DstReg.File = PROGRAM_OUTPUT; - last->DstReg.Index = FRAG_RESULT_COLR; + last->DstReg.Index = FRAG_RESULT_COLOR; } /* END; */ diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c73d0080ca..cc7a9e7890 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -75,7 +75,7 @@ is_passthrough_program(const struct gl_fragment_program *prog) if (inst[0].Opcode == OPCODE_MOV && inst[1].Opcode == OPCODE_END && inst[0].DstReg.File == PROGRAM_OUTPUT && - inst[0].DstReg.Index == FRAG_RESULT_COLR && + inst[0].DstReg.Index == FRAG_RESULT_COLOR && inst[0].DstReg.WriteMask == WRITEMASK_XYZW && inst[0].SrcReg[0].File == PROGRAM_INPUT && inst[0].SrcReg[0].Index == FRAG_ATTRIB_COL0 && @@ -158,7 +158,7 @@ combined_drawpix_fragment_program(GLcontext *ctx) /** * Create fragment shader that does a TEX() instruction to get a Z - * value, then writes to FRAG_RESULT_DEPR. + * value, then writes to FRAG_RESULT_DEPTH. * Pass fragment color through as-is. */ static struct st_fragment_program * @@ -191,7 +191,7 @@ make_fragment_shader_z(struct st_context *st) /* TEX result.depth, fragment.texcoord[0], texture[0], 2D; */ p->Instructions[ic].Opcode = OPCODE_TEX; p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; - p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPR; + p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH; p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; @@ -202,7 +202,7 @@ make_fragment_shader_z(struct st_context *st) /* MOV result.color, fragment.color */ p->Instructions[ic].Opcode = OPCODE_MOV; p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; - p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLR; + p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0; ic++; @@ -213,7 +213,7 @@ make_fragment_shader_z(struct st_context *st) assert(ic == p->NumInstructions); p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0; - p->OutputsWritten = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_DEPR); + p->OutputsWritten = (1 << FRAG_RESULT_COLOR) | (1 << FRAG_RESULT_DEPTH); p->SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */ st->drawpix.z_shader = (struct st_fragment_program *) p; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index d2535b6a2f..f825204915 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -466,23 +466,23 @@ st_translate_fragment_program(struct st_context *st, GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten; /* if z is written, emit that first */ - if (outputsWritten & (1 << FRAG_RESULT_DEPR)) { + if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) { fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION; fs_output_semantic_index[fs_num_outputs] = 0; - outputMapping[FRAG_RESULT_DEPR] = fs_num_outputs; + outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs; fs_num_outputs++; - outputsWritten &= ~(1 << FRAG_RESULT_DEPR); + outputsWritten &= ~(1 << FRAG_RESULT_DEPTH); } /* handle remaning outputs (color) */ for (attr = 0; attr < FRAG_RESULT_MAX; attr++) { if (outputsWritten & (1 << attr)) { switch (attr) { - case FRAG_RESULT_DEPR: + case FRAG_RESULT_DEPTH: /* handled above */ assert(0); break; - case FRAG_RESULT_COLR: + case FRAG_RESULT_COLOR: fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR; fs_output_semantic_index[fs_num_outputs] = numColors; outputMapping[attr] = fs_num_outputs; diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 297940adbd..719e6b8296 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -206,7 +206,7 @@ _swrast_update_deferred_texture(GLcontext *ctx) else { const struct gl_fragment_program *fprog = ctx->FragmentProgram._Current; - if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR))) { + if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH))) { /* Z comes from fragment program/shader */ swrast->_DeferredTexture = GL_FALSE; } diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index c6601f5593..3735f041d6 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -202,9 +202,9 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) if (_mesa_execute_program(ctx, &program->Base, machine)) { /* Store result color */ - if (outputsWritten & (1 << FRAG_RESULT_COLR)) { + if (outputsWritten & (1 << FRAG_RESULT_COLOR)) { COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], - machine->Outputs[FRAG_RESULT_COLR]); + machine->Outputs[FRAG_RESULT_COLOR]); } else { /* Multiple drawbuffers / render targets @@ -221,8 +221,8 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) } /* Store result depth/z */ - if (outputsWritten & (1 << FRAG_RESULT_DEPR)) { - const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPR][2]; + if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) { + const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPTH][2]; if (depth <= 0.0) span->array->z[i] = 0; else if (depth >= 1.0) @@ -259,12 +259,12 @@ _swrast_exec_fragment_program( GLcontext *ctx, SWspan *span ) run_program(ctx, span, 0, span->end); - if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR)) { + if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)) { span->interpMask &= ~SPAN_RGBA; span->arrayMask |= SPAN_RGBA; } - if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) { + if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) { span->interpMask &= ~SPAN_Z; span->arrayMask |= SPAN_Z; } -- cgit v1.2.3 From 69e07bdeb42f2454f5052f86119adfb68f253098 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 7 Mar 2009 11:53:18 -0700 Subject: mesa: remove GL_MESA_program_debug extension This was never fully fleshed out and hasn't been used. --- docs/MESA_shader_debug.spec | 2 +- src/mesa/SConscript | 1 - src/mesa/drivers/common/driverfuncs.c | 3 - src/mesa/drivers/dri/tdfx/tdfx_context.c | 4 - src/mesa/drivers/glide/fxdd.c | 1 - src/mesa/main/dd.h | 3 - src/mesa/main/enable.c | 22 --- src/mesa/main/extensions.c | 4 - src/mesa/main/ffvertex_prog.c | 1 - src/mesa/main/get.c | 48 ------ src/mesa/main/get_gen.py | 10 -- src/mesa/main/getstring.c | 30 ---- src/mesa/main/mfeatures.h | 1 - src/mesa/main/mtypes.h | 15 -- src/mesa/shader/arbprogparse.c | 9 -- src/mesa/shader/nvfragparse.c | 4 - src/mesa/shader/nvvertparse.c | 7 - src/mesa/shader/prog_debug.c | 255 ------------------------------- src/mesa/shader/prog_debug.h | 44 ------ src/mesa/shader/prog_execute.c | 41 ----- src/mesa/shader/prog_instruction.h | 5 - src/mesa/sources.mak | 1 - src/mesa/swrast/swrast.h | 6 - 23 files changed, 1 insertion(+), 516 deletions(-) delete mode 100644 src/mesa/shader/prog_debug.c delete mode 100644 src/mesa/shader/prog_debug.h (limited to 'src/mesa/shader/arbprogparse.c') diff --git a/docs/MESA_shader_debug.spec b/docs/MESA_shader_debug.spec index 1f7d42ac91..fab92abc76 100644 --- a/docs/MESA_shader_debug.spec +++ b/docs/MESA_shader_debug.spec @@ -13,7 +13,7 @@ Contact Status - XXX - Not complete yet!!! + Obsolete. Version diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 273ce11280..2e0168e0bc 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -189,7 +189,6 @@ if env['platform'] != 'winddk': 'shader/nvvertparse.c', 'shader/program.c', 'shader/prog_cache.c', - 'shader/prog_debug.c', 'shader/prog_execute.c', 'shader/prog_instruction.c', 'shader/prog_noise.c', diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 9bee212c6a..44adaf8682 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -134,9 +134,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->BindProgram = NULL; driver->NewProgram = _mesa_new_program; driver->DeleteProgram = _mesa_delete_program; -#if FEATURE_MESA_program_debug - driver->GetProgramRegister = _mesa_get_program_register; -#endif /* FEATURE_MESA_program_debug */ /* simple state commands */ driver->AlphaFunc = NULL; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index 20046fcb3a..68b5027561 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -67,7 +67,6 @@ #define need_GL_EXT_fog_coord #define need_GL_EXT_paletted_texture /* #define need_GL_EXT_secondary_color */ -/* #define need_GL_MESA_program_debug */ /* #define need_GL_NV_vertex_program */ #include "extension_helper.h" @@ -101,9 +100,6 @@ const struct dri_extension card_extensions[] = #ifdef need_GL_NV_vertex_program { "GL_NV_vertex_program", GL_NV_vertex_program_functions } { "GL_NV_vertex_program1_1", NULL }, -#endif -#ifdef need_GL_MESA_program_debug - { "GL_MESA_program_debug", GL_MESA_program_debug_functions }, #endif { NULL, NULL } }; diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 1bcf2512a6..2bc60399ea 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1922,7 +1922,6 @@ fxDDInitExtensions(GLcontext * ctx) _mesa_enable_extension(ctx, "GL_ARB_vertex_program"); _mesa_enable_extension(ctx, "GL_NV_vertex_program"); _mesa_enable_extension(ctx, "GL_NV_vertex_program1_1"); - _mesa_enable_extension(ctx, "GL_MESA_program_debug"); } #if 0 /* this requires _tnl_vertex_cull_stage in the pipeline */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index a335f77479..d994401e55 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -602,9 +602,6 @@ struct dd_function_table { /** Notify driver that a program string has been specified. */ void (*ProgramStringNotify)(GLcontext *ctx, GLenum target, struct gl_program *prog); - /** Get value of a program register during program execution. */ - void (*GetProgramRegister)(GLcontext *ctx, enum register_file file, - GLuint index, GLfloat val[4]); /** Query if program can be loaded onto hardware */ GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target, diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index a824705bdc..f432be183c 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -944,18 +944,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) ctx->Depth.BoundsTest = state; break; - /* GL_MESA_program_debug */ -#if FEATURE_MESA_program_debug - case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: - CHECK_EXTENSION(MESA_program_debug, cap); - ctx->FragmentProgram.CallbackEnabled = state; - break; - case GL_VERTEX_PROGRAM_CALLBACK_MESA: - CHECK_EXTENSION(MESA_program_debug, cap); - ctx->VertexProgram.CallbackEnabled = state; - break; -#endif - #if FEATURE_ATI_fragment_shader case GL_FRAGMENT_SHADER_ATI: CHECK_EXTENSION(ATI_fragment_shader, cap); @@ -1398,16 +1386,6 @@ _mesa_IsEnabled( GLenum cap ) CHECK_EXTENSION(EXT_depth_bounds_test); return ctx->Depth.BoundsTest; - /* GL_MESA_program_debug */ -#if FEATURE_MESA_program_debug - case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: - CHECK_EXTENSION(MESA_program_debug); - return ctx->FragmentProgram.CallbackEnabled; - case GL_VERTEX_PROGRAM_CALLBACK_MESA: - CHECK_EXTENSION(MESA_program_debug); - return ctx->VertexProgram.CallbackEnabled; -#endif - #if FEATURE_ATI_fragment_shader case GL_FRAGMENT_SHADER_ATI: CHECK_EXTENSION(ATI_fragment_shader); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 9c8bd13e69..fbca924ad3 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -147,7 +147,6 @@ static const struct { { OFF, "GL_INGR_blend_func_separate", F(EXT_blend_func_separate) }, { OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) }, { OFF, "GL_MESA_packed_depth_stencil", F(MESA_packed_depth_stencil) }, - { OFF, "GL_MESA_program_debug", F(MESA_program_debug) }, { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, { OFF, "GL_MESA_texture_array", F(MESA_texture_array) }, { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) }, @@ -276,9 +275,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE; /*ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;*/ ctx->Extensions.MESA_pack_invert = GL_TRUE; -#if FEATURE_MESA_program_debug - ctx->Extensions.MESA_program_debug = GL_TRUE; -#endif ctx->Extensions.MESA_resize_buffers = GL_TRUE; ctx->Extensions.MESA_texture_array = GL_TRUE; ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 42c8cc97c0..72b880e28e 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -655,7 +655,6 @@ static void emit_op3fn(struct tnl_program *p, inst = &p->program->Base.Instructions[nr]; inst->Opcode = (enum prog_opcode) op; - inst->StringPos = 0; inst->Data = 0; emit_arg( &inst->SrcReg[0], src0 ); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 3a8d56140f..0937fd053c 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1715,22 +1715,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMin); params[1] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMax); break; - case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetBooleanv"); - params[0] = ctx->FragmentProgram.CallbackEnabled; - break; - case GL_VERTEX_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetBooleanv"); - params[0] = ctx->VertexProgram.CallbackEnabled; - break; - case GL_FRAGMENT_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.CurrentPosition); - break; - case GL_VERTEX_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->VertexProgram.CurrentPosition); - break; case GL_MAX_DRAW_BUFFERS_ARB: params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers); break; @@ -3541,22 +3525,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = ctx->Depth.BoundsMin; params[1] = ctx->Depth.BoundsMax; break; - case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.CallbackEnabled); - break; - case GL_VERTEX_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.CallbackEnabled); - break; - case GL_FRAGMENT_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetFloatv"); - params[0] = (GLfloat)(ctx->FragmentProgram.CurrentPosition); - break; - case GL_VERTEX_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetFloatv"); - params[0] = (GLfloat)(ctx->VertexProgram.CurrentPosition); - break; case GL_MAX_DRAW_BUFFERS_ARB: params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers); break; @@ -5367,22 +5335,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = IROUND(ctx->Depth.BoundsMin); params[1] = IROUND(ctx->Depth.BoundsMax); break; - case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.CallbackEnabled); - break; - case GL_VERTEX_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.CallbackEnabled); - break; - case GL_FRAGMENT_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetIntegerv"); - params[0] = ctx->FragmentProgram.CurrentPosition; - break; - case GL_VERTEX_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetIntegerv"); - params[0] = ctx->VertexProgram.CurrentPosition; - break; case GL_MAX_DRAW_BUFFERS_ARB: params[0] = ctx->Const.MaxDrawBuffers; break; diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 729f382b4b..fa695c48f1 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -902,16 +902,6 @@ StateVars = [ ["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"], "", ["EXT_depth_bounds_test"] ), - # GL_MESA_program_debug - ( "GL_FRAGMENT_PROGRAM_CALLBACK_MESA", GLboolean, - ["ctx->FragmentProgram.CallbackEnabled"], "", ["MESA_program_debug"] ), - ( "GL_VERTEX_PROGRAM_CALLBACK_MESA", GLboolean, - ["ctx->VertexProgram.CallbackEnabled"], "", ["MESA_program_debug"] ), - ( "GL_FRAGMENT_PROGRAM_POSITION_MESA", GLint, - ["ctx->FragmentProgram.CurrentPosition"], "", ["MESA_program_debug"] ), - ( "GL_VERTEX_PROGRAM_POSITION_MESA", GLint, - ["ctx->VertexProgram.CurrentPosition"], "", ["MESA_program_debug"] ), - # GL_ARB_draw_buffers ( "GL_MAX_DRAW_BUFFERS_ARB", GLint, ["ctx->Const.MaxDrawBuffers"], "", None ), diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index a42c44686d..41fd786d7d 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -242,36 +242,6 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) case GL_SELECTION_BUFFER_POINTER: *params = ctx->Select.Buffer; break; -#if FEATURE_MESA_program_debug - case GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA: - if (!ctx->Extensions.MESA_program_debug) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); - return; - } - *params = *(GLvoid **) &ctx->FragmentProgram.Callback; - break; - case GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA: - if (!ctx->Extensions.MESA_program_debug) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); - return; - } - *params = ctx->FragmentProgram.CallbackData; - break; - case GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA: - if (!ctx->Extensions.MESA_program_debug) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); - return; - } - *params = *(GLvoid **) &ctx->VertexProgram.Callback; - break; - case GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA: - if (!ctx->Extensions.MESA_program_debug) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); - return; - } - *params = ctx->VertexProgram.CallbackData; - break; -#endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" ); return; diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 8fb32dd7e9..f570647942 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -75,7 +75,6 @@ #define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL #define FEATURE_EXT_timer_query _HAVE_FULL_GL #define FEATURE_ATI_fragment_shader _HAVE_FULL_GL -#define FEATURE_MESA_program_debug _HAVE_FULL_GL #define FEATURE_NV_fence _HAVE_FULL_GL #define FEATURE_NV_fragment_program _HAVE_FULL_GL #define FEATURE_NV_vertex_program _HAVE_FULL_GL diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index baf5850b83..17f6241e04 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1856,13 +1856,6 @@ struct gl_vertex_program_state /** Cache of fixed-function programs */ struct gl_program_cache *Cache; -#if FEATURE_MESA_program_debug - GLprogramcallbackMESA Callback; - GLvoid *CallbackData; - GLboolean CallbackEnabled; - GLuint CurrentPosition; -#endif - GLboolean _Overriden; }; @@ -1892,13 +1885,6 @@ struct gl_fragment_program_state /** Cache of fixed-function programs */ struct gl_program_cache *Cache; - -#if FEATURE_MESA_program_debug - GLprogramcallbackMESA Callback; - GLvoid *CallbackData; - GLboolean CallbackEnabled; - GLuint CurrentPosition; -#endif }; @@ -2502,7 +2488,6 @@ struct gl_extensions GLboolean IBM_multimode_draw_arrays; GLboolean MESA_pack_invert; GLboolean MESA_packed_depth_stencil; - GLboolean MESA_program_debug; GLboolean MESA_resize_buffers; GLboolean MESA_ycbcr_texture; GLboolean MESA_texture_array; diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index ccc0318a53..75398cda90 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -2752,9 +2752,6 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, _mesa_init_instructions(fp, 1); - /* Record the position in the program string for debugging */ - fp->StringPos = Program->Position; - /* OP_ALU_INST or OP_TEX_INST */ instClass = *(*inst)++; @@ -3194,8 +3191,6 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, code = *(*inst)++; _mesa_init_instructions(vp, 1); - /* Record the position in the program string for debugging */ - vp->StringPos = Program->Position; switch (type) { /* XXX: */ @@ -3557,10 +3552,6 @@ parse_instructions(GLcontext * ctx, const GLubyte * inst, const GLuint numInst = Program->Base.NumInstructions; _mesa_init_instructions(Program->Base.Instructions + numInst, 1); Program->Base.Instructions[numInst].Opcode = OPCODE_END; - /* YYY Wrong Position in program, whatever, at least not random -> crash - Program->Position = parse_position (&inst); - */ - Program->Base.Instructions[numInst].StringPos = Program->Position; } Program->Base.NumInstructions++; diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 37418ffb6e..b935cb562a 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -1311,8 +1311,6 @@ Parse_InstructionSequence(struct parse_state *parseState, } else if (Parse_String(parseState, "END")) { inst->Opcode = OPCODE_END; - inst->StringPos = parseState->curLine - parseState->start; - assert(inst->StringPos >= 0); parseState->numInst++; if (Parse_Token(parseState, token)) { RETURN_ERROR1("Code after END opcode."); @@ -1339,8 +1337,6 @@ Parse_InstructionSequence(struct parse_state *parseState, inst->SaturateMode = (instMatch.suffixes & (_S)) ? SATURATE_ZERO_ONE : SATURATE_OFF; inst->CondUpdate = (instMatch.suffixes & (_C)) ? GL_TRUE : GL_FALSE; - inst->StringPos = parseState->curLine - parseState->start; - assert(inst->StringPos >= 0); /* * parse the input and output operands diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index 08538c0ee4..268b577aec 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -799,7 +799,6 @@ Parse_UnaryOpInstruction(struct parse_state *parseState, RETURN_ERROR1("ABS illegal for vertex program 1.0"); inst->Opcode = opcode; - inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) @@ -832,7 +831,6 @@ Parse_BiOpInstruction(struct parse_state *parseState, RETURN_ERROR1("SUB illegal for vertex program 1.0"); inst->Opcode = opcode; - inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) @@ -880,7 +878,6 @@ Parse_TriOpInstruction(struct parse_state *parseState, enum prog_opcode opcode) { inst->Opcode = opcode; - inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) @@ -951,7 +948,6 @@ Parse_ScalarInstruction(struct parse_state *parseState, RETURN_ERROR1("RCC illegal for vertex program 1.0"); inst->Opcode = opcode; - inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) @@ -977,7 +973,6 @@ static GLboolean Parse_AddressInstruction(struct parse_state *parseState, struct prog_instruction *inst) { inst->Opcode = OPCODE_ARL; - inst->StringPos = parseState->curLine - parseState->start; /* Make ARB_vp backends happy */ inst->DstReg.File = PROGRAM_ADDRESS; @@ -1010,7 +1005,6 @@ Parse_EndInstruction(struct parse_state *parseState, struct prog_instruction *in GLubyte token[100]; inst->Opcode = OPCODE_END; - inst->StringPos = parseState->curLine - parseState->start; /* this should fail! */ if (Parse_Token(parseState, token)) @@ -1044,7 +1038,6 @@ Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction * GLint idx; inst->Opcode = OPCODE_PRINT; - inst->StringPos = parseState->curLine - parseState->start; /* The first argument is a literal string 'just like this' */ if (!Parse_String(parseState, "'")) diff --git a/src/mesa/shader/prog_debug.c b/src/mesa/shader/prog_debug.c deleted file mode 100644 index 35ce37d5ce..0000000000 --- a/src/mesa/shader/prog_debug.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 1999-2007 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include "main/glheader.h" -#include "main/context.h" -#include "main/macros.h" -#include "nvfragparse.h" -#include "nvvertparse.h" -#include "program.h" -#include "prog_debug.h" -#include "prog_parameter.h" -#include "prog_instruction.h" - - - -/** - * Functions for the experimental GL_MESA_program_debug extension. - */ - - -/* XXX temporary */ -GLAPI void GLAPIENTRY -glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, - GLvoid *data) -{ - _mesa_ProgramCallbackMESA(target, callback, data); -} - - -void -_mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, - GLvoid *data) -{ - GET_CURRENT_CONTEXT(ctx); - - switch (target) { - case GL_FRAGMENT_PROGRAM_ARB: - if (!ctx->Extensions.ARB_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } - ctx->FragmentProgram.Callback = callback; - ctx->FragmentProgram.CallbackData = data; - break; - case GL_FRAGMENT_PROGRAM_NV: - if (!ctx->Extensions.NV_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } - ctx->FragmentProgram.Callback = callback; - ctx->FragmentProgram.CallbackData = data; - break; - case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ - if (!ctx->Extensions.ARB_vertex_program && - !ctx->Extensions.NV_vertex_program) { - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } - ctx->VertexProgram.Callback = callback; - ctx->VertexProgram.CallbackData = data; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } -} - - -/* XXX temporary */ -GLAPI void GLAPIENTRY -glGetProgramRegisterfvMESA(GLenum target, - GLsizei len, const GLubyte *registerName, - GLfloat *v) -{ - _mesa_GetProgramRegisterfvMESA(target, len, registerName, v); -} - - -void -_mesa_GetProgramRegisterfvMESA(GLenum target, - GLsizei len, const GLubyte *registerName, - GLfloat *v) -{ - char reg[1000]; - GET_CURRENT_CONTEXT(ctx); - - /* We _should_ be inside glBegin/glEnd */ -#if 0 - if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); - return; - } -#endif - - /* make null-terminated copy of registerName */ - len = MIN2((unsigned int) len, sizeof(reg) - 1); - _mesa_memcpy(reg, registerName, len); - reg[len] = 0; - - switch (target) { - case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ - if (!ctx->Extensions.ARB_vertex_program && - !ctx->Extensions.NV_vertex_program) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } - if (!ctx->VertexProgram._Enabled) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetProgramRegisterfvMESA"); - return; - } - /* GL_NV_vertex_program */ - if (reg[0] == 'R') { - /* Temp register */ - GLint i = _mesa_atoi(reg + 1); - if (i >= (GLint)ctx->Const.VertexProgram.MaxTemps) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - ctx->Driver.GetProgramRegister(ctx, PROGRAM_TEMPORARY, i, v); - } - else if (reg[0] == 'v' && reg[1] == '[') { - /* Vertex Input attribute */ - GLuint i; - for (i = 0; i < ctx->Const.VertexProgram.MaxAttribs; i++) { - const char *name = _mesa_nv_vertex_input_register_name(i); - char number[10]; - _mesa_sprintf(number, "%d", i); - if (_mesa_strncmp(reg + 2, name, 4) == 0 || - _mesa_strncmp(reg + 2, number, _mesa_strlen(number)) == 0) { - ctx->Driver.GetProgramRegister(ctx, PROGRAM_INPUT, i, v); - return; - } - } - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - else if (reg[0] == 'o' && reg[1] == '[') { - /* Vertex output attribute */ - } - /* GL_ARB_vertex_program */ - else if (_mesa_strncmp(reg, "vertex.", 7) == 0) { - - } - else { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - break; - case GL_FRAGMENT_PROGRAM_ARB: - if (!ctx->Extensions.ARB_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } - if (!ctx->FragmentProgram._Enabled) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetProgramRegisterfvMESA"); - return; - } - /* XXX to do */ - break; - case GL_FRAGMENT_PROGRAM_NV: - if (!ctx->Extensions.NV_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } - if (!ctx->FragmentProgram._Enabled) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetProgramRegisterfvMESA"); - return; - } - if (reg[0] == 'R') { - /* Temp register */ - GLint i = _mesa_atoi(reg + 1); - if (i >= (GLint)ctx->Const.FragmentProgram.MaxTemps) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - ctx->Driver.GetProgramRegister(ctx, PROGRAM_TEMPORARY, - i, v); - } - else if (reg[0] == 'f' && reg[1] == '[') { - /* Fragment input attribute */ - GLuint i; - for (i = 0; i < ctx->Const.FragmentProgram.MaxAttribs; i++) { - const char *name = _mesa_nv_fragment_input_register_name(i); - if (_mesa_strncmp(reg + 2, name, 4) == 0) { - ctx->Driver.GetProgramRegister(ctx, PROGRAM_INPUT, i, v); - return; - } - } - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - else if (_mesa_strcmp(reg, "o[COLR]") == 0 || - _mesa_strcmp(reg, "o[COLH]") == 0) { - /* Fragment output color */ - ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, - FRAG_RESULT_COLOR, v); - } - else if (_mesa_strcmp(reg, "o[DEPR]") == 0) { - /* Fragment output depth */ - ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, - FRAG_RESULT_DEPTH, v); - } - else { - /* try user-defined identifiers */ - const GLfloat *value = _mesa_lookup_parameter_value( - ctx->FragmentProgram.Current->Base.Parameters, -1, reg); - if (value) { - COPY_4V(v, value); - } - else { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - } - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } -} diff --git a/src/mesa/shader/prog_debug.h b/src/mesa/shader/prog_debug.h deleted file mode 100644 index fc400e19de..0000000000 --- a/src/mesa/shader/prog_debug.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 1999-2007 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef PROG_DEBUG_H -#define PROG_DEBUG_H 1 - - -/* - * GL_MESA_program_debug - */ - -extern void -_mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, - GLvoid *data); - -extern void -_mesa_GetProgramRegisterfvMESA(GLenum target, GLsizei len, - const GLubyte *registerName, GLfloat *v); - - - -#endif /* PROG_DEBUG_H */ diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index a93733c085..a60cda674b 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -186,30 +186,6 @@ get_dst_register_pointer(const struct prog_dst_register *dest, -#if FEATURE_MESA_program_debug -static struct gl_program_machine *CurrentMachine = NULL; - -/** - * For GL_MESA_program_debug. - * Return current value (4*GLfloat) of a program register. - * Called via ctx->Driver.GetProgramRegister(). - */ -void -_mesa_get_program_register(GLcontext *ctx, enum register_file file, - GLuint index, GLfloat val[4]) -{ - if (CurrentMachine) { - struct prog_src_register srcReg; - const GLfloat *src; - srcReg.File = file; - srcReg.Index = index; - src = get_src_register_pointer(&srcReg, CurrentMachine); - COPY_4V(val, src); - } -} -#endif /* FEATURE_MESA_program_debug */ - - /** * Fetch a 4-element float vector from the given source register. * Apply swizzling and negating as needed. @@ -633,10 +609,6 @@ _mesa_execute_program(GLcontext * ctx, printf("execute program %u --------------------\n", program->Id); } -#if FEATURE_MESA_program_debug - CurrentMachine = machine; -#endif - if (program->Target == GL_VERTEX_PROGRAM_ARB) { machine->EnvParams = ctx->VertexProgram.Parameters; } @@ -647,15 +619,6 @@ _mesa_execute_program(GLcontext * ctx, for (pc = 0; pc < numInst; pc++) { const struct prog_instruction *inst = program->Instructions + pc; -#if FEATURE_MESA_program_debug - if (ctx->FragmentProgram.CallbackEnabled && - ctx->FragmentProgram.Callback) { - ctx->FragmentProgram.CurrentPosition = inst->StringPos; - ctx->FragmentProgram.Callback(program->Target, - ctx->FragmentProgram.CallbackData); - } -#endif - if (DEBUG_PROG) { _mesa_print_instruction(inst); } @@ -1780,9 +1743,5 @@ _mesa_execute_program(GLcontext * ctx, } /* for pc */ -#if FEATURE_MESA_program_debug - CurrentMachine = NULL; -#endif - return GL_TRUE; } diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index 95dd7fda7f..4adce11f95 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -421,11 +421,6 @@ struct prog_instruction /** for driver use (try to remove someday) */ GLint Aux; - - /* XXX obsolete - remove someday */ -#if FEATURE_MESA_program_debug - GLshort StringPos; -#endif }; diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 08ba345009..d8d48476e8 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -220,7 +220,6 @@ SHADER_SOURCES = \ shader/nvvertparse.c \ shader/program.c \ shader/prog_cache.c \ - shader/prog_debug.c \ shader/prog_execute.c \ shader/prog_instruction.c \ shader/prog_noise.c \ diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 015f8a05c3..c319ca62f9 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -266,12 +266,6 @@ extern void _swrast_eject_texture_images(GLcontext *ctx); -#if FEATURE_MESA_program_debug -extern void -_swrast_get_program_register(GLcontext *, enum register_file file, - GLuint index, GLfloat val[4]); -#endif /* FEATURE_MESA_program_debug */ - /** * The driver interface for the software rasterizer. -- cgit v1.2.3 From b4026d9be828bd0b6f60158456edf24994efb053 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 7 Mar 2009 12:02:52 -0700 Subject: mesa: gl_register_file enum typedef --- src/mesa/drivers/dri/r200/r200_vertprog.c | 2 +- src/mesa/drivers/dri/r300/r300_vertprog.c | 4 ++-- src/mesa/main/mtypes.h | 34 +++++++++++++++---------------- src/mesa/shader/arbprogparse.c | 22 ++++++++++---------- src/mesa/shader/prog_execute.h | 2 +- src/mesa/shader/prog_parameter.c | 6 +++--- src/mesa/shader/prog_parameter.h | 8 ++++---- src/mesa/shader/prog_print.c | 16 +++++++-------- src/mesa/shader/programopt.c | 2 +- src/mesa/shader/programopt.h | 2 +- src/mesa/shader/slang/slang_codegen.c | 2 +- src/mesa/shader/slang/slang_emit.c | 2 +- src/mesa/shader/slang/slang_ir.c | 10 ++++----- src/mesa/shader/slang/slang_ir.h | 14 ++++++------- src/mesa/state_tracker/st_mesa_to_tgsi.c | 2 +- 15 files changed, 64 insertions(+), 64 deletions(-) (limited to 'src/mesa/shader/arbprogparse.c') diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index 562992fbb5..a2561df579 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -202,7 +202,7 @@ static unsigned long t_dst(struct prog_dst_register *dst) } } -static unsigned long t_src_class(enum register_file file) +static unsigned long t_src_class(gl_register_file file) { switch(file){ diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index b6a4d30687..0ccb918703 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -126,7 +126,7 @@ static unsigned long t_dst_mask(GLuint mask) return mask & VSF_FLAG_ALL; } -static unsigned long t_dst_class(enum register_file file) +static unsigned long t_dst_class(gl_register_file file) { switch (file) { @@ -161,7 +161,7 @@ static unsigned long t_dst_index(struct r300_vertex_program *vp, return dst->Index; } -static unsigned long t_src_class(enum register_file file) +static unsigned long t_src_class(gl_register_file file) { switch (file) { case PROGRAM_TEMPORARY: diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 17f6241e04..57b7065b83 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1703,24 +1703,24 @@ struct gl_evaluators * be "uniform" variables since they can only be set outside glBegin/End. * They're also all stored in the same Parameters array. */ -enum register_file -{ - PROGRAM_TEMPORARY = 0, /**< machine->Temporary[] */ - PROGRAM_LOCAL_PARAM = 1, /**< gl_program->LocalParams[] */ - PROGRAM_ENV_PARAM = 2, /**< gl_program->Parameters[] */ - PROGRAM_STATE_VAR = 3, /**< gl_program->Parameters[] */ - PROGRAM_INPUT = 4, /**< machine->Inputs[] */ - PROGRAM_OUTPUT = 5, /**< machine->Outputs[] */ - PROGRAM_NAMED_PARAM = 6, /**< gl_program->Parameters[] */ - PROGRAM_CONSTANT = 7, /**< gl_program->Parameters[] */ - PROGRAM_UNIFORM = 8, /**< gl_program->Parameters[] */ - PROGRAM_VARYING = 9, /**< machine->Inputs[]/Outputs[] */ - PROGRAM_WRITE_ONLY = 10, /**< A dummy, write-only register */ - PROGRAM_ADDRESS = 11, /**< machine->AddressReg */ - PROGRAM_SAMPLER = 12, /**< for shader samplers, compile-time only */ - PROGRAM_UNDEFINED = 13, /**< Invalid value */ +typedef enum +{ + PROGRAM_TEMPORARY, /**< machine->Temporary[] */ + PROGRAM_LOCAL_PARAM, /**< gl_program->LocalParams[] */ + PROGRAM_ENV_PARAM, /**< gl_program->Parameters[] */ + PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */ + PROGRAM_INPUT, /**< machine->Inputs[] */ + PROGRAM_OUTPUT, /**< machine->Outputs[] */ + PROGRAM_NAMED_PARAM, /**< gl_program->Parameters[] */ + PROGRAM_CONSTANT, /**< gl_program->Parameters[] */ + PROGRAM_UNIFORM, /**< gl_program->Parameters[] */ + PROGRAM_VARYING, /**< machine->Inputs[]/Outputs[] */ + PROGRAM_WRITE_ONLY, /**< A dummy, write-only register */ + PROGRAM_ADDRESS, /**< machine->AddressReg */ + PROGRAM_SAMPLER, /**< for shader samplers, compile-time only */ + PROGRAM_UNDEFINED, /**< Invalid/TBD value */ PROGRAM_FILE_MAX -}; +} gl_register_file; /** Vertex and fragment instructions */ diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 75398cda90..cd6289deb5 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -2246,7 +2246,7 @@ parse_declaration (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc static GLuint parse_masked_dst_reg (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, - enum register_file *File, GLuint *Index, GLint *WriteMask) + gl_register_file *File, GLuint *Index, GLint *WriteMask) { GLuint tmp, result; struct var_cache *dst; @@ -2478,7 +2478,7 @@ static GLuint parse_src_reg (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, - enum register_file * File, GLint * Index, + gl_register_file * File, GLint * Index, GLboolean *IsRelOffset ) { struct var_cache *src; @@ -2527,7 +2527,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, return 1; } - *File = (enum register_file) src->param_binding_type; + *File = (gl_register_file) src->param_binding_type; switch (*(*inst)++) { case ARRAY_INDEX_ABSOLUTE: @@ -2573,7 +2573,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, if (parse_param_use (ctx, inst, vc_head, Program, &src)) return 1; - *File = (enum register_file) src->param_binding_type; + *File = (gl_register_file) src->param_binding_type; *Index = src->param_binding_begin; break; } @@ -2598,7 +2598,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, /* XXX: We have to handle offsets someplace in here! -- or are those above? */ case vt_param: - *File = (enum register_file) src->param_binding_type; + *File = (gl_register_file) src->param_binding_type; *Index = src->param_binding_begin; break; @@ -2623,7 +2623,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, } if (*File == PROGRAM_STATE_VAR) { - enum register_file file; + gl_register_file file; /* If we're referencing the Program->Parameters[] array, check if the * parameter is really a constant/literal. If so, set File to CONSTANT. @@ -2652,7 +2652,7 @@ parse_vector_src_reg(GLcontext *ctx, const GLubyte **inst, struct arb_program *program, struct prog_src_register *reg) { - enum register_file file; + gl_register_file file; GLint index; GLubyte negateMask; GLubyte swizzle[4]; @@ -2686,7 +2686,7 @@ parse_scalar_src_reg(GLcontext *ctx, const GLubyte **inst, struct arb_program *program, struct prog_src_register *reg) { - enum register_file file; + gl_register_file file; GLint index; GLubyte negateMask; GLubyte swizzle[4]; @@ -2722,7 +2722,7 @@ parse_dst_reg(GLcontext * ctx, const GLubyte ** inst, { GLint mask; GLuint idx; - enum register_file file; + gl_register_file file; if (parse_masked_dst_reg (ctx, inst, vc_head, program, &file, &idx, &mask)) return 1; @@ -3013,7 +3013,7 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, { GLubyte swizzle[4]; GLubyte negateMask; - enum register_file file; + gl_register_file file; GLint index; if (parse_src_reg(ctx, inst, vc_head, Program, &file, &index, &rel)) @@ -3354,7 +3354,7 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, GLubyte swizzle[4]; GLubyte negateMask; GLboolean relAddr; - enum register_file file; + gl_register_file file; GLint index; if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) diff --git a/src/mesa/shader/prog_execute.h b/src/mesa/shader/prog_execute.h index 8ceb7b092e..adefc5439d 100644 --- a/src/mesa/shader/prog_execute.h +++ b/src/mesa/shader/prog_execute.h @@ -73,7 +73,7 @@ struct gl_program_machine extern void -_mesa_get_program_register(GLcontext *ctx, enum register_file file, +_mesa_get_program_register(GLcontext *ctx, gl_register_file file, GLuint index, GLfloat val[4]); extern GLboolean diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 8ae961241f..60e9d07423 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -78,7 +78,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList) */ GLint _mesa_add_parameter(struct gl_program_parameter_list *paramList, - enum register_file type, const char *name, + gl_register_file type, const char *name, GLuint size, GLenum datatype, const GLfloat *values, const gl_state_index state[STATE_LENGTH], GLbitfield flags) @@ -681,7 +681,7 @@ _mesa_combine_parameter_lists(const struct gl_program_parameter_list *listA, */ GLuint _mesa_longest_parameter_name(const struct gl_program_parameter_list *list, - enum register_file type) + gl_register_file type) { GLuint i, maxLen = 0; if (!list) @@ -702,7 +702,7 @@ _mesa_longest_parameter_name(const struct gl_program_parameter_list *list, */ GLuint _mesa_num_parameters_of_type(const struct gl_program_parameter_list *list, - enum register_file type) + gl_register_file type) { GLuint i, count = 0; if (list) { diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h index 200f2c0045..01f5a0e179 100644 --- a/src/mesa/shader/prog_parameter.h +++ b/src/mesa/shader/prog_parameter.h @@ -54,7 +54,7 @@ struct gl_program_parameter { const char *Name; /**< Null-terminated string */ - enum register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ + gl_register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ GLuint Size; /**< Number of components (1..4) */ GLboolean Used; /**< Helper flag for GLSL uniform tracking */ @@ -102,7 +102,7 @@ _mesa_num_parameters(const struct gl_program_parameter_list *list) extern GLint _mesa_add_parameter(struct gl_program_parameter_list *paramList, - enum register_file type, const char *name, + gl_register_file type, const char *name, GLuint size, GLenum datatype, const GLfloat *values, const gl_state_index state[STATE_LENGTH], GLbitfield flags); @@ -161,11 +161,11 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list, extern GLuint _mesa_longest_parameter_name(const struct gl_program_parameter_list *list, - enum register_file type); + gl_register_file type); extern GLuint _mesa_num_parameters_of_type(const struct gl_program_parameter_list *list, - enum register_file type); + gl_register_file type); #endif /* PROG_PARAMETER_H */ diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 6988e9c052..0a78a0a866 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -43,7 +43,7 @@ * Return string name for given program/register file. */ static const char * -file_string(enum register_file f, gl_prog_print_mode mode) +file_string(gl_register_file f, gl_prog_print_mode mode) { switch (f) { case PROGRAM_TEMPORARY: @@ -219,7 +219,7 @@ arb_output_attrib_string(GLint index, GLenum progType) * \param prog pointer to containing program */ static const char * -reg_string(enum register_file f, GLint index, gl_prog_print_mode mode, +reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, GLboolean relAddr, const struct gl_program *prog) { static char str[100]; @@ -432,7 +432,7 @@ fprint_dst_reg(FILE * f, const struct gl_program *prog) { _mesa_fprintf(f, "%s%s", - reg_string((enum register_file) dstReg->File, + reg_string((gl_register_file) dstReg->File, dstReg->Index, mode, dstReg->RelAddr, prog), _mesa_writemask_string(dstReg->WriteMask)); @@ -445,7 +445,7 @@ fprint_dst_reg(FILE * f, #if 0 _mesa_fprintf(f, "%s[%d]%s", - file_string((enum register_file) dstReg->File, mode), + file_string((gl_register_file) dstReg->File, mode), dstReg->Index, _mesa_writemask_string(dstReg->WriteMask)); #endif @@ -462,14 +462,14 @@ fprint_src_reg(FILE *f, _mesa_fprintf(f, "%s%s%s%s", abs, - reg_string((enum register_file) srcReg->File, + reg_string((gl_register_file) srcReg->File, srcReg->Index, mode, srcReg->RelAddr, prog), _mesa_swizzle_string(srcReg->Swizzle, srcReg->NegateBase, GL_FALSE), abs); #if 0 _mesa_fprintf(f, "%s[%d]%s", - file_string((enum register_file) srcReg->File, mode), + file_string((gl_register_file) srcReg->File, mode), srcReg->Index, _mesa_swizzle_string(srcReg->Swizzle, srcReg->NegateBase, GL_FALSE)); @@ -562,7 +562,7 @@ _mesa_fprint_instruction_opt(FILE *f, if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { _mesa_fprintf(f, ", "); _mesa_fprintf(f, "%s[%d]%s", - file_string((enum register_file) inst->SrcReg[0].File, + file_string((gl_register_file) inst->SrcReg[0].File, mode), inst->SrcReg[0].Index, _mesa_swizzle_string(inst->SrcReg[0].Swizzle, @@ -579,7 +579,7 @@ _mesa_fprint_instruction_opt(FILE *f, _mesa_fprintf(f, " "); fprint_dst_reg(f, &inst->DstReg, mode, prog); _mesa_fprintf(f, ", %s[%d], %s", - file_string((enum register_file) inst->SrcReg[0].File, + file_string((gl_register_file) inst->SrcReg[0].File, mode), inst->SrcReg[0].Index, _mesa_swizzle_string(inst->SrcReg[0].Swizzle, diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index 05d9bdf7ec..e283f8933b 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -375,7 +375,7 @@ _mesa_count_texture_instructions(struct gl_program *prog) * So, rewrite the program to use a temporary register in this case. */ void -_mesa_remove_output_reads(struct gl_program *prog, enum register_file type) +_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) { GLuint i; GLint outputMap[VERT_RESULT_MAX]; diff --git a/src/mesa/shader/programopt.h b/src/mesa/shader/programopt.h index 11572e64f5..96acaf9566 100644 --- a/src/mesa/shader/programopt.h +++ b/src/mesa/shader/programopt.h @@ -40,6 +40,6 @@ extern void _mesa_count_texture_instructions(struct gl_program *prog); extern void -_mesa_remove_output_reads(struct gl_program *prog, enum register_file type); +_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type); #endif /* PROGRAMOPT_H */ diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index ee24e2e138..d8246ae75f 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2998,7 +2998,7 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var, slang_ir_node *varDecl, *n; slang_ir_storage *store; GLint arrayLen, size, totalSize; /* if array then totalSize > size */ - enum register_file file; + gl_register_file file; /*assert(!var->declared);*/ var->declared = GL_TRUE; diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 6a47585c7a..94d0c084aa 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -446,7 +446,7 @@ new_instruction(slang_emit_info *emitInfo, gl_inst_opcode opcode) static struct prog_instruction * emit_arl_load(slang_emit_info *emitInfo, - enum register_file file, GLint index, GLuint swizzle) + gl_register_file file, GLint index, GLuint swizzle) { struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ARL); inst->SrcReg[0].File = file; diff --git a/src/mesa/shader/slang/slang_ir.c b/src/mesa/shader/slang/slang_ir.c index dc4086d888..1c7f7474e7 100644 --- a/src/mesa/shader/slang/slang_ir.c +++ b/src/mesa/shader/slang/slang_ir.c @@ -121,7 +121,7 @@ _slang_ir_info(slang_ir_opcode opcode) void _slang_init_ir_storage(slang_ir_storage *st, - enum register_file file, GLint index, GLint size, + gl_register_file file, GLint index, GLint size, GLuint swizzle) { st->File = file; @@ -137,7 +137,7 @@ _slang_init_ir_storage(slang_ir_storage *st, * Return a new slang_ir_storage object. */ slang_ir_storage * -_slang_new_ir_storage(enum register_file file, GLint index, GLint size) +_slang_new_ir_storage(gl_register_file file, GLint index, GLint size) { slang_ir_storage *st; st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); @@ -157,7 +157,7 @@ _slang_new_ir_storage(enum register_file file, GLint index, GLint size) * Return a new slang_ir_storage object. */ slang_ir_storage * -_slang_new_ir_storage_swz(enum register_file file, GLint index, GLint size, +_slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size, GLuint swizzle) { slang_ir_storage *st; @@ -196,10 +196,10 @@ _slang_new_ir_storage_relative(GLint index, GLint size, slang_ir_storage * -_slang_new_ir_storage_indirect(enum register_file file, +_slang_new_ir_storage_indirect(gl_register_file file, GLint index, GLint size, - enum register_file indirectFile, + gl_register_file indirectFile, GLint indirectIndex, GLuint indirectSwizzle) { diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h index d77feeadba..0ec38b10a5 100644 --- a/src/mesa/shader/slang/slang_ir.h +++ b/src/mesa/shader/slang/slang_ir.h @@ -171,7 +171,7 @@ typedef enum */ struct slang_ir_storage_ { - enum register_file File; /**< PROGRAM_TEMPORARY, PROGRAM_INPUT, etc */ + gl_register_file File; /**< PROGRAM_TEMPORARY, PROGRAM_INPUT, etc */ GLint Index; /**< -1 means unallocated */ GLint Size; /**< number of floats or ints */ GLuint Swizzle; /**< Swizzle AND writemask info */ @@ -180,7 +180,7 @@ struct slang_ir_storage_ GLboolean RelAddr; /* we'll remove this eventually */ GLboolean IsIndirect; - enum register_file IndirectFile; + gl_register_file IndirectFile; GLint IndirectIndex; GLuint IndirectSwizzle; GLuint TexTarget; /**< If File==PROGRAM_SAMPLER, one of TEXTURE_x_INDEX */ @@ -235,15 +235,15 @@ _slang_ir_info(slang_ir_opcode opcode); extern void _slang_init_ir_storage(slang_ir_storage *st, - enum register_file file, GLint index, GLint size, + gl_register_file file, GLint index, GLint size, GLuint swizzle); extern slang_ir_storage * -_slang_new_ir_storage(enum register_file file, GLint index, GLint size); +_slang_new_ir_storage(gl_register_file file, GLint index, GLint size); extern slang_ir_storage * -_slang_new_ir_storage_swz(enum register_file file, GLint index, GLint size, +_slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size, GLuint swizzle); extern slang_ir_storage * @@ -252,10 +252,10 @@ _slang_new_ir_storage_relative(GLint index, GLint size, extern slang_ir_storage * -_slang_new_ir_storage_indirect(enum register_file file, +_slang_new_ir_storage_indirect(gl_register_file file, GLint index, GLint size, - enum register_file indirectFile, + gl_register_file indirectFile, GLint indirectIndex, GLuint indirectSwizzle); diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 8ce0b20113..cbf3f334c0 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -48,7 +48,7 @@ */ static GLuint map_register_file( - enum register_file file, + gl_register_file file, GLuint index, const GLuint immediateMapping[], GLboolean indirectAccess ) -- cgit v1.2.3 From 9ba52e12688d6f677c2241729776e6bf10737d4b Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 16 Mar 2009 09:12:21 +0100 Subject: mesa: Silence compiler warnings. --- src/mesa/shader/arbprogparse.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa/shader/arbprogparse.c') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index cd6289deb5..a4d0fc3efc 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -969,6 +969,7 @@ parse_output_color_num (GLcontext * ctx, const GLubyte ** inst, GLint i = parse_integer (inst, Program); if ((i < 0) || (i >= (int)ctx->Const.MaxDrawBuffers)) { + *color = 0; program_error(ctx, Program->Position, "Invalid draw buffer index"); return 1; } -- cgit v1.2.3