[Mesa-dev] [PATCH 00/26] ARB_gl_spirv: ubo/ssbo support
Alejandro Piñeiro
apinheiro at igalia.com
Sat Sep 15 16:18:23 UTC 2018
Hi,
this series adds the support for UBO and SSBO. The following patches
can be classified as:
* Patches 1-8: changes on spirv to nir to take into account ubo and
ssbo, so it would be compatible to what OpenGL expects (like having
a interface_type, the correct mode, etc).
* Patch 09: some nir wrappers over glsl_types methods to be used
later on the ARB_gl_spirv nir linker.
* Patches 10-13: adding the explicit matrix stride, and the explicit
array stride on glsl_types, their nir C-wrappers, and the proper
filling up on the spirv to nir pass. This is needed because on
ARB_gl_spirv the layouts are gone, and are mapped with explicits
offsets/array strides/matrix strides. Spec quotes on their
patches. The array stride patch was somewhat more intrusive that
what I liked, but it was the best option we found.
* Patch 14: is_in_ubo/is_in_ssbo/is_in_block helpers on nir.h,
equivalent to the already existing at ir.h
* Patches 15-16: lowering of vulkan_resource_index. Right now the nir
shader from spirv to nir includes this intrinsic. We found more
easy to lower it to something that OpenGL could understand, instead
of change spirv to nir to return one intrinsic or the other,
depending if you are on vulkan or opengl.
* Patch 17: add the code to link blocks on the ARB_gl_spirv
codepath. This became a kind of uber patch, but we found more
natural to keep in one commit, instead of split it. We are open to
suggestions.
* Patches 18-22: updates on the uniform linking, now that ubo/ssbos
are supported.
* Patch 23: add uniform blocks to the resource list.
* Patches 24-25: call to the ARB_gl_spirv ubo/ssbo linking method on
the i965 driver, plus a nitpicky clean-up.
* Patch 26: add some name NULL checks when querying
NUM_ACTIVE_VARIABLES. We added several of such queries on our
tests, so it is somewhat unrelated nice to have.
The tree for this series can be found on the following repository:
https://github.com/Igalia/mesa/tree/arb_gl_spirv-series6-ubo-ssbo-v1
And can be tested with the following piglit branch:
https://github.com/Igalia/piglit/tree/arb_gl_spirv-series5-ubo-ssbo-v1
Alejandro Piñeiro (22):
spirv/nir: translate uniform blocks
spirv/nir: translate ssbo
spirv/nir: setting interface type for ubos/ssbos
spirv/nir: fill up nir variable info for ubos and ssbo
spirv/nir: include SPIR-V explicit offset on the glsl struct type
spirv/nir: include row major coming from SPIR-V on the glsl type
spirv/nir: don't set interface_type if it is not a struct
nir/types: add three new wrapper helpers
glsl_types/nir: add matrix_stride plus nir wrapper helpers
spirv/nir: fill glsl_struct_field explicit_matrix_stride
glsl_types/nir: add explicit_array_stride plus nir wrapper helpers
spirv/nir: fill glsl_type array stride
nir: add is_in_ubo/ssbo/block helpers
nir/linker: add gl_nir_link_uniform_blocks.c
nir/linker: fill is_shader_storage for uniforms
nir/linker: use only the array element type for array of ssbo/ubo
nir/linker: fill up uniform_storage with explicit data
nir/linker: update already processed uniforms search for UBOs/SSBOs
nir/linker: add program ubo/ssbo at the resource list
i965: use GLboolean for all brw_link_shader returns
i965: call to gl_nir_link_uniform_blocks
mesa: add NULL name check for NUM_ACTIVE_VARIABLES query
Antia Puentes (1):
nir/linker: Set the uniform's block_index
Neil Roberts (3):
spirv/nir: Handle location decorations on block interface members
nir/linker/i965: Lower vulkan_resource_index during linking
nir/linker: handle non-ubo uses of vulkan_resource_index
src/compiler/Makefile.sources | 2 +
src/compiler/glsl/gl_nir.h | 4 +
src/compiler/glsl/gl_nir_link_uniform_blocks.c | 713 +++++++++++++++++++++
src/compiler/glsl/gl_nir_link_uniforms.c | 160 ++++-
src/compiler/glsl/gl_nir_linker.c | 14 +
src/compiler/glsl/gl_nir_linker.h | 3 +
src/compiler/glsl/gl_nir_lower_samplers_as_deref.c | 2 +-
.../glsl/gl_nir_lower_vulkan_resource_index.c | 163 +++++
src/compiler/glsl/meson.build | 2 +
src/compiler/glsl_types.cpp | 31 +-
src/compiler/glsl_types.h | 23 +-
src/compiler/nir/nir.h | 22 +
src/compiler/nir/nir_lower_io_arrays_to_elements.c | 3 +-
src/compiler/nir/nir_split_per_member_structs.c | 3 +-
src/compiler/nir/nir_split_vars.c | 3 +-
src/compiler/nir_types.cpp | 47 +-
src/compiler/nir_types.h | 20 +-
src/compiler/spirv/spirv_to_nir.c | 24 +-
src/compiler/spirv/vtn_private.h | 6 +
src/compiler/spirv/vtn_variables.c | 90 ++-
src/mesa/drivers/dri/i965/brw_link.cpp | 12 +-
src/mesa/main/shader_query.cpp | 30 +-
22 files changed, 1301 insertions(+), 76 deletions(-)
create mode 100644 src/compiler/glsl/gl_nir_link_uniform_blocks.c
create mode 100644 src/compiler/glsl/gl_nir_lower_vulkan_resource_index.c
--
2.14.1
More information about the mesa-dev
mailing list