diff options
author | Jason Ekstrand <[email protected]> | 2014-10-15 21:52:58 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-01-15 07:18:59 -0800 |
commit | 744b4e9348db1767a772fda2a5cbe33abbba7db1 (patch) | |
tree | 6ae15829b51bd773374a8cdba37cb6ba906f3724 /src/mesa/drivers | |
parent | 6e46c98ec1f4344d5c4794423e773d3cc591ebbb (diff) |
i965/fs_nir: Add atomic counters support
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 5d78272e82a..36ee294f42a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -1324,9 +1324,28 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr) case nir_intrinsic_atomic_counter_inc: case nir_intrinsic_atomic_counter_dec: - case nir_intrinsic_atomic_counter_read: - assert(!"TODO"); - + case nir_intrinsic_atomic_counter_read: { + unsigned surf_index = prog_data->binding_table.abo_start + + (unsigned) instr->const_index[0]; + fs_reg offset = fs_reg(get_nir_src(instr->src[0])); + + switch (instr->intrinsic) { + case nir_intrinsic_atomic_counter_inc: + emit_untyped_atomic(BRW_AOP_INC, surf_index, dest, offset, + fs_reg(), fs_reg()); + break; + case nir_intrinsic_atomic_counter_dec: + emit_untyped_atomic(BRW_AOP_PREDEC, surf_index, dest, offset, + fs_reg(), fs_reg()); + break; + case nir_intrinsic_atomic_counter_read: + emit_untyped_surface_read(surf_index, dest, offset); + break; + default: + unreachable("Unreachable"); + } + break; + } case nir_intrinsic_load_front_face: assert(!"TODO"); |