This series is another 11 patches in the direction of improving SPIR-V
error messages and validation.  The purpose here isn't really to validate
the SPIR-V (I'm sure there will be many things we won't error on) but to
make it such that the assumptions we do make about the incoming SPIR-V and
require for correctness are well-documented and based on actual SPIR-V
constructs instead of obscure asserts deep inside spirv_to_nir.

A good example of this is the penultimate patch of this series which
reworks our error checking for decorations.  The biggest potential failure
point for decorations is struct member decorations which are either not on
an OpTypeStruct or have a member literal that is out-of-bounds.  By
carefully checking for all this up-front, we can allow later code to just
assume everything is sane.  It's also theoretically possible to construct
(invalid) SPIR-V which has nested member decorations.  This isn't allowed
by the spec but it's nicer to throw an error than to just get confused or,
even worse, crash.  The final patch in the series follows this up by
replacing a bunch of vtn_asserts in various bits of decoration handling
code with regular debug-only asserts that should now be guaranteed to never
trigger.

Jason Ekstrand (11):
  spirv: Add better error messages in vtn_value helpers
  spirv: Make 'info' a local array spirv_info_c.py
  spirv/info: Add spirv_op_to_string
  spirv: Unify boolean constants and add better validation
  spirv: Remove a pointless assignment in SpvOpSpecConstant
  spirv: Add better validation to Op[Spec]Constant
  spirv: Refactor Op[Spec]ConstantComposite and add better validation
  spirv: Switch on vtn_base_type in OpComposite(Extract|Insert)
  spirv: Add better type validation to OpTypeImage
  spirv: Rework error checking for decorations
  spirv: Rework asserts in var_decoration_cb

 src/compiler/spirv/spirv_info.h    |   1 +
 src/compiler/spirv/spirv_info_c.py |  18 ++-
 src/compiler/spirv/spirv_to_nir.c  | 225 ++++++++++++++++++++-----------------
 src/compiler/spirv/vtn_private.h   |  26 +++--
 src/compiler/spirv/vtn_variables.c |  15 +--
 5 files changed, 163 insertions(+), 122 deletions(-)

-- 
2.5.0.400.gff86faf

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to