Skip to content

Commit 19ecc1d

Browse files
committed
Using GL_EXT_samplerless_texture_functions instead of NoSampler
1 parent 8819d65 commit 19ecc1d

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

sources/engine/Stride.Graphics/Vulkan/CommandList.Vulkan.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ public unsafe void ResourceBarrierTransition(GraphicsResource resource, Graphics
460460
case GraphicsResourceState.PixelShaderResource:
461461
texture.NativeLayout = VkImageLayout.ShaderReadOnlyOptimal;
462462
texture.NativeAccessMask = VkAccessFlags.ShaderRead;
463-
texture.NativePipelineStageMask = VkPipelineStageFlags.FragmentShader | VkPipelineStageFlags.ComputeShader; // TODO: Not sure why I did this can probably double check ...
463+
texture.NativePipelineStageMask = VkPipelineStageFlags.FragmentShader | VkPipelineStageFlags.ComputeShader;
464464
break;
465465
case GraphicsResourceState.GenericRead:
466466
texture.NativeLayout = VkImageLayout.General;

sources/engine/Stride.Shaders.Compiler/OpenGL/ShaderCompiler.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,6 @@ private string Compile(string shaderSource, string entryPoint, ShaderStage stage
295295

296296
if (shaderPlatform == GlslShaderPlatform.Vulkan)
297297
{
298-
// Register "NoSampler", required by HLSL=>GLSL translation to support HLSL such as texture.Load().
299-
var noSampler = new EffectResourceBindingDescription { KeyInfo = { KeyName = "NoSampler" }, RawName = "NoSampler", Class = EffectParameterClass.Sampler, SlotStart = -1, SlotCount = 1 };
300-
reflection.ResourceBindings.Add(noSampler);
301-
302-
// Make sure it's a point sampler as some texture formats do not support linear sampling which will result in validation errors.
303-
reflection.SamplerStates.Add(new EffectSamplerStateBinding("NoSampler", new SamplerStateDescription(TextureFilter.Point, TextureAddressMode.Clamp)));
304-
305298
// Defines the ordering of resource groups in Vulkan. This is mirrored in the PipelineState
306299
var resourceGroups = reflection.ResourceBindings.Select(x => x.ResourceGroup ?? "Globals").Distinct().ToList();
307300

@@ -370,6 +363,8 @@ private string Compile(string shaderSource, string entryPoint, ShaderStage stage
370363
glslShaderWriter.Extensions.Add("GL_EXT_shader_image_load_formatted");
371364
}
372365

366+
glslShaderWriter.Extensions.Add("GL_EXT_samplerless_texture_functions");
367+
373368
// Write shader
374369
glslShaderWriter.Visit(glslShader);
375370

sources/shaders/Stride.Core.Shaders/Convertor/HlslToGlslConvertor.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2549,10 +2549,6 @@ private void GenerateSamplerMappingAndStrip()
25492549
AddGlobalDeclaration(textureSampler.Value);
25502550
}
25512551
}
2552-
else
2553-
{
2554-
AddGlobalDeclaration(new Variable(StateType.SamplerState, "NoSampler"));
2555-
}
25562552
}
25572553

25582554
/// <summary>
@@ -3751,7 +3747,7 @@ private Expression GetGLSampler(Variable sampler, Variable texture, bool forceNu
37513747
}
37523748
else
37533749
{
3754-
return new MethodInvocationExpression(new TypeReferenceExpression(glslSampler.Type), new VariableReferenceExpression(texture), new VariableReferenceExpression("NoSampler"));
3750+
return new VariableReferenceExpression(texture);
37553751
}
37563752
}
37573753

0 commit comments

Comments
 (0)