From 369a2314c2a87774223fcdfabfc9373b059ef1a4 Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Fri, 10 Nov 2023 17:58:52 -0800 Subject: [PATCH] renderer_vk: Create MSAA graphics pipelines Forced on for now, needs some additional detection and masking for when this feature should be used. --- src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | 6 +++--- src/video_core/renderer_vulkan/vk_instance.cpp | 2 ++ src/video_core/renderer_vulkan/vk_rasterizer.cpp | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 44ceb8151..ecaa67cdf 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -155,7 +155,7 @@ bool GraphicsPipeline::Build(bool fail_on_compile_required) { const vk::PipelineMultisampleStateCreateInfo multisampling = { .rasterizationSamples = vk::SampleCountFlagBits(info.attachments.sample_count), - .sampleShadingEnable = false, + .sampleShadingEnable = true, }; const vk::PipelineColorBlendAttachmentState colorblend_attachment = { @@ -264,8 +264,8 @@ bool GraphicsPipeline::Build(bool fail_on_compile_required) { .pColorBlendState = &color_blending, .pDynamicState = &dynamic_info, .layout = pipeline_layout, - .renderPass = - renderpass_cache.GetRenderpass(info.attachments.color, info.attachments.depth, false), + .renderPass = renderpass_cache.GetRenderpass(info.attachments.color, info.attachments.depth, + false, info.attachments.sample_count), }; if (fail_on_compile_required) { diff --git a/src/video_core/renderer_vulkan/vk_instance.cpp b/src/video_core/renderer_vulkan/vk_instance.cpp index c0e14e4a2..36e602bf7 100644 --- a/src/video_core/renderer_vulkan/vk_instance.cpp +++ b/src/video_core/renderer_vulkan/vk_instance.cpp @@ -511,9 +511,11 @@ bool Instance::CreateDevice() { .features{ .robustBufferAccess = features.robustBufferAccess, .geometryShader = features.geometryShader, + .sampleRateShading = features.sampleRateShading, .logicOp = features.logicOp, .samplerAnisotropy = features.samplerAnisotropy, .fragmentStoresAndAtomics = features.fragmentStoresAndAtomics, + .shaderStorageImageMultisample = features.shaderStorageImageMultisample, .shaderClipDistance = features.shaderClipDistance, }, }, diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 0208c8cde..394368589 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -476,6 +476,7 @@ bool RasterizerVulkan::Draw(bool accelerate, bool is_indexed) { pipeline_info.attachments.color = framebuffer->Format(SurfaceType::Color); pipeline_info.attachments.depth = framebuffer->Format(SurfaceType::Depth); + pipeline_info.attachments.sample_count = framebuffer->Samples(); if (shadow_rendering) { pipeline_cache.BindStorageImage(6, framebuffer->ImageView(SurfaceType::Color)); @@ -765,6 +766,7 @@ bool RasterizerVulkan::AccelerateDisplay(const Pica::FramebufferConfig& config, src_params.stride = pixel_stride; src_params.is_tiled = false; src_params.pixel_format = VideoCore::PixelFormatFromGPUPixelFormat(config.color_format); + src_params.sample_count = Settings::values.sample_count.GetValue(); src_params.UpdateParams(); const auto [src_surface_id, src_rect] =