diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-10-29 19:25:46 -0500 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-10-29 19:25:46 -0500 |
commit | 7a661eaa7c89814ffa533d6884141b4eecce704c (patch) | |
tree | f1c4c2e2ffb0311eeabec8cf8f081a115cc6e4a2 /servers/rendering | |
parent | b8f626a0e12525024e1676b611fcf95c86ae93c5 (diff) | |
parent | 03f56fc15d111e9ec2253f46547bae312d76b630 (diff) | |
download | redot-engine-7a661eaa7c89814ffa533d6884141b4eecce704c.tar.gz |
Merge pull request #98612 from DarioSamo/alignment-transfer-fix
Fix transfer alignment on initial texture transfer.
Diffstat (limited to 'servers/rendering')
-rw-r--r-- | servers/rendering/rendering_device.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp index 3faf4b5ab1..b0e29e426b 100644 --- a/servers/rendering/rendering_device.cpp +++ b/servers/rendering/rendering_device.cpp @@ -1260,8 +1260,6 @@ Error RenderingDevice::_texture_initialize(RID p_texture, uint32_t p_layer, cons write_ptr = driver->buffer_map(transfer_worker->staging_buffer); ERR_FAIL_NULL_V(write_ptr, ERR_CANT_CREATE); - write_ptr += staging_worker_offset; - if (driver->api_trait_get(RDD::API_TRAIT_HONORS_PIPELINE_BARRIERS)) { // Transition the texture to the optimal layout. RDD::TextureBarrier tb; @@ -1303,11 +1301,12 @@ Error RenderingDevice::_texture_initialize(RID p_texture, uint32_t p_layer, cons if (copy_pass) { const uint8_t *read_ptr_mipmap_layer = read_ptr_mipmap + (tight_mip_size / depth) * z; - _copy_region_block_or_regular(read_ptr_mipmap_layer, write_ptr, 0, 0, width, width, height, block_w, block_h, pitch, pixel_size, block_size); - write_ptr += to_allocate; + uint64_t staging_buffer_offset = staging_worker_offset + staging_local_offset; + uint8_t *write_ptr_mipmap_layer = write_ptr + staging_buffer_offset; + _copy_region_block_or_regular(read_ptr_mipmap_layer, write_ptr_mipmap_layer, 0, 0, width, width, height, block_w, block_h, pitch, pixel_size, block_size); RDD::BufferTextureCopyRegion copy_region; - copy_region.buffer_offset = staging_worker_offset + staging_local_offset; + copy_region.buffer_offset = staging_buffer_offset; copy_region.texture_subresources.aspect = texture->read_aspect_flags; copy_region.texture_subresources.mipmap = mm_i; copy_region.texture_subresources.base_layer = p_layer; |