Skip to content
Permalink
Browse files

[Shaders] Vulkan: Add "NoSampler" to reflection

  • Loading branch information
xen2 committed Jan 14, 2019
1 parent 76cd37b commit cd609ad45f10c4e6587ebb87f635d4e6516c6143
Showing with 4 additions and 0 deletions.
  1. +4 −0 sources/engine/Xenko.Shaders.Compiler/OpenGL/ShaderCompiler.cs
@@ -302,6 +302,10 @@ private string Compile(string shaderSource, string entryPoint, ShaderStage stage
// Defines the ordering of resource groups in Vulkan. This is mirrored in the PipelineState
var resourceGroups = reflection.ResourceBindings.Select(x => x.ResourceGroup ?? "Globals").Distinct().ToList();

// Register "NoSampler", required by HLSL=>GLSL translation to support HLSL such as texture.Load().
var noSampler = new EffectResourceBindingDescription { KeyInfo = { KeyName = "NoSampler" }, RawName = "NoSampler", Class = EffectParameterClass.Sampler, SlotStart = -1, SlotCount = 1 };
reflection.ResourceBindings.Add(noSampler);

var bindings = resourceGroups.SelectMany(resourceGroup => reflection.ResourceBindings
.Where(x => x.ResourceGroup == resourceGroup || (x.ResourceGroup == null && resourceGroup == "Globals"))
.GroupBy(x => new { KeyName = x.KeyInfo.KeyName, RawName = x.RawName, Class = x.Class, Type = x.Type, SlotCount = x.SlotCount, LogicalGroup = x.LogicalGroup })

0 comments on commit cd609ad

Please sign in to comment.
You can’t perform that action at this time.