100 Commits
Author SHA1 Message Date
lightningterror c53b0c9c92 GS/GL: Rename active state attachments.
Matches the other renderers naming.
rt->current_rt
ds_as_rt ->current_ds_as_rt
ds->current_ds
2026-10-11 02:36:08 +02:00
lightningterror 6bdd913a67 GS/HW: Try to use barriers first if depth buffer isn't safe to read on shuffles. 2026-10-10 19:12:02 +02:00
lightningterror cf3c372043 GS/GL: Partially revert 16592f3a and disable depth test and sample.
When an attachment is bound but not written and also bound as a shader resource
it might still cause issues if the writes didn't finish from the previous draw so it
will still need a barrier.

Attachment can not be bound as read only unlike on dx11/12/vk,
and it's not always guaranteed to work properly even if depth write is disabled.
2026-10-09 23:19:59 +02:00
lightningterror aa7ab4306e R5900: Early return when Rt part of register is zero in LD.
We already do this in other functions.
2026-10-08 22:25:38 +02:00
lightningterror 562705ea5c GS/DX: Fix swapchain flags when falling back from fullscreen to windowed mode. 2026-10-08 20:46:26 +02:00
lightningterror 3c8df07e8e GS/DX12/VK: Fix DoMerge feedbackwrite shader copy sizes.
We are doing a shader copy from dTex to sTex[2] so we should be using the destination sizes from sTex[2].
2026-10-08 16:18:38 +02:00
lightningterror 9f6ea5ddec GS/GL: Fix conservative depth and cas not working when vs expand is disabled. 2026-10-05 20:02:42 +02:00
lightningterror 45ba57032d GS/Shaders: Fix up types mismatch.
Causes issues on gl, change dx/vk for consistency.
2026-09-26 20:45:34 +02:00
lightningterror 7372a44101 GS/GL: Drop requirement for GL_ARB_gpu_shader5.
Emulate it, use the dx11/12 shader which does the same.
2026-09-26 20:45:34 +02:00
lightningterror 24eea4392c GS/DX11: Fix null texture related crashes when device creation fails.
Make sure null texture is initialized to null, otherwise if device creation fails early it causes issues when deleting the texture since it wasn't even created.
Also properly null it out after deletion.
2026-09-26 16:32:21 +02:00
lightningterror 9c1bea4ab6 GS: Switch CAS from compute shader type to pixel shader type.
Depending on the gpu/driver in some situations it can be a little faster or a little slower. Usually faster on igpus and slower on dgpus, but we want to prioritize igpus since they are on the lower end.

GL: Support has been extended to older hardware GL version 3.3.
Drop requirement of GL_ARB_gpu_shader5, emulate bitfieldExtract and bitfieldInsert in the cas shader instead.
Make GL_ARB_shading_language_packing as a fallback when gl core 4.2 is not available.

DX11: Enable on feature level 10.

DX12/VK co author port by TJnotJT.
Metal co author port by TellowKrinkle.
2026-09-26 15:25:56 +02:00
lightningterror 5b6843ad2b GS/GL: Rework logging for supported extensions/features.
Make it clear what extension is supported, what isn't and what it's currently used such as alternatives or fallbacks.
2026-09-20 07:36:06 +02:00
lightningterror 6c4f4114a5 GS/GL: Expand conservative depth to the same extension variants.
Conservative depth is part of gl core 4.2, for older check:
GLAD_GL_ARB_conservative_depth,
GLAD_GL_AMD_conservative_depth.

