From edf8cafe6d3799f58a92ccc83ba70dd41c461f6a Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Sat, 22 Jul 2017 14:05:07 -0700 Subject: Make the "hack" sampler explicit for now - We use this to work around the fact that, e.g., `Texture2D.Load` doesn't take a sampler, but the equivalent GLSL operation `texelFetch` requires one - Previously we tried to hide the sampler from the user, hoping that glslang would drop it and we could just ignore it, but that doesn't work - For now we'll go ahead and explicitly show the sampler in the reflection info so that an app can react appropriately - We also generate a unique binding for the sampler, instead of the old behavior that fixed it with `binding = 0` - We still fix it with `set = 0`, so it might still surprise users --- source/slang/emit.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/slang/emit.cpp') diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 61e473c7d..5a59674f5 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -3848,7 +3848,10 @@ String emitEntryPoint( if (sharedContext.needHackSamplerForTexelFetch) { - finalResultBuilder << "layout(set = 0, binding = 0) uniform sampler SLANG_hack_samplerForTexelFetch;\n"; + finalResultBuilder + << "layout(set = 0, binding = " + << programLayout->bindingForHackSampler + << ") uniform sampler SLANG_hack_samplerForTexelFetch;\n"; } finalResultBuilder << code; -- cgit v1.2.3