[Mesa-dev] [RFC 23/27] i965/fs: Add helper for emitting plain texture resinfo messages
Topi Pohjolainen
topi.pohjolainen at intel.com
Sat Feb 22 01:05:49 PST 2014
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_fs.h | 2 ++
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index b4b146a..968ae77 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -513,6 +513,8 @@ public:
void visit_atomic_counter_intrinsic(ir_call *ir);
+ fs_reg fetch_resinfo(int sampler, const fs_reg& lod);
+
struct gl_fragment_program *fp;
int *param_size;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index ed19157..42836ac 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1567,6 +1567,27 @@ fs_visitor::emit_mcs_fetch(ir_texture *ir, fs_reg coordinate, int sampler)
return dest;
}
+fs_reg
+fs_visitor::fetch_resinfo(int sampler, const fs_reg& lod)
+{
+ fs_reg info = fs_reg(this, glsl_type::get_instance(GLSL_TYPE_UINT, 4, 1));
+ fs_reg payload = brw->gen >= 7 ? fs_reg(this, glsl_type::float_type) :
+ fs_reg(MRF, 2, BRW_REGISTER_TYPE_UD);
+ fs_inst *fetch;
+
+ emit(MOV(retype(payload, BRW_REGISTER_TYPE_UD), lod));
+
+ if (brw->gen >= 7)
+ fetch = emit(SHADER_OPCODE_TEX_RESINFO, info, payload);
+ else
+ fetch = emit(SHADER_OPCODE_TEX_RESINFO, info);
+
+ fetch->sampler = sampler;
+ fetch->regs_written = 4;
+
+ return info;
+}
+
void
fs_visitor::visit(ir_texture *ir)
{
--
1.8.3.1
More information about the mesa-dev
mailing list