case nir_texop_tex:
return emit_tex_tex(tex, src, shader);
case nir_texop_txf:
- return emit_tex_txf(tex, src, shader);
+ return emit_tex_txf(tex, src, shader);
case nir_texop_txb:
case nir_texop_txl:
return emit_tex_txl_txb(tex, src, shader);
case nir_texop_txd:
return emit_tex_txd(tex, src, shader);
case nir_texop_txf_ms:
- return emit_tex_tex_ms(tex, src, shader);
+ if (shader.chip_class() < ISA_CC_EVERGREEN)
+ return emit_tex_tex_ms_direct(tex, src, shader);
+ else
+ return emit_tex_tex_ms(tex, src, shader);
case nir_texop_tg4:
return emit_tex_tg4(tex, src, shader);
case nir_texop_texture_samples:
return true;
}
+bool TexInstr::emit_tex_tex_ms_direct(nir_tex_instr *tex, Inputs& src, Shader& shader)
+{
+ assert(tex->src[0].src.is_ssa);
+ auto& vf = shader.value_factory();
+
+ r600::sfn_log << SfnLog::instr << "emit '"
+ << *reinterpret_cast<nir_instr*>(tex)
+ << "' (" << __func__ << ")\n";
+
+ auto sampler = get_sampler_id(tex->sampler_index, src.sampler_deref);
+ assert(!sampler.indirect && "Indirect sampler selection not yet supported");
+
+ auto temp2 = vf.temp_vec4(pin_group);
+
+ for (unsigned i = 0; i < tex->coord_components; ++i) {
+ unsigned k = i;
+ if (tex->is_array && tex->sampler_dim == GLSL_SAMPLER_DIM_1D && i == 1)
+ k = 2;
+
+ shader.emit_instruction(new AluInstr(op1_mov, temp2[k],
+ src.coord[k], AluInstr::write));
+ }
+
+ shader.emit_instruction(new AluInstr(op1_mov, temp2[3], src.ms_index,
+ AluInstr::last_write));
+
+ auto dst = vf.dest_vec4(tex->dest, pin_group);
+
+ /* txf doesn't need rounding for the array index, but 1D has the array index
+ * in the z component */
+ auto tex_ir = new TexInstr(ld, dst, {0,1,2,3}, temp2,
+ sampler.id,
+ sampler.id + R600_MAX_CONST_BUFFERS, src.sampler_offset);
+
+ shader.emit_instruction(tex_ir);
+ return true;
+}
+
bool TexInstr::emit_tex_tex_ms(nir_tex_instr *tex, Inputs& src, Shader& shader)
{
assert(tex->src[0].src.is_ssa);
static bool emit_buf_txf(nir_tex_instr *tex, Inputs& src, Shader& shader);
static bool emit_tex_txf(nir_tex_instr *tex, Inputs& src, Shader& shader);
+ static bool emit_tex_tex_ms_direct(nir_tex_instr *tex, Inputs& src, Shader& shader);
static bool emit_tex_tex_ms(nir_tex_instr *tex, Inputs& src, Shader& shader);
static bool emit_tex_tex(nir_tex_instr *tex, Inputs& src, Shader& shader);
static bool emit_tex_txl_txb(nir_tex_instr *tex, Inputs& src, Shader& shader);