diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index e6cc43033..1f529644d 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -414,8 +414,8 @@ vk::Pipeline PipelineCache::BuildPipeline(const PipelineInfo& info) { vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA}; const vk::PipelineColorBlendStateCreateInfo color_blending = { - .logicOpEnable = info.blending.logic_op_enable.Value(), - .logicOp = PicaToVK::LogicOp(info.blending.logic_op), + .logicOpEnable = !info.blending.blend_enable.Value(), + .logicOp = PicaToVK::LogicOp(info.blending.logic_op.Value()), .attachmentCount = 1, .pAttachments = &colorblend_attachment, .blendConstants = std::array{1.0f, 1.0f, 1.0f, 1.0f}}; diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.h b/src/video_core/renderer_vulkan/vk_pipeline_cache.h index d21c1ba1e..5ff79a3bd 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.h +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.h @@ -61,8 +61,7 @@ union BlendingState { BitField<16, 4, Pica::FramebufferRegs::BlendFactor> dst_alpha_blend_factor; BitField<20, 3, Pica::FramebufferRegs::BlendEquation> alpha_blend_eq; BitField<23, 4, u32> color_write_mask; - BitField<27, 1, u32> logic_op_enable; - BitField<28, 4, Pica::FramebufferRegs::LogicOp> logic_op; + BitField<27, 4, Pica::FramebufferRegs::LogicOp> logic_op; }; union VertexBinding { diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index 0c3dc3a8b..618111bb3 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp @@ -33,15 +33,6 @@ void Swapchain::Create(u32 width, u32 height) { is_outdated = false; is_suboptimal = false; - // Destroy the previous image views - vk::Device device = instance.GetDevice(); - for (auto& image : swapchain_images) { - if (image.image) { - device.destroyImageView(image.image_view); - device.destroyFramebuffer(image.framebuffer); - } - } - // Fetch information about the provided surface Configure(width, height); @@ -70,6 +61,7 @@ void Swapchain::Create(u32 width, u32 height) { .clipped = true, .oldSwapchain = swapchain}; + vk::Device device = instance.GetDevice(); vk::SwapchainKHR new_swapchain = device.createSwapchainKHR(swapchain_info); // If an old swapchain exists, destroy it and move the new one to its place. @@ -79,6 +71,12 @@ void Swapchain::Create(u32 width, u32 height) { auto images = device.getSwapchainImagesKHR(swapchain); + // Destroy the previous image views + for (auto& image : swapchain_images) { + device.destroyImageView(image.image_view); + device.destroyFramebuffer(image.framebuffer); + } + swapchain_images.clear(); swapchain_images.resize(images.size()); @@ -149,21 +147,13 @@ void Swapchain::Present(vk::Semaphore wait_for_present) { .pImageIndices = ¤t_image}; vk::Queue present_queue = instance.GetPresentQueue(); - vk::Result result = present_queue.presentKHR(present_info); - - switch (result) { - case vk::Result::eSuccess: - break; - case vk::Result::eSuboptimalKHR: - is_suboptimal = true; - LOG_DEBUG(Render_Vulkan, "Suboptimal swapchain"); - break; - case vk::Result::eErrorOutOfDateKHR: + try { + [[maybe_unused]] vk::Result result = present_queue.presentKHR(present_info); + } catch (vk::OutOfDateKHRError err) { is_outdated = true; - break; - default: + } catch (vk::SystemError err) { LOG_CRITICAL(Render_Vulkan, "Swapchain presentation failed"); - break; + UNREACHABLE(); } } diff --git a/src/video_core/renderer_vulkan/vk_texture_runtime.cpp b/src/video_core/renderer_vulkan/vk_texture_runtime.cpp index ebf846caa..641e349b2 100644 --- a/src/video_core/renderer_vulkan/vk_texture_runtime.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_runtime.cpp @@ -228,6 +228,10 @@ void TextureRuntime::FormatConvert(const Surface& surface, bool upload, std::spa switch (surface.pixel_format) { case VideoCore::PixelFormat::RGBA4: return Pica::Texture::ConvertRGBA8ToRGBA4(source, dest); + case VideoCore::PixelFormat::RGB8: + return Pica::Texture::ConvertRGBAToBGR(source, dest); + default: + break; } } @@ -450,6 +454,8 @@ void TextureRuntime::Transition(vk::CommandBuffer command_buffer, ImageAlloc& al return; } + renderpass_cache.ExitRenderpass(); + struct LayoutInfo { vk::AccessFlags access; vk::PipelineStageFlags stage;