diff options
author | Gert Wollny <[email protected]> | 2020-05-07 00:03:29 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-19 07:52:13 +0000 |
commit | 91a618eae9f0f126367b14dec8ebe3c80b7cf825 (patch) | |
tree | 5826965c704acf8dc145c04353443b500ffdd0cc | |
parent | 70b84920befb3121b58e22e176267a63a8b1317a (diff) |
r600/sfn: Handle loading sample_pos
Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5085>
-rw-r--r-- | src/gallium/drivers/r600/sfn/sfn_shader_base.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp | 34 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sfn/sfn_shader_fragment.h | 1 |
3 files changed, 36 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_base.h b/src/gallium/drivers/r600/sfn/sfn_shader_base.h index d284efc3f07..27afe4023d4 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_base.h +++ b/src/gallium/drivers/r600/sfn/sfn_shader_base.h @@ -121,6 +121,7 @@ protected: es_rel_patch_id, es_sample_mask_in, es_sample_id, + es_sample_pos, es_tess_factor_base, es_vertexid, es_tess_coord, diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp index c4084553f16..a443ea3e86a 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp @@ -120,6 +120,9 @@ bool FragmentShaderFromNir::scan_sysvalue_access(nir_instr *instr) case nir_intrinsic_load_sample_mask_in: m_sv_values.set(es_sample_mask_in); break; + case nir_intrinsic_load_sample_pos: + m_sv_values.set(es_sample_pos); + /* fallthrough */ case nir_intrinsic_load_sample_id: m_sv_values.set(es_sample_id); break; @@ -346,6 +349,9 @@ bool FragmentShaderFromNir::emit_intrinsic_instruction_override(nir_intrinsic_in return emit_interp_deref_at_offset(instr); case nir_intrinsic_interp_deref_at_centroid: return emit_interp_deref_at_centroid(instr); + case nir_intrinsic_load_sample_pos: + return emit_load_sample_pos(instr); + default: return false; } @@ -363,6 +369,34 @@ void FragmentShaderFromNir::load_front_face() emit_instruction(ir); } +bool FragmentShaderFromNir::emit_load_sample_pos(nir_intrinsic_instr* instr) +{ + GPRVector dest = vec_from_nir(instr->dest, nir_dest_num_components(instr->dest)); + auto fetch = new FetchInstruction(vc_fetch, + no_index_offset, + fmt_32_32_32_32_float, + vtx_nf_scaled, + vtx_es_none, + m_sample_id_reg, + dest, + 0, + false, + 0xf, + R600_BUFFER_INFO_CONST_BUFFER, + 0, + bim_none, + false, + false, + 0, + 0, + 0, + PValue(), + {0,1,2,3}); + fetch->set_flag(vtx_srf_mode); + emit_instruction(fetch); + return true; +} + bool FragmentShaderFromNir::emit_interp_deref_at_sample(nir_intrinsic_instr* instr) { GPRVector slope = get_temp_vec4(); diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_fragment.h b/src/gallium/drivers/r600/sfn/sfn_shader_fragment.h index 57d6cf7ec9a..045c054d7e6 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_fragment.h +++ b/src/gallium/drivers/r600/sfn/sfn_shader_fragment.h @@ -70,6 +70,7 @@ private: bool emit_load_front_face(nir_intrinsic_instr* instr); bool emit_load_sample_mask_in(nir_intrinsic_instr* instr); + bool emit_load_sample_pos(nir_intrinsic_instr* instr); bool emit_load_sample_id(nir_intrinsic_instr* instr); bool emit_interp_deref_at_sample(nir_intrinsic_instr* instr); bool emit_interp_deref_at_offset(nir_intrinsic_instr* instr); |