Bonus: Also check for gl version 4.5 for clip control.
2026-09-20 07:36:06 +02:00
lightningterror 1048bdf0b1 GS/GL: Add GLAD_GL_EXT_direct_state_access fallback.
Better than no DSA fallback, should be faster.
2026-09-19 08:33:33 +02:00
lightningterror f3db1eba66 GS/DX: Check for TypedUAVLoadAdditionalFormats for rov.
Haswell reports ROVsSupported true while TypedUAVLoadAdditionalFormats false.
We need TypedUAVLoadAdditionalFormats for rov to work properly.
2026-09-19 06:31:01 +02:00
lightningterror 1275b25ac0 GS/GL: Remove extra fb attachment binding.
Already handled in StretchRect call.
2026-09-18 13:15:55 +02:00
lightningterror c22f627f0a GS/Shaders: Fix aa1 on haswell dx11/12.
Intel Haswell seems to be having issues on dx11/12 with running the bfi instruction in this specific case, so let's use an alternative that gives the same result, note this is only broken on Haswell, Ivy Bridge and Skylake are fine, the issue appears when running the D3D compiler with optimizations, running with D3DCOMPILE_SKIP_OPTIMIZATION is fine with bfi.
2026-09-18 12:25:32 +02:00
lightningterror 64dd6655f3 GS: Roll back to dx11 as default for haswell/broadwell again.
After some testing it seems that OpenGL is much slower than Direct3D11 on haswell, and possibly broadwell to se let's default back to dx11 again.
2026-09-18 07:14:00 +02:00
lightningterror 7a9af33f7d GS: Update intel igpu/dgpu auto renderer.
Ivy Bridge and below default to Direct3D11.

Haswell/Broadwell default to OpenGL.

Skylake and above default to Direct3D12.
2026-09-13 06:01:25 +02:00
lightningterror f8ea1477f6 GS/GL: Check if RGBA16 UNORM is hw blendable, if not then fallback to RGBA16 Float. 2026-09-13 05:48:46 +02:00
lightningterror f13b70f6a0 GS/GL: Use correct formats for ColorHQ, ColorHDR.
ColorHQ: GL_RGB10_A2.
ColorHDR: GL_RGBA16F.
2026-09-13 05:48:46 +02:00
lightningterror 393278fe4d GS: Make sure ColorHDR is treated as a feedbackloop format.
It is used as a fallback when hw blending isn't supported on RGBA16 UNORM.
2026-09-13 05:48:46 +02:00
lightningterror a5fc5aefc9 GS/DX12: Enable dx12 support on haswell/broadwell if supported.
Could be useful for testing, also there's no need to lock it out even if it has issues as it can come in handy similar to Fermi.
2026-09-11 03:13:30 +02:00
lightningterror e6a88bccff GS/HW: Purge Ultraman Fighting Evolution crc.
Not needed anymore.
2026-09-11 03:12:17 +02:00
lightningterror aaf03c18b6 GS/TC: Fix -Wsign-compare warning. 2026-09-04 13:35:32 +02:00
lightningterror 2bbb92de16 GS/DX11: DS as RT/UAV binding fixes.
Properly unbind state in BeginPresent.
Properly update state in OMSetRenderTargets.
Also use ds as rt size for Viewport.
2026-09-01 21:09:57 +02:00
lightningterror 8c1bb5742e GS: Fix unused variable warning. 2026-08-10 00:45:08 +02:00
lightningterror 2ce2cb6459 GS/DX11: Fix uav null_texture usage.
We shouldn't use Feedback alone here as it would cause issues and trigger ValidateUsageAndFormat assert, use FeedbackTarget as that's the next best without uav.
2026-08-01 19:53:35 +02:00
lightningterror fe55f87289 GS/VK: Remove undefined unused shader macro. 2026-07-31 17:29:28 +02:00
lightningterror 053b42d36c GameDB: Add missing tex in rt for some GITS regions. 2026-07-28 22:49:08 +02:00
lightningterror 645a37ad58 GS/VK: Fix crash when no device is created and vk is the selected renderer. 2026-07-28 16:50:08 +02:00
lightningterror 92914cee40 GS: Bump shader cache version. 2026-07-12 21:43:59 +02:00
lightningterror 2444c6090b GS: Fix Compiler warnings. 2026-07-09 18:06:50 +02:00
lightningterror a4b11651a4 GS: Better handle imgui texture creation hazards. 2026-07-04 20:40:55 +02:00
lightningterror 05015bc476 GS/HW: Better handle some texture creation hazards.
BeginDSAsRT and ConvertTextureTypeROVSingle make sure the textures are actually created.
2026-07-02 11:24:08 +02:00
lightningterror 1f0f3b92b3 GS/DX12: Expand the fb optimization hit detection. 2026-07-02 11:21:49 +02:00
lightningterror 13b7345189 GS/HW: Fix bbox when using aa1.
Suggested by TJ.
2026-06-27 09:02:11 +02:00
lightningterror 66ea4c4967 GS/DX11: Backport ds as rt from GL for depth feedback.
Doing gpu depth copies is quite slower on dx11, so let's
use the ds as rt behavior from GL which would allow us
to treat them as rt copies instead which are faster.
2026-06-25 20:56:58 +02:00
lightningterror a6769818fd GS/HW: DATE setup changes.
DATE one can run on complex alpha test if there's no overlap.
Make sure DATE one doesn't run if complex alpha test is enabled and there's overlap.
Enable DATE barrier on complex alpha test if there's overlap.
2026-06-24 16:02:45 +02:00
lightningterror 8e73dea7e2 GS/GL: Fix recent aa1 shader regressions.
Line was accidentally removed and macro typo.
2026-06-21 01:17:52 +02:00
lightningterror a8db6587cb Qt: Disable VK Rov barrier toggle on other renderers. 2026-06-15 18:28:55 +02:00
lightningterror 16592f3a6e GS/GL: Expand the fb optimization hit detection. 2026-06-12 22:29:47 +02:00
lightningterror 2b5d3510c3 GS/DX11: Expand the fb optimization hit detection. 2026-06-12 22:29:47 +02:00
lightningterror 13d3491571 GS/GL: Add basic clip control fallback.
When GLAD_GL_ARB_clip_control is not supported then change
the vertex shader depth ranges to make sure it matches -1 1.
2026-06-10 01:35:46 +02:00
lightningterror 8a6d6818fb Revert "GS/GL: Discard stencil when not in use while using depth."
This reverts commit e0365c1d10.
2026-06-10 01:35:46 +02:00
lightningterror 904a0942f0 GS/DX11: Destroy uav resources. 2026-06-09 09:22:07 +02:00
lightningterror 7f20ff60ea GS/DX11: Fallback to regular OMSetRenderTargets if no uav are active. 2026-06-09 09:22:07 +02:00
lightningterror 1ce246e05d GS/DX11: Reuse frame buffer optimizations for uav/rov. 2026-06-09 09:22:07 +02:00
lightningterror b3b1ff0f50 GS/GL: Expand fb copy fallbacks.
Add nv extension GLAD_GL_NV_copy_image copy fallback.

