diff options
author | Brian Paul <[email protected]> | 2005-11-01 04:36:33 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-11-01 04:36:33 +0000 |
commit | 05051037101dfa053798cf5ad91d1975fd1aa6a7 (patch) | |
tree | 0cf21bc55a1c006a6f7fa99d7613e73428598fee /src/mesa/drivers/dri | |
parent | ffec105109f5b16bfe8282bd477d4aa32b550015 (diff) |
Re-org and clean-up of vertx/fragment program limits (instructions,
temporaries, parameters, etc).
glGetProgramivARB() now returns all the right things.
Updated i915 and r300 code to initialize program native limits and
current program's native instruction/temporary/etc counts.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_context.c | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_program.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.c | 32 |
3 files changed, 42 insertions, 25 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 6e6af35c760..cd0eaf2470f 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -154,16 +154,15 @@ GLboolean i915CreateContext( const __GLcontextModes *mesaVis, * we'll still have to check and fallback each time. */ - ctx->Const.MaxFragmentProgramTemps = I915_MAX_TEMPORARY; - ctx->Const.MaxFragmentProgramAttribs = 11; /* 8 tex, 2 color, fog */ - ctx->Const.MaxFragmentProgramLocalParams = I915_MAX_CONSTANT; - ctx->Const.MaxFragmentProgramEnvParams = I915_MAX_CONSTANT; - ctx->Const.MaxFragmentProgramAluInstructions = I915_MAX_ALU_INSN; - ctx->Const.MaxFragmentProgramTexInstructions = I915_MAX_TEX_INSN; - ctx->Const.MaxFragmentProgramInstructions = (I915_MAX_ALU_INSN + + ctx->Const.FragmentProgram.MaxNativeTemps = I915_MAX_TEMPORARY; + ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* 8 tex, 2 color, fog */ + ctx->Const.FragmentProgram.MaxNativeParameters = I915_MAX_CONSTANT; + ctx->Const.FragmentProgram.MaxNativeAluInstructions = I915_MAX_ALU_INSN; + ctx->Const.FragmentProgram.MaxNativeTexInstructions = I915_MAX_TEX_INSN; + ctx->Const.FragmentProgram.MaxNativeInstructions = (I915_MAX_ALU_INSN + I915_MAX_TEX_INSN); - ctx->Const.MaxFragmentProgramTexIndirections = I915_MAX_TEX_INDIRECT; - ctx->Const.MaxFragmentProgramAddressRegs = 0; /* I don't think we have one */ + ctx->Const.FragmentProgram.MaxNativeTexIndirections = I915_MAX_TEX_INDIRECT; + ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */ driInitExtensions( ctx, i915_extensions, GL_FALSE ); diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c index a1d32791d44..45276fb6908 100644 --- a/src/mesa/drivers/dri/i915/i915_program.c +++ b/src/mesa/drivers/dri/i915/i915_program.c @@ -351,6 +351,9 @@ GLuint i915_emit_param4fv( struct i915_fragment_program *p, void i915_program_error( struct i915_fragment_program *p, const char *msg ) { + /* XXX we shouldn't print anything to stdout, record GL error or + * call _mesa_problem() + */ fprintf(stderr, "%s\n", msg); p->error = 1; } @@ -410,6 +413,21 @@ void i915_fini_program( struct i915_fragment_program *p ) if (p->nr_decl_insn > I915_MAX_DECL_INSN) i915_program_error(p, "Exceeded max DECL instructions"); + if (p->error) { + p->FragProg.Base.NumNativeInstructions = 0; + p->FragProg.NumNativeAluInstructions = 0; + p->FragProg.NumNativeTexInstructions = 0; + p->FragProg.NumNativeTexIndirections = 0; + } + else { + p->FragProg.Base.NumNativeInstructions = (p->nr_alu_insn + + p->nr_tex_insn + + p->nr_decl_insn); + p->FragProg.NumNativeAluInstructions = p->nr_alu_insn; + p->FragProg.NumNativeTexInstructions = p->nr_tex_insn; + p->FragProg.NumNativeTexIndirections = p->nr_tex_indirect; + } + p->declarations[0] |= program_size + decl_size - 2; } diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 07eaaedfbe8..56b1f49affa 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -269,7 +269,9 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, #ifdef USER_BUFFERS /* Needs further modifications */ - //ctx->Const.MaxArrayLockSize = (/*512*/RADEON_BUFFER_SIZE*16*1024) / (4*4); +#if 0 + ctx->Const.MaxArrayLockSize = (/*512*/RADEON_BUFFER_SIZE*16*1024) / (4*4); +#endif #endif /* Initialize the software rasterizer and helper modules. @@ -298,23 +300,21 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, _tnl_allow_vertex_fog(ctx, GL_TRUE); /* currently bogus data */ - ctx->Const.MaxVertexProgramInstructions=VSF_MAX_FRAGMENT_LENGTH; - ctx->Const.MaxVertexProgramAttribs=16; // r420 - ctx->Const.MaxVertexProgramTemps=VSF_MAX_FRAGMENT_TEMPS; - ctx->Const.MaxVertexProgramLocalParams=256; // r420 - ctx->Const.MaxVertexProgramEnvParams=256; // r420 - ctx->Const.MaxVertexProgramAddressRegs=1; + ctx->Const.VertexProgram.MaxNativeInstructions=VSF_MAX_FRAGMENT_LENGTH; + ctx->Const.VertexProgram.MaxNativeAttribs=16; /* r420 */ + ctx->Const.VertexProgram.MaxNativeTemps=VSF_MAX_FRAGMENT_TEMPS; + ctx->Const.VertexProgram.MaxNativeParameters=256; /* r420 */ + ctx->Const.VertexProgram.MaxNativeAddressRegs=1; #if USE_ARB_F_P - ctx->Const.MaxFragmentProgramTemps = PFS_NUM_TEMP_REGS; - ctx->Const.MaxFragmentProgramAttribs = 11; /* copy i915... */ - ctx->Const.MaxFragmentProgramLocalParams = PFS_NUM_CONST_REGS; - ctx->Const.MaxFragmentProgramEnvParams = PFS_NUM_CONST_REGS; - ctx->Const.MaxFragmentProgramAluInstructions = PFS_MAX_ALU_INST; - ctx->Const.MaxFragmentProgramTexInstructions = PFS_MAX_TEX_INST; - ctx->Const.MaxFragmentProgramInstructions = PFS_MAX_ALU_INST+PFS_MAX_TEX_INST; - ctx->Const.MaxFragmentProgramTexIndirections = PFS_MAX_TEX_INDIRECT; - ctx->Const.MaxFragmentProgramAddressRegs = 0; /* and these are?? */ + ctx->Const.FragmentProgram.MaxNativeTemps = PFS_NUM_TEMP_REGS; + ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */ + ctx->Const.FragmentProgram.MaxNativeParameters = PFS_NUM_CONST_REGS; + ctx->Const.FragmentProgram.MaxNativeAluInstructions = PFS_MAX_ALU_INST; + ctx->Const.FragmentProgram.MaxNativeTexInstructions = PFS_MAX_TEX_INST; + ctx->Const.FragmentProgram.MaxNativeInstructions = PFS_MAX_ALU_INST+PFS_MAX_TEX_INST; + ctx->Const.FragmentProgram.MaxNativeTexIndirections = PFS_MAX_TEX_INDIRECT; + ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */ ctx->_MaintainTexEnvProgram = GL_TRUE; #endif |