From 361e29572ff8e2cdd1e4ffe2cb62599e9ef06461 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 17 Jul 2017 20:08:31 -0700 Subject: Map HLSL `GatherRed` to GLSL `textureGather`, etc. This is a straightforward mapping given the infrastructure already in place. --- source/slang/slang-stdlib.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source') 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 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 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 Gather" << componentName << "(SamplerState s, "; sb << "float" << kBaseTextureTypes[tt].coordCount << " location, "; sb << "int" << kBaseTextureTypes[tt].coordCount << " offset1, "; -- cgit v1.2.3