yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Video Core: fix building for GCC.

This commit is contained in:
Fernando Sahmkow 2021-10-20 00:33:03 +02:00
parent 826a350e2b
commit 4ad22c7d2b
5 changed files with 43 additions and 25 deletions

View File

@ -48,8 +48,8 @@ struct Rectangle {
} }
[[nodiscard]] Rectangle<T> Scale(const float s) const { [[nodiscard]] Rectangle<T> Scale(const float s) const {
return Rectangle{left, top, static_cast<T>(left + GetWidth() * s), return Rectangle{left, top, static_cast<T>(static_cast<float>(left + GetWidth()) * s),
static_cast<T>(top + GetHeight() * s)}; static_cast<T>(static_cast<float>(top + GetHeight()) * s)};
} }
}; };

View File

@ -77,7 +77,7 @@ public:
.stageFlags = static_cast<VkShaderStageFlags>( .stageFlags = static_cast<VkShaderStageFlags>(
is_compute ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_ALL_GRAPHICS), is_compute ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_ALL_GRAPHICS),
.offset = 0, .offset = 0,
.size = sizeof(RescalingLayout) - size_offset, .size = static_cast<u32>(sizeof(RescalingLayout)) - size_offset,
}; };
return device->GetLogical().CreatePipelineLayout({ return device->GetLogical().CreatePipelineLayout({
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common_types.h"
#include "common/div_ceil.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_easu_comp_spv.h"
#include "video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_comp_spv.h" #include "video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_comp_spv.h"
@ -12,10 +13,10 @@
namespace Vulkan { namespace Vulkan {
FSR::FSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count, FSR::FSR(const Device& device_, MemoryAllocator& memory_allocator_, size_t image_count_,
VkExtent2D output_size) VkExtent2D output_size_)
: device{device}, memory_allocator{memory_allocator}, image_count{image_count}, : device{device_}, memory_allocator{memory_allocator_}, image_count{image_count_},
output_size{output_size} { output_size{output_size_} {
CreateImages(); CreateImages();
CreateSampler(); 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 auto blit_image_view = *image_views[image_count + image_index];
const VkDescriptorImageInfo image_info{ const VkDescriptorImageInfo image_info{
.sampler = VK_NULL_HANDLE,
.imageView = image_view, .imageView = image_view,
.imageLayout = VK_IMAGE_LAYOUT_GENERAL, .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
}; };
const VkDescriptorImageInfo fsr_image_info{ const VkDescriptorImageInfo fsr_image_info{
.sampler = VK_NULL_HANDLE,
.imageView = fsr_image_view, .imageView = fsr_image_view,
.imageLayout = VK_IMAGE_LAYOUT_GENERAL, .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
}; };
const VkDescriptorImageInfo blit_image_info{ const VkDescriptorImageInfo blit_image_info{
.sampler = VK_NULL_HANDLE,
.imageView = blit_image_view, .imageView = blit_image_view,
.imageLayout = VK_IMAGE_LAYOUT_GENERAL, .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
}; };
@ -341,35 +345,52 @@ void FSR::CreateSampler() {
void FSR::CreateShaders() { void FSR::CreateShaders() {
easu_shader = BuildShader(device, VULKAN_FIDELITYFX_FSR_EASU_COMP_SPV); 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() { void FSR::CreatePipeline() {
VkPipelineShaderStageCreateInfo shader_stage{ VkPipelineShaderStageCreateInfo shader_stage_easu{
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
.pNext = nullptr, .pNext = nullptr,
.flags = 0, .flags = 0,
.stage = VK_SHADER_STAGE_COMPUTE_BIT, .stage = VK_SHADER_STAGE_COMPUTE_BIT,
.module = *easu_shader,
.pName = "main", .pName = "main",
.pSpecializationInfo = nullptr, .pSpecializationInfo = nullptr,
}; };
VkComputePipelineCreateInfo pipeline_ci{ 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_easu{
.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
.pNext = nullptr, .pNext = nullptr,
.flags = 0, .flags = 0,
.stage = shader_stage_easu,
.layout = *pipeline_layout, .layout = *pipeline_layout,
.basePipelineHandle = VK_NULL_HANDLE,
.basePipelineIndex = 0, .basePipelineIndex = 0,
}; };
shader_stage.module = *easu_shader; VkComputePipelineCreateInfo pipeline_ci_rcas{
pipeline_ci.stage = shader_stage; .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
easu_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci); .pNext = nullptr,
.flags = 0,
.stage = shader_stage_rcas,
.layout = *pipeline_layout,
.basePipelineHandle = VK_NULL_HANDLE,
.basePipelineIndex = 0,
};
shader_stage.module = *rcas_shader; easu_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci_easu);
pipeline_ci.stage = shader_stage; rcas_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci_rcas);
rcas_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci);
} }
} // namespace Vulkan } // namespace Vulkan

View File

@ -211,8 +211,6 @@ void RasterizerVulkan::Draw(bool is_indexed, bool is_instanced) {
EndTransformFeedback(); EndTransformFeedback();
} }
#pragma optimize("", off)
void RasterizerVulkan::Clear() { void RasterizerVulkan::Clear() {
MICROPROFILE_SCOPE(Vulkan_Clearing); MICROPROFILE_SCOPE(Vulkan_Clearing);
@ -284,13 +282,14 @@ void RasterizerVulkan::Clear() {
std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color)); std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color));
} else if (!is_signed) { } else if (!is_signed) {
for (size_t i = 0; i < 4; i++) { for (size_t i = 0; i < 4; i++) {
clear_value.color.uint32[i] = clear_value.color.uint32[i] = static_cast<u32>(
static_cast<u32>(static_cast<u64>(int_size << 1U) * regs.clear_color[i]); static_cast<f32>(static_cast<u64>(int_size) << 1U) * regs.clear_color[i]);
} }
} else { } else {
for (size_t i = 0; i < 4; i++) { for (size_t i = 0; i < 4; i++) {
clear_value.color.int32[i] = static_cast<s32>( clear_value.color.int32[i] =
(static_cast<s32>(int_size - 1) << 1) * (regs.clear_color[i] - 0.5f)); static_cast<s32>(static_cast<f32>(static_cast<s64>(int_size - 1) << 1) *
(regs.clear_color[i] - 0.5f));
} }
} }

View File

@ -600,8 +600,6 @@ void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, con
.width = info.size.width, .width = info.size.width,
.height = info.size.height, .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; const VkFilter vk_filter = is_bilinear ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
scheduler.RequestOutsideRenderPassOperationContext(); scheduler.RequestOutsideRenderPassOperationContext();