[Mesa-dev] [PATCH 0/6] Fix Various Compilation Issues With Bindless

Rhys Perry pendingchaos02 at gmail.com
Wed Jun 6 19:55:02 UTC 2018


Previously, there were some errors in the compiler's implementation of
ARB_bindless_texture, mostly related to usage of bound image or sampler
handles allowed by ARB_bindless_texture, resulting in assertions or
compilation errors. This series fixes following issues found in mesa:
- Assertions when casting bound handles to uvec2
- Compilation errors when using the ?: operator with bound handles
- Assertions creating a constant image/sampler handle
   - For example: image2D(uvec2(5, 6))
- Inlining of function calls with rvalues other than dereferences to
  handle uniforms passed into them creates assertion failures
- Usage of bound handles as l-values

In order to create bindless handles from bound images or samplers, two new
TGSI opcodes needed to be added: SAMP2HND and IMG2HND. These are used when
casting bound handles or when using them as l-values (e.g. using them with
the ?: operator).

This series has the following limitations because I don't have the
hardware needed to test the needed changes:
- radeonsi and gallivm do not handle SAMP2HND and IMG2HND
- similar instructions/intrinsics for nir have not been added
- the tgsi to nir conversion code does not handle SAMP2HND and IMG2HND
- IMG2HND with Kepler is not implemented
Usage of bound handles as l-values and casting them is handled better than
before though.

Some tests for these changes have been posted on the piglit mailing list.

Rhys Perry (6):
  gallium: add new SAMP2HND and IMG2HND opcodes
  nv50/ir: add support for SAMP2HND on gk104+ and IMG2HND on gm107+
  glsl_to_tgsi: allow bound samplers and images to be used as l-values
  glsl: allow ?: operator with images and samplers when bindless is enabled
  glsl,glsl_to_tgsi: fix sampler/image constants
  glsl: fix function inlining with opaque parameters

 src/compiler/glsl/ast_to_hir.cpp                   |  8 ++-
 src/compiler/glsl/ir.cpp                           | 32 +++++++++-
 src/compiler/glsl/opt_function_inlining.cpp        | 52 +++++++++++++---
 src/gallium/auxiliary/tgsi/tgsi_info.c             |  2 +
 src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h     |  4 +-
 src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h       |  3 +
 src/gallium/docs/source/tgsi.rst                   | 25 ++++++++
 src/gallium/drivers/nouveau/codegen/nv50_ir.cpp    |  2 +
 src/gallium/drivers/nouveau/codegen/nv50_ir.h      |  2 +
 .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp  | 22 +++++++
 .../drivers/nouveau/codegen/nv50_ir_inlines.h      |  4 +-
 .../nouveau/codegen/nv50_ir_lowering_nvc0.cpp      | 25 ++++++++
 .../nouveau/codegen/nv50_ir_lowering_nvc0.h        |  1 +
 .../drivers/nouveau/codegen/nv50_ir_print.cpp      |  2 +
 .../drivers/nouveau/codegen/nv50_ir_target.cpp     |  7 ++-
 src/gallium/include/pipe/p_shader_tokens.h         |  2 +
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp         | 69 ++++++++++++++++++++--
 src/mesa/state_tracker/st_glsl_to_tgsi_private.h   |  1 +
 18 files changed, 239 insertions(+), 24 deletions(-)

-- 
2.14.4



More information about the mesa-dev mailing list