<div dir="ltr">2013/10/5 Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
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, 14 insertions(+), 1 deletion(-)<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 9e6cc78..1112b23 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
@@ -2192,6 +2192,10 @@ vec4_visitor::visit(ir_texture *ir)<br>
lod = this->result;<br>
lod_type = ir->lod_info.lod->type;<br>
break;<br>
+ case ir_query_levels:<br>
+ lod = src_reg(0);<br>
+ lod_type = glsl_type::int_type;<br>
+ break;<br>
case ir_txf_ms:<br>
ir->lod_info.sample_index->accept(this);<br>
sample_index = this->result;<br>
@@ -2232,6 +2236,8 @@ vec4_visitor::visit(ir_texture *ir)<br>
break;<br>
case ir_tg4:<br>
inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TG4);<br></blockquote><div><br></div><div><div>I think you are missing a "break;" here.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ case ir_query_levels:<br>
+ inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXS);<br>
break;<br>
case ir_txb:<br>
assert(!"TXB is not valid for vertex shaders.");<br>
@@ -2264,7 +2270,7 @@ vec4_visitor::visit(ir_texture *ir)<br>
/* MRF for the first parameter */<br>
int param_base = inst->base_mrf + inst->header_present;<br>
<br>
- if (ir->op == ir_txs) {<br>
+ if (ir->op == ir_txs || ir->op == ir_query_levels) {<br>
int writemask = brw->gen == 4 ? WRITEMASK_W : WRITEMASK_X;<br>
emit(MOV(dst_reg(MRF, param_base, lod_type, writemask), lod));<br>
} else {<br>
@@ -2415,6 +2421,13 @@ vec4_visitor::swizzle_result(ir_texture *ir, src_reg orig_val, int sampler)<br>
this->result = src_reg(this, ir->type);<br>
dst_reg swizzled_result(this->result);<br>
<br>
+ if (ir->op == ir_query_levels) {<br>
+ /* # levels is in .w */<br>
+ orig_val.swizzle = BRW_SWIZZLE4(SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W);<br>
+ emit(MOV(swizzled_result, orig_val));<br>
+ return;<br>
+ }<br>
+<br>
if (ir->op == ir_txs || ir->type == glsl_type::float_type<br>
|| s == SWIZZLE_NOOP || ir->op == ir_tg4) {<br>
emit(MOV(swizzled_result, orig_val));<br>
<span class=""><font color="#888888">--<br>
1.8.4<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>
<br>
</font></span></blockquote></div><br></div></div>