From: Marek Olšák Date: Thu, 2 May 2013 00:30:44 +0000 (+0200) Subject: mesa: move max texture image unit constants to gl_program_constants X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e78433eec94fcaa87bdcb2526ec0910a69ed347;p=mesa.git mesa: move max texture image unit constants to gl_program_constants Const.MaxTextureImageUnits -> Const.FragmentProgram.MaxTextureImageUnits Const.MaxVertexTextureImageUnits -> Const.VertexProgram.MaxTextureImageUnits etc. Reviewed-by: Kenneth Graunke Reviewed-by: Brian Paul Reviewed-by: Eric Anholt --- diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index e4636f87309..cf6c8c62151 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -93,9 +93,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs; this->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents; this->Const.MaxVaryingFloats = ctx->Const.MaxVarying * 4; - this->Const.MaxVertexTextureImageUnits = ctx->Const.MaxVertexTextureImageUnits; + this->Const.MaxVertexTextureImageUnits = ctx->Const.VertexProgram.MaxTextureImageUnits; this->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits; - this->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits; + this->Const.MaxTextureImageUnits = ctx->Const.FragmentProgram.MaxTextureImageUnits; this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents; this->Const.MinProgramTexelOffset = ctx->Const.MinProgramTexelOffset; this->Const.MaxProgramTexelOffset = ctx->Const.MaxProgramTexelOffset; diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 2b30d2b652d..3ef5940f892 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1512,15 +1512,15 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog) }; const unsigned max_samplers[MESA_SHADER_TYPES] = { - ctx->Const.MaxVertexTextureImageUnits, - ctx->Const.MaxTextureImageUnits, - ctx->Const.MaxGeometryTextureImageUnits + ctx->Const.VertexProgram.MaxTextureImageUnits, + ctx->Const.FragmentProgram.MaxTextureImageUnits, + ctx->Const.GeometryProgram.MaxTextureImageUnits }; const unsigned max_uniform_components[MESA_SHADER_TYPES] = { ctx->Const.VertexProgram.MaxUniformComponents, ctx->Const.FragmentProgram.MaxUniformComponents, - 0 /* FINISHME: Geometry shaders. */ + ctx->Const.GeometryProgram.MaxUniformComponents }; const unsigned max_uniform_blocks[MESA_SHADER_TYPES] = { diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp index 3c8f70f9e29..8653c4e1eef 100644 --- a/src/glsl/standalone_scaffolding.cpp +++ b/src/glsl/standalone_scaffolding.cpp @@ -117,9 +117,9 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) ctx->Const.VertexProgram.MaxUniformComponents = 512; ctx->Const.MaxVarying = 8; /* == gl_MaxVaryingFloats / 4 */ - ctx->Const.MaxVertexTextureImageUnits = 0; + ctx->Const.VertexProgram.MaxTextureImageUnits = 0; ctx->Const.MaxCombinedTextureImageUnits = 2; - ctx->Const.MaxTextureImageUnits = 2; + ctx->Const.FragmentProgram.MaxTextureImageUnits = 2; ctx->Const.FragmentProgram.MaxUniformComponents = 64; ctx->Const.MaxDrawBuffers = 1; diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index 072f8e02aab..b7553d87fdc 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -96,7 +96,7 @@ i830CreateContext(int api, FALLBACK(intel, INTEL_FALLBACK_USER, 1); intel->ctx.Const.MaxTextureUnits = I830_TEX_UNITS; - intel->ctx.Const.MaxTextureImageUnits = I830_TEX_UNITS; + intel->ctx.Const.FragmentProgram.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 e5635372a09..d3864465b26 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -191,12 +191,12 @@ i915CreateContext(int api, FALLBACK(intel, INTEL_FALLBACK_USER, 1); ctx->Const.MaxTextureUnits = I915_TEX_UNITS; - ctx->Const.MaxTextureImageUnits = I915_TEX_UNITS; + ctx->Const.FragmentProgram.MaxTextureImageUnits = I915_TEX_UNITS; ctx->Const.MaxTextureCoordUnits = I915_TEX_UNITS; ctx->Const.MaxVarying = I915_TEX_UNITS; ctx->Const.MaxCombinedTextureImageUnits = - ctx->Const.MaxVertexTextureImageUnits + - ctx->Const.MaxTextureImageUnits; + ctx->Const.VertexProgram.MaxTextureImageUnits + + ctx->Const.FragmentProgram.MaxTextureImageUnits; /* Advertise the full hardware capabilities. The new memory * manager should cope much better with overload situations: diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 5e6e97d4325..a676415dde0 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -155,14 +155,14 @@ brwCreateContext(int api, ctx->Const.MaxDualSourceDrawBuffers = 1; ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS; - ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT; + ctx->Const.FragmentProgram.MaxTextureImageUnits = BRW_MAX_TEX_UNIT; ctx->Const.MaxTextureCoordUnits = 8; /* Mesa limit */ ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureCoordUnits, - ctx->Const.MaxTextureImageUnits); - ctx->Const.MaxVertexTextureImageUnits = BRW_MAX_TEX_UNIT; + ctx->Const.FragmentProgram.MaxTextureImageUnits); + ctx->Const.VertexProgram.MaxTextureImageUnits = BRW_MAX_TEX_UNIT; ctx->Const.MaxCombinedTextureImageUnits = - ctx->Const.MaxVertexTextureImageUnits + - ctx->Const.MaxTextureImageUnits; + ctx->Const.VertexProgram.MaxTextureImageUnits + + ctx->Const.FragmentProgram.MaxTextureImageUnits; ctx->Const.MaxTextureLevels = 14; /* 8192 */ if (ctx->Const.MaxTextureLevels > MAX_TEXTURE_LEVELS) diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c index 829aa87c473..c198c03f095 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.MaxTextureImageUnits = NV04_TEXTURE_UNITS; + ctx->Const.FragmentProgram.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 4ffc4ef153f..1918f12238d 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.MaxTextureImageUnits = NV10_TEXTURE_UNITS; + ctx->Const.FragmentProgram.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 68e90d2c67f..1d77132db11 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.MaxTextureImageUnits = NV20_TEXTURE_UNITS; + ctx->Const.FragmentProgram.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 4d62bc4af7e..036ff7560ad 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -306,7 +306,7 @@ GLboolean r200CreateContext( gl_api api, */ ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache, "texture_units"); - ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits; + ctx->Const.FragmentProgram.MaxTextureImageUnits = ctx->Const.MaxTextureUnits; ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits; ctx->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxTextureUnits; diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 6f79610f85b..f812a15c62a 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2237,7 +2237,7 @@ static GLboolean r200ValidateBuffers(struct gl_context *ctx) 0, RADEON_GEM_DOMAIN_VRAM); } - for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { + for (i = 0; i < ctx->Const.FragmentProgram.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 e1b83a2d90f..7dd9109cca7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -269,7 +269,7 @@ r100CreateContext( gl_api api, ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache, "texture_units"); - ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits; + ctx->Const.FragmentProgram.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 2f30f64f2ed..94fb69bc768 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -2013,7 +2013,7 @@ static GLboolean r100ValidateBuffers(struct gl_context *ctx) 0, RADEON_GEM_DOMAIN_VRAM); } - for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; ++i) { radeonTexObj *t; if (!ctx->Texture.Unit[i]._ReallyEnabled) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 2cc8f36c53b..e94509ad773 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -552,9 +552,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.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; + ctx->Const.FragmentProgram.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureCoordUnits, - ctx->Const.MaxTextureImageUnits); + ctx->Const.FragmentProgram.MaxTextureImageUnits); ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY; ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS; ctx->Const.MaxTextureBufferSize = 65536; @@ -601,10 +601,10 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS; ctx->Const.MaxRenderbufferSize = MAX_RENDERBUFFER_SIZE; - ctx->Const.MaxVertexTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; + ctx->Const.VertexProgram.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.MaxGeometryTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; + ctx->Const.GeometryProgram.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; ctx->Const.MaxVertexVaryingComponents = MAX_VERTEX_VARYING_COMPONENTS; ctx->Const.MaxGeometryVaryingComponents = MAX_GEOMETRY_VARYING_COMPONENTS; ctx->Const.MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES; @@ -681,20 +681,20 @@ check_context_limits(struct gl_context *ctx) assert(ctx->Const.VertexProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS); /* Texture unit checks */ - assert(ctx->Const.MaxTextureImageUnits > 0); - assert(ctx->Const.MaxTextureImageUnits <= MAX_TEXTURE_IMAGE_UNITS); + assert(ctx->Const.FragmentProgram.MaxTextureImageUnits > 0); + assert(ctx->Const.FragmentProgram.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.MaxTextureImageUnits, + assert(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.FragmentProgram.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.MaxTextureImageUnits); + assert(ctx->Const.MaxTextureCoordUnits <= ctx->Const.FragmentProgram.MaxTextureImageUnits); /* Texture size checks */ diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index 2b97da6b5ee..596c86dc073 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -273,8 +273,8 @@ descriptor=[ # GL_ARB_fragment_program # == GL_MAX_TEXTURE_IMAGE_UNITS_NV - [ "MAX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxTextureImageUnits), extra_ARB_fragment_program" ], - [ "MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxVertexTextureImageUnits), extra_ARB_vertex_shader" ], + [ "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_COMBINED_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxCombinedTextureImageUnits), extra_ARB_vertex_shader" ], # GL_ARB_shader_objects @@ -637,7 +637,7 @@ 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.MaxGeometryTextureImageUnits), extra_ARB_geometry_shader4" ], + [ "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxTextureImageUnits), extra_ARB_geometry_shader4" ], [ "MAX_GEOMETRY_OUTPUT_VERTICES_ARB", "CONTEXT_INT(Const.MaxGeometryOutputVertices), extra_ARB_geometry_shader4" ], [ "MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxGeometryTotalOutputComponents), extra_ARB_geometry_shader4" ], [ "MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxUniformComponents), extra_ARB_geometry_shader4" ], diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 3fb8618c62f..6cd8b96b54f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2735,6 +2735,7 @@ struct gl_program_constants /* GL_ARB_uniform_buffer_object */ GLuint MaxUniformBlocks; GLuint MaxCombinedUniformComponents; + GLuint MaxTextureImageUnits; }; @@ -2751,11 +2752,8 @@ struct gl_constants GLuint MaxArrayTextureLayers; /**< Max layers in array textures */ GLuint MaxTextureRectSize; /**< Max rectangle texture size, in pixes */ GLuint MaxTextureCoordUnits; - GLuint MaxTextureImageUnits; - GLuint MaxVertexTextureImageUnits; GLuint MaxCombinedTextureImageUnits; - GLuint MaxGeometryTextureImageUnits; - GLuint MaxTextureUnits; /**< = MIN(CoordUnits, ImageUnits) */ + GLuint MaxTextureUnits; /**< = MIN(CoordUnits, FragmentProgram.ImageUnits) */ GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */ GLuint MaxTextureBufferSize; /**< GL_ARB_texture_buffer_object */ diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index c2cf89ee489..84731dddab5 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -880,7 +880,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.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { count++; } @@ -888,7 +888,7 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param ) *param = count; } else if (pname == GL_BUMP_TEX_UNITS_ATI) { - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { *param++ = i + GL_TEXTURE0; } @@ -929,7 +929,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.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { count++; } @@ -937,7 +937,7 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param ) *param = (GLfloat) count; } else if (pname == GL_BUMP_TEX_UNITS_ATI) { - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { *param++ = (GLfloat) (i + GL_TEXTURE0); } diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 4f83a6f887d..cdd5ed316af 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -260,7 +260,7 @@ compute_version(struct gl_context *ctx) ctx->Extensions.EXT_texture_snorm && ctx->Extensions.NV_primitive_restart && ctx->Extensions.NV_texture_rectangle && - ctx->Const.MaxVertexTextureImageUnits >= 16); + ctx->Const.VertexProgram.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_parse.y b/src/mesa/program/program_parse.y index 8e4fdb61a75..cbf3fe6ca7c 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -2714,7 +2714,7 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st ? & ctx->Const.VertexProgram : & ctx->Const.FragmentProgram; - state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits; + state->MaxTextureImageUnits = ctx->Const.FragmentProgram.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 db51eead16b..302e1298143 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.MaxTextureImageUnits, + ctx->Const.FragmentProgram.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.MaxVertexTextureImageUnits, + ctx->Const.VertexProgram.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.MaxGeometryTextureImageUnits, + ctx->Const.GeometryProgram.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 fc2d69013ae..8d1250fdc91 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -325,11 +325,11 @@ update_vertex_textures(struct st_context *st) { const struct gl_context *ctx = st->ctx; - if (ctx->Const.MaxVertexTextureImageUnits > 0) { + if (ctx->Const.VertexProgram.MaxTextureImageUnits > 0) { update_textures(st, PIPE_SHADER_VERTEX, &ctx->VertexProgram._Current->Base, - ctx->Const.MaxVertexTextureImageUnits, + ctx->Const.VertexProgram.MaxTextureImageUnits, st->state.sampler_views[PIPE_SHADER_VERTEX], &st->state.num_sampler_views[PIPE_SHADER_VERTEX]); } @@ -344,7 +344,7 @@ update_fragment_textures(struct st_context *st) update_textures(st, PIPE_SHADER_FRAGMENT, &ctx->FragmentProgram._Current->Base, - ctx->Const.MaxTextureImageUnits, + ctx->Const.FragmentProgram.MaxTextureImageUnits, st->state.sampler_views[PIPE_SHADER_FRAGMENT], &st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]); } @@ -359,7 +359,7 @@ update_geometry_textures(struct st_context *st) update_textures(st, PIPE_SHADER_GEOMETRY, &ctx->GeometryProgram._Current->Base, - ctx->Const.MaxTextureImageUnits, + ctx->Const.FragmentProgram.MaxTextureImageUnits, st->state.sampler_views[PIPE_SHADER_GEOMETRY], &st->state.num_sampler_views[PIPE_SHADER_GEOMETRY]); } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index a72728c1a82..9111d1fc594 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -90,12 +90,12 @@ void st_init_limits(struct st_context *st) c->MaxArrayTextureLayers = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS); - c->MaxTextureImageUnits + c->FragmentProgram.MaxTextureImageUnits = _min(screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS), MAX_TEXTURE_IMAGE_UNITS); - c->MaxVertexTextureImageUnits + c->VertexProgram.MaxTextureImageUnits = _min(screen->get_shader_param(screen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS), MAX_TEXTURE_IMAGE_UNITS); @@ -105,9 +105,9 @@ void st_init_limits(struct st_context *st) MAX_COMBINED_TEXTURE_IMAGE_UNITS); c->MaxTextureCoordUnits - = _min(c->MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS); + = _min(c->FragmentProgram.MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS); - c->MaxTextureUnits = _min(c->MaxTextureImageUnits, c->MaxTextureCoordUnits); + c->MaxTextureUnits = _min(c->FragmentProgram.MaxTextureImageUnits, c->MaxTextureCoordUnits); /* Define max viewport size and max renderbuffer size in terms of * max texture size (note: max tex RECT size = max tex 2D size). diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 5f1ffecc6dd..dd8810d454c 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4930,7 +4930,7 @@ st_translate_program( assert(i == program->num_immediates); /* texture samplers */ - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.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 2581e1ea88c..dd9f4fc53bf 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -1221,7 +1221,7 @@ st_translate_mesa_program( } /* texture samplers */ - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.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 cd36a30e309..591fe57cbd3 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -459,7 +459,7 @@ _swrast_invalidate_state( struct gl_context *ctx, GLbitfield new_state ) swrast->BlendFunc = _swrast_validate_blend_func; if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC) - for (i = 0 ; i < ctx->Const.MaxTextureImageUnits ; i++) + for (i = 0 ; i < ctx->Const.FragmentProgram.MaxTextureImageUnits ; i++) swrast->TextureSample[i] = NULL; } @@ -473,7 +473,7 @@ _swrast_update_texture_samplers(struct gl_context *ctx) if (!swrast) return; /* pipe hack */ - for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) { + for (u = 0; u < ctx->Const.FragmentProgram.MaxTextureImageUnits; u++) { struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current; /* Note: If tObj is NULL, the sample function will be a simple * function that just returns opaque black (0,0,0,1). diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 523fea15afd..df3a74a06ad 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -612,7 +612,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) * thread. */ swrast->TexelBuffer = - malloc(ctx->Const.MaxTextureImageUnits * maxThreads * + malloc(ctx->Const.FragmentProgram.MaxTextureImageUnits * maxThreads * SWRAST_MAX_WIDTH * 4 * sizeof(GLfloat)); if (!swrast->TexelBuffer) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine"); diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index 1720e434b31..5ade54343dd 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -260,7 +260,7 @@ map_textures(struct gl_context *ctx, const struct gl_vertex_program *vp) { GLuint u; - for (u = 0; u < ctx->Const.MaxVertexTextureImageUnits; u++) { + for (u = 0; u < ctx->Const.VertexProgram.MaxTextureImageUnits; u++) { if (vp->Base.TexturesUsed[u]) { /* Note: _Current *should* correspond to the target indicated * in TexturesUsed[u]. @@ -279,7 +279,7 @@ unmap_textures(struct gl_context *ctx, const struct gl_vertex_program *vp) { GLuint u; - for (u = 0; u < ctx->Const.MaxVertexTextureImageUnits; u++) { + for (u = 0; u < ctx->Const.VertexProgram.MaxTextureImageUnits; u++) { if (vp->Base.TexturesUsed[u]) { /* Note: _Current *should* correspond to the target indicated * in TexturesUsed[u].