diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-10-19 13:53:18 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-19 13:53:18 -0700 |
| commit | 53731f674601a2eb81c5715957d2e0e65637aee3 (patch) | |
| tree | dafd74a4e926676c55b93e06e8275a4844a862e8 /source/slang/lower-to-ir.cpp | |
| parent | 3a5214b65b2a5efdbcf9bf6fb4d7603e9ee63234 (diff) | |
Vulkan implicit sampler fixups (#686)
* Fix sampler-less texture functions (#685)
* Fix sampler-less texeture functions
I'm honestly not sure how the original work on this feature in #648 worked at all (probably insufficient testing).
We have these front-end modifiers to indicate that a particular function definition requires a certain GLSL version, or a GLSL extension in order to be used, and they are supposed to be automatically employed by the logic in `emit.cpp` to output `#extension` lines in the output GLSL. However, it turns out that nothing is actually wired up right now, so that adding the modifiers to a declaration is a placebo.
This change propagates the modifiers through as decorations, and then uses them during GLSL code emit, which allows the functions that require `EXT_samplerless_texture_functions` to work.
* fixup: 32-bit warning
* Add serialization support for GLSL extension/version decorations
Diffstat (limited to 'source/slang/lower-to-ir.cpp')
| -rw-r--r-- | source/slang/lower-to-ir.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp index 7b63f510f..5f3b00b24 100644 --- a/source/slang/lower-to-ir.cpp +++ b/source/slang/lower-to-ir.cpp @@ -5112,6 +5112,23 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> // for a particular target, then handle that here. addTargetIntrinsicDecorations(irFunc, decl); + // If this declaration requires certain GLSL extension (or a particular GLSL version) + // for it to be usable, then declare that here. + // + // TODO: We should wrap this an `SpecializedForTargetModifier` together into a single + // case for enumerating the "capabilities" that a declaration requires. + // + for(auto extensionMod : decl->GetModifiersOfType<RequiredGLSLExtensionModifier>()) + { + auto decoration = getBuilder()->addDecoration<IRRequireGLSLExtensionDecoration>(irFunc); + decoration->extensionName = getBuilder()->addStringToFree(extensionMod->extensionNameToken.Content); + } + for(auto versionMod : decl->GetModifiersOfType<RequiredGLSLVersionModifier>()) + { + auto decoration = getBuilder()->addDecoration<IRRequireGLSLVersionDecoration>(irFunc); + decoration->languageVersion = Int(getIntegerLiteralValue(versionMod->versionNumberToken)); + } + // For convenience, ensure that any additional global // values that were emitted while outputting the function // body appear before the function itself in the list |
