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

Fix Vulkan texture update #80781

Merged
merged 1 commit into from
Aug 21, 2023

Conversation

bitsawer
Copy link
Member

@bitsawer bitsawer commented Aug 19, 2023

For some non-4 byte aligned or compressed image formats (like FORMAT_RH, FORMAT_RG8 or COMPRESS_S3TC with USED_CHANNELS_RG etc.) the staging buffer calculation was off because possible alignment adjustment offset was not taken into account. This sometimes made the last pixel in an image corrupt when uploaded to GPU. Also see RenderingDeviceVulkan::_buffer_update() which does this same calculation correctly.

edit:

This fix proably needs to be done in #80164 RenderingDeviceVulkan::_texture_update_partial() too. Interestingly, this issue is fixed in Direct3D 12 PR #70315 in RenderingDeviceD3D12::_texture_update().

@bitsawer bitsawer added this to the 4.2 milestone Aug 19, 2023
@bitsawer bitsawer requested a review from a team as a code owner August 19, 2023 09:32
@RandomShaper RandomShaper added cherrypick:4.0 cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release labels Aug 21, 2023
@RandomShaper
Copy link
Member

Staging buffer and other common code will be unified eventually. but in the meantime this PR is needed.

The original fix was proposed here: #64304 (review). I didn't realize it could be crossported to Vulkan.

@akien-mga akien-mga merged commit fef62a6 into godotengine:master Aug 21, 2023
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.2.

@YuriSizov YuriSizov removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Sep 21, 2023
@bitsawer bitsawer deleted the fix_vulkan_texture_upload branch September 28, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

problem with ImageTexture created from image with FORMAT_RH
5 participants