microsoft / hlsl-specs

HLSL Specifications
MIT License
123 stars 33 forks source link

[0011] Make SpirvType take type template parameter pack #167

Closed cassiebeckley closed 8 months ago

cassiebeckley commented 8 months ago

Instead of using an arbitrary unchecked list of parameters, require that SpirvType and SpirvOpaqueType take a type template parameter pack for the list of operands. For example, now SpirvOpaqueType is defined as

template<uint OpCode, typename... Operands>
struct SpirvOpaqueType {};

A type vk::integral_constant<typename T, T v> is defined in order to allow literal values as operands, and a type qualifier _spirv_immediate is defined in order to specify that a literal value should be embedded as an immediate value in the SPIR-V type-declaration instruction.

@s-perron and @llvm-beanz for review.

s-perron commented 8 months ago

I'll delegate my review to @keenuts. In general, I am fine with this direction. It will make it easier to add it to clang and DXC.