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 | |
| 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')
| -rw-r--r-- | source/slang/core.meta.slang | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index 80ff09ea8..58e6e287c 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -770,6 +770,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) sb << "$1"; } sb << ")$z\")\n"; + } sb << "T Load("; sb << "int" << loadCoordCount << " location"; @@ -887,6 +888,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"; |
