Commit Graph

8017 Commits

Author SHA1 Message Date
Unknown W. Brackets
bad4a93d3c D3D11: Correct depth readback. 2022-10-09 15:50:50 -07:00
Unknown W. Brackets
55d5dc3834 GPU: Rename readback and buffer write operations.
Avoid download/upload and pack, which don't have clear directions.
2022-10-09 13:49:41 -07:00
Unknown W. Brackets
d83f736b1f D3D9: Correct depth readback. 2022-10-09 13:21:04 -07:00
Henrik Rydgård
0c4935f336 Depal from dynamic CLUT: When detecting bounds, be more conservative.
Followup to #16188 .

Further fixes the lens flare.

It confused me before that there are two sections of the track on
Sunset Drive where the sun is visible, but only on the second is the
lens flare sprite actually shown, which is rather weird.

Verified that exactly the same thing happens on hardware, so it's not a
an emulation problem! Rather seems like a glitch in the game itself.
2022-10-09 20:57:06 +02:00
Henrik Rydgård
9422b05ee3 Fix depal bounds with dynamic CLUT. Fixes lens flare glitches in Ridge Racer
With this wrong, we ended up drawing pixels that came from a DONT_CARE
init of the depal temp buffer, which was a pile of garbage on Android
and blank on PC.

Now, we seem to end up not drawing anything because the depal operation
results in transparent black into whatever is actually intended, but at
least the screen isn't full of glitches when the sun is visible on Adreno.

