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.
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.
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.
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.
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.
- 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.
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.
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.
Currently pre binding doesn't work correctly/to it's full capacity as I forgot to update PSUnbindConflictingSRVs.
When doing a pre bind idea is to update local state, then if there are no conflicts to use that newly updated local state instead of unbinding the slot, this will avoid unnecessary re bindings.
Don't set blend state and color mask when writing depth stencil only.
Blend state and color mask is used when writing to render target.
Don't set depth stencil state when writing render target only.
Depth stencil state is used when writing to depth stencil only.
Don't set blend state when writing depth stencil only.
Blend state is used when writing to render target.
Don't set depth stencil state when writing render target only.
Depth stencil state is used when writing to depth stencil only.
In some cases if we don't have a first ate pass but we do a second pass we swap the ate second pass to the first, in such case we can also allow date one/primid/date barrier cases enabled.
When alpha is written extend only when there's no alpha second pass to date one/date barrier/date primid.
When alpha isn't written extend to date barrier.
1. Expand 4 pixel boundaries correction to non overlapping draws.
2. If the copy area covers 95% or more of the render target size switch to full copies using CopyResource instead of CopySubresourceRegion.
At this size using full copies should be faster.
Currently it is only used when texture barriers are disabled but can be used when Depth testing/Afail copies are implemented.
3. Backport to other renderers DX12/GL/VK.
Idea:
PSSetShaderResource binds local state only (ps_sr_views).
PSUnbindConflictingSRVs binds/updates local and gpu state (ps_sr_views, ps_cached_sr_views and srv gpu state)
What we can do is before checking for conflicts we can preemptively bind new tex on the local state if it's not already bound to the current render target, depth target, then PSUnbindConflictingSRVs will update the gpu state when it checks for conflicts.
Then the following update that happens during the Draw which calls for a gpu upgrade will be ignored since it's already been updated.
Add the copy counters in the function themselves, easier to track.
This also tracks other shader copies such as setupdate, primid date,
post processing such as shade boost and others which weren't tracked before.
If not then use DXGI_FORMAT_R16G16B16A16_FLOAT,
it will be less precise but will still work on feature level 10.0 and some 10.1 gpus and allow for hardware blending.
Fixes api warning in specific scenario when force running through dxcpl:
D3D11 INFO: ID3D11DeviceContext::OMSetRenderTargets: Forcing OM Render Target slot 0 to NULL , since calling Present for DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL SwapChains unbinds backbuffer 0 from all GPU writeable bind points, except for DXGI_PRESENT_DO_NOT_SEQUENCE or DXGI_PRESENT_TEST usage. [ STATE_SETTING INFO 49: OMSETRENDERTARGETS_UNBINDDELETINGOBJECT]
On older versions of Windows 10 (example 2019 LTSC) D3D12GetInterface may fail because it doesn't exist, in such case we can check if D3D12GetInterface exists first.
DX12 trades blows with Vulkan on AMD depending on cpu usage and will be stable on RDNA 3 so let's default to it.
NVIDIA: 590 drivers on Nvidia are bad causing performance regressions so let's switch to DX12 as the default.
Check if depth copies are supported first.
If depth copies aren't supported fallback to doing full depth copies, also make sure source and destination rects match.