Empirical attempt at fixing #15661

Basically, software culling fails in some configuration, like the one we
end up with on Mali.

As noted by unknownbrackets in #15661, the viewport Z scale, offset is -0.0, 0.0.

We end up with CalcCullParams computing minZValue == maxZValue == 1.0f,
and with the vertices ending up with z,w == 1.0, 1.0.
and as a result, the inside/outside calculations will always decide that
it's outside.

Changing the comparisons from >= / <= to > / < fixes the problem, but I
don't know if this might break something else.

Anyhow, here's the simple way to repro on PC:

Change the ending of GPU_Vulkan::CheckFeatures to:

```c
	return GPU_USE_LIGHT_UBERSHADER | GPU_USE_BLEND_MINMAX | GPU_USE_TEXTURE_NPOT | GPU_USE_INSTANCE_RENDERING |
		GPU_USE_VERTEX_TEXTURE_FETCH | GPU_USE_TEXTURE_FLOAT | GPU_USE_16BIT_FORMATS | GPU_USE_TEXTURE_LOD_CONTROL |
		GPU_USE_DEPTH_TEXTURE | GPU_USE_ACCURATE_DEPTH;
```
This commit is contained in:
Henrik Rydgård 2022-11-27 23:16:16 +01:00
parent 200e2f26c4
commit 72029b678a

View file

@ -600,9 +600,9 @@ void SoftwareTransform::BuildDrawingParams(int prim, int vertexCount, u32 vertTy
// First, check inside/outside directions for each index.
for (int i = 0; i < vertexCount; ++i) {
float z = transformed[indsIn[i]].z / transformed[indsIn[i]].pos_w;
if (z >= maxZValue)
if (z > maxZValue)
outsideZ[i] = 1;
else if (z <= minZValue)
else if (z < minZValue)
outsideZ[i] = -1;
else
outsideZ[i] = 0;