From 5f97d36793a6defba64f2c1a2d3fb5cffcc3d21d Mon Sep 17 00:00:00 2001 From: turanszkij Date: Mon, 23 Apr 2018 14:23:53 +0100 Subject: [PATCH] vulkan: samplecmplevelzero in GS was rejected by driver, hotfix --- WickedEngine/lensFlareGS.hlsl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/WickedEngine/lensFlareGS.hlsl b/WickedEngine/lensFlareGS.hlsl index 8db59001b..84ae9a845 100644 --- a/WickedEngine/lensFlareGS.hlsl +++ b/WickedEngine/lensFlareGS.hlsl @@ -99,12 +99,15 @@ void main(point InVert p[1], inout TriangleStream triStream) for (float x = -range.x; x <= range.x; x += step.x) { samples += 1.0f; +#ifndef SHADERCOMPILER_SPIRV // SampleCmpLevelZero also makes a comparison by using a comparison sampler // It compares the reference depth value to the depthmap value. - // Returns 0.0 if all samples in a bilinear kernel are greater than reference value - // Returns 1.0 if all samples in a bilinear kernel are less or equal than refernce value // Can return in between values based on bilinear filtering accdepth += texture_depth.SampleCmpLevelZero(samplercmp, xSunPos.xy + float2(x, y), referenceDepth).r; +#else + // But samplecmplevelzero seems to not work in GS with my vulkan driver? + accdepth += texture_depth.SampleLevel(sampler_point_clamp, xSunPos.xy + float2(x, y), 0).r >= referenceDepth ? 1 : 0; +#endif } } accdepth /= samples;