diff options
author | Brian Paul <[email protected]> | 2008-12-31 11:54:02 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-12-31 12:00:17 -0700 |
commit | e9b34885b8ff2ccb67a801cd1ce07e0df1b0e397 (patch) | |
tree | 588afee46d734cba7e002fdc01cfc588a999f52e /src/mesa/shader/slang | |
parent | bfebeffc0045266d354a36968336337e099a9f27 (diff) |
mesa: increase max texture image units and GLSL samplers to 16
The max texture coord units is still 8. All the fixed-function paths are
still limited to 8 too. But GLSL shaders can use more samplers now.
Note that some texcoord-related data structures are declared to be 16
elements in size rather than 8. This just simplifies the code in a few
places; the extra elements aren't accessible to the user.
These changes haven't been extensively tested yet, but sanity checking has
been done.
It should be possible to increase the max image units/samplers to 32 without
doing anything special. Beyond that we'll need longer bitfields in a few
places.
Diffstat (limited to 'src/mesa/shader/slang')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 2 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_link.c | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 7d764cb5c1d..4976daf533b 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -391,7 +391,7 @@ _slang_input_index(const char *name, GLenum target, GLuint *swizzleOut) const struct input_info *inputs = (target == GL_VERTEX_PROGRAM_ARB) ? vertInputs : fragInputs; - ASSERT(MAX_TEXTURE_UNITS == 8); /* if this fails, fix vertInputs above */ + ASSERT(MAX_TEXTURE_COORD_UNITS == 8); /* if this fails, fix vertInputs above */ for (i = 0; inputs[i].Name; i++) { if (strcmp(inputs[i].Name, name) == 0) { diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 22ae635b065..b49fd0e99d3 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -208,7 +208,8 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) * the vertex and fragment shaders. */ static GLboolean -link_uniform_vars(struct gl_shader_program *shProg, +link_uniform_vars(GLcontext *ctx, + struct gl_shader_program *shProg, struct gl_program *prog, GLuint *numSamplers) { @@ -239,10 +240,10 @@ link_uniform_vars(struct gl_shader_program *shProg, /* Allocate a new sampler index */ GLuint sampNum = *numSamplers; GLuint oldSampNum = (GLuint) prog->Parameters->ParameterValues[i][0]; - if (oldSampNum >= MAX_SAMPLERS) { + if (oldSampNum >= ctx->Const.MaxTextureImageUnits) { char s[100]; sprintf(s, "Too many texture samplers (%u, max is %u)", - oldSampNum + 1, MAX_SAMPLERS); + oldSampNum + 1, ctx->Const.MaxTextureImageUnits); link_error(shProg, s); return GL_FALSE; } @@ -568,13 +569,13 @@ _slang_link(GLcontext *ctx, /* link uniform vars */ if (shProg->VertexProgram) { - if (!link_uniform_vars(shProg, &shProg->VertexProgram->Base, + if (!link_uniform_vars(ctx, shProg, &shProg->VertexProgram->Base, &numSamplers)) { return; } } if (shProg->FragmentProgram) { - if (!link_uniform_vars(shProg, &shProg->FragmentProgram->Base, + if (!link_uniform_vars(ctx, shProg, &shProg->FragmentProgram->Base, &numSamplers)) { return; } |