[Mesa-dev] [PATCH 00/18] ARB_gl_spirv series 3: support for atomic counters
Alejandro Piñeiro
apinheiro at igalia.com
Fri Jun 29 14:28:45 UTC 2018
Hi,
this is the third series for the ongoing support for ARB_gl_spirv. The
main focus of this series is providing support for atomic
counters. More than half of the patches are for spirv/nir, as atomic
counters is a feature not included on Vulkan.
Note that the need of supporting atomic counters has somewhat
flip-flopped on different specs. In the practice it is basically a
deprecated feature, that lead to be explicitly removed from
GL_KHR_vulkan_glsl. But although ARB_gl_spirv uses GL_KHR_vulkan_glsl
as reference for the mapping of GLSL->SPIR-V features needed to be
supported, atomic counters got explicitly re-introduced with
ARB_gl_spirv. From ARB_gl_spirv spec:
"Corresponding features that GLSL keeps, despite GL_KHR_vulkan_glsl removal:
* default uniforms (those not inside a uniform block)
* atomic-counter bindings have the /offset/ layout qualifier"
Another characteristic of atomic counters is that they lack explicit
location. From ARB_shader_atomics_counters spec:
"Unlike other user-defined uniforms declared at global scope, they
take NO storage from the default partition, they have NO
location, and they may NOT be set with the Uniform* commands.
Atomic counters may also NOT be grouped into uniform blocks."
so it is an exception of the general ARB_gl_spirv rule "explicit
location for uniforms are mandatory". This series implements at the
nir/linker the ability to set a location for uniforms without a
location.
The tree for this series can be found on the following repository:
* https://github.com/Igalia/mesa/tree/arb_gl_spirv-series3-atomics-counters-v1
and we provide some atomic-counter tests for the extension here
(although it would be needed to use MESA_EXTENSION_OVERRIDE):
* https://github.com/Igalia/piglit/commits/arb_gl_spirv-series2-atomic-counters-v1
Alejandro Piñeiro (11):
nir/linker: handle uniforms without explicit location
compiler/glsl: refactor empty_uniform_block utilities to linker_util
nir/linker: use empty block info to assign uniform locations
spirv/nir: SpvStorageClassAtomicCounter support on
vtn_storage_class_to_mode
spirv/nir: add offset at vtn_variable
nir_types: add glsl_atomic_uint_type() helper
spirv/nir: tweak nir type when storage class is
SpvStorageClassAtomicCounter
spirv/nir: initialize offset on the nir var at vtn_create_variable
spirv/nir: add atomic counter support on
vtn_handle_ssbo_or_shared_atomic
spirv/nir: add capability check for SpvCapabilityAtomicStorage
i965: enable AtomicStorage capability for gen7+
Antia Puentes (4):
compiler: utility to get the depth of multidimensional array
nir/spirv: Fix atomic counter (multidimensional-)arrays
nir: Fix OpAtomicCounterIDecrement for uniform atomic counters
mesa/glspirv: lower workgroup access to offsets
Neil Roberts (3):
nir/types: Add wrappers for a couple of atomic counter methods
nir/linker: Add a pure NIR implementation of the atomic counter linker
i965: Use the new nir atomic counter linker for SPIR-V shaders
src/compiler/Makefile.sources | 1 +
src/compiler/glsl/gl_nir_link_atomics.c | 282 +++++++++++++++++++++++++++
src/compiler/glsl/gl_nir_link_uniforms.c | 64 +++++-
src/compiler/glsl/gl_nir_linker.h | 3 +
src/compiler/glsl/gl_nir_lower_atomics.c | 8 +-
src/compiler/glsl/glsl_to_nir.cpp | 4 +-
src/compiler/glsl/link_uniforms.cpp | 34 +---
src/compiler/glsl/linker.cpp | 19 +-
src/compiler/glsl/linker.h | 13 --
src/compiler/glsl/linker_util.cpp | 55 ++++++
src/compiler/glsl/linker_util.h | 21 ++
src/compiler/glsl/meson.build | 1 +
src/compiler/glsl_types.h | 15 ++
src/compiler/nir/nir_intrinsics.py | 3 +-
src/compiler/nir/nir_lower_atomics_to_ssbo.c | 8 +-
src/compiler/nir_types.cpp | 24 +++
src/compiler/nir_types.h | 7 +
src/compiler/shader_info.h | 1 +
src/compiler/spirv/spirv_to_nir.c | 95 ++++++++-
src/compiler/spirv/vtn_private.h | 1 +
src/compiler/spirv/vtn_variables.c | 55 +++++-
src/mesa/drivers/dri/i965/brw_context.c | 1 +
src/mesa/drivers/dri/i965/brw_link.cpp | 2 +
src/mesa/main/glspirv.c | 1 +
24 files changed, 636 insertions(+), 82 deletions(-)
create mode 100644 src/compiler/glsl/gl_nir_link_atomics.c
--
2.14.1
More information about the mesa-dev
mailing list