GLbitfield InputsRead; /* Bitmask of which input regs are read */
GLbitfield OutputsWritten; /* Bitmask of which output regs are written to */
+ GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */
/** Named parameters, constants, etc. from program text */
struct gl_program_parameter_list *Parameters;
struct gl_fragment_program
{
struct gl_program Base; /**< base class */
- GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */
GLuint NumAluInstructions; /**< GL_ARB_fragment_program */
GLuint NumTexInstructions;
GLuint NumTexIndirections;
* settle on the one with highest priority (see texture_override below).
*/
if (fprog) {
- enableBits = fprog->TexturesUsed[unit];
+ enableBits = fprog->Base.TexturesUsed[unit];
}
else {
if (!texUnit->Enabled)
program->Base.InputsRead = ap.Base.InputsRead;
program->Base.OutputsWritten = ap.Base.OutputsWritten;
for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
- program->TexturesUsed[i] = ap.TexturesUsed[i];
+ program->Base.TexturesUsed[i] = ap.TexturesUsed[i];
program->FogOption = ap.FogOption;
if (program->Base.Instructions)
program->Base.InputsRead = parseState.inputsRead;
program->Base.OutputsWritten = parseState.outputsWritten;
for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++)
- program->TexturesUsed[u] = parseState.texturesUsed[u];
+ program->Base.TexturesUsed[u] = parseState.texturesUsed[u];
/* save program parameters */
program->Base.Parameters = parseState.parameters;
prog->NumInstructions * sizeof(struct prog_instruction));
clone->InputsRead = prog->InputsRead;
clone->OutputsWritten = prog->OutputsWritten;
+ memcpy(clone->TexturesUsed, prog->TexturesUsed, sizeof(prog->TexturesUsed));
+
if (prog->Parameters)
clone->Parameters = _mesa_clone_parameter_list(prog->Parameters);
memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams));
const struct gl_fragment_program *fp
= (const struct gl_fragment_program *) prog;
struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone;
- memcpy(fpc->TexturesUsed, fp->TexturesUsed, sizeof(fp->TexturesUsed));
fpc->NumAluInstructions = fp->NumAluInstructions;
fpc->NumTexInstructions = fp->NumTexInstructions;
fpc->NumTexIndirections = fp->NumTexIndirections;
static struct prog_instruction *
emit_tex(slang_gen_context *gc, slang_ir_node *n, struct gl_program *prog)
{
- struct gl_fragment_program *fProg = (struct gl_fragment_program *) prog;
struct prog_instruction *inst;
if (n->Opcode == IR_TEX) {
inst = new_instruction(prog, OPCODE_TEX);
inst->TexSrcTarget = n->TexTarget;
inst->TexSrcUnit = 0; /* XXX temp */
- fProg->TexturesUsed[inst->TexSrcUnit] |= (1 << inst->TexSrcTarget);
+ prog->TexturesUsed[inst->TexSrcUnit] |= (1 << inst->TexSrcTarget);
return inst;
}