summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2024-09-23 16:30:40 -0700
committerGitHub <noreply@github.com>2024-09-23 16:30:40 -0700
commit6912c58538112e75f3c18c749ceabe8f316fcef8 (patch)
tree1be575dfd8ee05dd5f80161e7096a609a20fc56c
parent53684ed919ff2f5f3656aed2e95a111207452392 (diff)
Fix incorrect use of pointer in WGSL (#5144)
Closes #5143 Recently there was a commit that changed the behavior of the memory pointer for WGSL. This commit fixes some issues came up after the change.
-rw-r--r--source/slang/hlsl.meta.slang8
-rw-r--r--source/slang/slang-stdlib-textures.cpp18
2 files changed, 13 insertions, 13 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index b0c1ed450..8d1b3202e 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -9039,7 +9039,7 @@ __generic<T : __BuiltinFloatingPointType>
[require(wgsl)]
void __wgsl_frexp(T x, out T fract, out int exp)
{
- __intrinsic_asm "{ var s = frexp($0); (*($1)) = s.fract; (*($2)) = s.exp; }";
+ __intrinsic_asm "{ var s = frexp($0); ($1) = s.fract; ($2) = s.exp; }";
}
__generic<T : __BuiltinFloatingPointType, let N : int>
@@ -9071,7 +9071,7 @@ __generic<T : __BuiltinFloatingPointType, let N : int>
[require(wgsl)]
void __wgsl_frexp(vector<T, N> x, out vector<T, N> fract, out vector<int, N> exp)
{
- __intrinsic_asm "{ var s = frexp($0); (*($1)) = s.fract; (*($2)) = s.exp; }";
+ __intrinsic_asm "{ var s = frexp($0); ($1) = s.fract; ($2) = s.exp; }";
}
__generic<T : __BuiltinFloatingPointType, let N : int, let M : int, let L : int>
@@ -11469,7 +11469,7 @@ __generic<T : __BuiltinFloatingPointType>
[require(wgsl)]
void __wgsl_modf(T x, out T fract, out T whole)
{
- __intrinsic_asm "{ var s = modf($0); (*($1)) = s.fract; (*($2)) = s.whole; }";
+ __intrinsic_asm "{ var s = modf($0); ($1) = s.fract; ($2) = s.whole; }";
}
__generic<T : __BuiltinFloatingPointType, let N : int>
@@ -11501,7 +11501,7 @@ __generic<T : __BuiltinFloatingPointType, let N : int>
[require(wgsl)]
void __wgsl_modf(vector<T,N> x, out vector<T,N> fract, out vector<T,N> whole)
{
- __intrinsic_asm "{ var s = modf($0); (*($1)) = s.fract; (*($2)) = s.whole; }";
+ __intrinsic_asm "{ var s = modf($0); ($1) = s.fract; ($2) = s.whole; }";
}
__generic<T : __BuiltinFloatingPointType, let N : int, let M : int, let L : int>
diff --git a/source/slang/slang-stdlib-textures.cpp b/source/slang/slang-stdlib-textures.cpp
index a9f14522b..c9b7598c7 100644
--- a/source/slang/slang-stdlib-textures.cpp
+++ b/source/slang/slang-stdlib-textures.cpp
@@ -224,7 +224,7 @@ void TextureTypeInfo::writeGetDimensionFunctions()
++paramCount;
params << t << "width";
metal << "(*($" << String(paramCount) << ") = $0.get_width(" << String(metalMipLevel) << ")),";
- wgsl << "*($" << String(paramCount) << ") = textureDimensions($0" << (includeMipInfo ? ", $1" : "") << ");";
+ wgsl << "($" << String(paramCount) << ") = textureDimensions($0" << (includeMipInfo ? ", $1" : "") << ");";
sizeDimCount = 1;
break;
@@ -235,12 +235,12 @@ void TextureTypeInfo::writeGetDimensionFunctions()
params << t << "width,";
metal << "(*($" << String(paramCount) << ") = $0.get_width(" << String(metalMipLevel) << ")),";
wgsl << "var dim = textureDimensions($0" << (includeMipInfo ? ", $1" : "") << ");";
- wgsl << "(*$" << String(paramCount) << ") = dim.x;";
+ wgsl << "($" << String(paramCount) << ") = dim.x;";
++paramCount;
params << t << "height";
metal << "(*($" << String(paramCount) << ") = $0.get_height(" << String(metalMipLevel) << ")),";
- wgsl << "(*$" << String(paramCount) << ") = dim.y;";
+ wgsl << "($" << String(paramCount) << ") = dim.y;";
sizeDimCount = 2;
break;
@@ -250,17 +250,17 @@ void TextureTypeInfo::writeGetDimensionFunctions()
params << t << "width,";
metal << "(*($" << String(paramCount) << ") = $0.get_width(" << String(metalMipLevel) << ")),";
wgsl << "var dim = textureDimensions($0" << (includeMipInfo ? ", $1" : "") << ");";
- wgsl << "(*$" << String(paramCount) << ") = dim.x;";
+ wgsl << "($" << String(paramCount) << ") = dim.x;";
++paramCount;
params << t << "height,";
metal << "(*($" << String(paramCount) << ") = $0.get_height(" << String(metalMipLevel) << ")),";
- wgsl << "(*$" << String(paramCount) << ") = dim.y;";
+ wgsl << "($" << String(paramCount) << ") = dim.y;";
++paramCount;
params << t << "depth";
metal << "(*($" << String(paramCount) << ") = $0.get_depth(" << String(metalMipLevel) << ")),";
- wgsl << "(*$" << String(paramCount) << ") = dim.z;";
+ wgsl << "($" << String(paramCount) << ") = dim.z;";
sizeDimCount = 3;
break;
@@ -276,7 +276,7 @@ void TextureTypeInfo::writeGetDimensionFunctions()
++paramCount;
params << ", " << t << "elements";
metal << "(*($" << String(paramCount) << ") = $0.get_array_size()),";
- wgsl << "(*$" << String(paramCount) << ") = textureNumLayers($0);";
+ wgsl << "($" << String(paramCount) << ") = textureNumLayers($0);";
}
if (isMultisample)
@@ -284,7 +284,7 @@ void TextureTypeInfo::writeGetDimensionFunctions()
++paramCount;
params << ", " << t << "sampleCount";
metal << "(*($" << String(paramCount) << ") = $0.get_num_samples()),";
- wgsl << "(*$" << String(paramCount) << ") = textureNumSamples($0);";
+ wgsl << "($" << String(paramCount) << ") = textureNumSamples($0);";
}
if (includeMipInfo)
@@ -292,7 +292,7 @@ void TextureTypeInfo::writeGetDimensionFunctions()
++paramCount;
params << ", " << t << "numberOfLevels";
metal << "(*($" << String(paramCount) << ") = $0.get_num_mip_levels()),";
- wgsl << "(*$" << String(paramCount) << ") = textureNumLevels($0);";
+ wgsl << "($" << String(paramCount) << ") = textureNumLevels($0);";
}
metal.reduceLength(metal.getLength() - 1); // drop the last comma