diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-10-20 00:33:03 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-16 22:11:31 +0100 |
commit | 4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef (patch) | |
tree | 84fffb5ba3590ce45698b02e7ed4382f371784e1 /src | |
parent | Vulkan Rasterizer: Fix clears on integer textures. (diff) | |
download | yuzu-4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef.tar yuzu-4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef.tar.gz yuzu-4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef.tar.bz2 yuzu-4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef.tar.lz yuzu-4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef.tar.xz yuzu-4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef.tar.zst yuzu-4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/math_util.h | 4 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/pipeline_helper.h | 2 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_fsr.cpp | 47 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 11 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 2 |
5 files changed, 42 insertions, 24 deletions
diff --git a/src/common/math_util.h b/src/common/math_util.h index 4c38d8040..510c4e56d 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h @@ -48,8 +48,8 @@ struct Rectangle { } [[nodiscard]] Rectangle<T> Scale(const float s) const { - return Rectangle{left, top, static_cast<T>(left + GetWidth() * s), - static_cast<T>(top + GetHeight() * s)}; + return Rectangle{left, top, static_cast<T>(static_cast<float>(left + GetWidth()) * s), + static_cast<T>(static_cast<float>(top + GetHeight()) * s)}; } }; diff --git a/src/video_core/renderer_vulkan/pipeline_helper.h b/src/video_core/renderer_vulkan/pipeline_helper.h index ae5e66ef4..11c160570 100644 --- a/src/video_core/renderer_vulkan/pipeline_helper.h +++ b/src/video_core/renderer_vulkan/pipeline_helper.h @@ -77,7 +77,7 @@ public: .stageFlags = static_cast<VkShaderStageFlags>( is_compute ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_ALL_GRAPHICS), .offset = 0, - .size = sizeof(RescalingLayout) - size_offset, + .size = static_cast<u32>(sizeof(RescalingLayout)) - size_offset, }; return device->GetLogical().CreatePipelineLayout({ .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, diff --git a/src/video_core/renderer_vulkan/vk_fsr.cpp b/src/video_core/renderer_vulkan/vk_fsr.cpp index fd0a4aa42..1f60974be 100644 --- a/src/video_core/renderer_vulkan/vk_fsr.cpp +++ b/src/video_core/renderer_vulkan/vk_fsr.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/common_types.h" #include "common/div_ceil.h" #include "video_core/host_shaders/vulkan_fidelityfx_fsr_easu_comp_spv.h" #include "video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_comp_spv.h" @@ -12,10 +13,10 @@ namespace Vulkan { -FSR::FSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count, - VkExtent2D output_size) - : device{device}, memory_allocator{memory_allocator}, image_count{image_count}, - output_size{output_size} { +FSR::FSR(const Device& device_, MemoryAllocator& memory_allocator_, size_t image_count_, + VkExtent2D output_size_) + : device{device_}, memory_allocator{memory_allocator_}, image_count{image_count_}, + output_size{output_size_} { CreateImages(); CreateSampler(); @@ -266,14 +267,17 @@ void FSR::UpdateDescriptorSet(std::size_t image_index, VkImageView image_view) c const auto blit_image_view = *image_views[image_count + image_index]; const VkDescriptorImageInfo image_info{ + .sampler = VK_NULL_HANDLE, .imageView = image_view, .imageLayout = VK_IMAGE_LAYOUT_GENERAL, }; const VkDescriptorImageInfo fsr_image_info{ + .sampler = VK_NULL_HANDLE, .imageView = fsr_image_view, .imageLayout = VK_IMAGE_LAYOUT_GENERAL, }; const VkDescriptorImageInfo blit_image_info{ + .sampler = VK_NULL_HANDLE, .imageView = blit_image_view, .imageLayout = VK_IMAGE_LAYOUT_GENERAL, }; @@ -341,35 +345,52 @@ void FSR::CreateSampler() { void FSR::CreateShaders() { easu_shader = BuildShader(device, VULKAN_FIDELITYFX_FSR_EASU_COMP_SPV); - rcas_shader = BuildShader(device, VULKAN_FIDELITYFX_FSR_EASU_COMP_SPV); + rcas_shader = BuildShader(device, VULKAN_FIDELITYFX_FSR_RCAS_COMP_SPV); } void FSR::CreatePipeline() { - VkPipelineShaderStageCreateInfo shader_stage{ + VkPipelineShaderStageCreateInfo shader_stage_easu{ + .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, + .pNext = nullptr, + .flags = 0, + .stage = VK_SHADER_STAGE_COMPUTE_BIT, + .module = *easu_shader, + .pName = "main", + .pSpecializationInfo = nullptr, + }; + VkPipelineShaderStageCreateInfo shader_stage_rcas{ .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, .pNext = nullptr, .flags = 0, .stage = VK_SHADER_STAGE_COMPUTE_BIT, + .module = *rcas_shader, .pName = "main", .pSpecializationInfo = nullptr, }; - VkComputePipelineCreateInfo pipeline_ci{ + VkComputePipelineCreateInfo pipeline_ci_easu{ .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, .pNext = nullptr, .flags = 0, + .stage = shader_stage_easu, .layout = *pipeline_layout, + .basePipelineHandle = VK_NULL_HANDLE, .basePipelineIndex = 0, }; - shader_stage.module = *easu_shader; - pipeline_ci.stage = shader_stage; - easu_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci); + VkComputePipelineCreateInfo pipeline_ci_rcas{ + .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, + .pNext = nullptr, + .flags = 0, + .stage = shader_stage_rcas, + .layout = *pipeline_layout, + .basePipelineHandle = VK_NULL_HANDLE, + .basePipelineIndex = 0, + }; - shader_stage.module = *rcas_shader; - pipeline_ci.stage = shader_stage; - rcas_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci); + easu_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci_easu); + rcas_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci_rcas); } } // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index ff75d14a1..5ca67c413 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -211,8 +211,6 @@ void RasterizerVulkan::Draw(bool is_indexed, bool is_instanced) { EndTransformFeedback(); } -#pragma optimize("", off) - void RasterizerVulkan::Clear() { MICROPROFILE_SCOPE(Vulkan_Clearing); @@ -284,13 +282,14 @@ void RasterizerVulkan::Clear() { std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color)); } else if (!is_signed) { for (size_t i = 0; i < 4; i++) { - clear_value.color.uint32[i] = - static_cast<u32>(static_cast<u64>(int_size << 1U) * regs.clear_color[i]); + clear_value.color.uint32[i] = static_cast<u32>( + static_cast<f32>(static_cast<u64>(int_size) << 1U) * regs.clear_color[i]); } } else { for (size_t i = 0; i < 4; i++) { - clear_value.color.int32[i] = static_cast<s32>( - (static_cast<s32>(int_size - 1) << 1) * (regs.clear_color[i] - 0.5f)); + clear_value.color.int32[i] = + static_cast<s32>(static_cast<f32>(static_cast<s64>(int_size - 1) << 1) * + (regs.clear_color[i] - 0.5f)); } } diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 7c8732ec1..413d472cd 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -600,8 +600,6 @@ void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, con .width = info.size.width, .height = info.size.height, }; - const bool is_zeta = (aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT) != 0; - const bool is_int_format = IsPixelFormatInteger(info.format); const VkFilter vk_filter = is_bilinear ? VK_FILTER_LINEAR : VK_FILTER_NEAREST; scheduler.RequestOutsideRenderPassOperationContext(); |