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
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion hw/xbox/nv2a/pgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -5741,7 +5741,8 @@ static void pgraph_populate_surface_binding_entry_sized(NV2AState *d,
entry->vram_addr = dma.address + surface->offset;
entry->width = width;
entry->height = height;
entry->pitch = surface->pitch;
entry->pitch = entry->swizzle ? (entry->width * entry->fmt.bytes_per_pixel)
: surface->pitch;
entry->size = height * surface->pitch;
entry->upload_pending = true;
entry->download_pending = false;
Expand All @@ -5751,6 +5752,8 @@ static void pgraph_populate_surface_binding_entry_sized(NV2AState *d,
entry->frame_time = pg->frame_time;
entry->draw_time = pg->draw_time;
entry->cleared = false;

assert(entry->pitch >= (entry->width * entry->fmt.bytes_per_pixel));
}

static void pgraph_populate_surface_binding_entry(NV2AState *d, bool color,
Expand Down