Commit Graph

34 Commits

Author SHA1 Message Date
Henrik Rydgård
dae92b41fb Safer spongebob depth inverse check, includes color check and depth func 2022-08-28 07:25:08 +02:00
Henrik Rydgård
df92f72ac3 Unify the spongebob depth inverse check 2022-08-28 07:11:00 +02:00
Unknown W. Brackets
b5a4843c1f GPU: Purify ConvertViewportAndScissor().
This makes it harder to misuse.  See #15856.
2022-08-20 14:21:11 -07:00
Henrik Rydgård
73fc9fb520 OpenGL fix 2022-08-01 11:57:22 +02:00
Henrik Rydgård
c9a37ec6b9 Remove bool that was always true in state mapping. 2022-07-24 21:04:54 +02:00
Henrik Rydgård
462972f7ea Add option to redirect blue to alpha if 565 mode is rendered and mask is 0x0FFFFF.
This is used by several games to render to the alpha channel of RGBA4444
images, which cannot normally be done directly on the PSP.

Can be used as a far more efficient replacement for
ReinterpretFramebuffers/ShaderColorBitmask
2022-04-30 18:17:16 +02:00
Henrik Rydgård
6bc7a699fe Minor cleanups in framebuffer manager 2022-04-30 18:14:53 +02:00
Henrik Rydgård
32df78a2cc Make the existing ReinterpretFramebuffers/ShaderColorBitmask path work for Split/Second
It took writing and debugging #15500 for me to understand what the issue with the old path was..

Much simpler alternative to #15500, or we could merge both but disable Split/Second
for this one. Needs some benchmarks I guess...
2022-04-25 00:11:09 +02:00
Henrik Rydgård
45308a16c0 Vulkan is strict about scissor rect, so let's clamp centrally.
Better than spreading the logic all over.

Fixes #15207
2021-12-08 22:38:01 +01:00
Henrik Rydgård
6310af25fa Get shader color write masking going on all backends. 2020-11-08 23:45:47 +01:00
Henrik Rydgård
793e89d2e3 Fix some comments, rename a function. 2020-11-08 14:34:04 +01:00
Henrik Rydgård
3d289594f9 ShaderBlend and FramebufferRead are separate concepts. Reflect that in naming.
The former has forms that don't need to read the framebuffer.

This exposes that some logic is wrong...
2020-11-08 12:54:05 +01:00
Henrik Rydgård
e6dfb55d3d Optimize value conversion in (unused) depth readback.
This also exposes factors we can feed into shaders to do the conversion
on the GPU.
2020-08-09 10:47:01 +02:00
Unknown W. Brackets
30ede8240c GPU: Move hw transform decision to draw engine. 2020-04-04 11:14:32 -07:00
Unknown W. Brackets
b955ec70c9 GPU: Correct depth clamp range in range cull.
It was just wrong before, causing wrong culling when using a non-standard
viewport scale/center for depth.

Fixes #11701, fixes #11781.
2019-02-10 09:58:01 -08:00
Unknown W. Brackets
5932cbabc3 GPU: Avoid stencil emulation if possible.
This reduces use of replaceAlpha, and reduces use of more complicated
blend states.  This simplifies fragment shaders a little.
2018-12-01 14:05:29 -08:00
Unknown W. Brackets
5ad948df73 Vulkan: Avoid discard when we can blend.
Where possible, replace alpha and color testing with a zero alpha value.

This allows early fragment tests more often, which may help #11227.  It
may also generally help performance on PowerVR devices.
2018-07-27 20:04:36 -07:00
Henrik Rydgard
f5fa238e22 More minor changes to make GPU and native build on UWP later 2017-02-24 20:26:38 +01:00
Henrik Rydgård
674937a520 Extend some enums with potentially useful values 2016-12-27 11:59:12 +01:00
Unknown W. Brackets
e00c9940e8 Correct pixel depth rounding. 2016-01-19 20:19:50 -08:00
Unknown W. Brackets
6ef97f72d2 gedbg: Show scaled depth values properly. 2016-01-19 07:23:06 -08:00
Unknown W. Brackets
d1b3768e49 Use a common func everywhere for float depth vals. 2016-01-18 19:29:45 -08:00
Unknown W. Brackets
529abd7db4 Correct clamped depth range from [0, 65535].
This changes a few things:
 * All backends clamp the depth range and keep it positive.
 * The depth rounding uniform is now properly dirtied.
 * Projection is updated to translate and scale appropriately.
 * Depth rounding is halved on OpenGL to account for [-1, 1] range.

Fixes Phantasy Star Portable 2 without the need for a game-specific hack.
2016-01-03 12:29:43 -08:00
Unknown W. Brackets
c31a8f860b Adjust stencil ops for 5551 and 565 buffers.
This attempts to better approximate the operations that actually happen,
where possible.  Expected to help #5278.
2015-12-31 17:01:03 -08:00
Unknown W. Brackets
13a09647e2 d3d9: Disable shader blending, not implemented.
Fixes bad graphics in Ridge Racer, etc.
2015-11-13 23:11:06 -08:00
Henrik Rydgard
df94914a63 D3D: No need to convert blendcolor to float and back
Fix bug with constantAlpha

Remove misleading comment, thanks unknown
2015-11-12 18:11:23 +01:00
Henrik Rydgard
4a71d4cda2 The ConvertBlendState machinery is now pure, so move it out to GPU/Common 2015-11-12 18:11:20 +01:00
Henrik Rydgard
091fb28f55 Extract the glstate.blendcolor call from ConvertBlendState 2015-11-12 18:11:19 +01:00
Henrik Rydgard
71103cb0ca Make ConvertBlendState into a reasonably pure function with no side effects 2015-11-12 18:11:15 +01:00
Henrik Rydgard
e97d771e0f Extract blend state mapping into a function. 2015-11-12 15:57:33 +01:00
Henrik Rydgard
a6ced1d0b4 Move viewport/stencil conversion out into GPUStateUtils.cpp, use it in D3D as well.
D3D bugfixes. Not perfect yet.
2015-11-09 21:21:54 +01:00
Unknown W. Brackets
2b832e7f6c Zero out dst blend factors in 565. 2015-11-04 00:35:55 -08:00
Henrik Rydgard
edafa9bc17 Centralize the GPU state conversion functions 2015-10-24 23:49:05 +02:00
Unknown W. Brackets
e1df8fc45f Centralize sampling params and test optimizations. 2015-09-13 06:38:07 -07:00