Re add fbo copy fallback when no copy extension is supported and expand it for both color and depth.
2026-06-04 02:22:17 +02:00
lightningterror e0365c1d10 GS/GL: Discard stencil when not in use while using depth.
Backport from DX12, clear the stencil when it's not used.
2026-05-30 22:02:09 +02:00
lightningterror 30d7fed0e5 GS/DX12: Discard stencil when not in use while using depth.
Because the same texture is shared and used for both depth and stencil we want to discard when the stencil is not used instead of no access as that gives a validation error.
2026-05-30 15:02:22 +02:00
lightningterror ae0b5834a0 GS/HW: Adjust depth read only handle. 2026-05-24 14:04:39 +02:00
lightningterror 0783ec1b9c GameDB: Add Tex in RT for Blood Will Tell/Dororo.
Fixes broken shuffles that replaced the shuffle hackfix.
2026-05-23 11:14:46 +02:00
lightningterror 0f9b8afe04 GS/HW: Further improve tex hazards.
Always enable test and sample depth on vk as well.

Make sure there is no feedback depth when using barriers,
as GL/DX12 have issues with it, so just stick with a plain copy
which is equivalent to depth as rt which we would have to do anyway.

Check for hazards properly for Hitman shuffle.

Better handle depth read only condition, allow for a barrier if it isn't.

Better handle hazard checks in device when doing a copy.

