aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2014-01-08 10:00:28 -0800
committerPaul Berry <stereotype441@gmail.com>2014-01-09 09:31:01 -0800
commit84732a982c3eeaca2e2809532c8422dc5f7045c1 (patch)
tree851c411dc92ad2192d2c63db0898dec46a200611 /src/mesa
parent9b96be595b93544266436ec3b22b2cbd349d180c (diff)
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: Brian Paul <brianp@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i915/i830_context.c2
-rw-r--r--src/mesa/drivers/dri/i915/i915_context.c52
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c98
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_context.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_context.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_context.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c12
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c2
-rw-r--r--src/mesa/main/arbprogram.c20
-rw-r--r--src/mesa/main/context.c26
-rw-r--r--src/mesa/main/ffvertex_prog.c2
-rw-r--r--src/mesa/main/get.c10
-rw-r--r--src/mesa/main/get_hash_params.py50
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/main/shader_query.cpp2
-rw-r--r--src/mesa/main/shaderapi.c4
-rw-r--r--src/mesa/main/texenv.c8
-rw-r--r--src/mesa/main/varray.c24
-rw-r--r--src/mesa/main/version.c2
-rw-r--r--src/mesa/program/program.c26
-rw-r--r--src/mesa/program/program_parse.y6
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c6
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c8
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp2
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c2
-rw-r--r--src/mesa/swrast/s_context.c6
-rw-r--r--src/mesa/swrast/s_texcombine.c2
-rw-r--r--src/mesa/tnl/t_vb_program.c4
30 files changed, 194 insertions, 196 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c
index 87d1a496ecc..e8959ac3d0d 100644
--- a/src/mesa/drivers/dri/i915/i830_context.c
+++ b/src/mesa/drivers/dri/i915/i830_context.c
@@ -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
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index 23890439ca5..c30eed95266 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -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;
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 8d202a2d425..1b4275138d1 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -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 */
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c
index c198c03f095..6cd191e7a78 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -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;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 1918f12238d..8582cb25d97 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -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;
ctx->Const.MaxTextureMaxAnisotropy = 2;
ctx->Const.MaxTextureLodBias = 15;
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 1d77132db11..618280f4c8f 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -467,7 +467,7 @@ nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visua
/* GL constants. */
ctx->Const.MaxTextureCoordUnits = NV20_TEXTURE_UNITS;
- ctx->Const.FragmentProgram.MaxTextureImageUnits = NV20_TEXTURE_UNITS;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = NV20_TEXTURE_UNITS;
ctx->Const.MaxTextureUnits = NV20_TEXTURE_UNITS;
ctx->Const.MaxTextureMaxAnisotropy = 8;
ctx->Const.MaxTextureLodBias = 15;
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 5c53720d1b1..f82424b8eb5 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -295,7 +295,7 @@ GLboolean r200CreateContext( gl_api api,
ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache,
"texture_units");
- ctx->Const.FragmentProgram.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxTextureUnits;
@@ -329,11 +329,11 @@ GLboolean r200CreateContext( gl_api api,
ctx->Const.MaxLineWidthAA = 10.0;
ctx->Const.LineWidthGranularity = 0.0625;
- ctx->Const.VertexProgram.MaxNativeInstructions = R200_VSF_MAX_INST;
- ctx->Const.VertexProgram.MaxNativeAttribs = 12;
- ctx->Const.VertexProgram.MaxNativeTemps = R200_VSF_MAX_TEMPS;
- ctx->Const.VertexProgram.MaxNativeParameters = R200_VSF_MAX_PARAM;
- ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeInstructions = R200_VSF_MAX_INST;
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeAttribs = 12;
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeTemps = R200_VSF_MAX_TEMPS;
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeParameters = R200_VSF_MAX_PARAM;
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxNativeAddressRegs = 1;
ctx->Const.MaxDrawBuffers = 1;
ctx->Const.MaxColorAttachments = 1;
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index ee7b9459664..b4ef7cfa6f8 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -2243,7 +2243,7 @@ static GLboolean r200ValidateBuffers(struct gl_context *ctx)
0, RADEON_GEM_DOMAIN_VRAM);
}
- for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; ++i) {
+ for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; ++i) {
radeonTexObj *t;
if (!ctx->Texture.Unit[i]._ReallyEnabled)
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 02dbe064421..1e059ebb386 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -258,7 +258,7 @@ r100CreateContext( gl_api api,
ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache,
"texture_units");
- ctx->Const.FragmentProgram.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxTextureUnits;
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 625271dd168..843a5a6cf07 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -2020,7 +2020,7 @@ static GLboolean r100ValidateBuffers(struct gl_context *ctx)
0, RADEON_GEM_DOMAIN_VRAM);
}
- for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; ++i) {
+ for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; ++i) {
radeonTexObj *t;
if (!ctx->Texture.Unit[i]._ReallyEnabled)
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index bf2a5f83298..247b4925368 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -247,12 +247,12 @@ get_local_param_pointer(struct gl_context *ctx, const char *func,
if (target == GL_VERTEX_PROGRAM_ARB
&& ctx->Extensions.ARB_vertex_program) {
prog = &(ctx->VertexProgram.Current->Base);
- maxParams = ctx->Const.VertexProgram.MaxLocalParams;
+ maxParams = ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams;
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
prog = &(ctx->FragmentProgram.Current->Base);
- maxParams = ctx->Const.FragmentProgram.MaxLocalParams;
+ maxParams = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
@@ -282,7 +282,7 @@ get_env_param_pointer(struct gl_context *ctx, const char *func,
{
if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
- if (index >= ctx->Const.FragmentProgram.MaxEnvParams) {
+ if (index >= ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxEnvParams) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(index)", func);
return GL_FALSE;
}
@@ -291,7 +291,7 @@ get_env_param_pointer(struct gl_context *ctx, const char *func,
}
else if (target == GL_VERTEX_PROGRAM_ARB &&
ctx->Extensions.ARB_vertex_program) {
- if (index >= ctx->Const.VertexProgram.MaxEnvParams) {
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxEnvParams) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(index)", func);
return GL_FALSE;
}
@@ -436,7 +436,7 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
- if ((index + count) > ctx->Const.FragmentProgram.MaxEnvParams) {
+ if ((index + count) > ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxEnvParams) {
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(index + count)");
return;
}
@@ -444,7 +444,7 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
}
else if (target == GL_VERTEX_PROGRAM_ARB
&& ctx->Extensions.ARB_vertex_program) {
- if ((index + count) > ctx->Const.VertexProgram.MaxEnvParams) {
+ if ((index + count) > ctx->Const.Program[MESA_SHADER_VERTEX].MaxEnvParams) {
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(index + count)");
return;
}
@@ -530,8 +530,8 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT",
target, index, &dest)) {
GLuint maxParams = target == GL_FRAGMENT_PROGRAM_ARB ?
- ctx->Const.FragmentProgram.MaxLocalParams :
- ctx->Const.VertexProgram.MaxLocalParams;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams :
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams;
if ((index + count) > maxParams) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -602,12 +602,12 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
if (target == GL_VERTEX_PROGRAM_ARB
&& ctx->Extensions.ARB_vertex_program) {
prog = &(ctx->VertexProgram.Current->Base);
- limits = &ctx->Const.VertexProgram;
+ limits = &ctx->Const.Program[MESA_SHADER_VERTEX];
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
prog = &(ctx->FragmentProgram.Current->Base);
- limits = &ctx->Const.FragmentProgram;
+ limits = &ctx->Const.Program[MESA_SHADER_FRAGMENT];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)");
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 76e2eccfd5c..cfebbd2cd72 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -561,9 +561,9 @@ _mesa_init_constants(struct gl_context *ctx)
ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE;
ctx->Const.MaxArrayTextureLayers = MAX_ARRAY_TEXTURE_LAYERS;
ctx->Const.MaxTextureCoordUnits = MAX_TEXTURE_COORD_UNITS;
- ctx->Const.FragmentProgram.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureCoordUnits,
- ctx->Const.FragmentProgram.MaxTextureImageUnits);
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits);
ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY;
ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS;
ctx->Const.MaxTextureBufferSize = 65536;
@@ -593,9 +593,9 @@ _mesa_init_constants(struct gl_context *ctx)
ctx->Const.MaxUniformBlockSize = 16384;
ctx->Const.UniformBufferOffsetAlignment = 1;
- init_program_limits(ctx, GL_VERTEX_PROGRAM_ARB, &ctx->Const.VertexProgram);
- init_program_limits(ctx, GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.FragmentProgram);
- init_program_limits(ctx, MESA_GEOMETRY_PROGRAM, &ctx->Const.GeometryProgram);
+ init_program_limits(ctx, GL_VERTEX_PROGRAM_ARB, &ctx->Const.Program[MESA_SHADER_VERTEX]);
+ init_program_limits(ctx, GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.Program[MESA_SHADER_FRAGMENT]);
+ init_program_limits(ctx, MESA_GEOMETRY_PROGRAM, &ctx->Const.Program[MESA_SHADER_GEOMETRY]);
ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES;
ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH;
@@ -609,10 +609,10 @@ _mesa_init_constants(struct gl_context *ctx)
ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS;
ctx->Const.MaxRenderbufferSize = MAX_RENDERBUFFER_SIZE;
- ctx->Const.VertexProgram.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
ctx->Const.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
ctx->Const.MaxVarying = 16; /* old limit not to break tnl and swrast */
- ctx->Const.GeometryProgram.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
+ ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
ctx->Const.MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES;
ctx->Const.MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS;
@@ -699,24 +699,24 @@ check_context_limits(struct gl_context *ctx)
(8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
/* shader-related checks */
- assert(ctx->Const.FragmentProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
- assert(ctx->Const.VertexProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
+ assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
+ assert(ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
/* Texture unit checks */
- assert(ctx->Const.FragmentProgram.MaxTextureImageUnits > 0);
- assert(ctx->Const.FragmentProgram.MaxTextureImageUnits <= MAX_TEXTURE_IMAGE_UNITS);
+ assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits > 0);
+ assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits <= MAX_TEXTURE_IMAGE_UNITS);
assert(ctx->Const.MaxTextureCoordUnits > 0);
assert(ctx->Const.MaxTextureCoordUnits <= MAX_TEXTURE_COORD_UNITS);
assert(ctx->Const.MaxTextureUnits > 0);
assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_IMAGE_UNITS);
assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_COORD_UNITS);
- assert(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.FragmentProgram.MaxTextureImageUnits,
+ assert(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
ctx->Const.MaxTextureCoordUnits));
assert(ctx->Const.MaxCombinedTextureImageUnits > 0);
assert(ctx->Const.MaxCombinedTextureImageUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS);
assert(ctx->Const.MaxTextureCoordUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS);
/* number of coord units cannot be greater than number of image units */
- assert(ctx->Const.MaxTextureCoordUnits <= ctx->Const.FragmentProgram.MaxTextureImageUnits);
+ assert(ctx->Const.MaxTextureCoordUnits <= ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits);
/* Texture size checks */
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 074fbf9a3f4..808ea9cbde1 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -1677,7 +1677,7 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
create_new_program( &key, prog,
ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].PreferDP4,
- ctx->Const.VertexProgram.MaxTemps );
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxTemps );
#if 0
if (ctx->Driver.ProgramStringNotify)
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index c45a8d156c3..6342fbefca4 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -871,11 +871,11 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
v->value_float = ctx->Color.AlphaRefUnclamped;
break;
case GL_MAX_VERTEX_UNIFORM_VECTORS:
- v->value_int = ctx->Const.VertexProgram.MaxUniformComponents / 4;
+ v->value_int = ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents / 4;
break;
case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
- v->value_int = ctx->Const.FragmentProgram.MaxUniformComponents / 4;
+ v->value_int = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents / 4;
break;
/* GL_ARB_texture_buffer_object */
@@ -1769,7 +1769,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
case GL_VERTEX_BINDING_DIVISOR:
if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_instanced_arrays)
goto invalid_enum;
- if (index >= ctx->Const.VertexProgram.MaxAttribs)
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
goto invalid_value;
v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
return TYPE_INT;
@@ -1777,7 +1777,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
case GL_VERTEX_BINDING_OFFSET:
if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum;
- if (index >= ctx->Const.VertexProgram.MaxAttribs)
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
goto invalid_value;
v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;
return TYPE_INT;
@@ -1785,7 +1785,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
case GL_VERTEX_BINDING_STRIDE:
if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum;
- if (index >= ctx->Const.VertexProgram.MaxAttribs)
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
goto invalid_value;
v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
return TYPE_INT;
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index e84be748589..7f025a98093 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -271,8 +271,8 @@ descriptor=[
# GL_ARB_fragment_program
# == GL_MAX_TEXTURE_IMAGE_UNITS_NV
- [ "MAX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.FragmentProgram.MaxTextureImageUnits), extra_ARB_fragment_program" ],
- [ "MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.VertexProgram.MaxTextureImageUnits), extra_ARB_vertex_shader" ],
+ [ "MAX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits), extra_ARB_fragment_program" ],
+ [ "MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits), extra_ARB_vertex_shader" ],
[ "MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxCombinedTextureImageUnits), extra_ARB_vertex_shader" ],
# GL_ARB_shader_objects
@@ -288,7 +288,7 @@ descriptor=[
[ "STENCIL_BACK_FAIL", "CONTEXT_ENUM(Stencil.FailFunc[1]), NO_EXTRA" ],
[ "STENCIL_BACK_PASS_DEPTH_FAIL", "CONTEXT_ENUM(Stencil.ZFailFunc[1]), NO_EXTRA" ],
[ "STENCIL_BACK_PASS_DEPTH_PASS", "CONTEXT_ENUM(Stencil.ZPassFunc[1]), NO_EXTRA" ],
- [ "MAX_VERTEX_ATTRIBS_ARB", "CONTEXT_INT(Const.VertexProgram.MaxAttribs), extra_ARB_vertex_program_api_es2" ],
+ [ "MAX_VERTEX_ATTRIBS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxAttribs), extra_ARB_vertex_program_api_es2" ],
# OES_texture_3D
[ "TEXTURE_BINDING_3D", "LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX, NO_EXTRA" ],
@@ -328,14 +328,14 @@ descriptor=[
[ "MINOR_VERSION", "LOC_CUSTOM, TYPE_INT, 0, extra_gl30_es3" ],
# GL 3.2 / GLES3
- [ "MAX_VERTEX_OUTPUT_COMPONENTS", "CONTEXT_INT(Const.VertexProgram.MaxOutputComponents), extra_gl32_es3" ],
- [ "MAX_FRAGMENT_INPUT_COMPONENTS", "CONTEXT_INT(Const.FragmentProgram.MaxInputComponents), extra_gl32_es3" ],
+ [ "MAX_VERTEX_OUTPUT_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents), extra_gl32_es3" ],
+ [ "MAX_FRAGMENT_INPUT_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents), extra_gl32_es3" ],
# GL_ARB_ES3_compatibility
[ "MAX_ELEMENT_INDEX", "CONTEXT_INT64(Const.MaxElementIndex), extra_ARB_ES3_compatibility_api_es3"],
# GL_ARB_fragment_shader
- [ "MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.FragmentProgram.MaxUniformComponents), extra_ARB_fragment_shader" ],
+ [ "MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents), extra_ARB_fragment_shader" ],
# GL_ARB_framebuffer_object
[ "MAX_SAMPLES", "CONTEXT_INT(Const.MaxSamples), extra_ARB_framebuffer_object_EXT_framebuffer_multisample" ],
@@ -349,18 +349,18 @@ descriptor=[
[ "TRANSFORM_FEEDBACK_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_transform_feedback2_api_es3" ],
# GL_ARB_uniform_buffer_object
- [ "MAX_VERTEX_UNIFORM_BLOCKS", "CONTEXT_INT(Const.VertexProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object" ],
- [ "MAX_FRAGMENT_UNIFORM_BLOCKS", "CONTEXT_INT(Const.FragmentProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object" ],
+ [ "MAX_VERTEX_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxUniformBlocks), extra_ARB_uniform_buffer_object" ],
+ [ "MAX_FRAGMENT_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxUniformBlocks), extra_ARB_uniform_buffer_object" ],
[ "MAX_COMBINED_UNIFORM_BLOCKS", "CONTEXT_INT(Const.MaxCombinedUniformBlocks), extra_ARB_uniform_buffer_object" ],
[ "MAX_UNIFORM_BLOCK_SIZE", "CONTEXT_INT(Const.MaxUniformBlockSize), extra_ARB_uniform_buffer_object" ],
[ "MAX_UNIFORM_BUFFER_BINDINGS", "CONTEXT_INT(Const.MaxUniformBufferBindings), extra_ARB_uniform_buffer_object" ],
- [ "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.VertexProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object" ],
- [ "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.FragmentProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object" ],
+ [ "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object" ],
+ [ "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object" ],
[ "UNIFORM_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.UniformBufferOffsetAlignment), extra_ARB_uniform_buffer_object" ],
[ "UNIFORM_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_uniform_buffer_object" ],
# GL_ARB_vertex_shader
- [ "MAX_VERTEX_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.VertexProgram.MaxUniformComponents), extra_ARB_vertex_shader" ],
+ [ "MAX_VERTEX_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents), extra_ARB_vertex_shader" ],
[ "MAX_VARYING_FLOATS_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_vertex_shader" ],
# GL_EXT_framebuffer_blit
@@ -646,12 +646,12 @@ descriptor=[
[ "MAX_VERTEX_STREAMS", "CONTEXT_INT(Const.MaxVertexStreams), extra_ARB_transform_feedback3" ],
# GL_ARB_geometry_shader4
- [ "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxTextureImageUnits), extra_gl32_ARB_geometry_shader4" ],
+ [ "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits), extra_gl32_ARB_geometry_shader4" ],
[ "MAX_GEOMETRY_OUTPUT_VERTICES_ARB", "CONTEXT_INT(Const.MaxGeometryOutputVertices), extra_gl32_ARB_geometry_shader4" ],
[ "MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxGeometryTotalOutputComponents), extra_gl32_ARB_geometry_shader4" ],
- [ "MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxUniformComponents), extra_gl32_ARB_geometry_shader4" ],
- [ "MAX_GEOMETRY_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxOutputComponents), extra_ARB_geometry_shader4" ],
- [ "MAX_VERTEX_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.VertexProgram.MaxOutputComponents), extra_ARB_geometry_shader4" ],
+ [ "MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxUniformComponents), extra_gl32_ARB_geometry_shader4" ],
+ [ "MAX_GEOMETRY_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxOutputComponents), extra_ARB_geometry_shader4" ],
+ [ "MAX_VERTEX_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents), extra_ARB_geometry_shader4" ],
# GL_ARB_color_buffer_float
[ "RGBA_FLOAT_MODE_ARB", "BUFFER_FIELD(Visual.floatMode, TYPE_BOOLEAN), extra_core_ARB_color_buffer_float_and_new_buffers" ],
@@ -691,8 +691,8 @@ descriptor=[
# GL 3.2
[ "CONTEXT_PROFILE_MASK", "CONTEXT_INT(Const.ProfileMask), extra_version_32" ],
- [ "MAX_GEOMETRY_INPUT_COMPONENTS", "CONTEXT_INT(Const.GeometryProgram.MaxInputComponents), extra_version_32" ],
- [ "MAX_GEOMETRY_OUTPUT_COMPONENTS", "CONTEXT_INT(Const.GeometryProgram.MaxOutputComponents), extra_version_32" ],
+ [ "MAX_GEOMETRY_INPUT_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxInputComponents), extra_version_32" ],
+ [ "MAX_GEOMETRY_OUTPUT_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxOutputComponents), extra_version_32" ],
# GL_ARB_robustness
[ "RESET_NOTIFICATION_STRATEGY_ARB", "CONTEXT_ENUM(Const.ResetStrategy), NO_EXTRA" ],
@@ -709,8 +709,8 @@ descriptor=[
[ "MAX_DUAL_SOURCE_DRAW_BUFFERS", "CONTEXT_INT(Const.MaxDualSourceDrawBuffers), extra_ARB_blend_func_extended" ],
# GL_ARB_uniform_buffer_object
- [ "MAX_GEOMETRY_UNIFORM_BLOCKS", "CONTEXT_INT(Const.GeometryProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object_and_geometry_shader" ],
- [ "MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.GeometryProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object_and_geometry_shader" ],
+ [ "MAX_GEOMETRY_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxUniformBlocks), extra_ARB_uniform_buffer_object_and_geometry_shader" ],
+ [ "MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object_and_geometry_shader" ],
# GL_ARB_timer_query
[ "TIMESTAMP", "LOC_CUSTOM, TYPE_INT64, 0, extra_ARB_timer_query" ],
@@ -730,12 +730,12 @@ descriptor=[
[ "ATOMIC_COUNTER_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_shader_atomic_counters" ],
[ "MAX_ATOMIC_COUNTER_BUFFER_BINDINGS", "CONTEXT_INT(Const.MaxAtomicBufferBindings), extra_ARB_shader_atomic_counters" ],
[ "MAX_ATOMIC_COUNTER_BUFFER_SIZE", "CONTEXT_INT(Const.MaxAtomicBufferSize), extra_ARB_shader_atomic_counters" ],
- [ "MAX_VERTEX_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.VertexProgram.MaxAtomicBuffers), extra_ARB_shader_atomic_counters" ],
- [ "MAX_VERTEX_ATOMIC_COUNTERS", "CONTEXT_INT(Const.VertexProgram.MaxAtomicCounters), extra_ARB_shader_atomic_counters" ],
- [ "MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.FragmentProgram.MaxAtomicBuffers), extra_ARB_shader_atomic_counters" ],
- [ "MAX_FRAGMENT_ATOMIC_COUNTERS", "CONTEXT_INT(Const.FragmentProgram.MaxAtomicCounters), extra_ARB_shader_atomic_counters" ],
- [ "MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.GeometryProgram.MaxAtomicBuffers), extra_ARB_shader_atomic_counters_and_geometry_shader" ],
- [ "MAX_GEOMETRY_ATOMIC_COUNTERS", "CONTEXT_INT(Const.GeometryProgram.MaxAtomicCounters), extra_ARB_shader_atomic_counters_and_geometry_shader" ],
+ [ "MAX_VERTEX_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers), extra_ARB_shader_atomic_counters" ],
+ [ "MAX_VERTEX_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxAtomicCounters), extra_ARB_shader_atomic_counters" ],
+ [ "MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers), extra_ARB_shader_atomic_counters" ],
+ [ "MAX_FRAGMENT_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters), extra_ARB_shader_atomic_counters" ],
+ [ "MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers), extra_ARB_shader_atomic_counters_and_geometry_shader" ],
+ [ "MAX_GEOMETRY_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters), extra_ARB_shader_atomic_counters_and_geometry_shader" ],
[ "MAX_COMBINED_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.MaxCombinedAtomicBuffers), extra_ARB_shader_atomic_counters" ],
[ "MAX_COMBINED_ATOMIC_COUNTERS", "CONTEXT_INT(Const.MaxCombinedAtomicCounters), extra_ARB_shader_atomic_counters" ],
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 37e05927d8c..908ec30d800 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3135,9 +3135,7 @@ struct gl_constants
GLuint MaxViewportWidth, MaxViewportHeight;
- struct gl_program_constants VertexProgram; /**< GL_ARB_vertex_program */
- struct gl_program_constants FragmentProgram; /**< GL_ARB_fragment_program */
- struct gl_program_constants GeometryProgram; /**< GL_ARB_geometry_shader4 */
+ struct gl_program_constants Program[MESA_SHADER_STAGES];
GLuint MaxProgramMatrices;
GLuint MaxProgramMatrixStackDepth;
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index f14e1a562a7..e1afe5315f4 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -59,7 +59,7 @@ _mesa_BindAttribLocation(GLhandleARB program, GLuint index,
return;
}
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE, "glBindAttribLocation(index)");
return;
}
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 16a9a384c3b..6042fa896d5 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1533,10 +1533,10 @@ _mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
switch (shadertype) {
case GL_VERTEX_SHADER:
- limits = &ctx->Const.VertexProgram;
+ limits = &ctx->Const.Program[MESA_SHADER_VERTEX];
break;
case GL_FRAGMENT_SHADER:
- limits = &ctx->Const.FragmentProgram;
+ limits = &ctx->Const.Program[MESA_SHADER_FRAGMENT];
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM,
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index 1aadd7fde58..4848208f574 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -879,7 +879,7 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param )
}
else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
GLint count = 0;
- for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) {
+ for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
if (ctx->Const.SupportedBumpUnits & (1 << i)) {
count++;
}
@@ -887,7 +887,7 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param )
*param = count;
}
else if (pname == GL_BUMP_TEX_UNITS_ATI) {
- for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) {
+ for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
if (ctx->Const.SupportedBumpUnits & (1 << i)) {
*param++ = i + GL_TEXTURE0;
}
@@ -928,7 +928,7 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param )
}
else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
GLint count = 0;
- for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) {
+ for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
if (ctx->Const.SupportedBumpUnits & (1 << i)) {
count++;
}
@@ -936,7 +936,7 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param )
*param = (GLfloat) count;
}
else if (pname == GL_BUMP_TEX_UNITS_ATI) {
- for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) {
+ for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
if (ctx->Const.SupportedBumpUnits & (1 << i)) {
*param++ = (GLfloat) (i + GL_TEXTURE0);
}
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 0f38270d5d9..b73a396e25d 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -621,7 +621,7 @@ _mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type,
UNSIGNED_INT_10F_11F_11F_REV_BIT);
GET_CURRENT_CONTEXT(ctx);
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(index)");
return;
}
@@ -649,7 +649,7 @@ _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type,
const GLboolean integer = GL_TRUE;
GET_CURRENT_CONTEXT(ctx);
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribIPointer(index)");
return;
}
@@ -667,7 +667,7 @@ _mesa_EnableVertexAttribArray(GLuint index)
struct gl_array_object *arrayObj;
GET_CURRENT_CONTEXT(ctx);
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glEnableVertexAttribArrayARB(index)");
return;
@@ -693,7 +693,7 @@ _mesa_DisableVertexAttribArray(GLuint index)
struct gl_array_object *arrayObj;
GET_CURRENT_CONTEXT(ctx);
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glDisableVertexAttribArrayARB(index)");
return;
@@ -725,7 +725,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
const struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
const struct gl_vertex_attrib_array *array;
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)", caller, index);
return 0;
}
@@ -795,7 +795,7 @@ get_current_attrib(struct gl_context *ctx, GLuint index, const char *function)
return NULL;
}
}
- else if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ else if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE,
"%s(index>=GL_MAX_VERTEX_ATTRIBS)", function);
return NULL;
@@ -913,7 +913,7 @@ _mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer)
{
GET_CURRENT_CONTEXT(ctx);
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerARB(index)");
return;
}
@@ -1308,7 +1308,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
return;
}
- if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribDivisor(index = %u)",
index);
return;
@@ -1479,7 +1479,7 @@ _mesa_VertexAttribFormat(GLuint attribIndex, GLint size, GLenum type,
* "The error INVALID_VALUE is generated if index is greater than or equal
* to the value of MAX_VERTEX_ATTRIBS."
*/
- if (attribIndex >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (attribIndex >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glVertexAttribFormat(attribindex=%u > "
"GL_MAX_VERTEX_ATTRIBS)",
@@ -1526,7 +1526,7 @@ _mesa_VertexAttribIFormat(GLuint attribIndex, GLint size, GLenum type,
* "The error INVALID_VALUE is generated if index is greater than
* or equal to the value of MAX_VERTEX_ATTRIBS."
*/
- if (attribIndex >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (attribIndex >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glVertexAttribIFormat(attribindex=%u > "
"GL_MAX_VERTEX_ATTRIBS)",
@@ -1574,7 +1574,7 @@ _mesa_VertexAttribLFormat(GLuint attribIndex, GLint size, GLenum type,
* "The error INVALID_VALUE is generated if <attribindex> is greater than
* or equal to the value of MAX_VERTEX_ATTRIBS."
*/
- if (attribIndex >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (attribIndex >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glVertexAttribLFormat(attribindex=%u > "
"GL_MAX_VERTEX_ATTRIBS)",
@@ -1616,7 +1616,7 @@ _mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex)
* MAX_VERTEX_ATTRIB_BINDINGS, otherwise the error INVALID_VALUE
* is generated."
*/
- if (attribIndex >= ctx->Const.VertexProgram.MaxAttribs) {
+ if (attribIndex >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glVertexAttribBinding(attribindex=%u >= "
"GL_MAX_VERTEX_ATTRIBS)",
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 00eeca764cb..9af5f091e04 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -255,7 +255,7 @@ compute_version(struct gl_context *ctx)
ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.NV_primitive_restart &&
ctx->Extensions.NV_texture_rectangle &&
- ctx->Const.VertexProgram.MaxTextureImageUnits >= 16);
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits >= 16);
const GLboolean ver_3_2 = (ver_3_1 &&
ctx->Const.GLSLVersion >= 150 &&
ctx->Extensions.ARB_depth_clamp &&
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 45748fdc93c..df4d75fddbd 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -56,21 +56,21 @@ _mesa_init_program(struct gl_context *ctx)
* If this assertion fails, we need to increase the field
* size for register indexes (see INST_INDEX_BITS).
*/
- ASSERT(ctx->Const.VertexProgram.MaxUniformComponents / 4
+ ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents / 4
<= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents / 4
+ ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents / 4
<= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.VertexProgram.MaxTemps <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.VertexProgram.MaxLocalParams <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.FragmentProgram.MaxTemps <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.FragmentProgram.MaxLocalParams <= (1 << INST_INDEX_BITS));
+ ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxTemps <= (1 << INST_INDEX_BITS));
+ ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams <= (1 << INST_INDEX_BITS));
+ ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTemps <= (1 << INST_INDEX_BITS));
+ ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.VertexProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS);
- ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS);
+ ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents <= 4 * MAX_UNIFORMS);
+ ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents <= 4 * MAX_UNIFORMS);
- ASSERT(ctx->Const.VertexProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.FragmentProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS));
+ ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxAddressOffset <= (1 << INST_INDEX_BITS));
+ ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAddressOffset <= (1 << INST_INDEX_BITS));
/* If this fails, increase prog_instruction::TexSrcUnit size */
STATIC_ASSERT(MAX_TEXTURE_UNITS <= (1 << 5));
@@ -898,13 +898,13 @@ _mesa_valid_register_index(const struct gl_context *ctx,
switch (shaderType) {
case MESA_SHADER_VERTEX:
- c = &ctx->Const.VertexProgram;
+ c = &ctx->Const.Program[MESA_SHADER_VERTEX];
break;
case MESA_SHADER_FRAGMENT:
- c = &ctx->Const.FragmentProgram;
+ c = &ctx->Const.Program[MESA_SHADER_FRAGMENT];
break;
case MESA_SHADER_GEOMETRY:
- c = &ctx->Const.GeometryProgram;
+ c = &ctx->Const.Program[MESA_SHADER_GEOMETRY];
break;
default:
_mesa_problem(ctx,
diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
index a76db4e86b7..6dde69d5372 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -2707,10 +2707,10 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st
state->st = _mesa_symbol_table_ctor();
state->limits = (target == GL_VERTEX_PROGRAM_ARB)
- ? & ctx->Const.VertexProgram
- : & ctx->Const.FragmentProgram;
+ ? & ctx->Const.Program[MESA_SHADER_VERTEX]
+ : & ctx->Const.Program[MESA_SHADER_FRAGMENT];
- state->MaxTextureImageUnits = ctx->Const.FragmentProgram.MaxTextureImageUnits;
+ state->MaxTextureImageUnits = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 57670ce259b..cb5369bed53 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -279,14 +279,14 @@ update_samplers(struct st_context *st)
update_shader_samplers(st,
PIPE_SHADER_FRAGMENT,
&ctx->FragmentProgram._Current->Base,
- ctx->Const.FragmentProgram.MaxTextureImageUnits,
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_FRAGMENT],
&st->state.num_samplers[PIPE_SHADER_FRAGMENT]);
update_shader_samplers(st,
PIPE_SHADER_VERTEX,
&ctx->VertexProgram._Current->Base,
- ctx->Const.VertexProgram.MaxTextureImageUnits,
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_VERTEX],
&st->state.num_samplers[PIPE_SHADER_VERTEX]);
@@ -294,7 +294,7 @@ update_samplers(struct st_context *st)
update_shader_samplers(st,
PIPE_SHADER_GEOMETRY,
&ctx->GeometryProgram._Current->Base,
- ctx->Const.GeometryProgram.MaxTextureImageUnits,
+ ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_GEOMETRY],
&st->state.num_samplers[PIPE_SHADER_GEOMETRY]);
}
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index bd0a22dde42..7604202baf6 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -326,11 +326,11 @@ update_vertex_textures(struct st_context *st)
{
const struct gl_context *ctx = st->ctx;
- if (ctx->Const.VertexProgram.MaxTextureImageUnits > 0) {
+ if (ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits > 0) {
update_textures(st,
PIPE_SHADER_VERTEX,
&ctx->VertexProgram._Current->Base,
- ctx->Const.VertexProgram.MaxTextureImageUnits,
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
st->state.sampler_views[PIPE_SHADER_VERTEX],
&st->state.num_sampler_views[PIPE_SHADER_VERTEX]);
}
@@ -345,7 +345,7 @@ update_fragment_textures(struct st_context *st)
update_textures(st,
PIPE_SHADER_FRAGMENT,
&ctx->FragmentProgram._Current->Base,
- ctx->Const.FragmentProgram.MaxTextureImageUnits,
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
st->state.sampler_views[PIPE_SHADER_FRAGMENT],
&st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]);
}
@@ -360,7 +360,7 @@ update_geometry_textures(struct st_context *st)
update_textures(st,
PIPE_SHADER_GEOMETRY,
&ctx->GeometryProgram._Current->Base,
- ctx->Const.FragmentProgram.MaxTextureImageUnits,
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
st->state.sampler_views[PIPE_SHADER_GEOMETRY],
&st->state.num_sampler_views[PIPE_SHADER_GEOMETRY]);
}
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index c4dc77f3e8c..4b6fd2d4bae 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4970,7 +4970,7 @@ st_translate_program(
assert(i == program->num_immediates);
/* texture samplers */
- for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) {
+ for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
if (program->samplers_used & (1 << i)) {
t->samplers[i] = ureg_DECL_sampler(ureg, i);
}
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 1c2abc1224f..aa9ec1359c5 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -1225,7 +1225,7 @@ st_translate_mesa_program(
}
/* texture samplers */
- for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) {
+ for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
if (program->SamplersUsed & (1 << i)) {
t->samplers[i] = ureg_DECL_sampler( ureg, i );
}
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 8934088df31..fdf9b370a81 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -794,9 +794,9 @@ _swrast_CreateContext( struct gl_context *ctx )
swrast->PointSpan.facing = 0;
swrast->PointSpan.array = swrast->SpanArrays;
- init_program_native_limits(&ctx->Const.VertexProgram);
- init_program_native_limits(&ctx->Const.GeometryProgram);
- init_program_native_limits(&ctx->Const.FragmentProgram);
+ init_program_native_limits(&ctx->Const.Program[MESA_SHADER_VERTEX]);
+ init_program_native_limits(&ctx->Const.Program[MESA_SHADER_GEOMETRY]);
+ init_program_native_limits(&ctx->Const.Program[MESA_SHADER_FRAGMENT]);
ctx->swrast_context = swrast;
diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c
index 297491ed5b2..32d7c094447 100644
--- a/src/mesa/swrast/s_texcombine.c
+++ b/src/mesa/swrast/s_texcombine.c
@@ -619,7 +619,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
* thread.
*/
swrast->TexelBuffer =
- malloc(ctx->Const.FragmentProgram.MaxTextureImageUnits * maxThreads *
+ malloc(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits * maxThreads *
SWRAST_MAX_WIDTH * 4 * sizeof(GLfloat));
#ifdef _OPENMP
} /* critical section */
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index e43d5d9ebdf..d08abe7c25d 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -259,7 +259,7 @@ map_textures(struct gl_context *ctx, const struct gl_vertex_program *vp)
{
GLuint u;
- for (u = 0; u < ctx->Const.VertexProgram.MaxTextureImageUnits; u++) {
+ for (u = 0; u < ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits; u++) {
if (vp->Base.TexturesUsed[u]) {
/* Note: _Current *should* correspond to the target indicated
* in TexturesUsed[u].
@@ -278,7 +278,7 @@ unmap_textures(struct gl_context *ctx, const struct gl_vertex_program *vp)
{
GLuint u;
- for (u = 0; u < ctx->Const.VertexProgram.MaxTextureImageUnits; u++) {
+ for (u = 0; u < ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits; u++) {
if (vp->Base.TexturesUsed[u]) {
/* Note: _Current *should* correspond to the target indicated
* in TexturesUsed[u].