diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-01-24 15:06:08 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-24 15:06:08 -0500 |
| commit | b8f294445b998eadb9b09e2b91eb462b881eaf2e (patch) | |
| tree | 8607e5d2f6c2c2b4b7545a721d6d58e6e557e5c0 /source/slang/core.meta.slang.h | |
| parent | 394983d61efa2bf99ba96aa68a47df8927a8a634 (diff) | |
Texture Sample available in CUDA (#1176)
* WIP: Trying to figure out how texturing will work with CUDA.
* WIP: Fixes for CUDA layout. Initial CUDA texture test.
* WIP: Outputs something compilable by CUDA for TextureND.Sample
* 2d texture working with CUDA.
* Fix how binding for SamplerState occurs in CUDA.
* Small tidy up of comments.
Diffstat (limited to 'source/slang/core.meta.slang.h')
| -rw-r--r-- | source/slang/core.meta.slang.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source/slang/core.meta.slang.h b/source/slang/core.meta.slang.h index 27811b588..201429700 100644 --- a/source/slang/core.meta.slang.h +++ b/source/slang/core.meta.slang.h @@ -791,6 +791,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) sb << "$1"; } sb << ")$z\")\n"; + } sb << "T Load("; sb << "int" << loadCoordCount << " location"; @@ -908,6 +909,24 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) // `Sample()` sb << "__target_intrinsic(glsl, \"$ctexture($p, $2)$z\")\n"; + + if( baseShape != TextureFlavor::Shape::ShapeCube ) + { + sb << "__target_intrinsic(cuda, \"tex" << kBaseTextureTypes[tt].coordCount << "D<$S0>($0"; + if (kBaseTextureTypes[tt].coordCount == 1) + { + sb << ", $2"; + } + else + { + for (int i = 0; i < kBaseTextureTypes[tt].coordCount; ++i) + { + sb << ", ($2)." << char(i + 'x'); + } + } + sb << ")\")\n"; + } + sb << "T Sample(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location);\n"; @@ -1258,7 +1277,7 @@ for (auto op : binaryOps) sb << "__intrinsic_op(" << int(op.opCode) << ") matrix<" << resultType << ",N,M> operator" << op.opName << "(" << leftQual << "matrix<" << leftType << ",N,M> left, " << rightType << " right);\n"; } } -SLANG_RAW("#line 1240 \"core.meta.slang\"") +SLANG_RAW("#line 1259 \"core.meta.slang\"") SLANG_RAW("\n") SLANG_RAW("\n") SLANG_RAW("// Specialized function\n") |
