From 6909d65c77bb4e7c9cfb281bd1684a58d5f8b94d Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 11 Jun 2024 12:31:37 -0700 Subject: SPIRV backend: add support for tessellation stages, (#4336) --- source/slang/hlsl.meta.slang | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'source/slang/hlsl.meta.slang') diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index 1fac47588..c03c47703 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -3799,13 +3799,30 @@ struct ConsumeStructuredBuffer } }; +__intrinsic_op($(kIROp_GetElement)) +T __getElement(U collection, I index); + __generic [require(glsl_hlsl_spirv, hull)] __magic_type(HLSLInputPatchType) __intrinsic_type($(kIROp_HLSLInputPatchType)) struct InputPatch { - __subscript(uint index) -> T; + __generic + __subscript(TIndex index)->T + { + [__unsafeForceInlineEarly] + get + { + __target_switch + { + case hlsl: + __intrinsic_asm ".operator[]"; + default: + return __getElement(this, index); + } + } + } }; __generic @@ -3814,7 +3831,21 @@ __magic_type(HLSLOutputPatchType) __intrinsic_type($(kIROp_HLSLOutputPatchType)) struct OutputPatch { - __subscript(uint index) -> T; + __generic + __subscript(TIndex index)->T + { + [__unsafeForceInlineEarly] + get + { + __target_switch + { + case hlsl: + __intrinsic_asm ".operator[]"; + default: + return __getElement(this, index); + } + } + } }; ${{{{ -- cgit v1.2.3