DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
[SPIR-V] Fix bug using `Texture2D` with alias template for `SpirvType`
Description
For the (currently unmerged) SpirvType PR, Texture2D (and presumably other built-in types) cannot be used as an argument to an alias template for SpirvType
Steps to Reproduce
Compile
template<typename SomeType, uint Length>
using Array = vk::SpirvOpaqueType</* OpTypeArray */ 28, SomeType, vk::integral_constant<uint, Length> >;
void main() {
Array<Texture2D, 4> image;
}
With the command
dxc -T ps_6_0 -E main -spirv
Actual Behavior Error:
foo.hlsl:2:1: error: 'Texture2D<vector<float, 4> >' is an object and cannot be used as a type parameter
using Array = vk::SpirvOpaqueType</* OpTypeArray */ 28, SomeType, vk::integral_constant<uint, Length> >;
^
foo.hlsl:5:3: note: in instantiation of template type alias 'Array' requested here
Array<Texture2D, 4> image;
^
Environment
- DXC version
libdxcompiler.so: 1.8(dev;4545-a97b48a5)(development version of #6156) - Host Operating System Linux
This problem isn't limited to built-in types, its also when you put one vk::SpirvType inside another: https://godbolt.org/z/sxejh1q7W
its whats blocking my "user space solution" to #5092