Skip to content

Conversation

@K0bin
Copy link
Collaborator

@K0bin K0bin commented Jun 17, 2025

Improves #4895 when using MSAA in Source.

HL2 frequently resolves a 2048x1536 screenshot into a 1024x1024 image which is then used for refraction when rendering glass.

The game does these resolves (using StretchRect) quite frequently and unfortunately a lot of them are redundant.
image

Current DXVK master would first resolve the original texture to a temporary image and then blit that to the actual target texture.
While that's actually what the D3D9 docs suggest happens behind the scenes, it's a bit slow:

Note that use of the extra surface involved in using StretchRect to downsample a Multisample Rendertarget will result in a performance hit.

This PR changes it so the blit and resolve are done in one step rather than in two. It improves performance in the HL2 main menu at 4k Max settings with 8x MSAA from 240 fps to 265 fps.

Besides that, the PR also forbids creating a lockable texture with more than 1 sample. This matches what I've seen in tests done on Windows.

In the future I'd like to get rid of the resolve step in LockImage but for now we still need it because of the GDI-based presentation fallback.

@K0bin K0bin marked this pull request as draft June 17, 2025 20:04
Copy link
Owner

@doitsujin doitsujin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment, haven't looked at the d3d9 side yet.

@Blisto91 Blisto91 added the d3d9 label Jun 18, 2025
@K0bin K0bin force-pushed the resolve-cleanup branch from 84727fc to 1bf8878 Compare June 21, 2025 00:50
@K0bin K0bin marked this pull request as ready for review June 21, 2025 00:50
@doitsujin doitsujin merged commit 528dbba into doitsujin:master Jun 21, 2025
4 checks passed
@Isaac-Clarke
Copy link

Thank you for your work.

I am happy to have helped.

@K0bin K0bin deleted the resolve-cleanup branch June 23, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants