gallium: make sure to set the SamplersUsed field for bitmap/drawpixels shaders
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 4 Apr 2008 17:20:44 +0000 (11:20 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 4 Apr 2008 17:20:44 +0000 (11:20 -0600)
Also, make sure that field is copied/updated in the program clone and combine functions.
Without this we weren't getting SAMP declarations in the TGSI shaders.

src/mesa/shader/program.c
src/mesa/state_tracker/st_atom_pixeltransfer.c
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_cb_drawpixels.c

index 09a8494bd3670ba995f73b2160dda131665170b5..3069b04836d46e385734913e0707de20c45928ef 100644 (file)
@@ -361,6 +361,7 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog)
                            prog->NumInstructions);
    clone->InputsRead = prog->InputsRead;
    clone->OutputsWritten = prog->OutputsWritten;
+   clone->SamplersUsed = prog->SamplersUsed;
    memcpy(clone->TexturesUsed, prog->TexturesUsed, sizeof(prog->TexturesUsed));
 
    if (prog->Parameters)
@@ -537,6 +538,7 @@ _mesa_combine_programs(GLcontext *ctx,
       }
       newProg->InputsRead = progA->InputsRead | inputsB;
       newProg->OutputsWritten = progB->OutputsWritten;
+      newProg->SamplersUsed = progA->SamplersUsed | progB->SamplersUsed;
    }
    else {
       /* vertex program */
index 1e3effd5491bd34de74bbfcf78e6112f1b3a8a61..6410e7cb24d1a90344154d6a94ad2e08c4bbaa5a 100644 (file)
@@ -130,6 +130,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
    ic++;
    fp->Base.InputsRead = (1 << FRAG_ATTRIB_TEX0);
    fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLR);
+   fp->Base.SamplersUsed = 0x1;  /* sampler 0 (bit 0) is used */
 
    /* MAD colorTemp, colorTemp, scale, bias; */
    if (key->scaleAndBias) {
index 0872f2bd28a73cc6befde94e8b1f3828a3480054..59f3c385df3a6940e08db8adfc0980e252e9cb1e 100644 (file)
@@ -148,6 +148,7 @@ make_bitmap_fragment_program(GLcontext *ctx)
 
    p->InputsRead = FRAG_BIT_TEX0;
    p->OutputsWritten = 0x0;
+   p->SamplersUsed = 0x1;  /* sampler 0 (bit 0) is used */
 
    stfp = (struct st_fragment_program *) p;
    stfp->Base.UsesKill = GL_TRUE;
index c7796cfb6aa20825004c5dae8cefec2c03b4d472..c57e05312a91e7d7e4e89921a75144900bcc1d96 100644 (file)
@@ -212,6 +212,7 @@ make_fragment_shader_z(struct st_context *st)
 
    p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0;
    p->OutputsWritten = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_DEPR);
+   p->SamplersUsed = 0x1;  /* sampler 0 (bit 0) is used */
 
    stfp = (struct st_fragment_program *) p;
    st_translate_fragment_program(st, stfp, NULL);