Commit 84732a98 authored by Paul Berry's avatar Paul Berry

mesa: replace ctx->Const.{Vertex,Fragment,Geomtery}Program with an array.

These are replaced with
ctx->Const.Program[MESA_SHADER_{VERTEX,FRAGMENT,GEOMETRY}].  In
patches to follow, this will allow us to replace a lot of ad-hoc logic
with a variable index into the array.

With the exception of the changes to mtypes.h, this patch was
generated entirely by the command:

    find src -type f '(' -iname '*.c' -o -iname '*.cpp' -o -iname '*.py' \
    -o -iname '*.y' ')' -print0 | xargs -0 sed -i \
    -e 's/Const\.VertexProgram/Const.Program[MESA_SHADER_VERTEX]/g' \
    -e 's/Const\.GeometryProgram/Const.Program[MESA_SHADER_GEOMETRY]/g' \
    -e 's/Const\.FragmentProgram/Const.Program[MESA_SHADER_FRAGMENT]/g'
Suggested-by: default avatarBrian Paul <brianp@vmware.com>
Reviewed-by: default avatarBrian Paul <brianp@vmware.com>
Reviewed-by: default avatarKenneth Graunke <kenneth@whitecape.org>
parent 9b96be59
......@@ -1986,13 +1986,13 @@ validate_binding_qualifier(struct _mesa_glsl_parse_state *state,
unsigned limit = 0;
switch (state->stage) {
case MESA_SHADER_VERTEX:
limit = ctx->Const.VertexProgram.MaxTextureImageUnits;
limit = ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits;
break;
case MESA_SHADER_GEOMETRY:
limit = ctx->Const.GeometryProgram.MaxTextureImageUnits;
limit = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits;
break;
case MESA_SHADER_FRAGMENT:
limit = ctx->Const.FragmentProgram.MaxTextureImageUnits;
limit = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
break;
}
......
......@@ -554,9 +554,9 @@ builtin_variable_generator::generate_constants()
*/
if (state->is_version(0, 300)) {
add_const("gl_MaxVertexOutputVectors",
state->ctx->Const.VertexProgram.MaxOutputComponents / 4);
state->ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents / 4);
add_const("gl_MaxFragmentInputVectors",
state->ctx->Const.FragmentProgram.MaxInputComponents / 4);
state->ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents / 4);
} else {
add_const("gl_MaxVaryingVectors",
state->ctx->Const.MaxVarying);
......
......@@ -96,30 +96,30 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->Const.MaxClipPlanes = ctx->Const.MaxClipPlanes;
this->Const.MaxTextureUnits = ctx->Const.MaxTextureUnits;
this->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits;
this->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs;
this->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents;
this->Const.MaxVertexTextureImageUnits = ctx->Const.VertexProgram.MaxTextureImageUnits;
this->Const.MaxVertexAttribs = ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs;
this->Const.MaxVertexUniformComponents = ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents;
this->Const.MaxVertexTextureImageUnits = ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits;
this->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits;
this->Const.MaxTextureImageUnits = ctx->Const.FragmentProgram.MaxTextureImageUnits;
this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents;
this->Const.MaxTextureImageUnits = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
this->Const.MaxFragmentUniformComponents = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents;
this->Const.MinProgramTexelOffset = ctx->Const.MinProgramTexelOffset;
this->Const.MaxProgramTexelOffset = ctx->Const.MaxProgramTexelOffset;
this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
/* 1.50 constants */
this->Const.MaxVertexOutputComponents = ctx->Const.VertexProgram.MaxOutputComponents;
this->Const.MaxGeometryInputComponents = ctx->Const.GeometryProgram.MaxInputComponents;
this->Const.MaxGeometryOutputComponents = ctx->Const.GeometryProgram.MaxOutputComponents;
this->Const.MaxFragmentInputComponents = ctx->Const.FragmentProgram.MaxInputComponents;
this->Const.MaxGeometryTextureImageUnits = ctx->Const.GeometryProgram.MaxTextureImageUnits;
this->Const.MaxVertexOutputComponents = ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents;
this->Const.MaxGeometryInputComponents = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxInputComponents;
this->Const.MaxGeometryOutputComponents = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxOutputComponents;
this->Const.MaxFragmentInputComponents = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents;
this->Const.MaxGeometryTextureImageUnits = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits;
this->Const.MaxGeometryOutputVertices = ctx->Const.MaxGeometryOutputVertices;
this->Const.MaxGeometryTotalOutputComponents = ctx->Const.MaxGeometryTotalOutputComponents;
this->Const.MaxGeometryUniformComponents = ctx->Const.GeometryProgram.MaxUniformComponents;
this->Const.MaxGeometryUniformComponents = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxUniformComponents;
this->Const.MaxVertexAtomicCounters = ctx->Const.VertexProgram.MaxAtomicCounters;
this->Const.MaxGeometryAtomicCounters = ctx->Const.GeometryProgram.MaxAtomicCounters;
this->Const.MaxFragmentAtomicCounters = ctx->Const.FragmentProgram.MaxAtomicCounters;
this->Const.MaxVertexAtomicCounters = ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicCounters;
this->Const.MaxGeometryAtomicCounters = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters;
this->Const.MaxFragmentAtomicCounters = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters;
this->Const.MaxCombinedAtomicCounters = ctx->Const.MaxCombinedAtomicCounters;
this->Const.MaxAtomicBufferBindings = ctx->Const.MaxAtomicBufferBindings;
......
......@@ -215,15 +215,15 @@ link_check_atomic_counter_resources(struct gl_context *ctx,
struct gl_shader_program *prog)
{
const unsigned max_atomic_counters[] = {
ctx->Const.VertexProgram.MaxAtomicCounters,
ctx->Const.GeometryProgram.MaxAtomicCounters,
ctx->Const.FragmentProgram.MaxAtomicCounters
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicCounters,
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters
};
STATIC_ASSERT(Elements(max_atomic_counters) == MESA_SHADER_STAGES);
const unsigned max_atomic_buffers[] = {
ctx->Const.VertexProgram.MaxAtomicBuffers,
ctx->Const.GeometryProgram.MaxAtomicBuffers,
ctx->Const.FragmentProgram.MaxAtomicBuffers
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers,
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers
};
STATIC_ASSERT(Elements(max_atomic_buffers) == MESA_SHADER_STAGES);
unsigned num_buffers;
......
......@@ -1252,10 +1252,10 @@ check_against_output_limit(struct gl_context *ctx,
unsigned max_output_components;
switch (producer->Stage) {
case MESA_SHADER_VERTEX:
max_output_components = ctx->Const.VertexProgram.MaxOutputComponents;
max_output_components = ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents;
break;
case MESA_SHADER_GEOMETRY:
max_output_components = ctx->Const.GeometryProgram.MaxOutputComponents;
max_output_components = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxOutputComponents;
break;
case MESA_SHADER_FRAGMENT:
default:
......@@ -1301,10 +1301,10 @@ check_against_input_limit(struct gl_context *ctx,
unsigned max_input_components;
switch (consumer->Stage) {
case MESA_SHADER_GEOMETRY:
max_input_components = ctx->Const.GeometryProgram.MaxInputComponents;
max_input_components = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxInputComponents;
break;
case MESA_SHADER_FRAGMENT:
max_input_components = ctx->Const.FragmentProgram.MaxInputComponents;
max_input_components = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents;
break;
case MESA_SHADER_VERTEX:
default:
......
......@@ -1895,32 +1895,32 @@ static void
check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
{
const unsigned max_samplers[] = {
ctx->Const.VertexProgram.MaxTextureImageUnits,
ctx->Const.GeometryProgram.MaxTextureImageUnits,
ctx->Const.FragmentProgram.MaxTextureImageUnits
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits
};
STATIC_ASSERT(Elements(max_samplers) == MESA_SHADER_STAGES);
const unsigned max_default_uniform_components[] = {
ctx->Const.VertexProgram.MaxUniformComponents,
ctx->Const.GeometryProgram.MaxUniformComponents,
ctx->Const.FragmentProgram.MaxUniformComponents
ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents,
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxUniformComponents,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents
};
STATIC_ASSERT(Elements(max_default_uniform_components) ==
MESA_SHADER_STAGES);
const unsigned max_combined_uniform_components[] = {
ctx->Const.VertexProgram.MaxCombinedUniformComponents,
ctx->Const.GeometryProgram.MaxCombinedUniformComponents,
ctx->Const.FragmentProgram.MaxCombinedUniformComponents
ctx->Const.Program[MESA_SHADER_VERTEX].MaxCombinedUniformComponents,
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxCombinedUniformComponents,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxCombinedUniformComponents
};
STATIC_ASSERT(Elements(max_combined_uniform_components) ==
MESA_SHADER_STAGES);
const unsigned max_uniform_blocks[] = {
ctx->Const.VertexProgram.MaxUniformBlocks,
ctx->Const.GeometryProgram.MaxUniformBlocks,
ctx->Const.FragmentProgram.MaxUniformBlocks
ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformBlocks,
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxUniformBlocks,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformBlocks
};
STATIC_ASSERT(Elements(max_uniform_blocks) == MESA_SHADER_STAGES);
......
......@@ -62,20 +62,20 @@ initialize_context(struct gl_context *ctx, gl_api api)
ctx->Const.MaxTextureCoordUnits = 0;
ctx->Const.MaxTextureUnits = 8;
ctx->Const.VertexProgram.MaxAttribs = 8;
ctx->Const.VertexProgram.MaxTextureImageUnits = 0;
ctx->Const.VertexProgram.MaxUniformComponents = 128 * 4;
ctx->Const.VertexProgram.MaxInputComponents = 0; /* not used */
ctx->Const.VertexProgram.MaxOutputComponents = 32;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs = 8;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = 0;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents = 128 * 4;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxInputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents = 32;
ctx->Const.FragmentProgram.MaxTextureImageUnits =
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits =
ctx->Const.MaxCombinedTextureImageUnits;
ctx->Const.FragmentProgram.MaxUniformComponents = 16 * 4;
ctx->Const.FragmentProgram.MaxInputComponents =
ctx->Const.VertexProgram.MaxOutputComponents;
ctx->Const.FragmentProgram.MaxOutputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents = 16 * 4;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents =
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxOutputComponents = 0; /* not used */
ctx->Const.MaxVarying = ctx->Const.VertexProgram.MaxOutputComponents / 4;
ctx->Const.MaxVarying = ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents / 4;
break;
case 110:
case 120:
......@@ -88,20 +88,20 @@ initialize_context(struct gl_context *ctx, gl_api api)
ctx->Const.MaxTextureCoordUnits = 2;
ctx->Const.MaxTextureUnits = 2;
ctx->Const.VertexProgram.MaxAttribs = 16;
ctx->Const.VertexProgram.MaxTextureImageUnits = 0;
ctx->Const.VertexProgram.MaxUniformComponents = 512;
ctx->Const.VertexProgram.MaxInputComponents = 0; /* not used */
ctx->Const.VertexProgram.MaxOutputComponents = 32;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs = 16;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = 0;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents = 512;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxInputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents = 32;
ctx->Const.FragmentProgram.MaxTextureImageUnits =
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits =
ctx->Const.MaxCombinedTextureImageUnits;
ctx->Const.FragmentProgram.MaxUniformComponents = 64;
ctx->Const.FragmentProgram.MaxInputComponents =
ctx->Const.VertexProgram.MaxOutputComponents;
ctx->Const.FragmentProgram.MaxOutputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents = 64;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents =
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxOutputComponents = 0; /* not used */
ctx->Const.MaxVarying = ctx->Const.VertexProgram.MaxOutputComponents / 4;
ctx->Const.MaxVarying = ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents / 4;
break;
case 130:
case 140:
......@@ -114,19 +114,19 @@ initialize_context(struct gl_context *ctx, gl_api api)
ctx->Const.MaxTextureCoordUnits = 8;
ctx->Const.MaxTextureUnits = 2;
ctx->Const.VertexProgram.MaxAttribs = 16;
ctx->Const.VertexProgram.MaxTextureImageUnits = 16;
ctx->Const.VertexProgram.MaxUniformComponents = 1024;
ctx->Const.VertexProgram.MaxInputComponents = 0; /* not used */
ctx->Const.VertexProgram.MaxOutputComponents = 64;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs = 16;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxInputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents = 64;
ctx->Const.FragmentProgram.MaxTextureImageUnits = 16;
ctx->Const.FragmentProgram.MaxUniformComponents = 1024;
ctx->Const.FragmentProgram.MaxInputComponents =
ctx->Const.VertexProgram.MaxOutputComponents;
ctx->Const.FragmentProgram.MaxOutputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents =
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxOutputComponents = 0; /* not used */
ctx->Const.MaxVarying = ctx->Const.VertexProgram.MaxOutputComponents / 4;
ctx->Const.MaxVarying = ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents / 4;
break;
case 150:
case 330:
......@@ -138,28 +138,28 @@ initialize_context(struct gl_context *ctx, gl_api api)
ctx->Const.MaxTextureCoordUnits = 8;
ctx->Const.MaxTextureUnits = 2;
ctx->Const.VertexProgram.MaxAttribs = 16;
ctx->Const.VertexProgram.MaxTextureImageUnits = 16;
ctx->Const.VertexProgram.MaxUniformComponents = 1024;
ctx->Const.VertexProgram.MaxInputComponents = 0; /* not used */
ctx->Const.VertexProgram.MaxOutputComponents = 64;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs = 16;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxInputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents = 64;
ctx->Const.GeometryProgram.MaxTextureImageUnits = 16;
ctx->Const.GeometryProgram.MaxUniformComponents = 1024;
ctx->Const.GeometryProgram.MaxInputComponents =
ctx->Const.VertexProgram.MaxOutputComponents;
ctx->Const.GeometryProgram.MaxOutputComponents = 128;
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxInputComponents =
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents;
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxOutputComponents = 128;
ctx->Const.FragmentProgram.MaxTextureImageUnits = 16;
ctx->Const.FragmentProgram.MaxUniformComponents = 1024;
ctx->Const.FragmentProgram.MaxInputComponents =
ctx->Const.GeometryProgram.MaxOutputComponents;
ctx->Const.FragmentProgram.MaxOutputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents =
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxOutputComponents;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxOutputComponents = 0; /* not used */
ctx->Const.MaxCombinedTextureImageUnits =
ctx->Const.VertexProgram.MaxTextureImageUnits
+ ctx->Const.GeometryProgram.MaxTextureImageUnits
+ ctx->Const.FragmentProgram.MaxTextureImageUnits;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits
+ ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
ctx->Const.MaxGeometryOutputVertices = 256;
ctx->Const.MaxGeometryTotalOutputComponents = 1024;
......@@ -178,18 +178,18 @@ initialize_context(struct gl_context *ctx, gl_api api)
ctx->Const.MaxTextureCoordUnits = 0;
ctx->Const.MaxTextureUnits = 0;
ctx->Const.VertexProgram.MaxAttribs = 16;
ctx->Const.VertexProgram.MaxTextureImageUnits = 16;
ctx->Const.VertexProgram.MaxUniformComponents = 1024;
ctx->Const.VertexProgram.MaxInputComponents = 0; /* not used */
ctx->Const.VertexProgram.MaxOutputComponents = 16 * 4;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs = 16;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxInputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents = 16 * 4;
ctx->Const.FragmentProgram.MaxTextureImageUnits = 16;
ctx->Const.FragmentProgram.MaxUniformComponents = 224;
ctx->Const.FragmentProgram.MaxInputComponents = 15 * 4;
ctx->Const.FragmentProgram.MaxOutputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents = 224;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents = 15 * 4;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxOutputComponents = 0; /* not used */
ctx->Const.MaxVarying = ctx->Const.FragmentProgram.MaxInputComponents / 4;
ctx->Const.MaxVarying = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents / 4;
break;
}
......
......@@ -127,16 +127,16 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
ctx->Const.MaxClipPlanes = 6;
ctx->Const.MaxTextureUnits = 2;
ctx->Const.MaxTextureCoordUnits = 2;
ctx->Const.VertexProgram.MaxAttribs = 16;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs = 16;
ctx->Const.VertexProgram.MaxUniformComponents = 512;
ctx->Const.VertexProgram.MaxOutputComponents = 32;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents = 512;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents = 32;
ctx->Const.MaxVarying = 8; /* == gl_MaxVaryingFloats / 4 */
ctx->Const.VertexProgram.MaxTextureImageUnits = 0;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = 0;
ctx->Const.MaxCombinedTextureImageUnits = 2;
ctx->Const.FragmentProgram.MaxTextureImageUnits = 2;
ctx->Const.FragmentProgram.MaxUniformComponents = 64;
ctx->Const.FragmentProgram.MaxInputComponents = 32;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = 2;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents = 64;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents = 32;
ctx->Const.MaxDrawBuffers = 1;
......
......@@ -97,7 +97,7 @@ i830CreateContext(int api,
FALLBACK(intel, INTEL_FALLBACK_USER, 1);
intel->ctx.Const.MaxTextureUnits = I830_TEX_UNITS;
intel->ctx.Const.FragmentProgram.MaxTextureImageUnits = I830_TEX_UNITS;
intel->ctx.Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = I830_TEX_UNITS;
intel->ctx.Const.MaxTextureCoordUnits = I830_TEX_UNITS;
/* Advertise the full hardware capabilities. The new memory
......
......@@ -192,14 +192,14 @@ i915CreateContext(int api,
FALLBACK(intel, INTEL_FALLBACK_USER, 1);
ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
ctx->Const.FragmentProgram.MaxTextureImageUnits = I915_TEX_UNITS;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = I915_TEX_UNITS;
ctx->Const.MaxTextureCoordUnits = I915_TEX_UNITS;
ctx->Const.MaxVarying = I915_TEX_UNITS;
ctx->Const.VertexProgram.MaxOutputComponents =
ctx->Const.FragmentProgram.MaxInputComponents = ctx->Const.MaxVarying * 4;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents =
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents = ctx->Const.MaxVarying * 4;
ctx->Const.MaxCombinedTextureImageUnits =
ctx->Const.VertexProgram.MaxTextureImageUnits +
ctx->Const.FragmentProgram.MaxTextureImageUnits;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits +
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
/* Advertise the full hardware capabilities. The new memory
* manager should cope much better with overload situations:
......@@ -217,33 +217,33 @@ i915CreateContext(int api,
* instruction can translate to more than one HW instruction, so
* we'll still have to check and fallback each time.
*/
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 +
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeTemps = I915_MAX_TEMPORARY;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeAttribs = 11; /* 8 tex, 2 color, fog */
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeParameters = I915_MAX_CONSTANT;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeAluInstructions = I915_MAX_ALU_INSN;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeTexInstructions = I915_MAX_TEX_INSN;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeInstructions = (I915_MAX_ALU_INSN +
I915_MAX_TEX_INSN);
ctx->Const.FragmentProgram.MaxNativeTexIndirections =
ctx->Const.Program[MESA_SHADER_FRAGMENT].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->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeAddressRegs = 0; /* I don't think we have one */
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxEnvParams =
MIN2(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeParameters,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxEnvParams);
/* i915 stores all values in single-precision floats. Values aren't set
* for other program targets because software is used for those targets.
*/
ctx->Const.FragmentProgram.MediumFloat.RangeMin = 127;
ctx->Const.FragmentProgram.MediumFloat.RangeMax = 127;
ctx->Const.FragmentProgram.MediumFloat.Precision = 23;
ctx->Const.FragmentProgram.LowFloat = ctx->Const.FragmentProgram.HighFloat =
ctx->Const.FragmentProgram.MediumFloat;
ctx->Const.FragmentProgram.MediumInt.RangeMin = 24;
ctx->Const.FragmentProgram.MediumInt.RangeMax = 24;
ctx->Const.FragmentProgram.MediumInt.Precision = 0;
ctx->Const.FragmentProgram.LowInt = ctx->Const.FragmentProgram.HighInt =
ctx->Const.FragmentProgram.MediumInt;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumFloat.RangeMin = 127;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumFloat.RangeMax = 127;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumFloat.Precision = 23;
ctx->Const.Program[MESA_SHADER_FRAGMENT].LowFloat = ctx->Const.Program[MESA_SHADER_FRAGMENT].HighFloat =
ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumFloat;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumInt.RangeMin = 24;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumInt.RangeMax = 24;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumInt.Precision = 0;
ctx->Const.Program[MESA_SHADER_FRAGMENT].LowInt = ctx->Const.Program[MESA_SHADER_FRAGMENT].HighInt =
ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumInt;
ctx->FragmentProgram._MaintainTexEnvProgram = true;
......
......@@ -288,20 +288,20 @@ brw_initialize_context_constants(struct brw_context *brw)
ctx->Const.MaxDualSourceDrawBuffers = 1;
ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
ctx->Const.FragmentProgram.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
ctx->Const.MaxTextureCoordUnits = 8; /* Mesa limit */
ctx->Const.MaxTextureUnits =
MIN2(ctx->Const.MaxTextureCoordUnits,
ctx->Const.FragmentProgram.MaxTextureImageUnits);
ctx->Const.VertexProgram.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits);
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
if (brw->gen >= 7)
ctx->Const.GeometryProgram.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
else
ctx->Const.GeometryProgram.MaxTextureImageUnits = 0;
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = 0;
ctx->Const.MaxCombinedTextureImageUnits =
ctx->Const.VertexProgram.MaxTextureImageUnits +
ctx->Const.FragmentProgram.MaxTextureImageUnits +
ctx->Const.GeometryProgram.MaxTextureImageUnits;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits +
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits +
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits;
ctx->Const.MaxTextureLevels = 14; /* 8192 */
if (ctx->Const.MaxTextureLevels > MAX_TEXTURE_LEVELS)
......@@ -385,49 +385,49 @@ brw_initialize_context_constants(struct brw_context *brw)
if (brw->gen >= 5 || brw->is_g4x)
ctx->Const.MaxClipPlanes = 8;
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 = 1024;
ctx->Const.VertexProgram.MaxEnvParams =
MIN2(ctx->Const.VertexProgram.MaxNativeParameters,
ctx->Const.VertexProgram.MaxEnvParams);
ctx->Const.FragmentProgram.MaxNativeInstructions = 1024;
ctx->Const.FragmentProgram.MaxNativeAluInstructions = 1024;
ctx->Const.FragmentProgram.MaxNativeTexInstructions = 1024;
ctx->Const.FragmentProgram.MaxNativeTexIndirections = 1024;
ctx->Const.FragmentProgram.MaxNativeAttribs = 12;
ctx->Const.FragmentProgram.MaxNativeTemps = 256;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
ctx->Const.FragmentProgram.MaxNativeParameters = 1024;
ctx->Const.FragmentProgram.MaxEnvParams =
MIN2(ctx->Const.FragmentProgram.MaxNativeParameters,
ctx->Const.FragmentProgram.MaxEnvParams);
ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeInstructions = 16 * 1024;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAluInstructions = 0;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTexInstructions = 0;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTexIndirections = 0;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeAluInstructions = 0;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeTexInstructions = 0;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeTexIndirections = 0;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeAttribs = 16;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeTemps = 256;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeAddressRegs = 1;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeParameters = 1024;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxEnvParams =
MIN2(ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeParameters,
ctx->Const.Program[MESA_SHADER_VERTEX].MaxEnvParams);
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeInstructions = 1024;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeAluInstructions = 1024;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeTexInstructions = 1024;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeTexIndirections = 1024;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeAttribs = 12;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeTemps = 256;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeAddressRegs = 0;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeParameters = 1024;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxEnvParams =
MIN2(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeParameters,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxEnvParams);
/* Fragment shaders use real, 32-bit twos-complement integers for all
* integer types.
*/
ctx->Const.FragmentProgram.LowInt.RangeMin = 31;
ctx->Const.FragmentProgram.LowInt.RangeMax = 30;
ctx->Const.FragmentProgram.LowInt.Precision = 0;
ctx->Const.FragmentProgram.HighInt = ctx->Const.FragmentProgram.LowInt;
ctx->Const.FragmentProgram.MediumInt = ctx->Const.FragmentProgram.LowInt;
ctx->Const.Program[MESA_SHADER_FRAGMENT].LowInt.RangeMin = 31;
ctx->Const.Program[MESA_SHADER_FRAGMENT].LowInt.RangeMax = 30;
ctx->Const.Program[MESA_SHADER_FRAGMENT].LowInt.Precision = 0;
ctx->Const.Program[MESA_SHADER_FRAGMENT].HighInt = ctx->Const.Program[MESA_SHADER_FRAGMENT].LowInt;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumInt = ctx->Const.Program[MESA_SHADER_FRAGMENT].LowInt;
if (brw->gen >= 7) {
ctx->Const.FragmentProgram.MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
ctx->Const.VertexProgram.MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
ctx->Const.GeometryProgram.MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
ctx->Const.FragmentProgram.MaxAtomicBuffers = BRW_MAX_ABO;
ctx->Const.VertexProgram.MaxAtomicBuffers = BRW_MAX_ABO;
ctx->Const.GeometryProgram.MaxAtomicBuffers = BRW_MAX_ABO;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers = BRW_MAX_ABO;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers = BRW_MAX_ABO;
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers = BRW_MAX_ABO;
ctx->Const.MaxCombinedAtomicBuffers = 3 * BRW_MAX_ABO;
}
......@@ -456,10 +456,10 @@ brw_initialize_context_constants(struct brw_context *brw)
if (brw->gen >= 6) {
ctx->Const.MaxVarying = 32;
ctx->Const.VertexProgram.MaxOutputComponents = 128;
ctx->Const.GeometryProgram.MaxInputComponents = 64;
ctx->Const.GeometryProgram.MaxOutputComponents = 128;
ctx->Const.FragmentProgram.MaxInputComponents = 128;
ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents = 128;
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxInputComponents = 64;
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxOutputComponents = 128;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents = 128;
}
/* We want the GLSL compiler to emit code that uses condition codes */
......
......@@ -159,7 +159,7 @@ nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visua
/* GL constants. */
ctx->Const.MaxTextureLevels = 11;
ctx->Const.MaxTextureCoordUnits = NV04_TEXTURE_UNITS;
ctx->Const.FragmentProgram.MaxTextureImageUnits = NV04_TEXTURE_UNITS;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = NV04_TEXTURE_UNITS;
ctx->Const.MaxTextureUnits = NV04_TEXTURE_UNITS;
ctx->Const.MaxTextureMaxAnisotropy = 2;
ctx->Const.MaxTextureLodBias = 15;
......
......@@ -457,7 +457,7 @@ nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visua
/* GL constants. */
ctx->Const.MaxTextureLevels = 12;
ctx->Const.MaxTextureCoordUnits = NV10_TEXTURE_UNITS;
ctx->Const.FragmentProgram.MaxTextureImageUnits = NV10_TEXTURE_UNITS;
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = NV10_TEXTURE_UNITS;
ctx->Const.MaxTextureUnits = NV10_TEXTURE_UNITS;