diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache_base.h | 6 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index aadd6967c..1ba31be88 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -1335,7 +1335,8 @@ bool AccelerateDMA::DmaBufferImageCopy(const Tegra::DMA::ImageCopy& copy_info, | |||
| 1335 | } | 1335 | } |
| 1336 | const u32 buffer_size = static_cast<u32>(buffer_operand.pitch * buffer_operand.height); | 1336 | const u32 buffer_size = static_cast<u32>(buffer_operand.pitch * buffer_operand.height); |
| 1337 | static constexpr auto sync_info = VideoCommon::ObtainBufferSynchronize::FullSynchronize; | 1337 | static constexpr auto sync_info = VideoCommon::ObtainBufferSynchronize::FullSynchronize; |
| 1338 | const auto post_op = VideoCommon::ObtainBufferOperation::DoNothing; | 1338 | const auto post_op = IS_IMAGE_UPLOAD ? VideoCommon::ObtainBufferOperation::DoNothing |
| 1339 | : VideoCommon::ObtainBufferOperation::MarkAsWritten; | ||
| 1339 | const auto [buffer, offset] = | 1340 | const auto [buffer, offset] = |
| 1340 | buffer_cache.ObtainBuffer(buffer_operand.address, buffer_size, sync_info, post_op); | 1341 | buffer_cache.ObtainBuffer(buffer_operand.address, buffer_size, sync_info, post_op); |
| 1341 | 1342 | ||
| @@ -1344,8 +1345,12 @@ bool AccelerateDMA::DmaBufferImageCopy(const Tegra::DMA::ImageCopy& copy_info, | |||
| 1344 | const std::span copy_span{©, 1}; | 1345 | const std::span copy_span{©, 1}; |
| 1345 | 1346 | ||
| 1346 | if constexpr (IS_IMAGE_UPLOAD) { | 1347 | if constexpr (IS_IMAGE_UPLOAD) { |
| 1348 | texture_cache.PrepareImage(image_id, true, false); | ||
| 1347 | image->UploadMemory(buffer->Handle(), offset, copy_span); | 1349 | image->UploadMemory(buffer->Handle(), offset, copy_span); |
| 1348 | } else { | 1350 | } else { |
| 1351 | if (offset % BytesPerBlock(image->info.format)) { | ||
| 1352 | return false; | ||
| 1353 | } | ||
| 1349 | texture_cache.DownloadImageIntoBuffer(image, buffer->Handle(), offset, copy_span, | 1354 | texture_cache.DownloadImageIntoBuffer(image, buffer->Handle(), offset, copy_span, |
| 1350 | buffer_operand.address, buffer_size); | 1355 | buffer_operand.address, buffer_size); |
| 1351 | } | 1356 | } |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index aa59889bd..89aa243d2 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -830,7 +830,8 @@ bool AccelerateDMA::DmaBufferImageCopy(const Tegra::DMA::ImageCopy& copy_info, | |||
| 830 | } | 830 | } |
| 831 | const u32 buffer_size = static_cast<u32>(buffer_operand.pitch * buffer_operand.height); | 831 | const u32 buffer_size = static_cast<u32>(buffer_operand.pitch * buffer_operand.height); |
| 832 | static constexpr auto sync_info = VideoCommon::ObtainBufferSynchronize::FullSynchronize; | 832 | static constexpr auto sync_info = VideoCommon::ObtainBufferSynchronize::FullSynchronize; |
| 833 | const auto post_op = VideoCommon::ObtainBufferOperation::DoNothing; | 833 | const auto post_op = IS_IMAGE_UPLOAD ? VideoCommon::ObtainBufferOperation::DoNothing |
| 834 | : VideoCommon::ObtainBufferOperation::MarkAsWritten; | ||
| 834 | const auto [buffer, offset] = | 835 | const auto [buffer, offset] = |
| 835 | buffer_cache.ObtainBuffer(buffer_operand.address, buffer_size, sync_info, post_op); | 836 | buffer_cache.ObtainBuffer(buffer_operand.address, buffer_size, sync_info, post_op); |
| 836 | 837 | ||
| @@ -839,8 +840,12 @@ bool AccelerateDMA::DmaBufferImageCopy(const Tegra::DMA::ImageCopy& copy_info, | |||
| 839 | const std::span copy_span{©, 1}; | 840 | const std::span copy_span{©, 1}; |
| 840 | 841 | ||
| 841 | if constexpr (IS_IMAGE_UPLOAD) { | 842 | if constexpr (IS_IMAGE_UPLOAD) { |
| 843 | texture_cache.PrepareImage(image_id, true, false); | ||
| 842 | image->UploadMemory(buffer->Handle(), offset, copy_span); | 844 | image->UploadMemory(buffer->Handle(), offset, copy_span); |
| 843 | } else { | 845 | } else { |
| 846 | if (offset % BytesPerBlock(image->info.format)) { | ||
| 847 | return false; | ||
| 848 | } | ||
| 844 | texture_cache.DownloadImageIntoBuffer(image, buffer->Handle(), offset, copy_span, | 849 | texture_cache.DownloadImageIntoBuffer(image, buffer->Handle(), offset, copy_span, |
| 845 | buffer_operand.address, buffer_size); | 850 | buffer_operand.address, buffer_size); |
| 846 | } | 851 | } |
diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index e9ec91265..a40825c9f 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h | |||
| @@ -243,6 +243,9 @@ public: | |||
| 243 | /// Create channel state. | 243 | /// Create channel state. |
| 244 | void CreateChannel(Tegra::Control::ChannelState& channel) final override; | 244 | void CreateChannel(Tegra::Control::ChannelState& channel) final override; |
| 245 | 245 | ||
| 246 | /// Prepare an image to be used | ||
| 247 | void PrepareImage(ImageId image_id, bool is_modification, bool invalidate); | ||
| 248 | |||
| 246 | std::recursive_mutex mutex; | 249 | std::recursive_mutex mutex; |
| 247 | 250 | ||
| 248 | private: | 251 | private: |
| @@ -387,9 +390,6 @@ private: | |||
| 387 | /// Synchronize image aliases, copying data if needed | 390 | /// Synchronize image aliases, copying data if needed |
| 388 | void SynchronizeAliases(ImageId image_id); | 391 | void SynchronizeAliases(ImageId image_id); |
| 389 | 392 | ||
| 390 | /// Prepare an image to be used | ||
| 391 | void PrepareImage(ImageId image_id, bool is_modification, bool invalidate); | ||
| 392 | |||
| 393 | /// Prepare an image view to be used | 393 | /// Prepare an image view to be used |
| 394 | void PrepareImageView(ImageViewId image_view_id, bool is_modification, bool invalidate); | 394 | void PrepareImageView(ImageViewId image_view_id, bool is_modification, bool invalidate); |
| 395 | 395 | ||