summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-02-08 11:19:31 -0500
committerGitHub <noreply@github.com>2020-02-08 11:19:31 -0500
commit0eed0125fa5e5f425d546efdc2b284b09ffc2785 (patch)
tree4ded20c4966f05881a056fad8146e34ac595063e /source/slang/slang-emit-c-like.cpp
parent7de90c1e0b42b565a5f46e2f9f7580e1f577d414 (diff)
Fixes to make all CPU compute shaders work on CUDA (#1211)
* Launch CUDA test taking into account dispatch size. * Enable isCPUOnly hack to work on CUDA. * Rename 'isCPUOnly' hack to 'onlyCPULikeBinding'. * Add $T special type. Support SampleLevel on CUDA. * Fix typo.
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index a383caecf..2212cf9cc 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -1367,6 +1367,22 @@ void CLikeSourceEmitter::emitIntrinsicCallExprImpl(
}
break;
+ case 'T':
+ // Get the the 'element' type for the type of the param at the index
+ {
+ SLANG_RELEASE_ASSERT(*cursor >= '0' && *cursor <= '9');
+ Index argIndex = (*cursor++) - '0';
+ SLANG_RELEASE_ASSERT(argCount > argIndex);
+
+ IRType* type = args[argIndex].get()->getDataType();
+ if (auto baseTextureType = as<IRTextureType>(type))
+ {
+ type = baseTextureType->getElementType();
+ }
+ emitType(type);
+ }
+ break;
+
case 'S':
// Get the scalar type of a generic at specified index
{