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

D3D12: Fix out of bounds root parameter index when per-pixel lighting is disabled #13275

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

Conversation

Pokechu22
Copy link
Contributor

ROOT_PARAMETER statically allocates root parameter indexes, but DXContext::CreateGXRootSignature tries to skip ones that aren't relevant (those for bounding box and per-pixel lighting). b6d321b added an additional index for data related to graphics mods, which is always present (even if there are no graphics mods).

However, the logic for choosing what index to use didn't correctly handle per-pixel lighting being disabled, only bounding box being disabled. I've fixed that by moving the graphics mod one to the start of the list, so it doesn't have a dynamic offset. (I think it'd be better to make it optional too, but I'm not confident in my D3D12 abilities to do that right.)

Before:

No per-pixel lighting, no BB:

D3D12 ERROR: ID3D12CommandList::SetGraphicsRootConstantBufferView: RootParameterIndex [9] is out of bounds for the currently set root signature, which declares 9 root parameters. [ EXECUTION ERROR #710: SET_ROOT_CONSTANT_BUFFER_VIEW_INVALID]

No per-pixel lighting, yes BB:

D3D12 ERROR: ID3D12CommandList::SetGraphicsRootConstantBufferView: RootParameterIndex [10] is out of bounds for the currently set root signature, which declares 10 root parameters. [ EXECUTION ERROR #710: SET_ROOT_CONSTANT_BUFFER_VIEW_INVALID]

With per-pixel lighting enabled, this stopped happening. Now, things work properly in both cases.

@Pokechu22 Pokechu22 requested a review from iwubcode January 15, 2025 06:15
@Pokechu22 Pokechu22 force-pushed the d3d12-custom-root-param-index branch from 508a7b6 to 64514bd Compare January 15, 2025 06:30
@dolphin-ci
Copy link

dolphin-ci bot commented Jan 15, 2025

FifoCI detected that this change impacts graphical rendering. Here are the behavior differences detected by the system:

  • sw3-dt on ogl-lin-mesa: diff

automated-fifoci-reporter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant