diff options
author | Brian Paul <brianp@vmware.com> | 2012-06-08 14:26:53 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2012-06-18 13:24:23 -0600 |
commit | 29c67f920356553759e79f29e1e4648e4d389adf (patch) | |
tree | e60ccb80439fdc0f330cacbe6f1d24f8e0b1fa7d | |
parent | 29c4e92b2c5980b120023d3449419ce91b8ec9f8 (diff) |
st/mesa: fix glDrawPixels(GL_DEPTH_COMPONENT) color output
When drawing a depth image the fragment shader also needs to emit the
current raster color.
The new piglit drawpix-z test exercises this.
NOTE: This is a candiate for the 8.0 branch.
(cherry picked from commit f677954e07c6c1fd59b13622a7420c97d68a6029)
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 04d451b0080..d4992a75e51 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -215,7 +215,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st, if (!p) return NULL; - p->NumInstructions = write_depth ? 2 : 1; + p->NumInstructions = write_depth ? 3 : 1; p->NumInstructions += write_stencil ? 1 : 0; p->Instructions = _mesa_alloc_instructions(p->NumInstructions); @@ -236,6 +236,13 @@ st_make_drawpix_z_stencil_program(struct st_context *st, p->Instructions[ic].TexSrcUnit = 0; p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; + /* MOV result.color, fragment.color; */ + p->Instructions[ic].Opcode = OPCODE_MOV; + p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; + p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR; + p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; + p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0; + ic++; } if (write_stencil) { @@ -258,8 +265,10 @@ st_make_drawpix_z_stencil_program(struct st_context *st, p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0; p->OutputsWritten = 0; - if (write_depth) + if (write_depth) { p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_DEPTH); + p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_COLOR); + } if (write_stencil) p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_STENCIL); |