[Mesa-dev] [PATCH 0/8] compiler: Add a new gl_image_format enum and use it
Jason Ekstrand
jason at jlekstrand.net
Thu Jul 13 07:32:10 UTC 2017
I know what you're all thinking: Why are we adding yet another format
enum? I asked myself the same question. Really, I've spent enough of my
life writing format enum conversion tables that I should know better.
It all started as an attempt to write patch 6 which prints the formats of
images used in shaders in nir_print. Unfortunately, what I wanted to do
was to use _mesa_enum_to_string to convert the GL enum (which is what we
were using before) into a string to print. The problem is that this
function exists in mesa/main and is therefore unavailable in nir_print().
So, instead of writing a remap table just for nir_print(), I decided to
bite the bullet and add something to shader_enums.
Really, I think this makes a fair amount of sense as the image formats in
GLSL or SPIR-V really live in their own compiler enum space. The only
reason why we re-used the GL enums before was for convenience. This meant
that spirv_to_nir had a big table to convert SPIR-V enums to GL enums which
is a bit awkward since it's for Vulkan. In any case, I don't think this
actually makes the situation any worse.
Jason Ekstrand (8):
spirv: Fix SpvImageFormatR16ui
compiler/enums: Add an image format enum
compiler/glsl: Use the new gl_image_format enum
compiler/nir: Use the new image_format enum
spirv: Use the new gl_image_format enum
compiler/nir: Print image formats in nir_print
intel/compiler: Use gl_image_format in fs_surface_builder
anv/pipeline: Dump shader immedately after spirv_to_nir
src/compiler/glsl/ast.h | 2 +-
src/compiler/glsl/ast_to_hir.cpp | 4 +-
src/compiler/glsl/builtin_variables.cpp | 2 +-
src/compiler/glsl/glsl_parser.yy | 80 ++++++++++++------------
src/compiler/glsl/ir.h | 2 +-
src/compiler/glsl_types.h | 8 ++-
src/compiler/nir/nir.h | 2 +-
src/compiler/nir/nir_print.c | 8 ++-
src/compiler/shader_enums.c | 56 +++++++++++++++++
src/compiler/shader_enums.h | 54 ++++++++++++++++
src/compiler/spirv/spirv_to_nir.c | 82 ++++++++++++------------
src/compiler/spirv/vtn_private.h | 2 +-
src/intel/compiler/brw_fs_nir.cpp | 5 +-
src/intel/compiler/brw_fs_surface_builder.cpp | 90 +++++++++++++--------------
src/intel/compiler/brw_fs_surface_builder.h | 4 +-
src/intel/vulkan/anv_pipeline.c | 15 +++++
16 files changed, 274 insertions(+), 142 deletions(-)
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list