summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-17 20:08:31 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-18 12:58:47 -0700
commit361e29572ff8e2cdd1e4ffe2cb62599e9ef06461 (patch)
treea126a411c908e551808a460290fe00474228f0be /source
parentf04bf3c51fef65cf6f1e29ad5f0d2f836bcc0d3c (diff)
Map HLSL `GatherRed` to GLSL `textureGather`, etc.
This is a straightforward mapping given the infrastructure already in place.
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-stdlib.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/slang/slang-stdlib.cpp b/source/slang/slang-stdlib.cpp
index 5800a5deb..3062112c6 100644
--- a/source/slang/slang-stdlib.cpp
+++ b/source/slang/slang-stdlib.cpp
@@ -1808,13 +1808,19 @@ namespace Slang
for(auto kk : kGatherComponets)
{
+ auto componentIndex = kk.componentIndex;
auto componentName = kk.componentName;
EMIT_LINE_DIRECTIVE();
+
+ sb << "__intrinsic(glsl, \"textureGather($p, $1, " << componentIndex << ")\")\n";
+ sb << "__intrinsic\n";
sb << "vector<T, 4> Gather" << componentName << "(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount << " location);\n";
EMIT_LINE_DIRECTIVE();
+ sb << "__intrinsic(glsl, \"textureGatherOffset($p, $1, $2, " << componentIndex << ")\")\n";
+ sb << "__intrinsic\n";
sb << "vector<T, 4> Gather" << componentName << "(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount << " location, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset);\n";
@@ -1826,6 +1832,8 @@ namespace Slang
sb << "out uint status);\n";
EMIT_LINE_DIRECTIVE();
+ sb << "__intrinsic(glsl, \"textureGatherOffsets($p, $1, int" << kBaseTextureTypes[tt].coordCount << "[]($2, $3, $4, $5), " << componentIndex << ")\")\n";
+ sb << "__intrinsic\n";
sb << "vector<T, 4> Gather" << componentName << "(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount << " location, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset1, ";