We don't need two or union copies on dx11 for depth as dx11 can't do partial depth
gpu copies.
2026-05-23 11:14:46 +02:00
lightningterror d39457951a GS/HW: Adjust HandleBarrierHazard to return a value. 2026-05-23 11:14:46 +02:00
lightningterror 9fcb526aca GS/HW: Also backport the samplearea copy to VK/DX12. 2026-05-23 11:14:46 +02:00
lightningterror 0e178aecb8 GS/HW: Remove tex is fb specific device checks for copies.
Handled in RendererHW.
2026-05-23 11:14:46 +02:00
lightningterror 66f764cf02 GS/VK: Remove rt and ds hazard check, handled in RendererHW. 2026-05-23 11:14:46 +02:00
lightningterror 63f2d8d880 GS/DX12: Remove rt hazard check, handled in RendererHW. 2026-05-23 11:14:46 +02:00
lightningterror b123f016ab GS/GL: Remove the hazard checks as they are handled in renderer.
tex == rt, tex == ds hazards are handled in RendererHW.
Always enable test and sample depth for GL.
2026-05-23 11:14:46 +02:00
lightningterror f08f679ba7 GS/HW: Handle barrier hazards in RendererHW instead of Device.
Cleaner, easier to track.
2026-05-23 11:14:46 +02:00
lightningterror 30440099c2 GS/GLSL: Make sure color output is disabled for depth only writes or testing and fix afail typo. 2026-05-19 13:03:35 +02:00
lightningterror 4cc2a81f00 GS/DX11/GL: Fix tex is fb behaviour when doing gpu copies.
When I was doing the clean ups I forgot to include the condition.
2026-05-16 16:01:20 +02:00
lightningterror 2f8c98dccf GS/DX11/GL: Fix barrier typo, should check alpha second pass barrier. 2026-05-16 11:48:53 +02:00
lightningterror 59e422c538 GS/GL: Depth isn't written so we can skip a barrier. 2026-05-16 11:48:53 +02:00
lightningterror 5ef5e41e69 GS/DX11: Also check for depth feedback on alpha second pass. 2026-05-16 11:48:53 +02:00
lightningterror a64465681c GS/HW: Disable texture shuffle if there's no tex. 2026-05-08 18:29:05 +02:00
lightningterror de84c41757 GS: Check if current tex is valid before resizing. 2026-05-03 15:25:58 +02:00
lightningterror f9feca4f4d GS/DX11/GL: Further cleanup to the copy behavior and some features checks. 2026-05-01 20:35:30 +02:00
lightningterror 4fa9c4e382 GS/HW: Check if alpha second pass copies are feedback loops. 2026-05-01 20:35:30 +02:00
lightningterror 93f1fcbe88 GS/HW: Sync rt copy behaviour across renderers. 2026-05-01 20:35:30 +02:00
lightningterror f7ef43b155 GS/HW: Match TEXA behavior on shuffles between renderers. 2026-04-26 21:07:44 +02:00
lightningterror 282129030f GS/HW: Exclude shuffles for dst no rgb blend and no rt check. 2026-04-26 21:07:44 +02:00
lightningterror 5734403ffc GS/HW: Several barrier fixes to sw blend and barrier date.
- Accumulation blend: Require 32 bit RT is only when texture barriers/multidraw fb copies are on/supported.

- Barrier DATE:
Always use barrier date if texture barrier/multidraw fb copies are supported.
Check if texture barriers/multidraw fb copies are supported before enabling barrier date for AA1.
2026-04-26 21:07:44 +02:00
lightningterror 8d4d9ce026 GS/HW: Allow Date barrier when texture barriers/multidraw fb copies are disabled. 2026-04-26 21:07:44 +02:00
lightningterror 390e3994ad GS/HW: Clean up date stencil temp ds texture creation.
Add barrier fallback method.
2026-04-26 21:07:44 +02:00
lightningterror 226b4d25dc GS/HW: More AA1 fixes and optimizations.
Do not enable AA1 if we aren't drawing to the RT.
Check if RT is written for IsCoverageAlphaSupported().
2026-04-26 13:05:39 +02:00
lightningterror 84c0cd8890 GS: Fix AA1 coverage regression on sw and cleanup. 2026-04-24 13:09:54 +02:00
lightningterror 971382f11e GS/DX12/Debug: Enable dx12 support for debug purposes on Haswell. 2026-04-24 01:30:59 +02:00
lightningterror 16f2c262a3 GS/DX11: Clean up pre binding and srv conflict unbinding.
Move conflict check inside OMSetRenderTargets, it's easier to track and gets rid of duplicate code.

