Commit graph

104 commits

Author SHA1 Message Date
Henrik Rydgård
14f9c27b4e Bounds check writing to the index buffer when expanding lines/rects/points 2023-05-02 13:21:47 +02:00
Henrik Rydgård
f40f7ed38c Make it easier to reason about space in the inds buffer by moving an offset instead of the pointer. 2023-05-02 13:09:47 +02:00
Henrik Rydgård
805591e493 Replace all uses of ToScaledDepthFromIntegerScale. 2023-02-11 13:27:44 +01:00
Henrik Rydgård
d65dae7185 Depth scale functions: Clean up the naming, add a failing test 2023-02-10 14:57:45 +01:00
Henrik Rydgård
26c748f959 Make fog-enable driven by uniform instead of fragment shader flag bit 2023-01-04 10:14:11 +01:00
Unknown W. Brackets
6584899891 GPU: Account for perspective in non-centered lines. 2022-12-26 10:13:38 -08:00
Henrik Rydgård
c25e563d13 Fix rendering of lines with the same x/y but different z.
Also enabled centered lines in WebFest homebrew.
2022-12-26 18:16:54 +01:00
Unknown W. Brackets
a7b7bf7826 Global: Set many read-only params as const.
This makes what they do and which args to use clearer, if nothing else.
2022-12-10 21:13:36 -08:00
Henrik Rydgård
e6f0f84a45 SSE optimize Float4ToUint8x4, some uses 2022-12-01 16:32:23 +01:00
Henrik Rydgård
d02f46cb27 Minor VertexReader optimizations 2022-12-01 16:00:47 +01:00
Henrik Rydgård
72029b678a 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;
```
2022-11-27 23:16:16 +01:00
Unknown W. Brackets
3de2557ecb GPU: Always skin in decode for software transform. 2022-11-06 08:55:07 -08:00
Unknown W. Brackets
6c36f03a0d GPU: Purify vertTypeIsSkinningEnabled(). 2022-11-06 08:40:54 -08:00
Henrik Rydgård
9b8a5d1db3 Rename GPU_SUPPORTS_ to GPU_USE_ 2022-10-17 08:47:03 +02:00
Henrik Rydgård
daca0b2109 Rename gstate_c.Supports to gstate_c.Use 2022-10-17 08:46:37 +02:00
Unknown W. Brackets
97ae4ae712 GPU: Correct flat normal projection mapping. 2022-09-26 15:11:11 -07:00
Unknown W. Brackets
34a8056017 GPU: Correct normalized zero normal proj map.
Unlike lighting, this does not use 0, 0, 1.
2022-09-26 15:11:11 -07:00
Unknown W. Brackets
0a24004eac GPU: Account for w properly in lines, fixing width.
See #15756.
2022-09-20 15:12:16 -07:00
Henrik Rydgård
751afde7c9 Echochrome lines: Remove UV offsets, avoid reading the destination (much better codegen) 2022-06-11 11:22:29 +02:00
Henrik Rydgård
c82d8a04e0 Add centered line drawing for Echochrome. 2022-06-11 00:20:35 +02:00
Henrik Rydgård
493c17647a Take the absolute value when measuring pixel size for line expansion.
Fixes issues in Echochrome. Though still doesn't look fantastic.
2022-06-11 00:03:40 +02:00
Unknown W. Brackets
001d67b711
GPU: Remove explicit rect/line depth cull.
This appears to be breaking NFS (#15129) and isn't fully correct since
the triangles are still later checked anyway.
2021-12-13 23:07:26 -08:00
Henrik Rydgård
c07068f89b Fix text wrapping on PromptScreen by improving the layout 2021-12-13 22:42:03 +01:00
Henrik Rydgård
b85a7e9a46 Name uniform buffers, add more asserts. Used this to track down the bug fixed in the previous commit. 2021-12-10 21:01:01 +01:00
Unknown W. Brackets
ec1d980b30 GPU: Sort line verts to correct bias.
We want it to consistently go down and right.  This improves Persona 2 UI
significantly (see #3332.)
2021-11-02 21:57:00 -07:00
Unknown W. Brackets
76e1690646 GPU: Keep diagonal lines the same width. 2021-10-31 15:49:20 -07:00
Unknown W. Brackets
2718e81c0e GPU: Expand lines to triangles. 2021-10-31 14:46:46 -07:00
Unknown W. Brackets
ea6d0f07e4 GPU: Correct point width/height.
Oops, shouldn't be half in 3D transform.
2021-10-31 13:19:51 -07:00
Unknown W. Brackets
b3a8e013f6 GPU: Expand points into triangles for higher res. 2021-10-31 13:06:06 -07:00
Unknown W. Brackets
4fb09859fd GPU: Refactor out rectangle expansion.
Just so it's cleaner when the same is done for lines.
2021-10-31 11:09:04 -07:00
Unknown W. Brackets
bffa68a566 GPU: Cleanup comments on swtranform cull. 2021-10-31 07:22:59 -07:00
Unknown W. Brackets
5128480d74 GPU: Implement cull behavior in sw transform. 2021-10-30 21:04:16 -07:00
Unknown W. Brackets
7edfdd2cdd GPU: Rename pos/uv w for clarity. 2021-10-30 21:04:00 -07:00
Unknown W. Brackets
b4bc4c5c78 GPU: Remove buggy rectangle culling.
Transformed rectangles are uncommon, but culling them properly is a bit
trickier than this, so remove for now.
2021-10-30 18:26:23 -07:00
Unknown W. Brackets
e688bb2cdf GPU: Correct software transform projection.
Now reading the new fog value.
2021-10-30 18:23:58 -07:00
Unknown W. Brackets
4ec75de0e7 GPU: Add fog separately for swtransform verts.
At this point, still being processed wrong, this just changes the
attribute structure.
2021-10-30 18:22:54 -07:00
Unknown W. Brackets
4e5ce403b5 GPU: Process proj matrix in sw transform.
Will need this to properly handle culling and clipping in software
transform.

Temporarily breaks display rotation handling (Vulkan/UWP.)
2021-10-30 18:22:53 -07:00
Unknown W. Brackets
159eab5141 GPU: Set projection matrix per backend.
There's a bit of variance, so this keeps the central code clean.
2021-10-30 18:20:36 -07:00
Unknown W. Brackets
3730460bc5 GPU: Move swtransform flippedY to params. 2021-10-30 18:17:22 -07:00
Unknown W. Brackets
6252241c0f GPU: Verify throughmode for clears/rects. 2021-10-12 20:34:41 -07:00
Unknown W. Brackets
4ac36cb810 GPU: Cull rectangles more when depth clamp off.
If any vert is outside Z, it's culled when not clamping/clipping.
2021-10-12 20:34:41 -07:00
Unknown W. Brackets
5315c404c5 GPU: Cull rectangles outside valid Z.
Both TL and BR must be outside in the same direction to be culled when
depth clamp is enabled.
2021-10-12 20:34:41 -07:00
Unknown W. Brackets
2f63f9999d GPU: Normalize 0 to 1 always in software lighting.
See #14167.  This seems to be consistent.
2021-02-27 23:51:45 -08:00
Unknown W. Brackets
60b354a661 GPU: Fix safe size checks when rect offscreen. 2021-01-17 19:57:32 -08:00
Henrik Rydgård
0e3a84b4a8 Move most GPU things to Common.
It works after the move, on Windows and Android at least.

Deletes the D3DX9 shader compiler loader, which was not used.
2020-10-04 23:39:02 +02:00
Henrik Rydgård
9e41fafd0d Move math and some file and data conversion files out from native to Common.
Buildfixing

Move some file util files

Buildfix

Move KeyMap.cpp/h to Core where they belong better.

libretro buildfix attempt

Move ini_file

More buildfixes
2020-10-04 09:12:46 +02:00
Unknown W. Brackets
5ade93a091 GPU: Properly detect clears.
The check was reversed before, oops.  Detected masked draws.

Must've gotten this backwards debugging Mana Khemia.
2020-08-23 08:23:39 -07:00
Henrik Rydgård
d57edfbdac Rename FramebufferCommon.cpp/h to FramebufferManagerCommon.cpp/h for consistency 2020-08-03 23:17:22 +02:00
Unknown W. Brackets
1432cc9431 GPU: Try a bit harder to determine safe size. 2020-05-23 00:54:22 -07:00
Unknown W. Brackets
ea1f0a1195 Vulkan: Match safe size behavior on all backends.
Before, we would not mark a safe size for some Vulkan clears where depth
was not cleared, deviating from other backends.  We also never detected
that on PowerVR.  This makes things more consistent.
2020-05-23 00:25:39 -07:00