diff options
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_context.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 27 | ||||
-rw-r--r-- | src/mesa/main/config.h | 56 | ||||
-rw-r--r-- | src/mesa/main/context.c | 22 |
4 files changed, 80 insertions, 28 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index bb08cf8d18f..be47ace65e9 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -166,6 +166,9 @@ i915CreateContext(const __GLcontextModes * mesaVis, ctx->Const.FragmentProgram.MaxNativeTexIndirections = I915_MAX_TEX_INDIRECT; ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */ + ctx->Const.FragmentProgram.MaxEnvParams = + MIN2(ctx->Const.FragmentProgram.MaxNativeParameters, + ctx->Const.FragmentProgram.MaxEnvParams); ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 4dbe551d832..21c0ad16ab4 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -126,7 +126,32 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, /* We want the GLSL compiler to emit code that uses condition codes */ ctx->Shader.EmitCondCodes = GL_TRUE; -/* ctx->Const.MaxNativeVertexProgramTemps = 32; */ + ctx->Const.VertexProgram.MaxNativeInstructions = (16 * 1024); + ctx->Const.VertexProgram.MaxAluInstructions = 0; + ctx->Const.VertexProgram.MaxTexInstructions = 0; + ctx->Const.VertexProgram.MaxTexIndirections = 0; + ctx->Const.VertexProgram.MaxNativeAluInstructions = 0; + ctx->Const.VertexProgram.MaxNativeTexInstructions = 0; + ctx->Const.VertexProgram.MaxNativeTexIndirections = 0; + ctx->Const.VertexProgram.MaxNativeAttribs = 16; + ctx->Const.VertexProgram.MaxNativeTemps = 256; + ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; + ctx->Const.VertexProgram.MaxNativeParameters = 96; + ctx->Const.VertexProgram.MaxEnvParams = + MIN2(ctx->Const.VertexProgram.MaxNativeParameters, + ctx->Const.VertexProgram.MaxEnvParams); + + ctx->Const.FragmentProgram.MaxNativeInstructions = (16 * 1024); + ctx->Const.FragmentProgram.MaxNativeAluInstructions = (16 * 1024); + ctx->Const.FragmentProgram.MaxNativeTexInstructions = (16 * 1024); + ctx->Const.FragmentProgram.MaxNativeTexIndirections = (16 * 1024); + ctx->Const.FragmentProgram.MaxNativeAttribs = 12; + ctx->Const.FragmentProgram.MaxNativeTemps = 256; + ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; + ctx->Const.FragmentProgram.MaxNativeParameters = 64; + ctx->Const.FragmentProgram.MaxEnvParams = + MIN2(ctx->Const.FragmentProgram.MaxNativeParameters, + ctx->Const.FragmentProgram.MaxEnvParams); brw_init_state( brw ); diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index e4995c35c44..8a09efdb539 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -170,9 +170,48 @@ /** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */ #define MAX_TEXTURE_LOD_BIAS 12.0 +/** For any program target/extension */ +/*@{*/ +#define MAX_PROGRAM_INSTRUCTIONS (16 * 1024) + +/** + * Per-program constants (power of two) + * + * \c MAX_PROGRAM_LOCAL_PARAMS and \c MAX_UNIFORMS are just the assmebly shader + * and GLSL shader names for the same thing. They should \b always have the + * same value. Each refers to the number of vec4 values supplied as + * per-program parameters. + */ +/*@{*/ +#define MAX_PROGRAM_LOCAL_PARAMS 1024 +#define MAX_UNIFORMS 1024 +/*@}*/ + +/** + * Per-context constants (power of two) + * + * \note + * This value should always be less than or equal to \c MAX_PROGRAM_LOCAL_PARAMS + * and \c MAX_VERTEX_PROGRAM_PARAMS. Otherwise some applications will make + * incorrect assumptions. + */ +#define MAX_PROGRAM_ENV_PARAMS 256 + +#define MAX_PROGRAM_MATRICES 8 +#define MAX_PROGRAM_MATRIX_STACK_DEPTH 4 +#define MAX_PROGRAM_CALL_DEPTH 8 +#define MAX_PROGRAM_TEMPS 256 +#define MAX_PROGRAM_ADDRESS_REGS 2 +#define MAX_VARYING 16 /**< number of float[4] vectors */ +#define MAX_SAMPLERS MAX_TEXTURE_IMAGE_UNITS +#define MAX_PROGRAM_INPUTS 32 +#define MAX_PROGRAM_OUTPUTS 32 +/*@}*/ + /** For GL_ARB_vertex_program */ /*@{*/ #define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1 +#define MAX_VERTEX_PROGRAM_PARAMS MAX_UNIFORMS /*@}*/ /** For GL_ARB_fragment_program */ @@ -180,23 +219,6 @@ #define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 0 /*@}*/ -/** For any program target/extension */ -/*@{*/ -#define MAX_PROGRAM_INSTRUCTIONS (16 * 1024) -#define MAX_PROGRAM_LOCAL_PARAMS 256 /**< per-program constants (power of two) */ -#define MAX_PROGRAM_ENV_PARAMS 256 /**< per-context constants (power of two) */ -#define MAX_PROGRAM_MATRICES 8 -#define MAX_PROGRAM_MATRIX_STACK_DEPTH 4 -#define MAX_PROGRAM_CALL_DEPTH 8 -#define MAX_PROGRAM_TEMPS 256 -#define MAX_PROGRAM_ADDRESS_REGS 2 -#define MAX_UNIFORMS 1024 /**< number of vec4 uniforms */ -#define MAX_VARYING 16 /**< number of float[4] vectors */ -#define MAX_SAMPLERS MAX_TEXTURE_IMAGE_UNITS -#define MAX_PROGRAM_INPUTS 32 -#define MAX_PROGRAM_OUTPUTS 32 -/*@}*/ - /** For GL_NV_vertex_program */ /*@{*/ #define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128 diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index a9e520716d3..4651760d784 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -487,7 +487,7 @@ init_program_limits(GLenum type, struct gl_program_constants *prog) prog->MaxUniformComponents = 4 * MAX_UNIFORMS; if (type == GL_VERTEX_PROGRAM_ARB) { - prog->MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS; + prog->MaxParameters = MAX_VERTEX_PROGRAM_PARAMS; prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; } @@ -497,15 +497,17 @@ init_program_limits(GLenum type, struct gl_program_constants *prog) prog->MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; } - /* copy the above limits to init native limits */ - prog->MaxNativeInstructions = prog->MaxInstructions; - prog->MaxNativeAluInstructions = prog->MaxAluInstructions; - prog->MaxNativeTexInstructions = prog->MaxTexInstructions; - prog->MaxNativeTexIndirections = prog->MaxTexIndirections; - prog->MaxNativeAttribs = prog->MaxAttribs; - prog->MaxNativeTemps = prog->MaxTemps; - prog->MaxNativeAddressRegs = prog->MaxAddressRegs; - prog->MaxNativeParameters = prog->MaxParameters; + /* Set the native limits to zero. This implies that there is no native + * support for shaders. Let the drivers fill in the actual values. + */ + prog->MaxNativeInstructions = 0; + prog->MaxNativeAluInstructions = 0; + prog->MaxNativeTexInstructions = 0; + prog->MaxNativeTexIndirections = 0; + prog->MaxNativeAttribs = 0; + prog->MaxNativeTemps = 0; + prog->MaxNativeAddressRegs = 0; + prog->MaxNativeParameters = 0; } |