<div dir="ltr">On 4 February 2013 21:48, 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">
On Gen6, lower this to `ld` with lod=0 and an extra sample_index<br>
parameter.<br>
<br>
On Gen7, use `ld2dms`. This takes an additional MCS parameter to support<br>
compressed multisample surfaces, but we're not enabling them for<br>
multisample textures for now, so it's always zero and can be safely<br>
omitted.<br></blockquote><div><br></div><div>Nit pick: this should say "so it's always ignored and can be safely omitted."  (If ld2dms actually paid attention to the MCS parameter when sampling from a UMS surface, and we omitted it, the implicit value of zero would actually cause sample zero to always be loaded, which isn't what we want.  Fortunately the hardware ignores the MCS parameter when sampling from a UMS surface, so we're ok :))<br>
 <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
V2: Reworked completely, added support for Gen7.<br>
<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 | 19 +++++++++++++++++--<br>
 1 file changed, 17 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 1863fe5..008fa1d 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
@@ -2108,6 +2108,11 @@ vec4_visitor::visit(ir_texture *ir)<br>
       lod = this->result;<br>
       lod_type = ir->lod_info.lod->type;<br>
       break;<br>
+   case ir_txf_ms:<br>
+      ir->lod_info.sample_index->accept(this);<br>
+      lod = this->result;<br>
+      lod_type = ir->lod_info.sample_index->type;<br>
+      break;<br></blockquote><div><br></div><div>It seems kludgy to repurpose the local variables "lod" and "lod_type" for sample_index in this case.  Can we go ahead and create local variables "sample_index" and "sample_index_type", and use them instead?<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    case ir_txd:<br>
       ir->lod_info.grad.dPdx->accept(this);<br>
       dPdx = this->result;<br>
@@ -2133,6 +2138,9 @@ vec4_visitor::visit(ir_texture *ir)<br>
    case ir_txf:<br>
       inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXF);<br>
       break;<br>
+   case ir_txf_ms:<br>
+      inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXF_MS);<br>
+      break;<br>
    case ir_txs:<br>
       inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXS);<br>
       break;<br>
@@ -2219,8 +2227,15 @@ vec4_visitor::visit(ir_texture *ir)<br>
         }<br>
         emit(MOV(dst_reg(MRF, mrf, lod_type, writemask), lod));<br>
       } else if (ir->op == ir_txf) {<br>
-        emit(MOV(dst_reg(MRF, param_base, lod_type, WRITEMASK_W),<br>
-                 lod));<br>
+         emit(MOV(dst_reg(MRF, param_base, lod_type, WRITEMASK_W), lod));<br>
+      } else if (ir->op == ir_txf_ms) {<br>
+         emit(MOV(dst_reg(MRF, param_base + 1, lod_type, WRITEMASK_X), lod /*sample_index*/));<br>
+         inst->mlen++;<br>
+<br>
+         /* on Gen7, there is an additional MCS parameter here after SI,<br>
+          * but we don't bother to emit it since it's always zero. If<br>
+          * we start supporting texturing from CMS surfaces, this will have<br>
+          * to change */<br>
       } else if (ir->op == ir_txd) {<br>
         const glsl_type *type = lod_type;<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
1.8.1.2<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>