diff --git a/Source/Shaders/ShadowsSampling.hlsl b/Source/Shaders/ShadowsSampling.hlsl index c2b67301e..598a22748 100644 --- a/Source/Shaders/ShadowsSampling.hlsl +++ b/Source/Shaders/ShadowsSampling.hlsl @@ -11,13 +11,16 @@ #endif #if FEATURE_LEVEL >= FEATURE_LEVEL_SM5 -#define SAMPLE_SHADOW_SAMPLER ShadowSamplerLinear -#define SAMPLE_SHADOW_MAP(shadowMap, shadowUV, sceneDepth) shadowMap.SampleCmpLevelZero(SAMPLE_SHADOW_SAMPLER, shadowUV, sceneDepth) -#define SAMPLE_SHADOW_MAP_OFFSET(shadowMap, shadowUV, texelOffset, sceneDepth) shadowMap.SampleCmpLevelZero(SAMPLE_SHADOW_SAMPLER, shadowUV, sceneDepth, texelOffset) +#define SAMPLE_SHADOW_MAP(shadowMap, shadowUV, sceneDepth) shadowMap.SampleCmpLevelZero(ShadowSamplerLinear, shadowUV, sceneDepth) +#define SAMPLE_SHADOW_MAP_OFFSET(shadowMap, shadowUV, texelOffset, sceneDepth) shadowMap.SampleCmpLevelZero(ShadowSamplerLinear, shadowUV, sceneDepth, texelOffset) #else -#define SAMPLE_SHADOW_SAMPLER SamplerLinearClamp -#define SAMPLE_SHADOW_MAP(shadowMap, shadowUV, sceneDepth) (sceneDepth < shadowMap.SampleLevel(SAMPLE_SHADOW_SAMPLER, shadowUV, 0).r) -#define SAMPLE_SHADOW_MAP_OFFSET(shadowMap, shadowUV, texelOffset, sceneDepth) (sceneDepth < shadowMap.SampleLevel(SAMPLE_SHADOW_SAMPLER, shadowUV, 0, texelOffset).r) +#define SAMPLE_SHADOW_MAP(shadowMap, shadowUV, sceneDepth) (sceneDepth < shadowMap.SampleLevel(SamplerLinearClamp, shadowUV, 0).r) +#define SAMPLE_SHADOW_MAP_OFFSET(shadowMap, shadowUV, texelOffset, sceneDepth) (sceneDepth < shadowMap.SampleLevel(SamplerLinearClamp, shadowUV, 0, texelOffset).r) +#endif +#if VULKAN || FEATURE_LEVEL < FEATURE_LEVEL_SM5 +#define SAMPLE_SHADOW_MAP_SAMPLER SamplerPointClamp +#else +#define SAMPLE_SHADOW_MAP_SAMPLER SamplerLinearClamp #endif float4 GetShadowMask(ShadowSample shadow) @@ -278,7 +281,7 @@ ShadowSample SampleDirectionalLightShadow(LightData light, Buffer shadow { float opacity = gBuffer.CustomData.a; shadowMapUV = GetLightShadowAtlasUV(shadow, shadowTile, gBuffer.WorldPos, shadowPosition); - float shadowMapDepth = shadowMap.SampleLevel(SAMPLE_SHADOW_SAMPLER, shadowMapUV, 0).r; + float shadowMapDepth = shadowMap.SampleLevel(SAMPLE_SHADOW_MAP_SAMPLER, shadowMapUV, 0).r; result.TransmissionShadow = CalculateSubsurfaceOcclusion(opacity, shadowPosition.z, shadowMapDepth); result.TransmissionShadow = PostProcessShadow(shadow, result.TransmissionShadow); } @@ -339,7 +342,7 @@ ShadowSample SampleLocalLightShadow(LightData light, Buffer shadowsBuffe { float opacity = gBuffer.CustomData.a; shadowMapUV = GetLightShadowAtlasUV(shadow, shadowTile, gBuffer.WorldPos, shadowPosition); - float shadowMapDepth = shadowMap.SampleLevel(SAMPLE_SHADOW_SAMPLER, shadowMapUV, 0).r; + float shadowMapDepth = shadowMap.SampleLevel(SAMPLE_SHADOW_MAP_SAMPLER, shadowMapUV, 0).r; result.TransmissionShadow = CalculateSubsurfaceOcclusion(opacity, shadowPosition.z, shadowMapDepth); result.TransmissionShadow = PostProcessShadow(shadow, result.TransmissionShadow); }