diff options
| author | Yong He <yonghe@outlook.com> | 2024-06-11 12:31:37 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-11 12:31:37 -0700 |
| commit | 6909d65c77bb4e7c9cfb281bd1684a58d5f8b94d (patch) | |
| tree | 396a628b7fda779dcc6e820e86d44e29d0c7be95 /source/slang/hlsl.meta.slang | |
| parent | ef20d9309674dc8c25a9798d95138cf739299928 (diff) | |
SPIRV backend: add support for tessellation stages, (#4336)
Diffstat (limited to 'source/slang/hlsl.meta.slang')
| -rw-r--r-- | source/slang/hlsl.meta.slang | 35 |
1 files changed, 33 insertions, 2 deletions
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<T, U, I>(U collection, I index); + __generic<T, let N : int> [require(glsl_hlsl_spirv, hull)] __magic_type(HLSLInputPatchType) __intrinsic_type($(kIROp_HLSLInputPatchType)) struct InputPatch { - __subscript(uint index) -> T; + __generic<TIndex : __BuiltinIntegerType> + __subscript(TIndex index)->T + { + [__unsafeForceInlineEarly] + get + { + __target_switch + { + case hlsl: + __intrinsic_asm ".operator[]"; + default: + return __getElement<T>(this, index); + } + } + } }; __generic<T, let N : int> @@ -3814,7 +3831,21 @@ __magic_type(HLSLOutputPatchType) __intrinsic_type($(kIROp_HLSLOutputPatchType)) struct OutputPatch { - __subscript(uint index) -> T; + __generic<TIndex : __BuiltinIntegerType> + __subscript(TIndex index)->T + { + [__unsafeForceInlineEarly] + get + { + __target_switch + { + case hlsl: + __intrinsic_asm ".operator[]"; + default: + return __getElement<T>(this, index); + } + } + } }; ${{{{ |
