[orx-dnk3] Work-around problems with GLES back-end

This commit is contained in:
Edwin Jakobs
2025-11-08 17:17:20 +01:00
parent 97752e9cf1
commit e21683640d
4 changed files with 7 additions and 5 deletions

View File

@@ -109,7 +109,7 @@ class ViewDepthFacet : ColorBufferFacetCombiner(setOf(FacetType.VIEW_POSITION),
override fun generateShader(): String = "o_$targetOutput.r = v_viewPosition.z;"
}
class ClipDepthFacet : ColorBufferFacetCombiner(setOf(FacetType.CLIP_POSITION), "clipDepth", ColorFormat.R, ColorType.FLOAT32) {
override fun generateShader(): String = "o_$targetOutput.r = gl_FragCoord.z;"
override fun generateShader(): String = "o_$targetOutput = gl_FragCoord.z;"
}

View File

@@ -644,7 +644,7 @@ class PBRMaterial : Material {
light.projection(it) * look)
if (light.shadows is Shadows.DepthMappedShadows) {
shadeStyle.parameter("lightShadowMap$index", it.depthBuffer ?: TODO())
shadeStyle.parameter("lightShadowMap$index", it.depthBuffer?:error("no depth buffer for $it"))
}
if (light.shadows is Shadows.ColorMappedShadows) {

View File

@@ -20,7 +20,7 @@ val IrradianceProbePass = RenderPass(listOf(DiffuseIrradianceFacet()))
val DefaultOpaquePass = RenderPass(listOf(LDRColorFacet()), renderOpaque = true, renderTransparent = false)
val DefaultTransparentPass = RenderPass(listOf(LDRColorFacet()), renderOpaque = false, renderTransparent = true, depthWrite = false)
val LightPass = RenderPass(emptyList())
val LightPass = RenderPass(listOf(ClipDepthFacet()))
val VSMLightPass = RenderPass(listOf(MomentsFacet()))
fun RenderPass.createPassTarget(width: Int, height: Int, depthFormat: DepthFormat = DepthFormat.DEPTH24, multisample: BufferMultisample = this.multisample): RenderTarget {
@@ -31,6 +31,10 @@ fun RenderPass.createPassTarget(width: Int, height: Int, depthFormat: DepthForma
colorBuffer(combiner.targetOutput, combiner.format, combiner.type)
}
}
// Temporary fix for GLES back-end
if (combiners.isEmpty()) {
colorBuffer()
}
depthBuffer(depthFormat)
}
}

View File

@@ -86,8 +86,6 @@ class SceneRenderer {
val mapSize = (shadowLight.shadows as Shadows.MappedShadows).mapSize
pass.createPassTarget(mapSize, mapSize, DepthFormat.DEPTH_STENCIL)
}
target.clearDepth(depth = 1.0)
val look = shadowLight.view(it.node)
val materialContext = MaterialContext(pass, context.lights, context.fogs, shadowLightTargets, emptyMap(), 0)
drawer.isolatedWithTarget(target) {