Specialize images types to support multiple sample types (#439)
Fixes #286
Specialize OpenCL image types in clspv to encode the way they are used to generate correct SPIR-V and support multiple sample types.
A new pass performs type mutation replacing types with specializations like <base image type>.<sample type>[.sampled]. To support legacy code generation and tests, if no specializing builtin can be found, the specialized type defaults to a sampled float image.
Adds a new set of utility functions for identifying builtins rather relying on replicating strings in multiple files. Updated some arg utility functions to identify specialized images correctly as images.
Adds basic support for code generation of uint and int images. Currently can handle 2d and 3d sampled reads and 2d and 3d writes. Int images specially generate a signed 32-bit integer and a vec4 of a signed 32-bit integer for use. Bitcasts to/from unsigned 32-bit values are used to appropriately generate the exact type match for image writes or from image reads.
Many new tests.
diff --git a/lib/Passes.cpp b/lib/Passes.cpp
index eef6501..2f4ec19 100644
--- a/lib/Passes.cpp
+++ b/lib/Passes.cpp
@@ -42,6 +42,7 @@
initializeSimplifyPointerBitcastPassPass(r);
initializeSplatArgPassPass(r);
initializeSplatSelectConditionPassPass(r);
+ initializeSpecializeImageTypesPassPass(r);
initializeUBOTypeTransformPassPass(r);
initializeUndoBoolPassPass(r);
initializeUndoByvalPassPass(r);