Fixes missing SPIR-V shader combinations.

We have multiple renderer backends for a while. So we can't rely on
a single CONFIG_GLES2 macro for disabling features.
This commit is contained in:
Vladislav Belov 2025-01-07 02:49:38 +01:00
parent 16c0db12a9
commit 8ee48a164a
No known key found for this signature in database
GPG key ID: 353545E45DB9CCB3
2 changed files with 20 additions and 10 deletions

View file

@ -226,9 +226,13 @@ void CSceneRenderer::ReloadShaders(Renderer::Backend::IDevice* device)
ENSURE(1 <= cascadeCount && cascadeCount <= 4);
const CStrIntern cascadeCountStr[5] = {str_0, str_1, str_2, str_3, str_4};
m->globalContext.Add(str_SHADOWS_CASCADE_COUNT, cascadeCountStr[cascadeCount]);
#if !CONFIG2_GLES
m->globalContext.Add(str_USE_SHADOW_SAMPLER, str_1);
#if CONFIG2_GLES
const bool useShadowSampler{device->GetBackend() != Renderer::Backend::Backend::GL};
#else
const bool useShadowSampler{true};
#endif
if (useShadowSampler)
m->globalContext.Add(str_USE_SHADOW_SAMPLER, str_1);
}
m->globalContext.Add(str_RENDER_DEBUG_MODE,

View file

@ -549,16 +549,22 @@ void ShadowMapInternals::CreateTexture()
Renderer::Backend::Sampler::AddressMode::CLAMP_TO_EDGE));
}
#if CONFIG2_GLES
// GLES doesn't do depth comparisons, so treat it as a
// basic unfiltered depth texture
const Renderer::Backend::Sampler::Filter depthFilter{
Device->GetBackend() == Renderer::Backend::Backend::GL
? Renderer::Backend::Sampler::Filter::NEAREST
: Renderer::Backend::Sampler::Filter::LINEAR};
#else
// Use LINEAR to trigger automatic PCF on some devices.
const Renderer::Backend::Sampler::Filter depthFilter{
Renderer::Backend::Sampler::Filter::LINEAR};
#endif
Renderer::Backend::Sampler::Desc samplerDesc =
Renderer::Backend::Sampler::MakeDefaultSampler(
#if CONFIG2_GLES
// GLES doesn't do depth comparisons, so treat it as a
// basic unfiltered depth texture
Renderer::Backend::Sampler::Filter::NEAREST,
#else
// Use LINEAR to trigger automatic PCF on some devices.
Renderer::Backend::Sampler::Filter::LINEAR,
#endif
depthFilter,
Renderer::Backend::Sampler::AddressMode::CLAMP_TO_EDGE);
// Enable automatic depth comparisons
samplerDesc.compareEnabled = true;