<div dir="ltr">On 29 December 2012 04:35, Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When fetching texels from a multisample surface, the sample index is<br>
provided as an extra argument after the lod, and the actual lod needs<br>
to be hardwired to 0.<br>
<br>
The frontend gives us the sample index in the lod parameter, so fix this<br>
up.<br></blockquote><div><br></div><div>How much work would it be to modify the front end so that instead of giving us the sample index in the lod parameter, we add a "sample_index" element to the ir_texture::lod_info union? It seems like that would make this code easier to follow.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Signed-off-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 15 +++++++++++++--<br>
1 file changed, 13 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
index 104057c..8aa4b2d 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
@@ -2088,8 +2088,19 @@ vec4_visitor::visit(ir_texture *ir)<br>
}<br>
emit(MOV(dst_reg(MRF, mrf, ir->lod_info.lod->type, writemask), lod));<br>
} else if (ir->op == ir_txf) {<br>
- emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type, WRITEMASK_W),<br>
- lod));<br>
+ if (ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_MS) {<br>
+ /* for multisample samplers, actual lod is always 0, and the<br>
+ * extra parameter is the sample index */<br>
+ emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type, WRITEMASK_W),<br>
+ src_reg(0)));<br>
+ emit(MOV(dst_reg(MRF, param_base + 1, ir->lod_info.lod->type, WRITEMASK_X),<br>
+ lod)); /* sample_index */<br>
+ inst->mlen++; /* spilled over into a second reg of args */<br>
+ }<br>
+ else {<br>
+ emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type, WRITEMASK_W),<br>
+ lod));<br>
+ }<br>
} else if (ir->op == ir_txd) {<br>
const glsl_type *type = ir->lod_info.grad.dPdx->type;<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
1.8.0.3<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>