SPIRV-Tools/include/spirv-tools
Nathan Gauër 2ea4003633
opt: split composite from array flattening (#5733)
* opt: split composite from array flattening

DXC has an option to flatten resource arrays. But when this option
is not used, the resource arrays should be kept as-is.
On the other hand, when a struct contains resources, we MUST flatten is
to be compliant with the Vulkan spec.

Because this pass flattens both types of resources, using a struct of
resources automatically implied flattening arrays.
By adding those 2 new settings, we decide if the pass flattens only one type
of resources, or both.
Note: the flatten_arrays flag only impacts resource arrays.
Arrays of composites containing resources are still flattened.

Since the API is considered stable, I added 2 new functions to create
passes with one flag or the other, and kept the original behavior as-is.

Related to https://github.com/microsoft/DirectXShaderCompiler/issues/6745

Signed-off-by: Nathan Gauër <brioche@google.com>

* add commandline options

Signed-off-by: Nathan Gauër <brioche@google.com>

* clang-format

Signed-off-by: Nathan Gauër <brioche@google.com>

---------

Signed-off-by: Nathan Gauër <brioche@google.com>
2024-07-19 11:48:21 -04:00
..
instrument.hpp opt: Remove bindless and buff addr instrumentation passes (#5657) 2024-05-02 18:52:17 -04:00
libspirv.h Add FPEncoding operand type. (#5726) 2024-07-03 13:18:40 -04:00
libspirv.hpp Add SPIRV_TOOLS_EXPORT to public C++ API (#5591) 2024-04-18 17:31:34 -04:00
linker.hpp Add SPIRV_TOOLS_EXPORT to public C++ API (#5591) 2024-04-18 17:31:34 -04:00
linter.hpp Add SPIRV_TOOLS_EXPORT to public C++ API (#5591) 2024-04-18 17:31:34 -04:00
optimizer.hpp opt: split composite from array flattening (#5733) 2024-07-19 11:48:21 -04:00