diff options
| author | 2023-10-21 02:25:27 -0300 | |
|---|---|---|
| committer | 2023-10-21 02:25:27 -0300 | |
| commit | b76a1d987ff83b831a19a0c19f9fcd96c504c077 (patch) | |
| tree | 4b08482cc3d34e341d7d8620182854c248f899b5 /src/video_core | |
| parent | Reverted dirty code in main. (diff) | |
| parent | Merge pull request #11748 from liamwhite/kern_1700 (diff) | |
| download | yuzu-b76a1d987ff83b831a19a0c19f9fcd96c504c077.tar.gz yuzu-b76a1d987ff83b831a19a0c19f9fcd96c504c077.tar.xz yuzu-b76a1d987ff83b831a19a0c19f9fcd96c504c077.zip | |
Merge branch 'yuzu-emu:master' into new-shortcut
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/fence_manager.h | 5 | ||||
| -rw-r--r-- | src/video_core/host_shaders/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/video_core/host_shaders/convert_abgr8_to_d32f.frag | 15 | ||||
| -rw-r--r-- | src/video_core/host_shaders/convert_d32f_to_abgr8.frag | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/blit_image.cpp | 9 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/blit_image.h | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/renderer_vulkan.cpp | 14 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.h | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 23 |
10 files changed, 75 insertions, 12 deletions
diff --git a/src/video_core/fence_manager.h b/src/video_core/fence_manager.h index 805a89900..c0e6471fe 100644 --- a/src/video_core/fence_manager.h +++ b/src/video_core/fence_manager.h | |||
| @@ -86,7 +86,10 @@ public: | |||
| 86 | uncommitted_operations.emplace_back(std::move(func)); | 86 | uncommitted_operations.emplace_back(std::move(func)); |
| 87 | } | 87 | } |
| 88 | pending_operations.emplace_back(std::move(uncommitted_operations)); | 88 | pending_operations.emplace_back(std::move(uncommitted_operations)); |
| 89 | QueueFence(new_fence); | 89 | { |
| 90 | std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; | ||
| 91 | QueueFence(new_fence); | ||
| 92 | } | ||
| 90 | if (!delay_fence) { | 93 | if (!delay_fence) { |
| 91 | func(); | 94 | func(); |
| 92 | } | 95 | } |
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index 8bb429578..cd2549232 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt | |||
| @@ -19,6 +19,7 @@ set(SHADER_FILES | |||
| 19 | block_linear_unswizzle_2d.comp | 19 | block_linear_unswizzle_2d.comp |
| 20 | block_linear_unswizzle_3d.comp | 20 | block_linear_unswizzle_3d.comp |
| 21 | convert_abgr8_to_d24s8.frag | 21 | convert_abgr8_to_d24s8.frag |
| 22 | convert_abgr8_to_d32f.frag | ||
| 22 | convert_d32f_to_abgr8.frag | 23 | convert_d32f_to_abgr8.frag |
| 23 | convert_d24s8_to_abgr8.frag | 24 | convert_d24s8_to_abgr8.frag |
| 24 | convert_depth_to_float.frag | 25 | convert_depth_to_float.frag |
diff --git a/src/video_core/host_shaders/convert_abgr8_to_d32f.frag b/src/video_core/host_shaders/convert_abgr8_to_d32f.frag new file mode 100644 index 000000000..095b910c2 --- /dev/null +++ b/src/video_core/host_shaders/convert_abgr8_to_d32f.frag | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #version 450 | ||
| 5 | |||
| 6 | layout(binding = 0) uniform sampler2D color_texture; | ||
| 7 | |||
| 8 | void main() { | ||
| 9 | ivec2 coord = ivec2(gl_FragCoord.xy); | ||
| 10 | vec4 color = texelFetch(color_texture, coord, 0).abgr; | ||
| 11 | |||
| 12 | float value = color.a * (color.r + color.g + color.b) / 3.0f; | ||
| 13 | |||
| 14 | gl_FragDepth = value; | ||
| 15 | } | ||
diff --git a/src/video_core/host_shaders/convert_d32f_to_abgr8.frag b/src/video_core/host_shaders/convert_d32f_to_abgr8.frag index 04cfef8b5..4e5a9f955 100644 --- a/src/video_core/host_shaders/convert_d32f_to_abgr8.frag +++ b/src/video_core/host_shaders/convert_d32f_to_abgr8.frag | |||
| @@ -9,6 +9,6 @@ layout(location = 0) out vec4 color; | |||
| 9 | 9 | ||
| 10 | void main() { | 10 | void main() { |
| 11 | ivec2 coord = ivec2(gl_FragCoord.xy); | 11 | ivec2 coord = ivec2(gl_FragCoord.xy); |
| 12 | float depth = textureLod(depth_tex, coord, 0).r; | 12 | float depth = texelFetch(depth_tex, coord, 0).r; |
| 13 | color = vec4(depth, depth, depth, 1.0); | 13 | color = vec4(depth, depth, depth, 1.0); |
| 14 | } | 14 | } |
diff --git a/src/video_core/renderer_vulkan/blit_image.cpp b/src/video_core/renderer_vulkan/blit_image.cpp index f01d2394e..c3db09424 100644 --- a/src/video_core/renderer_vulkan/blit_image.cpp +++ b/src/video_core/renderer_vulkan/blit_image.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 9 | #include "video_core/host_shaders/blit_color_float_frag_spv.h" | 9 | #include "video_core/host_shaders/blit_color_float_frag_spv.h" |
| 10 | #include "video_core/host_shaders/convert_abgr8_to_d24s8_frag_spv.h" | 10 | #include "video_core/host_shaders/convert_abgr8_to_d24s8_frag_spv.h" |
| 11 | #include "video_core/host_shaders/convert_abgr8_to_d32f_frag_spv.h" | ||
| 11 | #include "video_core/host_shaders/convert_d24s8_to_abgr8_frag_spv.h" | 12 | #include "video_core/host_shaders/convert_d24s8_to_abgr8_frag_spv.h" |
| 12 | #include "video_core/host_shaders/convert_d32f_to_abgr8_frag_spv.h" | 13 | #include "video_core/host_shaders/convert_d32f_to_abgr8_frag_spv.h" |
| 13 | #include "video_core/host_shaders/convert_depth_to_float_frag_spv.h" | 14 | #include "video_core/host_shaders/convert_depth_to_float_frag_spv.h" |
| @@ -434,6 +435,7 @@ BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_, | |||
| 434 | convert_depth_to_float_frag(BuildShader(device, CONVERT_DEPTH_TO_FLOAT_FRAG_SPV)), | 435 | convert_depth_to_float_frag(BuildShader(device, CONVERT_DEPTH_TO_FLOAT_FRAG_SPV)), |
| 435 | convert_float_to_depth_frag(BuildShader(device, CONVERT_FLOAT_TO_DEPTH_FRAG_SPV)), | 436 | convert_float_to_depth_frag(BuildShader(device, CONVERT_FLOAT_TO_DEPTH_FRAG_SPV)), |
| 436 | convert_abgr8_to_d24s8_frag(BuildShader(device, CONVERT_ABGR8_TO_D24S8_FRAG_SPV)), | 437 | convert_abgr8_to_d24s8_frag(BuildShader(device, CONVERT_ABGR8_TO_D24S8_FRAG_SPV)), |
| 438 | convert_abgr8_to_d32f_frag(BuildShader(device, CONVERT_ABGR8_TO_D32F_FRAG_SPV)), | ||
| 437 | convert_d32f_to_abgr8_frag(BuildShader(device, CONVERT_D32F_TO_ABGR8_FRAG_SPV)), | 439 | convert_d32f_to_abgr8_frag(BuildShader(device, CONVERT_D32F_TO_ABGR8_FRAG_SPV)), |
| 438 | convert_d24s8_to_abgr8_frag(BuildShader(device, CONVERT_D24S8_TO_ABGR8_FRAG_SPV)), | 440 | convert_d24s8_to_abgr8_frag(BuildShader(device, CONVERT_D24S8_TO_ABGR8_FRAG_SPV)), |
| 439 | convert_s8d24_to_abgr8_frag(BuildShader(device, CONVERT_S8D24_TO_ABGR8_FRAG_SPV)), | 441 | convert_s8d24_to_abgr8_frag(BuildShader(device, CONVERT_S8D24_TO_ABGR8_FRAG_SPV)), |
| @@ -559,6 +561,13 @@ void BlitImageHelper::ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, | |||
| 559 | Convert(*convert_abgr8_to_d24s8_pipeline, dst_framebuffer, src_image_view); | 561 | Convert(*convert_abgr8_to_d24s8_pipeline, dst_framebuffer, src_image_view); |
| 560 | } | 562 | } |
| 561 | 563 | ||
| 564 | void BlitImageHelper::ConvertABGR8ToD32F(const Framebuffer* dst_framebuffer, | ||
| 565 | const ImageView& src_image_view) { | ||
| 566 | ConvertPipelineDepthTargetEx(convert_abgr8_to_d32f_pipeline, dst_framebuffer->RenderPass(), | ||
| 567 | convert_abgr8_to_d32f_frag); | ||
| 568 | Convert(*convert_abgr8_to_d32f_pipeline, dst_framebuffer, src_image_view); | ||
| 569 | } | ||
| 570 | |||
| 562 | void BlitImageHelper::ConvertD32FToABGR8(const Framebuffer* dst_framebuffer, | 571 | void BlitImageHelper::ConvertD32FToABGR8(const Framebuffer* dst_framebuffer, |
| 563 | ImageView& src_image_view) { | 572 | ImageView& src_image_view) { |
| 564 | ConvertPipelineColorTargetEx(convert_d32f_to_abgr8_pipeline, dst_framebuffer->RenderPass(), | 573 | ConvertPipelineColorTargetEx(convert_d32f_to_abgr8_pipeline, dst_framebuffer->RenderPass(), |
diff --git a/src/video_core/renderer_vulkan/blit_image.h b/src/video_core/renderer_vulkan/blit_image.h index a032c71fb..b2104a59e 100644 --- a/src/video_core/renderer_vulkan/blit_image.h +++ b/src/video_core/renderer_vulkan/blit_image.h | |||
| @@ -67,6 +67,8 @@ public: | |||
| 67 | 67 | ||
| 68 | void ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, const ImageView& src_image_view); | 68 | void ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, const ImageView& src_image_view); |
| 69 | 69 | ||
| 70 | void ConvertABGR8ToD32F(const Framebuffer* dst_framebuffer, const ImageView& src_image_view); | ||
| 71 | |||
| 70 | void ConvertD32FToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view); | 72 | void ConvertD32FToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view); |
| 71 | 73 | ||
| 72 | void ConvertD24S8ToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view); | 74 | void ConvertD24S8ToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view); |
| @@ -130,6 +132,7 @@ private: | |||
| 130 | vk::ShaderModule convert_depth_to_float_frag; | 132 | vk::ShaderModule convert_depth_to_float_frag; |
| 131 | vk::ShaderModule convert_float_to_depth_frag; | 133 | vk::ShaderModule convert_float_to_depth_frag; |
| 132 | vk::ShaderModule convert_abgr8_to_d24s8_frag; | 134 | vk::ShaderModule convert_abgr8_to_d24s8_frag; |
| 135 | vk::ShaderModule convert_abgr8_to_d32f_frag; | ||
| 133 | vk::ShaderModule convert_d32f_to_abgr8_frag; | 136 | vk::ShaderModule convert_d32f_to_abgr8_frag; |
| 134 | vk::ShaderModule convert_d24s8_to_abgr8_frag; | 137 | vk::ShaderModule convert_d24s8_to_abgr8_frag; |
| 135 | vk::ShaderModule convert_s8d24_to_abgr8_frag; | 138 | vk::ShaderModule convert_s8d24_to_abgr8_frag; |
| @@ -149,6 +152,7 @@ private: | |||
| 149 | vk::Pipeline convert_d16_to_r16_pipeline; | 152 | vk::Pipeline convert_d16_to_r16_pipeline; |
| 150 | vk::Pipeline convert_r16_to_d16_pipeline; | 153 | vk::Pipeline convert_r16_to_d16_pipeline; |
| 151 | vk::Pipeline convert_abgr8_to_d24s8_pipeline; | 154 | vk::Pipeline convert_abgr8_to_d24s8_pipeline; |
| 155 | vk::Pipeline convert_abgr8_to_d32f_pipeline; | ||
| 152 | vk::Pipeline convert_d32f_to_abgr8_pipeline; | 156 | vk::Pipeline convert_d32f_to_abgr8_pipeline; |
| 153 | vk::Pipeline convert_d24s8_to_abgr8_pipeline; | 157 | vk::Pipeline convert_d24s8_to_abgr8_pipeline; |
| 154 | vk::Pipeline convert_s8d24_to_abgr8_pipeline; | 158 | vk::Pipeline convert_s8d24_to_abgr8_pipeline; |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index c4c30d807..7e7a80740 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -132,12 +132,16 @@ void RendererVulkan::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { | |||
| 132 | const bool use_accelerated = | 132 | const bool use_accelerated = |
| 133 | rasterizer.AccelerateDisplay(*framebuffer, framebuffer_addr, framebuffer->stride); | 133 | rasterizer.AccelerateDisplay(*framebuffer, framebuffer_addr, framebuffer->stride); |
| 134 | const bool is_srgb = use_accelerated && screen_info.is_srgb; | 134 | const bool is_srgb = use_accelerated && screen_info.is_srgb; |
| 135 | RenderScreenshot(*framebuffer, use_accelerated); | ||
| 136 | 135 | ||
| 137 | Frame* frame = present_manager.GetRenderFrame(); | 136 | { |
| 138 | blit_screen.DrawToSwapchain(frame, *framebuffer, use_accelerated, is_srgb); | 137 | std::scoped_lock lock{rasterizer.LockCaches()}; |
| 139 | scheduler.Flush(*frame->render_ready); | 138 | RenderScreenshot(*framebuffer, use_accelerated); |
| 140 | present_manager.Present(frame); | 139 | |
| 140 | Frame* frame = present_manager.GetRenderFrame(); | ||
| 141 | blit_screen.DrawToSwapchain(frame, *framebuffer, use_accelerated, is_srgb); | ||
| 142 | scheduler.Flush(*frame->render_ready); | ||
| 143 | present_manager.Present(frame); | ||
| 144 | } | ||
| 141 | 145 | ||
| 142 | gpu.RendererFrameEndNotify(); | 146 | gpu.RendererFrameEndNotify(); |
| 143 | rasterizer.TickFrame(); | 147 | rasterizer.TickFrame(); |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 61d03daae..465eac37e 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -198,7 +198,7 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) { | |||
| 198 | if (!pipeline) { | 198 | if (!pipeline) { |
| 199 | return; | 199 | return; |
| 200 | } | 200 | } |
| 201 | std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; | 201 | std::scoped_lock lock{LockCaches()}; |
| 202 | // update engine as channel may be different. | 202 | // update engine as channel may be different. |
| 203 | pipeline->SetEngine(maxwell3d, gpu_memory); | 203 | pipeline->SetEngine(maxwell3d, gpu_memory); |
| 204 | pipeline->Configure(is_indexed); | 204 | pipeline->Configure(is_indexed); |
| @@ -708,6 +708,7 @@ void RasterizerVulkan::TiledCacheBarrier() { | |||
| 708 | } | 708 | } |
| 709 | 709 | ||
| 710 | void RasterizerVulkan::FlushCommands() { | 710 | void RasterizerVulkan::FlushCommands() { |
| 711 | std::scoped_lock lock{LockCaches()}; | ||
| 711 | if (draw_counter == 0) { | 712 | if (draw_counter == 0) { |
| 712 | return; | 713 | return; |
| 713 | } | 714 | } |
| @@ -805,6 +806,7 @@ void RasterizerVulkan::FlushWork() { | |||
| 805 | if ((++draw_counter & 7) != 7) { | 806 | if ((++draw_counter & 7) != 7) { |
| 806 | return; | 807 | return; |
| 807 | } | 808 | } |
| 809 | std::scoped_lock lock{LockCaches()}; | ||
| 808 | if (draw_counter < DRAWS_TO_DISPATCH) { | 810 | if (draw_counter < DRAWS_TO_DISPATCH) { |
| 809 | // Send recorded tasks to the worker thread | 811 | // Send recorded tasks to the worker thread |
| 810 | scheduler.DispatchWork(); | 812 | scheduler.DispatchWork(); |
| @@ -1499,7 +1501,7 @@ void RasterizerVulkan::UpdateVertexInput(Tegra::Engines::Maxwell3D::Regs& regs) | |||
| 1499 | void RasterizerVulkan::InitializeChannel(Tegra::Control::ChannelState& channel) { | 1501 | void RasterizerVulkan::InitializeChannel(Tegra::Control::ChannelState& channel) { |
| 1500 | CreateChannel(channel); | 1502 | CreateChannel(channel); |
| 1501 | { | 1503 | { |
| 1502 | std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; | 1504 | std::scoped_lock lock{LockCaches()}; |
| 1503 | texture_cache.CreateChannel(channel); | 1505 | texture_cache.CreateChannel(channel); |
| 1504 | buffer_cache.CreateChannel(channel); | 1506 | buffer_cache.CreateChannel(channel); |
| 1505 | } | 1507 | } |
| @@ -1512,7 +1514,7 @@ void RasterizerVulkan::BindChannel(Tegra::Control::ChannelState& channel) { | |||
| 1512 | const s32 channel_id = channel.bind_id; | 1514 | const s32 channel_id = channel.bind_id; |
| 1513 | BindToChannel(channel_id); | 1515 | BindToChannel(channel_id); |
| 1514 | { | 1516 | { |
| 1515 | std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; | 1517 | std::scoped_lock lock{LockCaches()}; |
| 1516 | texture_cache.BindToChannel(channel_id); | 1518 | texture_cache.BindToChannel(channel_id); |
| 1517 | buffer_cache.BindToChannel(channel_id); | 1519 | buffer_cache.BindToChannel(channel_id); |
| 1518 | } | 1520 | } |
| @@ -1525,7 +1527,7 @@ void RasterizerVulkan::BindChannel(Tegra::Control::ChannelState& channel) { | |||
| 1525 | void RasterizerVulkan::ReleaseChannel(s32 channel_id) { | 1527 | void RasterizerVulkan::ReleaseChannel(s32 channel_id) { |
| 1526 | EraseChannel(channel_id); | 1528 | EraseChannel(channel_id); |
| 1527 | { | 1529 | { |
| 1528 | std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; | 1530 | std::scoped_lock lock{LockCaches()}; |
| 1529 | texture_cache.EraseChannel(channel_id); | 1531 | texture_cache.EraseChannel(channel_id); |
| 1530 | buffer_cache.EraseChannel(channel_id); | 1532 | buffer_cache.EraseChannel(channel_id); |
| 1531 | } | 1533 | } |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index ad069556c..ce3dfbaab 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h | |||
| @@ -133,6 +133,10 @@ public: | |||
| 133 | 133 | ||
| 134 | void ReleaseChannel(s32 channel_id) override; | 134 | void ReleaseChannel(s32 channel_id) override; |
| 135 | 135 | ||
| 136 | std::scoped_lock<std::recursive_mutex, std::recursive_mutex> LockCaches() { | ||
| 137 | return std::scoped_lock{buffer_cache.mutex, texture_cache.mutex}; | ||
| 138 | } | ||
| 139 | |||
| 136 | private: | 140 | private: |
| 137 | static constexpr size_t MAX_TEXTURES = 192; | 141 | static constexpr size_t MAX_TEXTURES = 192; |
| 138 | static constexpr size_t MAX_IMAGES = 48; | 142 | static constexpr size_t MAX_IMAGES = 48; |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 93773a69f..de34f6d49 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -1194,6 +1194,11 @@ void TextureCacheRuntime::ConvertImage(Framebuffer* dst, ImageView& dst_view, Im | |||
| 1194 | return blit_image_helper.ConvertD16ToR16(dst, src_view); | 1194 | return blit_image_helper.ConvertD16ToR16(dst, src_view); |
| 1195 | } | 1195 | } |
| 1196 | break; | 1196 | break; |
| 1197 | case PixelFormat::A8B8G8R8_SRGB: | ||
| 1198 | if (src_view.format == PixelFormat::D32_FLOAT) { | ||
| 1199 | return blit_image_helper.ConvertD32FToABGR8(dst, src_view); | ||
| 1200 | } | ||
| 1201 | break; | ||
| 1197 | case PixelFormat::A8B8G8R8_UNORM: | 1202 | case PixelFormat::A8B8G8R8_UNORM: |
| 1198 | if (src_view.format == PixelFormat::S8_UINT_D24_UNORM) { | 1203 | if (src_view.format == PixelFormat::S8_UINT_D24_UNORM) { |
| 1199 | return blit_image_helper.ConvertD24S8ToABGR8(dst, src_view); | 1204 | return blit_image_helper.ConvertD24S8ToABGR8(dst, src_view); |
| @@ -1205,6 +1210,16 @@ void TextureCacheRuntime::ConvertImage(Framebuffer* dst, ImageView& dst_view, Im | |||
| 1205 | return blit_image_helper.ConvertD32FToABGR8(dst, src_view); | 1210 | return blit_image_helper.ConvertD32FToABGR8(dst, src_view); |
| 1206 | } | 1211 | } |
| 1207 | break; | 1212 | break; |
| 1213 | case PixelFormat::B8G8R8A8_SRGB: | ||
| 1214 | if (src_view.format == PixelFormat::D32_FLOAT) { | ||
| 1215 | return blit_image_helper.ConvertD32FToABGR8(dst, src_view); | ||
| 1216 | } | ||
| 1217 | break; | ||
| 1218 | case PixelFormat::B8G8R8A8_UNORM: | ||
| 1219 | if (src_view.format == PixelFormat::D32_FLOAT) { | ||
| 1220 | return blit_image_helper.ConvertD32FToABGR8(dst, src_view); | ||
| 1221 | } | ||
| 1222 | break; | ||
| 1208 | case PixelFormat::R32_FLOAT: | 1223 | case PixelFormat::R32_FLOAT: |
| 1209 | if (src_view.format == PixelFormat::D32_FLOAT) { | 1224 | if (src_view.format == PixelFormat::D32_FLOAT) { |
| 1210 | return blit_image_helper.ConvertD32ToR32(dst, src_view); | 1225 | return blit_image_helper.ConvertD32ToR32(dst, src_view); |
| @@ -1222,6 +1237,12 @@ void TextureCacheRuntime::ConvertImage(Framebuffer* dst, ImageView& dst_view, Im | |||
| 1222 | } | 1237 | } |
| 1223 | break; | 1238 | break; |
| 1224 | case PixelFormat::D32_FLOAT: | 1239 | case PixelFormat::D32_FLOAT: |
| 1240 | if (src_view.format == PixelFormat::A8B8G8R8_UNORM || | ||
| 1241 | src_view.format == PixelFormat::B8G8R8A8_UNORM || | ||
| 1242 | src_view.format == PixelFormat::A8B8G8R8_SRGB || | ||
| 1243 | src_view.format == PixelFormat::B8G8R8A8_SRGB) { | ||
| 1244 | return blit_image_helper.ConvertABGR8ToD32F(dst, src_view); | ||
| 1245 | } | ||
| 1225 | if (src_view.format == PixelFormat::R32_FLOAT) { | 1246 | if (src_view.format == PixelFormat::R32_FLOAT) { |
| 1226 | return blit_image_helper.ConvertR32ToD32(dst, src_view); | 1247 | return blit_image_helper.ConvertR32ToD32(dst, src_view); |
| 1227 | } | 1248 | } |
| @@ -2034,7 +2055,7 @@ void TextureCacheRuntime::TransitionImageLayout(Image& image) { | |||
| 2034 | }, | 2055 | }, |
| 2035 | }; | 2056 | }; |
| 2036 | scheduler.RequestOutsideRenderPassOperationContext(); | 2057 | scheduler.RequestOutsideRenderPassOperationContext(); |
| 2037 | scheduler.Record([barrier = barrier](vk::CommandBuffer cmdbuf) { | 2058 | scheduler.Record([barrier](vk::CommandBuffer cmdbuf) { |
| 2038 | cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, | 2059 | cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, |
| 2039 | VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, barrier); | 2060 | VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, barrier); |
| 2040 | }); | 2061 | }); |