summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-07-11 03:06:40 +0800
committerGitHub <noreply@github.com>2023-07-10 12:06:40 -0700
commit5569b4850dabbb7dbcb72278bb2918c281e0d475 (patch)
tree0acae3b4aeb3921513894fa31be4c0f1ba44c573 /source
parent0363a4d18c655697cfb0d958add2c7bf4b156874 (diff)
Add glsl intrinsic for SampleCmpLevelZero with offset and correct existing intrinsic (#2975)
* Correct glsl intrinsic for SampleCmpLevelZero without offset * Add glsl intrinsic for SampleCmpLevelZero with offset * Add test for samplecmplevelzero glsl translation --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source')
-rw-r--r--source/slang/core.meta.slang4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang
index d99b241c0..5342800be 100644
--- a/source/slang/core.meta.slang
+++ b/source/slang/core.meta.slang
@@ -1944,7 +1944,7 @@ struct TextureTypeInfo
sb << "float" << base.coordCount + isArray << " location, ";
sb << "float compareValue";
sb << ");\n";
- sb << "__target_intrinsic(glsl, \"texture($p, vec" << arrCoordCount + 1 << "($2, $3))\")";
+ sb << "__target_intrinsic(glsl, \"textureLod($p, vec" << arrCoordCount + 1 << "($2, $3), 0)\")";
if (isReadOnly)
sb << "[__readNone]\n";
sb << "float SampleCmpLevelZero(SamplerComparisonState s, ";
@@ -2001,6 +2001,7 @@ struct TextureTypeInfo
// saying they only exclude `offset` for cube maps (which makes
// sense). I'm going to assume the documentation for `SampleCmp`
// is just wrong.
+ sb << "__target_intrinsic(glsl, \"textureOffset($p, vec" << arrCoordCount + 1 << "($2, $3), $4)\")";
if (isReadOnly)
sb << "[__readNone]\n";
sb << "float SampleCmp(SamplerComparisonState s, ";
@@ -2008,6 +2009,7 @@ struct TextureTypeInfo
sb << "float compareValue, ";
sb << "constexpr int" << base.coordCount << " offset);\n";
+ sb << "__target_intrinsic(glsl, \"textureLodOffset($p, vec" << arrCoordCount + 1 << "($2, $3), 0, $4)\")";
if (isReadOnly)
sb << "[__readNone]\n";
sb << "float SampleCmpLevelZero(SamplerComparisonState s, ";