Skip to content
Permalink
Browse files

[Shaders] Make sure NoSampler is added before computing list of resou…

…rce groups (otherwise it ends up having no location attribute)
  • Loading branch information
xen2 committed Sep 6, 2019
1 parent cb9b317 commit f98890115e4c3d0d80e7768eb3c98797151a0151
Showing with 3 additions and 3 deletions.
  1. +3 −3 sources/engine/Xenko.Shaders.Compiler/OpenGL/ShaderCompiler.cs
@@ -299,13 +299,13 @@ private string Compile(string shaderSource, string entryPoint, ShaderStage stage

if (shaderPlatform == GlslShaderPlatform.Vulkan)
{
// 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);

// 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();

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, ElementType = x.ElementType.Type, SlotCount = x.SlotCount, LogicalGroup = x.LogicalGroup })

0 comments on commit f988901

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