summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-stdlib.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-19 10:10:17 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-19 10:12:58 -0700
commit55a29042a2826f26272c9e1b65cd3745bad3ee31 (patch)
treef8016cf92678a6dfaa1903a161ebcad78f0f42d0 /source/slang/slang-stdlib.cpp
parenta727017340165d02977387e1e1a2a7e328308295 (diff)
Fix up translation of `GetDimensions()`
Fixes #122 - In cases with an explicit mip level being specified, there was a mistake in how the argument for setting the mip level in the GLSL code was constructed that led to a parse error in GLSL - Also, that argument is a `uint` in HLSL and an `int` in GLSL, so an explicit cast was needed - The GLSL functions here seem to require a newer GLSL (at least higher than `420`), so I had to add in a capability for builtins to specify a required GLSL version. For now I made these ones require `450`. - Added a test case to confirm that our lowering works (for some definition of "works")
Diffstat (limited to 'source/slang/slang-stdlib.cpp')
-rw-r--r--source/slang/slang-stdlib.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/slang/slang-stdlib.cpp b/source/slang/slang-stdlib.cpp
index a62db693c..7850b0ce0 100644
--- a/source/slang/slang-stdlib.cpp
+++ b/source/slang/slang-stdlib.cpp
@@ -1417,6 +1417,7 @@ namespace Slang
for(int includeMipInfo = 0; includeMipInfo < 2; ++includeMipInfo)
{
{
+ sb << "__glsl_version(450)\n";
sb << "__intrinsic(glsl, \"(";
int aa = 0;
@@ -1424,8 +1425,9 @@ namespace Slang
if (includeMipInfo)
{
int mipLevelArg = aa++;
- lodStr.append("$");
+ lodStr = "int($";
lodStr.append(mipLevelArg);
+ lodStr.append(")");
}
int cc = 0;