1
0
Fork 0
forked from suyu/suyu

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 {
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)};
}
};

View file

@ -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,

View file

@ -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,
};
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,
.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

View file

@ -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));
}
}

View file

@ -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();