Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Age of Empires 2 Definitive Edition stutters unless apitrace mode is set #2491

Closed
EmmerichFrog opened this issue Feb 11, 2022 · 1 comment
Closed
Labels

Comments

@EmmerichFrog
Copy link

Software information

the game stutters regular intervals with dxvk, it's very noticeable online and as the game goes on it only gets worse. One other way to repro 100% of the time is to run the ingame benchmark: small stutters can be noticed (they are much more subtle this way and you might think it's just the benchmark that it's heavy but it's not that) every few second for the whole duration. This also does not happen with wined3d and the game runs as expected.
It might be a game bug since the same (or at least very similar) issue happens on windows for some people (seems the common thing is having an amd gpu), so it might not be reproducible on other hw.
Having apitrace mode on also makes the benchmark score noticeably higher (at least 100-150 points on my laptop, 150-200 on my desktop), so it's not just placebo.

The bug has been present since one game update about a year ago, and I have played it on several wine, proton, dxvk build over the months.

System information

  • GPU: happens both on a vega 8 laptop and a 6700xt
  • Driver: happens both on current mesa stable and various git builds
  • Wine version: tried proton experimental, 6.3 and various GE builds
  • DXVK version: lastest master, but it also happens on older versions

Log files

the logs are taken on my vega 8 laptop without apitrace mode

AoE2DE_s_d3d11.log
AoE2DE_s_dxgi.log

@K0bin K0bin added the d3d11 label Feb 11, 2022
@doitsujin
Copy link
Owner

Can't confirm, getting the same benchmark score with and without apitrace mode here. Also means that enabling it won't hurt though.

TheIronWolfModding added a commit to TheIronWolfModding/dxvk that referenced this issue Feb 19, 2022
* Enabled strict float emulation for BlazBlue Centralfiction

* [dxvk] Explicitly intiialize framebuffer info

* [d3d11] Lock context before EmitCs for annotations

* [build] Update arch-mingw-github-action to v6

* Added config for James Cameron's Avatar (DX9)

* [dxgi] Fix refresh rate filtering in FindClosestMatchingMode

We need to operate on the pre-filtered list, or otherwise we may run into
problems where not all refresh rates are supported for all display modes.

* [d3d9] Always upload all managed texture mips after AddDirtyBox call

Co-authored-by: Paul Gofman <[email protected]>

* [d3d9] Update FFVS when D3DFVF_PSIZE is specified.

This fixes doitsujin#2387

* [d3d9] Dirty FF vertex shader if any  D3D9VertexDeclFlags change.

The vertex shader depends on all of these in some way.

* [meta] Release 1.9.3

* WIP

* [dxvk] Display allocated memory in HUD again

* [dxvk] Free empty memory chunks

* [dxvk] Replace allocation priority with allocation flags

* [dxvk] Be smarter about which chunks to free

Freeing all empty chunks immediately may cause issues if an app constantly
allocates and frees a small number of resources that don't fit into any
existing chunk, so try to keep one around. Aggressively free everything
under memory pressure if necessary.

* [dxvk] Reduce size up to which device-local buffers can be invalidated

* [dxvk] Reduce maximum size of multi-slice buffers

* [util] Enable performance options for God of War

* [util] Disable NVAPI hack for God of War

Needed for DLSS support.

* [dxvk] Don't shrink HVV heap if it's the main video memory heap

May fix issues on RBAR-enabled Nvidia systems.

* [d3d9] Enable strict float emulation by default for new radv.

* [d3d9] Fix float emulation detection.

ffs

* WIP

* [dxvk] Remove options to disable OpenVR/XR support

No longer needed since we no longer load vrclient.so into the game's
process just to query extensions.

* [meta] Release 1.9.4

* [d3d11] Add FL12+ enum names

* [d3d9] Only enable FETCH4 for single channel formats

* [build] MSVC CI

* [dxvk] Fix MSVC build.

* [dxvk] Rework driver version fixup to use driver ID instead of vendor ID

* [dxvk] Add version fixup for proprietary Intel drivers

* [d3d11] Add D3D11On12CreateDevice stub

* [d3d11] Remove unused parameters from deferred context Map functions

* [d3d11] Fix confusing code in deferred context Map

This did work, but we shouldn't use an object that was already moved.

* [d3d11] Implement suballocation from staging buffer for small updates

* [d3d11] Optimize UpdateSubresource for small buffer updates

Some games use UpdateSubresource to upload constant buffers in
between draws, so this path should be as fast as possible.

Also fixes a potential issue when using D3D11_COPY_NO_OVERWRITE
on deferred contexts, since the Map requirements don't hold here.

* [build] Use MSBuild backend on Windows CI

Also merge Prepare and Build steps to prevent environment variable leaks and apply some minor formatting changes.

* [build] Avoid meson warning.

WARNING: You should add the boolean check kwarg to the run_command call.
         It currently defaults to false,
         but it will default to true in future releases of meson.

Stupid change, stupid warning, stupid fix.

* [util] Enable apitrace mode for AoE2 Definitive Edition

Fixes doitsujin#2491.

* [dxvk] Introduce sequence numbers for CS submissions

* [dxvk] Reorganize DxvkBuffer data structure

Should hopefully reduce CPU cache conflicts.

* [d3d11] Add ResourceAddRef/ReleasePrivate with known resource type

* [d3d11] Add D3D11ResourceRef

Implements private ref counting for arbitrary resource types.

* [d3d11] Store buffer map mode in D3D11Buffer

Matches what we do for textures, and makes it so that we don't
have to dereference the resource pointer to figure this out.

