diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-02-08 11:19:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-08 11:19:31 -0500 |
| commit | 0eed0125fa5e5f425d546efdc2b284b09ffc2785 (patch) | |
| tree | 4ded20c4966f05881a056fad8146e34ac595063e /source/slang/core.meta.slang | |
| parent | 7de90c1e0b42b565a5f46e2f9f7580e1f577d414 (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/core.meta.slang')
| -rw-r--r-- | source/slang/core.meta.slang | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index 85eb82576..14a8a0750 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -896,7 +896,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) if( baseShape != TextureFlavor::Shape::ShapeCube ) { - sb << "__target_intrinsic(cuda, \"tex" << kBaseTextureTypes[tt].coordCount << "D<$S0>($0"; + sb << "__target_intrinsic(cuda, \"tex" << kBaseTextureTypes[tt].coordCount << "D<$T0>($0"; if (kBaseTextureTypes[tt].coordCount == 1) { sb << ", $2"; @@ -1049,10 +1049,27 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) // `SampleLevel` sb << "__target_intrinsic(glsl, \"$ctextureLod($p, $2, $3)$z\")\n"; + + // CUDA + if (!isArray) + { + sb << "__target_intrinsic(cuda, \"tex" << kBaseTextureTypes[tt].coordCount << "DLod<$T0>($0"; + for (int i = 0; i < kBaseTextureTypes[tt].coordCount; ++i) + { + sb << ", $2"; + if (kBaseTextureTypes[tt].coordCount > 1) + { + sb << '.' << char(i + 'x'); + } + } + sb << ", $3)\")\n"; + } + sb << "T SampleLevel(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, "; sb << "float level);\n"; + if( baseShape != TextureFlavor::Shape::ShapeCube ) { sb << "__target_intrinsic(glsl, \"$ctextureLodOffset($p, $2, $3, $4)$z\")\n"; |