See issue #16083
2022-10-09 20:27:45 +02:00
Henrik Rydgård
28bc45451c
Merge pull request #16184 from unknownbrackets/depth-download
GPU: Hook Gods Eater Burst avatar read
2022-10-09 16:37:42 +02:00
Henrik Rydgård
49de375bff
Merge pull request #16183 from unknownbrackets/depth-usage
GPU: Ignore depth when masked and ALWAYS
2022-10-09 10:41:40 +02:00
Unknown W. Brackets
ad3220f857 GLES: Hook up depth download.
Currently, only used by one hook.
2022-10-09 01:08:04 -07:00
Unknown W. Brackets
bc84d6345b Vulkan: Disable geometry shaders for Mali <= 18.
These drivers apparently have some weird behavior.
2022-10-09 00:57:10 -07:00
Unknown W. Brackets
d0eb14ec02 GPU: Correct sizing account on block transfer. 2022-10-09 00:54:59 -07:00
Unknown W. Brackets
e7e7528fbc GPU: Consider depth buffers in block transfer.
Right now, only with an explicit flag (not yet used.)
2022-10-09 00:50:45 -07:00
Unknown W. Brackets
b2ce4d2c3f GPU: Refuse to set fb_address == z_address.
We don't do it when creating framebufs either, so don't update to
matching values.
2022-10-08 17:50:18 -07:00
Unknown W. Brackets
7d331f1928 GPU: Ignore depth when masked and ALWAYS.
Seen in NFS Pro Street, for example.  Shouldn't be interpreted as depth
usage.
2022-10-08 17:49:25 -07:00
Unknown W. Brackets
157ffed57f D3D9: Add simple rendered CLUT handling.
I think there's still a deeper half-pixel offset issue, but this fixes
Brave Story.
2022-10-08 15:36:36 -07:00
Henrik Rydgård
bf25f4b283 Shader uniforms (VK/D3D11): Fix issue where we could overwrite the fourth component padding. 2022-10-06 10:52:58 +02:00
Unknown W. Brackets
3aa863ec41 GPU: Clip against neg Z even w/o cull support.
This should fix rendering issues on Apple devices.
2022-10-06 00:34:02 -07:00
Henrik Rydgård
87d00f79da
Merge pull request #16165 from unknownbrackets/geo-shader
Vulkan: Clip clamped depth in geometry shader
2022-10-06 09:18:08 +02:00
Henrik Rydgård
3da1b46104
Merge pull request #16166 from unknownbrackets/hwtess
GPU: Verify generated shader buffer length
2022-10-06 08:24:46 +02:00
Unknown W. Brackets
aee2ad46a2 GPU: Verify generated shader buffer length.
Hardware tessellation + uberlighting + clamp was exceeding the buffer,
causing memory corruption.  Let's try to catch it, but also increase
buffers to be safe.
2022-10-05 21:41:09 -07:00
Unknown W. Brackets
bc3d3cf9fb GPU: Optimize clip distances needed.
We only need to write one clip distance to clip clamped depth, since we
don't clamp when it needs clipping on both sides.
2022-10-05 21:17:17 -07:00
Unknown W. Brackets
14bf9d1923 Vulkan: Correct clamped Z clip when clipping neg Z.
In the geometry shader, if used, we need to output the clip distance from
the clamped Z clip or it gets lost.
2022-10-05 20:48:38 -07:00
Unknown W. Brackets
8663541403 Vulkan: Avoid max_vertices=12 if unnecessary. 2022-10-05 20:11:10 -07:00
Unknown W. Brackets
3e5c09d432 Vulkan: Clip clamped depth in geometry shader.
This corrects deformed geometry on Mali devices which don't support
user-space clipping but do support depth clamp.
2022-10-05 19:41:59 -07:00
Henrik Rydgård
d6bd08cae7
Merge pull request #16162 from unknownbrackets/geo-shader
Implement negative Z clipping in geometry shader
2022-10-06 01:00:41 +02:00
Unknown W. Brackets
5d88e50201 Vulkan: Generate indices in clipping. 2022-10-04 23:04:25 -07:00
Unknown W. Brackets
f24edbe8a8 Compat: Remove DisableRangeCulling.
This hack was used because culling previously incorrectly handled Z, which
was fixed in #14833.
2022-10-04 22:19:40 -07:00
Unknown W. Brackets
8025def8d2 Vulkan: Clip to neg z in the geometry shader.
This is only used when clip distance is unsupported, such as on Mali.
2022-10-04 22:10:24 -07:00
Henrik Rydgård
362391b9d8 Fix Kurohyou again. See #9576 2022-10-04 20:56:41 +02:00
Henrik Rydgård
b333695cd1
Merge pull request #16160 from unknownbrackets/vram-mirrors
GPU: Use flags to fix triggered upload/download
2022-10-04 08:45:06 +02:00
Unknown W. Brackets
9ac4523fd2 GPU: Skip matching a framebuf for RAM. 2022-10-03 20:22:27 -07:00
Unknown W. Brackets
a1efed31b9 GPU: Use flags to fix triggered upload/download.
No longer using mirror hacks.
2022-10-03 20:17:25 -07:00
Henrik Rydgård
1469a32a9d Vertex decoder: Add fallback for non-SSE4.1
See #16157
2022-10-03 19:06:17 +02:00
Henrik Rydgård
973d0435c1 Fix another crash with non-buffered rendering 2022-10-03 19:02:16 +02:00
Henrik Rydgård
ed3cd1dc26
Merge pull request #16150 from unknownbrackets/vram-mirrors
GPU: Mask away unused bits in framebuf/zbuf ptr, cleanup
2022-10-03 11:56:24 +02:00
Herman Semenov
29b87e0c0b
Merge branch 'master' into master 2022-10-03 07:49:13 +00:00
Unknown W. Brackets
0be891c7ff softgpu: Minor opt, ignore unused z_stride. 2022-10-02 21:31:07 -07:00
Unknown W. Brackets
58a4376998 GPU: Normalize framebuf addresses.
In VRAM, always store without mirror.  In RAM, always store without
cache/kernel bits.
2022-10-02 21:28:53 -07:00
Unknown W. Brackets
73040ebb8f GE Debugger: Ignore mirrors for target in record. 2022-10-02 20:48:28 -07:00
Unknown W. Brackets
4a17ab8070 GE Debugger: Correct mask in target breakpoints. 2022-10-02 20:47:12 -07:00
Unknown W. Brackets
b9b59f7806 GPU: Mask away unused bits in framebuf/zbuf ptr.
Lower 4 bits are ignored during rendering, and mirrors (even even the 8
bit at the top) are ignored.
2022-10-02 20:44:35 -07:00
Unknown W. Brackets
4df7a8f357 Vulkan: Cleanup unused geometry shader vars.
Without clipping, these aren't used (but could be in the future with
manual clipping.)
2022-10-02 07:43:35 -07:00
Unknown W. Brackets
2832edcc37 Vulkan: Allow configuring geometry shaders on/off. 2022-10-02 07:42:22 -07:00
Unknown W. Brackets
8df956b036 Vulkan: Block geometry shaders on older Mali.
They're too slow to be usable.
2022-10-02 07:42:22 -07:00
Unknown W. Brackets
36eb0d9ad5 Vulkan: Use geo clip distance only where supported.
It might be supported without cull or GS.  Otherwise we may need to clip
the triangles manually.
2022-10-02 07:42:22 -07:00
Unknown W. Brackets
2ce0cda333 Vulkan: Enable geo shader for culling.
The compat setting was really for some previously buggy cases that
couldn't work without cull.
2022-10-02 07:42:22 -07:00
Unknown W. Brackets
bfaa304461 Vulkan: Correct geometry shader culling. 2022-10-02 07:42:17 -07:00
Henrik Rydgård
ac248338be Vulkan: Cull in geoshader, hack to on for now. 2022-10-02 07:42:17 -07:00
Henrik Rydgård
cdee10fe86 Vulkan: Basic geoshader code generation. 2022-10-02 07:42:17 -07:00
Unknown W. Brackets
fbdb278168 Vulkan: Update shader cache format for geo shaders. 2022-10-02 07:42:16 -07:00
Unknown W. Brackets
d16caa71af Vulkan: Add geometry shader ID tracking.
We're still not generating them, yet.  But this tracks the objects and
IDs through the pipeline.
2022-10-02 07:42:16 -07:00
Unknown W. Brackets
38e16324f0 Vulkan: Clean up shader module tag. 2022-10-02 07:42:16 -07:00
Unknown W. Brackets
878a049f60 GPU: Add dirtying for geo shader state.
Not yet used, but dirtied at the right times.
2022-10-02 07:42:16 -07:00
Henrik Rydgård
b36bfc37d5
Merge pull request #16139 from hrydgard/tighten-up-format-checks
Tighten up some color format checks with displays and copies
2022-10-02 15:39:51 +02:00
Henrik Rydgård
10b2263673
Merge pull request #16143 from unknownbrackets/edram-trans
Report, save, and frame dump the Edram translation value
2022-10-02 09:25:45 +02:00
Unknown W. Brackets
fcc877a0f3 GE Debugger: Fix memcpy/memset recording.
Uhh, oops.  I'm surprised I didn't notice these were broken for so long.
2022-10-01 23:48:23 -07:00
Unknown W. Brackets
978fd9fc60 GE Debugger: Record the Edram translation value. 2022-10-01 23:48:06 -07:00
Unknown W. Brackets
24999e792a Ge: Report and save Edram translation value.
See #16126 for some details on its usage and effects.
2022-10-01 23:18:42 -07:00
Unknown W. Brackets
80cccd7abb Build: Fix debug build on Windows 32-bit. 2022-10-01 17:07:27 -07:00
Henrik Rydgård
ab08db6fca Tighten up some color format checks with displays and copies
Now that we allow multiple color format buffers to overlap, and don't
just take one and change its format during copy for example, we could
use some additional checking.

Additionally, do a simple heuristic to reject "obviously" wrong copies
copies to framebuffers.

Fixes #15959, should also help #16124
2022-10-02 00:10:19 +02:00
Henrik Rydgård
151db69a32
Merge pull request #16138 from unknownbrackets/geo-shader-2
Basic groundwork for geometry shaders
2022-10-01 22:23:48 +02:00
Unknown W. Brackets
87171cef98 GPU: Add geometry path for shader writer.
Not yet used.
2022-10-01 12:45:43 -07:00
Unknown W. Brackets
59a489f883 Draw: Add COLOR1 semantic. 2022-10-01 12:14:46 -07:00
Henrik Rydgård
9ec41436d1 ES2 crash fix: Don't draw depth if lacking fragment shader depth write. 2022-10-01 19:28:52 +02:00
lainon
3cdf72b68b Better readability and optimization insertion into container by replacing 'insert' -> 'emplace', 'push_back' -> 'emplace_back' 2022-09-30 12:35:28 +03:00
lainon
c953bf7fc7 Fixed bug and memleaks 2022-09-30 12:32:49 +03:00
lainon
b304551747 Code readability, vec reserve() and remove excess c_str() 2022-09-30 12:31:32 +03:00
lainon
fec708489a Correct cleaning string and remove unused vars 2022-09-30 12:26:30 +03:00
Unknown W. Brackets
77696573f4 GE Debugger: Correct rounded coords in vertex list.
Were previously rounding to pixel, not subpixel.  Also, show out of range
values for clarity on clamping/culling.
2022-09-30 00:19:21 -07:00
Unknown W. Brackets
6468e0f03e softjit: Fix dst blend shift.
Example: src * dst.a + dst * one, still requires a shift back.
2022-09-29 22:31:50 -07:00
Unknown W. Brackets
dc90a5a851 softgpu: Avoid projecting textures in common case.
Several games appear to intentionally set the matrix flat.
2022-09-29 22:31:49 -07:00
Unknown W. Brackets
7cf05d0a46 GPU: Fix missed dirtying when fast loading tgen. 2022-09-29 22:31:07 -07:00
Unknown W. Brackets
904fb38003 GPU: Restore matrices with dirtying.
Without this, it's possible we might not notice or apply a change
whether in uniforms or etc.
2022-09-29 22:31:02 -07:00
Henrik Rydgård
bd759790b0 Update the Vulkan debug names when reassigning depth buffers. 2022-09-28 14:09:40 +02:00
Henrik Rydgård
de51d067f2 If a framebuffer starts using a different depth buffer than before, re-point.
Fixes depth artifacts in Silent Hill: Origins. See issue #16126
2022-09-28 13:41:41 +02:00
Henrik Rydgård
30c7b45ac8
Merge pull request #16123 from unknownbrackets/gpu-matrix
softgpu: Correct matrix value update wrapping
2022-09-28 09:39:27 +02:00
Unknown W. Brackets
6b20c0318d softgpu: Correct matrix value update wrapping.
The values read back when saving a context or getting matrix data are set
differently than the actual values used for rendering.

This implements the wrapping and bleeding between matrices within softgpu,
but leaves hardware rendering to only use the rendering registers for
speed.
2022-09-27 22:29:55 -07:00
Unknown W. Brackets
95d2083f04 Ge: Move matrix reading into GPU.
Let's keep managing its state / registers internal.
2022-09-27 22:23:02 -07:00
Unknown W. Brackets
38818f9f6e GLES: Fix colortest/logicop uint/int conversion.
Shown well in #16119.
2022-09-27 19:24:54 -07:00
Henrik Rydgård
ca5c69d3dd Vulkan: Better debug names for RENDER passes. 2022-09-27 23:41:09 +02:00
Henrik Rydgård
e538f5a441 Better bit scrambling when computing draw call IDs for vertex cache.
Fixes #13324
2022-09-27 10:09:52 +02:00
Unknown W. Brackets
23af9be9f4 softgpu: Handle rectangle texture projection. 2022-09-26 18:44:39 -07:00
Unknown W. Brackets
faa6c2d461 softgpu: Implement triangle texture projection. 2022-09-26 18:12:20 -07:00
Unknown W. Brackets
6282f8b05f softgpu: Expand texture coords to include q.
We'll need this to correctly project.
2022-09-26 17:13:14 -07:00
Unknown W. Brackets
8376176b2f softgpu: Split clippos out of rasterization vert.
We don't use it, except w, at all in rasterization, so no need to keep it
in the bin queue.
2022-09-26 16:50:40 -07: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
b3c0f177e2 softgpu: Save last tc/normal in vertex reading.
Matches PSP behavior, reusing last set values.
2022-09-26 15:11:11 -07:00
Unknown W. Brackets
59f11df98b
Merge pull request #16116 from hrydgard/color-test-fix
Fix color test.
2022-09-26 14:18:12 -07:00
Henrik Rydgård
9b46adb985 Fix color test.
Fixes the new color test bug reported in #13324, though doesn't fix that
issue (didn't confirm it still is one).
2022-09-26 22:51:46 +02:00
Henrik Rydgård
1c0d66aef7 Add compatibility flag for loading pixels on framebuffer create using nearest filtering
Solves the last problem with the speedometers - so we can finally say: Fixes #8509

Render-to-CLUT for speedometers renders on top of an image that just comes from the
underlying memory, so it's been drawn to the framebuffer with DrawPixels. That adds
filtering so at higher resolutions, there's some blurring of the CLUT, causing
artifacts.  We can solve this two ways: either we force on lower-resolution-for-effects
for Ridge Racer games, or we use nearest filtering when doing DrawPixels of the
memory under a framebuffer. For best result, we do the latter.

(The speedometers look even better with nearest filtering, but that's a more
general issue of UI looking better that way).
2022-09-26 20:47:55 +02:00
Unknown W. Brackets
4329aaa31c GPU: Apply color test mask as a uint.
This is simpler and allows us to unify paths better.
2022-09-26 06:57:41 -07:00
Unknown W. Brackets
a19a057e8c GPU: Consistently use uvec3 for colortest. 2022-09-26 06:57:41 -07:00
Henrik Rydgård
d9f74d2fb7 ivec->uvec, comment fix 2022-09-26 13:05:25 +02:00
Henrik Rydgård
fc30b04430 ShaderUniforms: cleanup, put every "4-float" on a line for clarity 2022-09-26 13:05:25 +02:00
Henrik Rydgård
cfa427c37a Shuffle constants around, squeezing them into gaps. Saves another 16 bytes. 2022-09-26 13:05:24 +02:00
Henrik Rydgård
f4b71e2dc7 Fragment shader uniforms: Pack color mask in 32 bits instead of expand to 128 bits.
Allows us to save 16 bytes from the main uniform buffer, since there's
free 32-bit spaces here and there to use.
2022-09-26 13:04:56 +02:00
Henrik Rydgård
07ca9e4656 Fold the "materialUpdate" flag into the light ubershader part.
This reduces the number of vertex shaders and thus pipelines by quite a
bit more in a few games, like Tekken and GoW, continuing the fight
against shader compile stutter.

The perf impact should be minimal if not positive due to less pipeline
changes.

GLES fixes

Make the vertex input declarations match (always declare fog input).  Fixes D3D11 validation

Tess fix
2022-09-26 12:06:16 +02:00
Henrik Rydgård
ad1021ea4b Add some recent flags to FragmentShaderDesc 2022-09-26 12:06:16 +02:00
Henrik Rydgård
76f03d30bf Remove suspicious dirty flag 2022-09-26 11:21:40 +02:00
Henrik Rydgård
196f8e3461 Prepare for dynamic mat update 2022-09-26 11:21:40 +02:00
Henrik Rydgård
94e439280e
Merge pull request #16111 from hrydgard/always-compute-fog-in-vs
Always do the vertex shader part of the fog computation.
2022-09-26 11:20:06 +02:00
Henrik Rydgård
9d1355e137 Always do the vertex shader part of the fog computation.
In #16104, we drastically reduced the number of shader variants for
games that use flexible lighting setups. I looked at a few games and it
seems that a lot of games have the same shaders with fog on/off, while
fog is super cheap to compute. So let's just always do it, reducing
vertex shader variants further (though the amount of pipelines will probably
remain the same, since we still specialize the fragment shader).

Might also be worth adding a dynamic bool for the fragment shader, but
if so, doing it separately.
2022-09-26 09:30:54 +02:00
Unknown W. Brackets
c80f325912 GPU: Fix SSE4 Vec3f normalize.
Was sometimes adding in garbage data, which could create NANs.
2022-09-26 00:24:12 -07:00
Henrik Rydgård
f30252f8d5 Oops! Also, testfix 2022-09-25 23:35:08 +02:00
Henrik Rydgård
96f054f098 Fix light ubershader for D3D11 and OpenGL, GLES unsigned/signed stuff 2022-09-25 23:35:08 +02:00
Henrik Rydgård
7adba20fac Experiment: Generate "Ubershaders" that can handle all lighting configurations
This drastically reduces the shader compile stutter that happens when a lot of new
light setups are created, like on the first punch in Tekken 6.

There's more stuff that might benefit from being made dynamic like this.
These branches are very cheap on modern GPUs since they're branching on
a uniform variable, so no divergence.

Only tested on Vulkan. I think we'll need to keep the old path too for
gpus like Mali-450...
2022-09-25 23:35:01 +02:00
Henrik Rydgård
b1afeeaf43
Merge pull request #16100 from unknownbrackets/d3d9-debugger
D3D9: Allow INTZ depth buffers more correctly
2022-09-25 17:37:56 +02:00
Unknown W. Brackets
e6db0bef2d
Merge pull request #16099 from hrydgard/vulkan-dont-always-alloc-depth
Vulkan: Avoid allocating depth images for stuff like temp copies, depal buffers etc.
2022-09-25 08:05:50 -07:00
Henrik Rydgård
a26a353c25
Merge pull request #16102 from unknownbrackets/softgpu-bin-tweaks
softgpu: Avoid waiting for a thread to drain
2022-09-25 10:01:44 +02:00
Henrik Rydgård
70c5ca62e6 Remove debug log. Add some new debug log though, unrelated to this PR, for fb clut + fb texture. Plus a couple asserts. 2022-09-25 09:56:39 +02:00
Henrik Rydgård
8a4147c042
Merge pull request #16101 from unknownbrackets/softgpu-fixes
softgpu: Avoid fast path in another wrong case
2022-09-25 09:52:29 +02:00
Unknown W. Brackets
24560eef5c softgpu: Avoid waiting for a thread to drain.
If we can, we want to keep the thread queues healthy, but not full.
Reduce the amount we push on a typical drain to avoid the Wait().
2022-09-24 20:01:00 -07:00
Unknown W. Brackets
1aa6841759 softgpu: Increase queued prims.
We made them smaller, so we can queue more of them in the same space.
Helps a little bit.
2022-09-24 20:01:00 -07:00
Unknown W. Brackets
444781c7b0 softgpu: Fix triangle strip with partial rects.
Seen in Wild Arms XF shop menu.
2022-09-24 18:55:45 -07:00
Unknown W. Brackets
c47d7eab38 softgpu: Simply 5551 blending fast path.
Since it only supports multiply and add, let's just stick with that.
2022-09-24 18:55:45 -07:00
Unknown W. Brackets
1eeb4f0bcf softpu: Refactor out 5551 fast path checks.
They were duplicated, and better to organize them according to state.
2022-09-24 18:55:45 -07:00
Unknown W. Brackets
f30b1d048d softgpu: Avoid fast path in another wrong case.
Seen in Kurohyo.  Missed that the alpha blend check essentially means only
standard blending can work.
2022-09-24 17:53:09 -07:00
Unknown W. Brackets
81e8336985 D3D9: Allow INTZ depth buffers more correctly.
The FBO check was wrong and just always failed.
2022-09-24 15:17:18 -07:00
Henrik Rydgård
08d2cb4486 Bump the shader cache version 2022-09-24 22:40:42 +02:00
Henrik Rydgård
9f3dfe7ebe Vulkan: Don't compile pipeline variants that don't make sense given their flags.
Ran into this with cache files from previous version of my change.

Also bumping the shader cache ID again to avoid this in other ways, but
good to be robust here.
2022-09-24 22:39:22 +02:00
Henrik Rydgård
c3b4caa30b
Merge pull request #15984 from lvonasek/compat_openxr_gta
OpenXR - Sky fix for GTA games
2022-09-24 17:16:28 +02:00
Unknown W. Brackets
c76d31dfa8 GPU: Cleanup unused CheckAlpha() funcs. 2022-09-24 02:00:03 -07:00
Unknown W. Brackets
6e6535c263 softjit: Skip reading dst pixel where blended out.
Sometimes used by blends used purely to multiply the source color by
something, usually prep for bloom.
2022-09-24 02:00:03 -07:00
Unknown W. Brackets
a4c3718431 softgpu: Optimize rectangle sampling/blending.
Sometimes the vertex color or alpha can allow us to optimize away some
multiplication.
2022-09-24 02:00:03 -07:00
Unknown W. Brackets
794a5c07ad softgpu: Ignore a needless color test case.
This happens in Ridge Racer, and we can entirely skip the color test.
2022-09-24 02:00:03 -07:00
Unknown W. Brackets
7ff5434968 GE Debugger: Tag frame dump replay VRAM writes.
Just for debugging, it's helpful especially paired with softgpu tagging.
2022-09-23 21:20:14 -07:00
Unknown W. Brackets
c3c5450b8f GE Debugger: Fix small tex/clut recopying.
If it's less than 256 bytes, we can't mark the entire VRAM area copied.
This still helps frame dumps avoid excessively slow VRAM recopying
situations, but fixes issues like missing trees in #12738.
2022-09-23 21:18:39 -07:00
Unknown W. Brackets
b56bd0d0fc
Merge pull request #16090 from hrydgard/more-vulkan-cleanup-work
Simplify synchronization in VulkanRenderManager
2022-09-23 17:24:34 -07:00
Henrik Rydgård
d743bfac93
Merge pull request #16085 from unknownbrackets/softgpu-vert
softgpu: Cache reused indexed verts
2022-09-24 00:00:26 +02:00
Henrik Rydgård
1259283c2e More tweaks, fix crash on exit (double-join thread) 2022-09-23 22:10:29 +02:00
Lubos
adffbb2ea7 Merge branch 'master' into compat_openxr_gta 2022-09-23 14:16:58 +02:00
Henrik Rydgård
7884e4ccb3 Another uninitialized variable (VAI minihash/hash) 2022-09-23 12:33:16 +02:00
Henrik Rydgård
ac7ca963db Make valgrind happy 2022-09-23 12:24:43 +02:00
Henrik Rydgård
bb6919ebcb
Merge pull request #16087 from unknownbrackets/depth-upload
GPU: Upload depth only on first usage
2022-09-23 09:07:33 +02:00
Unknown W. Brackets
93c909a88e GPU: Upload depth only on first usage.
Fixes various glitches in Kingdom Hearts, etc.
2022-09-23 00:04:14 -07:00
Unknown W. Brackets
66b6dfd0a5 softgpu: Fix self-render detect in Ridge Racer.
When we flush we mark all pending writes zero, but we rely on this being
set to detect self-render.

TRANSFORM_ALL was wrong as well, sometimes clearing BINNER_RANGE.
2022-09-22 20:36:15 -07:00
Unknown W. Brackets
88b3b26ed3 softgpu: Cache reused indexed verts.
This happens a lot for spline/bezier, so can significantly speed up curve
heavy scenes.  Isn't necessarily that common otherwise, though.
2022-09-22 18:27:59 -07:00
Unknown W. Brackets
067fac6817 softgpu: Skip matrix multiply for fog factor calc.
We can just use a dot product instead, and always skip viewpos.
2022-09-22 18:19:53 -07:00
Unknown W. Brackets
84a3f6de71 softgpu: Remove unnecessary state param.
Oops, meant to remove this when refactoring imm prims.
2022-09-22 18:18:49 -07:00
Henrik Rydgård
a6d6e0a3cc Texture/Framebuffer match: Ignore stride if texHeight == 1. Fixes Ridge Racer lens flares. 2022-09-22 22:11:16 +02:00
Henrik Rydgård
078fa9beb2 Fix corruption of Ridge Racer speedometers with AutoMaxQuality enabled.
See #8509
2022-09-22 15:27:17 +02:00
Henrik Rydgård
c3cbb68452
Merge pull request #16072 from hrydgard/depth-free-renderpass
Vulkan: Don't have renderpasses store/load depth buffers when we don't use them
2022-09-22 11:05:25 +02:00
Henrik Rydgård
c108db0e71
Merge pull request #16081 from hrydgard/zbuffer-upload-heuristic
Fix green flashes with Burnout Dominator lens flare
2022-09-22 11:02:27 +02:00
Henrik Rydgård
a31c5c8239 Cleanup logic 2022-09-22 10:48:45 +02:00
Henrik Rydgård
8e30a7ccfc Vulkan: Don't have renderpasses store/load depth buffers when we don't use them 2022-09-22 10:06:05 +02:00
Henrik Rydgård
e9bcefb052
Merge pull request #16080 from unknownbrackets/softgpu-spline
softgpu: Avoid unnecessary flushing for curves
2022-09-22 10:05:23 +02:00
Henrik Rydgård
bd196f7a50 Preserve depth buffer on framebuffer resize, if has been used. 2022-09-22 09:59:49 +02:00
Henrik Rydgård
188ab67d6a More lenient heuristic for uploading depth buffers. Still behind compat flag. See #11100 2022-09-22 09:29:33 +02:00
Henrik Rydgård
287e025978 Minor cleanups around dirtying of render state 2022-09-22 09:12:58 +02:00
Unknown W. Brackets
fc39f042ae softgpu: Avoid unnecessary flushing for curves.
We don't need to flush all drawing between curves in softgpu, let them
queue up.
2022-09-22 00:08:38 -07:00
Henrik Rydgård
594139885e
Merge pull request #16077 from unknownbrackets/hwtess
GPU: Use hardware tess params for texgen
2022-09-22 08:58:30 +02:00
Unknown W. Brackets
a8eced4773 GLES: Avoid resizing tessellation data textures.
Just recreate when it needs to be larger.  Fixes Test Drive Unlimited
issues noted in #16069.
2022-09-21 23:30:00 -07:00
Unknown W. Brackets
1e78f3aa57 GPU: Correct neg normal for hwtess texgen. 2022-09-21 22:06:32 -07:00
Unknown W. Brackets
a681d149db GPU: Use hardware tess params for texgen.
Fixes field in Test Drive Unlimited with hardware tessellation.
2022-09-21 21:15:58 -07:00
Henrik Rydgård
a92aaf9311 Dirty more state after depal 2022-09-21 23:57:19 +02:00
Henrik Rydgård
8ed1694a2f Don't try to replace or scale CLUT8-on-GPU textures.
See #8509
2022-09-21 23:50:03 +02:00
Henrik Rydgård
78ab013914 Shouldn't 'floor' there 2022-09-21 18:37:40 +02:00
Henrik Rydgård
94ae0fabfa CLUTs can be loaded from small rectangular textures. Need to linearize.
Fixes #8406, although technically, we should wrap by bufw, not the
texture width.
2022-09-21 18:33:15 +02:00
Henrik Rydgård
3ff400e40e
Merge pull request #16069 from unknownbrackets/depth-clamp
GPU: Simplify depth clamped clip planes
2022-09-21 10:01:49 +02:00
Henrik Rydgård
95ea0450fc
Merge pull request #16066 from unknownbrackets/softgpu-fastrect
softgpu: Narrow blend check for fast path further
2022-09-21 10:01:04 +02:00
Henrik Rydgård
7f0405b777
Merge pull request #16067 from unknownbrackets/lines
GPU: Account for w properly in lines, fixing width
2022-09-21 09:13:39 +02:00
Unknown W. Brackets
f8d29fdc1a GPU: Simplify depth clamped clip planes.
There's no need to think about the scaled Z if we're using w anyway, just
use the existing Z clipping.
2022-09-20 16:23:19 -07:00
Henrik Rydgård
a223e2a572
Merge pull request #16068 from unknownbrackets/depth-clamp
GPU: Clip clamped depth accounting for perspective
2022-09-21 01:15:12 +02:00
Unknown W. Brackets
2fc7f72d72 GPU: Clip clamped depth accounting for perspective. 2022-09-20 15:55:39 -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
Unknown W. Brackets
cefef3b4f9 softgpu: Narrow blend check for fast path further.
See #15756, frame was largely black because of a full screen blend
rectangle intended to brighten the screen slighty (I assume.)
2022-09-20 14:29:33 -07:00
Henrik Rydgård
0c39c434d0
Merge pull request #16065 from unknownbrackets/softgpu-tests
Correct some minor issues shown in a few tests
2022-09-20 23:27:41 +02:00
Unknown W. Brackets
bf86f00df8 GPU: Correct display framebuffer reading.
The displayFramebuf_ might not be set yet, but that doesn't mean we want
an INVALID format and zero stride.  We might also be rendering to a
different target, but still want the display.
2022-09-20 14:01:36 -07:00
Unknown W. Brackets
78a3925198 softgpu: Fix display framebuffer read. 2022-09-20 13:43:19 -07:00
Henrik Rydgård
355c18512f Fix BGRA issue on D3D with GPU CLUT textures 2022-09-20 22:31:54 +02:00
Unknown W. Brackets
7483923d07 softgpu: Correct clear rect off by one issues. 2022-09-20 12:57:05 -07:00
Lubos
c4dbd6d045 Merge branch 'master' into compat_openxr_gta 2022-09-20 21:46:33 +02:00
Henrik Rydgård
85d1f28997 Throw in assorted warning fixes 2022-09-20 18:04:08 +02:00
Henrik Rydgård
aa19712fc3 Unify depth texture and framebuffer fetch checks 2022-09-20 10:47:49 +02:00
Henrik Rydgård
09bcf3ec13 Unify range culling detection 2022-09-20 10:15:04 +02:00
Henrik Rydgård
1ae7c0132c Start unifying setting of the GPU feature flags, now that thin3d has feature detection. 2022-09-20 10:07:01 +02:00
Unknown W. Brackets
fddcbfc5fa GE Debugger: Include rendered CLUTs in frame dumps.
Like with textures, this uses the VRAM address directly.
2022-09-19 12:01:34 -07:00
Henrik Rydgård
3e0b3ba1a8
Merge pull request #16054 from unknownbrackets/softgpu-flush
softgpu: Reduce some flushing / flushing cost
2022-09-19 17:56:44 +02:00
Unknown W. Brackets
e2929fb395 softgpu: Skip flushing on no change.
Minor tweak, we sometimes try to flush even without anything to flush, and
were previously rechecking a lot of things.
2022-09-19 08:38:11 -07:00
Unknown W. Brackets
259abf79dd softgpu: Skip more triangles with equal verts.
Even if X is not equal, if all Y are equal, we can still skip.
This seems to happen more often than I expected with far away objects.

Skipping here avoids filling up the queue.
2022-09-19 08:37:47 -07:00
Unknown W. Brackets
7b4cc3334b GE Debugger: Save current clut in frame dumps.
For example, #14465 shows a case where the frame relies on a previously
loaded CLUT.
2022-09-19 08:30:12 -07:00
Henrik Rydgård
4b165f9fc1
Merge pull request #16049 from unknownbrackets/depth-clamp
GPU: Clip depth properly when also clamping
2022-09-19 10:22:34 +02:00
Henrik Rydgård
2b93fac3c3
Merge pull request #16047 from unknownbrackets/ge-debugger
GE Debugger: Allow search by state name
2022-09-19 09:42:26 +02:00
Unknown W. Brackets
a2a7e8258b GPU: Clip depth properly when also clamping.
Helps situations like #11216, where only one side should be clamped.
Keeps depth clamp (i.e. #7932) working.  See #11399.
2022-09-18 13:18:02 -07:00
Unknown W. Brackets
c08c873462 GLES: Support more clip distances.
Will be used later, for now just the enable/disable logic.
2022-09-18 13:16:59 -07:00
Unknown W. Brackets
7d4aa3eb2d softgpu: Correct line early z checks.
Was looking at completely wrong pixels, hadn't removed subpixels yet.
2022-09-18 11:44:01 -07:00
Unknown W. Brackets
5b5529b390 GE Debugger: Show time spent stepping. 2022-09-18 09:52:15 -07:00
Unknown W. Brackets
ca248e1201 softgpu: Fix s8 primitives in throughmode.
Also always cull no-position verts, hardware too.  Matches tests.
2022-09-18 07:46:18 -07:00
Unknown W. Brackets
9f84cde062 GPU: Fix crash on imm vert triangles.
Was crashing because the frag and vert shaders didn't match up.
2022-09-18 06:16:26 -07:00
Unknown W. Brackets
97002692c4 softgpu: Correct secondary color on imm verts.
Only with through set, and we have to ignore position.
2022-09-18 06:16:26 -07:00
Unknown W. Brackets
6877ff1af2 softgpu: Fix state/continuation for imm prims. 2022-09-18 06:16:26 -07:00
Unknown W. Brackets
596b07bd2e softgpu: Support fog and color1 on imm verts. 2022-09-18 06:16:26 -07:00
Unknown W. Brackets
35ba01e01f softgpu: Refactor imm draws to bypass vert read. 2022-09-18 06:16:25 -07:00
Unknown W. Brackets
799a9ae95b softgpu: Simplify vertex reading. 2022-09-18 06:16:25 -07:00
Unknown W. Brackets
de080e2594 softgpu: Simplify vertex range culling.
The previous logic was harder to understand and easier to get wrong.
Just drop them when clipping the primitive.
2022-09-18 06:16:25 -07:00
Unknown W. Brackets
028a341cc8 softgpu: Explicitly flush on sync and output.
We could in theory skip flush on FinishDeferred, and allow some CPU/GPU
overlap.  If we did, we'd still want to flush at these times.
2022-09-18 06:16:25 -07:00
Unknown W. Brackets
f740fcdbe7 GPU: Minor cleanup of unnecessary virtual. 2022-09-18 06:16:25 -07:00
Henrik Rydgård
4045de8d56 Consider the Adreno and Mali stencil-discard bugs the same. Use the better check from the Mali bug.
Should fix #11980
2022-09-18 10:34:43 +02:00
Unknown W. Brackets
9b01fce5b5 softgpu: Run early Z tests in fast rect path.
Needed for some 2D games, like Criminal Girls.
2022-09-17 13:37:54 -07:00
Henrik Rydgård
262a306b9a Flag shader blending as broken on Adreno for now. 2022-09-16 19:19:42 +02:00
Henrik Rydgård
5f5277a409 Need to have input attachments in the descriptor pool. 2022-09-16 19:19:42 +02:00
Henrik Rydgård
ce82fce8de Use subpass dependencies to implement shader framebuffer read in Vulkan. 2022-09-16 19:19:42 +02:00
Henrik Rydgård
370a7304a6 Careful with min filtering of framebuffer textures only if auto max quality is on. 2022-09-16 19:19:42 +02:00
Henrik Rydgård
9ec35d1464 Logic op fix, min filter fix. Also remove some unnecessary indentation. Fixes the water on Adreno (no logic) 2022-09-16 12:39:37 +02:00
Luboš Vonásek
861af63be9
Merge branch 'hrydgard:master' into compat_openxr_gta 2022-09-16 10:20:11 +02:00
Henrik Rydgård
e8aaf22163 D3D9 crashfix (flare doesn't render correctly though) 2022-09-15 17:22:09 +02:00
Henrik Rydgård
5d4075376d Copy the texels directly in LoadCLUT 2022-09-15 17:09:03 +02:00
Henrik Rydgård
662126a0a1 Small simplification 2022-09-15 16:57:03 +02:00
Henrik Rydgård
36c98ab367 Address feedback, change roles of the two dynamic clut fbos to eliminate the need for state (see next commit) 2022-09-15 09:15:02 +02:00
Henrik Rydgård
9c2bfad749 Seems Need for Speed: Shift has exactly the same lens flare, enable the same compat settings. 2022-09-15 00:18:26 +02:00
Henrik Rydgård
a208afb7b8 OpenGL and D3D11 fixes 2022-09-14 23:35:15 +02:00
Henrik Rydgård
85bb6786a1 Log improvements 2022-09-14 23:13:46 +02:00
Henrik Rydgård
1f6d27bd55 Ridge Racer fix 2022-09-14 22:46:17 +02:00
Henrik Rydgård
d6d7a15d25 Get depal-from-dynamic-CLUT working 2022-09-14 22:18:35 +02:00
Henrik Rydgård
51c97c7a7f Set texcache entry status flag if CLUT needs to be dynamic 2022-09-14 22:18:35 +02:00
Henrik Rydgård
abd58199ce Add way to bind cached textures to a DrawContext 2022-09-14 22:18:35 +02:00
Henrik Rydgård
f745e94899 Allow binding "native" texture objects to thin3d 2022-09-14 22:18:35 +02:00
Henrik Rydgård
9907957242 Start implementing ApplyTextureDepal 2022-09-14 22:18:35 +02:00
Henrik Rydgård
431f142413 Cleanup in ge_constants.h, add virtual CLUT8 buffer format 2022-09-14 22:18:35 +02:00
Henrik Rydgård
7213e9b7c2 Comment 2022-09-14 22:18:34 +02:00
Henrik Rydgård
650ce22359 Force low resolution for effects in Burnout Dominator. Fixes lens flare at high res 2022-09-14 22:18:34 +02:00
Henrik Rydgård
a52e62a187 Enable depth uploads on render-to-clut-buffer. Esoteric but needed for #11100. Compat flag for now. 2022-09-14 22:18:34 +02:00
Henrik Rydgård
8d00df12a4 Detect the CLUT8/8888 situation
Implement CLUT8 depal from 8888 textures. Hard to tell if working
2022-09-14 22:18:34 +02:00
Henrik Rydgård
4803825f83 Buffer copy matching workaround 2022-09-14 22:18:34 +02:00
Henrik Rydgård
0ed1f3d461 Switch multiple bools as parameters to DecodeTextureLevel to a flags enum. 2022-09-14 18:40:08 +02:00
Henrik Rydgård
776c650017 Fix regression in Tantalus games. See #15914 2022-09-14 08:58:06 +02:00
Henrik Rydgård
cf2ad5ceaf
Merge pull request #16024 from unknownbrackets/logicop-simulate
GPU: Fix simulating logicop with blend and shader
2022-09-14 08:41:29 +02:00
Unknown W. Brackets
440062530e GE Debugger: Allow fb copies while stepping.
This is now causing crashes and should be allowed.
2022-09-13 19:07:54 -07:00
Unknown W. Brackets
a397c74140 GPU: Fix simulating logicop with blend and shader.
We only need to do it in the shader, if we're doing it in the shader.
2022-09-13 19:07:25 -07:00
Lubos
e406dc4730 Merge branch 'master' into compat_openxr_gta 2022-09-13 21:01:55 +02:00
Henrik Rydgård
b4d0ac2e1c Unify CLUT texture size at 512 to reduce complexity. Worth the extra bytes. 2022-09-13 11:56:56 +02:00
Henrik Rydgård
39890f7d6f Extract function GetReinterpretPipeline 2022-09-13 11:46:47 +02:00
Unknown W. Brackets
8371091734 softgpu: Force correct alignment on 32-bit. 2022-09-12 22:15:02 -07:00
Unknown W. Brackets
1be5f1670c softgpu: Remove mostly unused screen offset state.
This is now already cleaned up from coords, so no need to cache it.
2022-09-12 22:02:10 -07:00
Unknown W. Brackets
167213c746 softgpu: Cache texture bufws at 16 bit.
Reducing the size of state a bit.
2022-09-12 21:57:00 -07:00
Unknown W. Brackets
b2e6a086dc softgpu: Reduce size of VertexData texture coords.
There's no real benefit to this with only two values.
Not much of a gain perf wise, but still good to transfer less data.
2022-09-12 21:10:46 -07:00
Unknown W. Brackets
a0515bf5ca
Merge pull request #16016 from lvonasek/feature_openxr_stereo
OpenXR stereo improved
2022-09-12 17:48:39 -07:00
Henrik Rydgård
d6fd9a386b Non-buffered rendering crashfix 2022-09-13 00:29:46 +02:00
Lubos
b695c1ffb3 Merge branch 'master' into compat_openxr_gta 2022-09-12 23:04:31 +02:00
Lubos
e49ee5c93b Merge branch 'master' into feature_openxr_stereo 2022-09-12 18:49:22 +02:00
Lubos
bdde5f0f7f OpenXR - Use per game stereo separation file 2022-09-12 18:47:13 +02:00
Henrik Rydgård
b86648b352 Address feedback 2022-09-12 16:30:08 +02:00
Henrik Rydgård
4ad345d78d Better shader compile logging 2022-09-12 15:39:29 +02:00
Henrik Rydgård
d9989ffc16 Don't start blending in the shader just because there's bitmasks, if blend is disabled. 2022-09-12 15:39:29 +02:00
Henrik Rydgård
a2eaad5445 Debug-name shader modules with their shader desc strings 2022-09-12 15:39:29 +02:00
Henrik Rydgård
2791ab3226
Merge pull request #16011 from unknownbrackets/softgpu-rect
Detect more triangles as rectangles in softgpu
2022-09-12 08:35:13 +02:00
Henrik Rydgård
9292fd84e2
Merge pull request #16009 from unknownbrackets/softgpu-colors
softgpu: Store vertex colors as packed RGBA8
2022-09-12 08:34:03 +02:00
Unknown W. Brackets
3c9372fb75 softgpu: Ignore stencil test mask in ALWAYS mode.
Small codegen improvement since we can directly use ref and avoid loading
the unmasked reference.
2022-09-11 22:39:56 -07:00
Unknown W. Brackets
1f6870798b softgpu: Include early Z in func description. 2022-09-11 22:39:32 -07:00
Unknown W. Brackets
151727ee01 softgpu: Detect longer strips of rectangles.
Could maybe even combine these into one large rectangle, but the main
benefit is avoiding triangles.
2022-09-11 22:39:32 -07:00