* [d3d11] Store ID3D11Resource interface in D3D11CommonTexture

Going full circle here, but it's actually useful now.

* [d3d11] Add method to query D3D11 resource dimension from texture

* [d3d11] Track last staging resource usage with a sequence number

* [d3d11] Increment sequence number when submitting command lists

This does not do any tracking on deferred contexts just yet.

* [d3d11] Implement sequence number tracking on deferred contexts

* [d3d11] Track resources when dispatching Cubin shaders as well

* [d3d11] Synchronize only to given sequence number in WaitForResources

Avoids costly thread synchronization when mapping staging resources
for reading, as well as some other scenarios.

* [d3d11] Optimize Unmap on immediate contexts

* [d3d11] Change D3D11ResourceRef constructor to be more useful

* [d3d11] Further simplify D3D11DeferredContextMapEntry

And no longer create a strong reference to the given resource.

* [d3d11] Avoid GPU synchronization on mapping buffers when possible

* [d3d11] Avoid GPU synchronization on mapping images when possible

* [dxvk] Expose a way to increment stat counters

In case the counters come from external sources.

* [dxvk] Store DXVK device inside DxvkCsThread object

* [dxvk] Add CS thread stat counters

* [hud] Add HUD item to show CS thread stats

* [d3d11] Only use updateBuffer for very small buffer updates

Otherwise we may end up with significant copy overhead on the CS thread.

* [d3d9] Exit early in ProcessVertices if the vertex count is 0

We don't want to pass a zero-sized copy to the backend.

* [dxvk] Repurpose updateBuffer

Only allow it for very small updates where scheduling a copy command would
likely be slower. Some drivers have special paths for tiny updates.

* [dxvk] Introduce tryInvalidateDeviceLocalBuffer

* [dxvk] Discard buffer slice in copyBuffer if possible

* [dxvk] Introduce DxvkStagingBuffer

* [d3d11] Use DxvkStagingBuffer in D3D11DeviceContext

* [dxvk] Use staging buffer for gamma ramp uploads

* [dxvk] Remove unused updateImage function

* [dxvk] Use DxvkStagingBuffer in DxvkContext

* [dxvk] Remove DxvkStagingDataAlloc

Unused and overly clunky.

* [dxvk] Allow large sysmem allocations on 64-bit platforms again

Since we frequently discard staging buffers now, having larger chunks
is actually beneficial again.

* [dxvk] Introduce transient memory flag for staging buffers

Potentially reduces fragmentation by putting short-lived staging buffers
and sysmem resources created by the application into different memory pools.

* [dxvk] Rework HUD font texture initialization

We really shouldn't need a separate context for this.

* [dxvk] Remove unused trimStagingBuffers method

* [dxvk] Don't suballocate large staging buffer allocations

Otherwise we'll risk wasting almost half the staging buffer memory.
Creating a temporary buffer is cheap enough, so just do that.

* [dxvk] Reduce context staging buffer size to 4 MiB

Same idea as before, just create a temporary buffer for larger resources.

This can avoid frequent Vulkan memory allocations and deallocations since
many small buffers are more likely to fit into a single memory chunk than
a small number of large buffers, thus reducing the overall memory footprint.

* [dxvk] Add stat counter for pipeline barriers

* [dxvk] Display barrier count in draw call HUD item

* [dxvk] Introduce DxvkDevice::waitForResource

Blocks on the queue thread's condition variable instead of busy-waiting,
and tracks synchronization with new stat counters. Cleanup is rearranged
to minimize delays before signals and resources are notified.

* [d3d11] Use new waitForResource method

* [d3d9] Use new waitForResource method

* [hud] Display GPU synchronization in HUD

* [d3d11] Add d3d11.maxImplicitDiscardSize option

* [util] Bump maxImplicitDiscardSize for Quantum Break

Otherwise we're synchronizing and frame times are garbage.

* [util] Enable apitrace mode for Nier Replicant

Game is broken and reads back dynamic vertex/index buffers over PCI-E.

* [d3d11] Handle subresource field in copy/move operations

Derp.

* [d3d11] Enable stall tracking for timestamp queries

Because games are dumb and don't understand that the GPU doesn't
work synchronously with the render thread.

* [d3d11] Add implicit flush after tracking sequence numbers

Flushing early when using a tracked resource may reduce stalls.

* [dxvk] Repurpose initImage method

This is now supposed to clear images of any type, and only to be
used for resource initialization after creation.

* [d3d11] Use initImage to clear uninitialized image resources

* [d3d9] Use initImage to clear uninitialized image resources

* [dxvk] Remove unused clear methods

* [dxvk] Add command buffer parameter to cmdFillBuffer

* [dxvk] Add initBuffer method

* [d3d11] Use initBuffer method

* [d3d9] Use initBuffer method

* [dxvk] Track buffer as used in initBuffer

Git ate my commit when I was testing something...

* [d3d11] Consider empty CS chunks when tracking resources

Avoids deadlocks if we track multiple resources and flush in between.

* [dxvk] Free existing staging buffer before creating a new one

* WIP

* WIP

Co-authored-by: Supreeeme <[email protected]>
Co-authored-by: Philip Rebohle <[email protected]>
Co-authored-by: Joshua Ashton <[email protected]>
Co-authored-by: dosse91 <[email protected]>
Co-authored-by: Robin Kertels <[email protected]>
Co-authored-by: Paul Gofman <[email protected]>
Co-authored-by: Christopher Egert <[email protected]>
Co-authored-by: Georg Lehmann <[email protected]>
Co-authored-by: Krzysztof Bogacki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants