-
Notifications
You must be signed in to change notification settings - Fork 123
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
Fix D3D12 WriteToSubresource size calculation #1699
Fix D3D12 WriteToSubresource size calculation #1699
Conversation
CI gfxreconstruct build queued with queue ID 246515. |
case D3D12_RESOURCE_DIMENSION_TEXTURE1D: | ||
data_size = GetOneRowSizeByDXGIFormat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GetOneRowSizeByDXGIFromat functions are no longer used. Would you like me to remove them as part of this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that can be a separate PR. Thanks!
return size; | ||
} | ||
|
||
uint64_t GetPixelByteSize(DXGI_FORMAT format) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing GetSubresourcePixelByteSize function was specifically documented as not supporting compressed texture formats, so I added a separate function to retrieve the block size for BC formats and then added this function to combine them. These could all be merged into a single function if you don't think that would produce any unexpected side effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are fine separated.
CI gfxreconstruct build # 4735 running. |
CI gfxreconstruct build # 4735 passed. |
The current WriteToSubresource size calculation may not work correctly when either the DstSubresource parameter is greater than 0 or the subresource is a texture with a block compressed format. The size calculation was updated to handle these cases using texture utility code that was originally added for D3D11, where it is used for the D3D11 UpdateSubresource and WriteToSubresource size calculations.
2d58500
to
795569c
Compare
CI gfxreconstruct build queued with queue ID 250573. |
CI gfxreconstruct build # 4784 running. |
CI gfxreconstruct build # 4784 passed. |
The current WriteToSubresource size calculation may not work correctly when either the DstSubresource parameter is greater than 0 or the subresource is a texture with a block compressed format.
The size calculation was updated to handle these cases using texture utility code that was originally added for D3D11, where it is used for the D3D11 UpdateSubresource and WriteToSubresource size calculations.
This fixes some crashes in ID3D12Resource::WriteToSubresource observed when capturing on devices with integrated GPUs.