st->state.num_textures = 0;
/* loop over sampler units (aka tex image units) */
- for (su = 0; su < st->ctx->Const.MaxTextureCoordUnits; su++) {
+ for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) {
struct pipe_texture *pt = NULL;
if (samplersUsed & (1 << su)) {
c->MaxTextureRectSize
= _min(1 << (c->MaxTextureLevels - 1), MAX_TEXTURE_RECT_SIZE);
- c->MaxTextureUnits
- = c->MaxTextureImageUnits
- = c->MaxTextureCoordUnits
+ c->MaxTextureImageUnits
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS),
MAX_TEXTURE_IMAGE_UNITS);
= _min(screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS),
MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+ c->MaxTextureCoordUnits = MAX_TEXTURE_COORD_UNITS;
+
+ c->MaxTextureUnits = MIN2(c->MaxTextureImageUnits, c->MaxTextureCoordUnits);
+
c->MaxDrawBuffers
= _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
1, MAX_DRAW_BUFFERS);
*/
GLuint
st_translate_mesa_program(
+ GLcontext *ctx,
uint procType,
const struct gl_program *program,
GLuint numInputs,
}
/* texture samplers */
- for (i = 0; i < 8; i++) {
+ for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
if (program->SamplersUsed & (1 << i)) {
struct tgsi_full_declaration fulldecl;
GLuint
st_translate_mesa_program(
+ GLcontext *ctx,
uint procType,
const struct gl_program *program,
GLuint numInputs,
/* XXX: fix static allocation of tokens:
*/
- num_tokens = st_translate_mesa_program(TGSI_PROCESSOR_VERTEX,
+ num_tokens = st_translate_mesa_program(st->ctx,
+ TGSI_PROCESSOR_VERTEX,
&stvp->Base.Base,
/* inputs */
vs_num_inputs,
/* XXX: fix static allocation of tokens:
*/
- num_tokens = st_translate_mesa_program(TGSI_PROCESSOR_FRAGMENT,
+ num_tokens = st_translate_mesa_program(st->ctx,
+ TGSI_PROCESSOR_FRAGMENT,
&stfp->Base.Base,
/* inputs */
fs_num_inputs,