summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/hlsl.meta.slang33
1 files changed, 31 insertions, 2 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index 44b9a8860..a6e1196e3 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -3610,7 +3610,7 @@ extension _Texture<T,Shape,isArray,0,sampleCount,0,isShadow,isCombined,format>
//@public:
[__readNone]
[ForceInline]
- [require(cpp_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_1_samplerless)]
+ [require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_1_samplerless)]
T Load(vector<int, Shape.dimensions+isArray+1> location)
{
__target_switch
@@ -3618,6 +3618,34 @@ extension _Texture<T,Shape,isArray,0,sampleCount,0,isShadow,isCombined,format>
case cpp:
case hlsl:
__intrinsic_asm ".Load";
+ case cuda:
+ if (isArray != 0)
+ {
+ static_assert(Shape.flavor == $(SLANG_TEXTURE_2D) || Shape.flavor == $(SLANG_TEXTURE_3D),
+ "Integer coordinates are supported for texture reads only for 2D and 3D textures and 2D array textures.");
+
+ if (Shape.flavor == $(SLANG_TEXTURE_2D))
+ {
+ __intrinsic_asm "tex2DArrayfetch_int<$T0>($0, ($1).x, ($1).y, ($1).z)";
+ }
+ else
+ {
+ __intrinsic_asm "<invalid intrinsic>";
+ }
+ }
+ else
+ {
+ switch(Shape.flavor)
+ {
+ case $(SLANG_TEXTURE_2D):
+ __intrinsic_asm "tex2Dfetch_int<$T0>($0, ($1).x, ($1).y)";
+ case $(SLANG_TEXTURE_3D):
+ __intrinsic_asm "tex3Dfetch_int<$T0>($0, ($1).x, ($1).y, ($1).z)";
+ case $(SLANG_TEXTURE_CUBE):
+ default:
+ __intrinsic_asm "<invalid intrinsic>";
+ }
+ }
case metal:
switch (Shape.flavor)
{
@@ -3824,7 +3852,7 @@ extension _Texture<T,Shape,isArray,0,sampleCount,0,isShadow,isCombined,format>
{
[__readNone]
[ForceInline]
- [require(cpp_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_1_samplerless)]
+ [require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_1_samplerless)]
get
{
__target_switch
@@ -3833,6 +3861,7 @@ extension _Texture<T,Shape,isArray,0,sampleCount,0,isShadow,isCombined,format>
case hlsl:
__intrinsic_asm ".operator[]";
case metal:
+ case cuda:
return Load(__makeVector(location, 0));
case glsl:
if (isCombined == 0)