Vulkan CP: Fix calculating an invalid copy destination base address when sizeof(texel) != 4

This commit is contained in:
Dr. Chat
2016-05-05 23:42:36 -05:00
parent 7c5042add7
commit 79f1193130
2 changed files with 69 additions and 6 deletions

View File

@@ -362,7 +362,7 @@ void VulkanCommandProcessor::PerformSwap(uint32_t frontbuffer_ptr,
command_buffer_pool_->EndBatch(current_batch_fence_);
// TODO(DrChat): Remove this.
VkFence fences[] = { *current_batch_fence_ };
VkFence fences[] = {*current_batch_fence_};
vkWaitForFences(*device_, 1, fences, true, -1);
// Scavenging.
@@ -733,9 +733,10 @@ bool VulkanCommandProcessor::PopulateVertexBuffers(
return true;
}
bool VulkanCommandProcessor::PopulateSamplers(
VkCommandBuffer command_buffer, VkCommandBuffer setup_buffer,
VulkanShader* vertex_shader, VulkanShader* pixel_shader) {
bool VulkanCommandProcessor::PopulateSamplers(VkCommandBuffer command_buffer,
VkCommandBuffer setup_buffer,
VulkanShader* vertex_shader,
VulkanShader* pixel_shader) {
#if FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
@@ -829,11 +830,13 @@ bool VulkanCommandProcessor::IssueCopy() {
window_offset_y |= 0x8000;
}
size_t read_size = GetTexelSize(ColorFormatToTextureFormat(copy_dest_format));
// Adjust the copy base offset to point to the beginning of the texture, so
// we don't run into hiccups down the road (e.g. resolving the last part going
// backwards).
int32_t dest_offset = window_offset_y * copy_dest_pitch * 4;
dest_offset += window_offset_x * 32 * 4;
int32_t dest_offset = window_offset_y * copy_dest_pitch * int(read_size);
dest_offset += window_offset_x * 32 * int(read_size);
copy_dest_base += dest_offset;
// HACK: vertices to use are always in vf0.