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

Implement damage-aware copies for RGB24-packed data #1099

Merged
merged 7 commits into from
Nov 6, 2023

Conversation

Xyene
Copy link
Contributor

@Xyene Xyene commented Nov 6, 2023

Copying my comments motivating this approach from Discord for posterity:

we can make a slight modification to the HLSL conversion shader to never consider data from row (i+1) when converting row i

(this can only happen for the alpha channel of the rightmost pixel on a row anyway)

so this would have the effect of making the height of the output texture be the same as the input, but the width be round(inputWidth * 3 / 4, 4) / 4

and we could perform a single CopySubResource per damage rect as we have before

and should not have any implications for the guest, they're still seeing the packed data they expected to see

we only need to do the 1 CopySubResource per row of damage rect thing if we allow the alpha channel of the last pixel on row i to encode the red channel of the first pixel on row (i+1)

by not allowing that we waste like 2 KiB per frame, but win the ability to use damage rects so seems worth it

In practice this worked out because `rows = cols`, but this will change
in future commits as I implement RGB24 damage support.
For the moment, this just increases texture memory usage, but does not
affect behavior.

In a future commit, I will modify the shaders to not pack data across
rows, in order to enable damage copies.
This is a precursor to allowing damage-aware RGB24 copies.
Now that data isn't packed across rows, we can decrease the amount of
texture memory we require.
@gnif gnif merged commit 05e1893 into gnif:dxgi-rgb24 Nov 6, 2023
15 of 16 checks passed
@Xyene Xyene deleted the dxgi-rgb24-with-damage branch November 6, 2023 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants