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

nv2a: Use width to calculate swizzled surface pitch #942

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mborgerson
Copy link
Member

I forget the case that prompted this change. Would like a test case to confirm hardware behavior wrt pitch on swizzled surfaces

@mborgerson mborgerson marked this pull request as draft May 20, 2022 09:28
@abaire
Copy link
Contributor

abaire commented May 21, 2022

I added a test case for this to the pgraph tester:
Test
HW results

At a high level, it sets up a green linear surface, then sets up a smaller swizzled surface at the same address and renders a checkerboard pattern into it. The original green surface is used to determine the in-memory layout of the smaller draw; the final output is rendered as a linear texture using the full surface size.

It does this with 4 permutations of NV097_SET_SURFACE_FORMAT_WIDTH/HEIGHT + NV097_SET_SURFACE_PITCH to see if the results differ, they do not.

Unfortunately with or without your fix, it crashes xemu (looks like there's an undersized malloc someplace, I haven't attempted to debug yet). The triggering case seems to be the case where the surface is set to the outer texture size and the pitch is set to the inner texture size.

On HW this case works fine and the others produce output that differs from xemu; HW appears to completely ignore pitch when dealing with swizzled surfaces.

@abaire
Copy link
Contributor

abaire commented Jul 6, 2022

I forgot that I wrote the test for this PR and ended up creating #1153 to fix the undersized malloc. Once that's merged this should probably be retested to verify that it matches HW behavior.

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.

None yet

2 participants