Move shader resource binding after rtv/dsv binding, easier to track and manage srv conflicts.

Get rid of shader resource pre binding, while it may work it's more of a headache to track so many states and things can go wrong easily, so just get rid of it, especially with shader binding after rtv/dsv binding.
2026-04-21 19:31:49 +02:00
lightningterror e8c750ee88 GS/DX11: Make sure we commit a clear for read only dsv too. 2026-04-21 19:31:49 +02:00
lightningterror 20bbb99516 GS/HW: Fix shader compile errors and warnings from AA1 on GL. 2026-04-21 02:20:13 +02:00
lightningterror 3cbc7f3f09 GS/DX11: Properly null out rtv/dsv during CAS.
This way we ensure the current states are also updated.
2026-04-20 19:10:31 +02:00
lightningterror 420f4177c9 GS/GL/DX11: Don't bind source tex on shader resource if it's tex is fb with no barrier.
Texture will be copied, the copy will be used as a shader resource. Avoids useless binds.
2026-04-15 21:53:40 +02:00
lightningterror a2e354c629 GS/GL: Better handle shader resource null. 2026-04-15 21:51:20 +02:00
lightningterror 241a929748 GS/DX11: Better handle shader resource null. 2026-04-15 21:51:20 +02:00
lightningterror 87319a2d2f GS/DX12: Replace the in render pass member check with function check.
Consitency.
2026-04-15 13:08:12 +02:00
lightningterror bf5be8ed4f GS/DX12: Fix render pass optimization not being properly hit.
The depth target render pass optimization wasn't being hit properly, so let's synch it with the other renderers.
2026-04-15 13:08:12 +02:00
lightningterror cb63269d9e GS: Fix a bunch of compiler warnings.
Type comparisons, unused variables, missing return value.
2026-04-14 00:01:19 +02:00
lightningterror 903e859433 FSUI: Fix unused variable compiler warning. 2026-04-14 00:01:19 +02:00
lightningterror 629e7ffa2f GS/GL: Use memory barrier when texture barrier isn't supported.
Only in Force Enabled mode as it's not guaranteed to work, otherwise use multidraw fb copy.
Also added nv texture barrier fallback when regular texture barrier isn't supported.
2026-04-07 16:10:45 +02:00
lightningterror dc6c4d7e4e GS/DX11: Rename caching states. 2026-04-06 04:29:56 +02:00
lightningterror 2fb8a48418 GS/GL: Properly clear fbo states.
Fixes crashes in Renderdoc when re launching OpenGL again.
2026-04-05 10:29:28 +02:00
lightningterror f56d3b5f2f GS/GL: Drop requirement for GLAD_GL_ARB_draw_buffers_blend.
Currently we don't use hw blend on individual render targets
so we can revert to old behavior while keeping compatibility
with older drivers.
2026-04-05 04:12:39 +02:00
lightningterror 2c608b4293 GS/GL: Backport multidraw fb copy for depth feedbacks. 2026-04-04 04:27:20 +02:00
lightningterror 2c908f4d09 GS/DX11: Check if Depth feedback is enabled before making a copy. 2026-04-04 04:27:20 +02:00
lightningterror c1bf4d5a56 GS/GL: Backport multidraw fb copy from DX11.
Will be used when GL_ARB_texture_barrier  isn't supported.
Can also be used for Depth feedback loops.
2026-04-04 04:27:20 +02:00
lightningterror eab8b92037 GS/DX11: Cleanup some multidraw fb copy code.
Remove skip first barrier check, rely on the one barrier parameter being set to false.
Other misc cleanup.
2026-04-04 04:27:20 +02:00
lightningterror 5cb7abf10c GS/GL: Make sure we always insert a barrier when tex is rt/ds. 2026-04-01 23:05:31 +02:00
lightningterror ac69bb2142 GS/HW: Don't bind source tex when using tex is fb hle.
Slot 2 will be used for fb read instead of slot 0, don't bind it when it's not needed.
2026-03-31 02:07:12 +02:00