move TexturesUsed[] into gl_program since vertex programs/shaders can use textures...
authorBrian <brian@yutani.localnet.net>
Fri, 5 Jan 2007 00:22:19 +0000 (17:22 -0700)
committerBrian <brian@yutani.localnet.net>
Fri, 5 Jan 2007 00:22:19 +0000 (17:22 -0700)
src/mesa/main/mtypes.h
src/mesa/main/texstate.c
src/mesa/shader/arbprogparse.c
src/mesa/shader/nvfragparse.c
src/mesa/shader/program.c
src/mesa/shader/slang/slang_emit.c

index e73c625a825bb36c18ab33a3bed0b92cf83519e5..5156eea99a243e4251bf86d24b0b1f31cdc6d2c2 100644 (file)
@@ -1853,6 +1853,7 @@ struct gl_program
 
    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;
@@ -1895,7 +1896,6 @@ struct gl_vertex_program
 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;
index 76ee4458dcfe4b587a2cc3354f8f05519fddf8ad..7be3a44d59f0c173a054706ac1c5e4c9bfeb3cbc 100644 (file)
@@ -2959,7 +2959,7 @@ update_texture_state( GLcontext *ctx )
        * 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)
index 7a87bf015ff11e4e7d67fb59fa187e2625bbfb02..80e342e40a07cdcb6018d478503e06758b5b384b 100644 (file)
@@ -4038,7 +4038,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
    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)
index 0b48d408f9db71e3d30ed3e6518b0f2ce9f1c09f..b4e19ce74de9c26cea6f4b73669fe9a05ca032d1 100644 (file)
@@ -1563,7 +1563,7 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget,
       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;
index 351427365cd1cd147ed1db5c6f56778efed3aae8..a50f7cff057464c53fe5f9f15ac4ef8c995e08b6 100644 (file)
@@ -358,6 +358,8 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog)
           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));
@@ -389,7 +391,6 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog)
          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;
index ac92bdcece72c214f81cc416928b557f262b5241..4e1606be318b2d382a0aed88b5a4756ec004e182 100644 (file)
@@ -1034,7 +1034,6 @@ emit_jump(const char *target, struct gl_program *prog)
 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);
@@ -1052,7 +1051,7 @@ emit_tex(slang_gen_context *gc, slang_ir_node *n, struct gl_program *prog)
    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;
 }