diff options
| author | 2021-10-20 00:33:03 +0200 | |
|---|---|---|
| committer | 2021-11-16 22:11:31 +0100 | |
| commit | 4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef (patch) | |
| tree | 84fffb5ba3590ce45698b02e7ed4382f371784e1 | |
| parent | Vulkan Rasterizer: Fix clears on integer textures. (diff) | |
| download | yuzu-4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef.tar.gz yuzu-4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef.tar.xz yuzu-4ad22c7d2b9d8fdfffc380f0b52f4ba943599bef.zip | |
Video Core: fix building for GCC.
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 { | |||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | [[nodiscard]] Rectangle<T> Scale(const float s) const { | 50 | [[nodiscard]] Rectangle<T> Scale(const float s) const { |
| 51 | return Rectangle{left, top, static_cast<T>(left + GetWidth() * s), | 51 | return Rectangle{left, top, static_cast<T>(static_cast<float>(left + GetWidth()) * s), |
| 52 | static_cast<T>(top + GetHeight() * s)}; | 52 | static_cast<T>(static_cast<float>(top + GetHeight()) * s)}; |
| 53 | } | 53 | } |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
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: | |||
| 77 | .stageFlags = static_cast<VkShaderStageFlags>( | 77 | .stageFlags = static_cast<VkShaderStageFlags>( |
| 78 | is_compute ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_ALL_GRAPHICS), | 78 | is_compute ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_ALL_GRAPHICS), |
| 79 | .offset = 0, | 79 | .offset = 0, |
| 80 | .size = sizeof(RescalingLayout) - size_offset, | 80 | .size = static_cast<u32>(sizeof(RescalingLayout)) - size_offset, |
| 81 | }; | 81 | }; |
| 82 | return device->GetLogical().CreatePipelineLayout({ | 82 | return device->GetLogical().CreatePipelineLayout({ |
| 83 | .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, | 83 | .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 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/common_types.h" | ||
| 5 | #include "common/div_ceil.h" | 6 | #include "common/div_ceil.h" |
| 6 | #include "video_core/host_shaders/vulkan_fidelityfx_fsr_easu_comp_spv.h" | 7 | #include "video_core/host_shaders/vulkan_fidelityfx_fsr_easu_comp_spv.h" |
| 7 | #include "video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_comp_spv.h" | 8 | #include "video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_comp_spv.h" |
| @@ -12,10 +13,10 @@ | |||
| 12 | 13 | ||
| 13 | namespace Vulkan { | 14 | namespace Vulkan { |
| 14 | 15 | ||
| 15 | FSR::FSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count, | 16 | FSR::FSR(const Device& device_, MemoryAllocator& memory_allocator_, size_t image_count_, |
| 16 | VkExtent2D output_size) | 17 | VkExtent2D output_size_) |
| 17 | : device{device}, memory_allocator{memory_allocator}, image_count{image_count}, | 18 | : device{device_}, memory_allocator{memory_allocator_}, image_count{image_count_}, |
| 18 | output_size{output_size} { | 19 | output_size{output_size_} { |
| 19 | 20 | ||
| 20 | CreateImages(); | 21 | CreateImages(); |
| 21 | CreateSampler(); | 22 | CreateSampler(); |
| @@ -266,14 +267,17 @@ void FSR::UpdateDescriptorSet(std::size_t image_index, VkImageView image_view) c | |||
| 266 | const auto blit_image_view = *image_views[image_count + image_index]; | 267 | const auto blit_image_view = *image_views[image_count + image_index]; |
| 267 | 268 | ||
| 268 | const VkDescriptorImageInfo image_info{ | 269 | const VkDescriptorImageInfo image_info{ |
| 270 | .sampler = VK_NULL_HANDLE, | ||
| 269 | .imageView = image_view, | 271 | .imageView = image_view, |
| 270 | .imageLayout = VK_IMAGE_LAYOUT_GENERAL, | 272 | .imageLayout = VK_IMAGE_LAYOUT_GENERAL, |
| 271 | }; | 273 | }; |
| 272 | const VkDescriptorImageInfo fsr_image_info{ | 274 | const VkDescriptorImageInfo fsr_image_info{ |
| 275 | .sampler = VK_NULL_HANDLE, | ||
| 273 | .imageView = fsr_image_view, | 276 | .imageView = fsr_image_view, |
| 274 | .imageLayout = VK_IMAGE_LAYOUT_GENERAL, | 277 | .imageLayout = VK_IMAGE_LAYOUT_GENERAL, |
| 275 | }; | 278 | }; |
| 276 | const VkDescriptorImageInfo blit_image_info{ | 279 | const VkDescriptorImageInfo blit_image_info{ |
| 280 | .sampler = VK_NULL_HANDLE, | ||
| 277 | .imageView = blit_image_view, | 281 | .imageView = blit_image_view, |
| 278 | .imageLayout = VK_IMAGE_LAYOUT_GENERAL, | 282 | .imageLayout = VK_IMAGE_LAYOUT_GENERAL, |
| 279 | }; | 283 | }; |
| @@ -341,35 +345,52 @@ void FSR::CreateSampler() { | |||
| 341 | 345 | ||
| 342 | void FSR::CreateShaders() { | 346 | void FSR::CreateShaders() { |
| 343 | easu_shader = BuildShader(device, VULKAN_FIDELITYFX_FSR_EASU_COMP_SPV); | 347 | easu_shader = BuildShader(device, VULKAN_FIDELITYFX_FSR_EASU_COMP_SPV); |
| 344 | rcas_shader = BuildShader(device, VULKAN_FIDELITYFX_FSR_EASU_COMP_SPV); | 348 | rcas_shader = BuildShader(device, VULKAN_FIDELITYFX_FSR_RCAS_COMP_SPV); |
| 345 | } | 349 | } |
| 346 | 350 | ||
| 347 | void FSR::CreatePipeline() { | 351 | void FSR::CreatePipeline() { |
| 348 | VkPipelineShaderStageCreateInfo shader_stage{ | 352 | VkPipelineShaderStageCreateInfo shader_stage_easu{ |
| 353 | .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, | ||
| 354 | .pNext = nullptr, | ||
| 355 | .flags = 0, | ||
| 356 | .stage = VK_SHADER_STAGE_COMPUTE_BIT, | ||
| 357 | .module = *easu_shader, | ||
| 358 | .pName = "main", | ||
| 359 | .pSpecializationInfo = nullptr, | ||
| 360 | }; | ||
| 349 | 361 | ||
| 362 | VkPipelineShaderStageCreateInfo shader_stage_rcas{ | ||
| 350 | .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, | 363 | .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, |
| 351 | .pNext = nullptr, | 364 | .pNext = nullptr, |
| 352 | .flags = 0, | 365 | .flags = 0, |
| 353 | .stage = VK_SHADER_STAGE_COMPUTE_BIT, | 366 | .stage = VK_SHADER_STAGE_COMPUTE_BIT, |
| 367 | .module = *rcas_shader, | ||
| 354 | .pName = "main", | 368 | .pName = "main", |
| 355 | .pSpecializationInfo = nullptr, | 369 | .pSpecializationInfo = nullptr, |
| 356 | }; | 370 | }; |
| 357 | 371 | ||
| 358 | VkComputePipelineCreateInfo pipeline_ci{ | 372 | VkComputePipelineCreateInfo pipeline_ci_easu{ |
| 359 | .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, | 373 | .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, |
| 360 | .pNext = nullptr, | 374 | .pNext = nullptr, |
| 361 | .flags = 0, | 375 | .flags = 0, |
| 376 | .stage = shader_stage_easu, | ||
| 362 | .layout = *pipeline_layout, | 377 | .layout = *pipeline_layout, |
| 378 | .basePipelineHandle = VK_NULL_HANDLE, | ||
| 363 | .basePipelineIndex = 0, | 379 | .basePipelineIndex = 0, |
| 364 | }; | 380 | }; |
| 365 | 381 | ||
| 366 | shader_stage.module = *easu_shader; | 382 | VkComputePipelineCreateInfo pipeline_ci_rcas{ |
| 367 | pipeline_ci.stage = shader_stage; | 383 | .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, |
| 368 | easu_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci); | 384 | .pNext = nullptr, |
| 385 | .flags = 0, | ||
| 386 | .stage = shader_stage_rcas, | ||
| 387 | .layout = *pipeline_layout, | ||
| 388 | .basePipelineHandle = VK_NULL_HANDLE, | ||
| 389 | .basePipelineIndex = 0, | ||
| 390 | }; | ||
| 369 | 391 | ||
| 370 | shader_stage.module = *rcas_shader; | 392 | easu_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci_easu); |
| 371 | pipeline_ci.stage = shader_stage; | 393 | rcas_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci_rcas); |
| 372 | rcas_pipeline = device.GetLogical().CreateComputePipeline(pipeline_ci); | ||
| 373 | } | 394 | } |
| 374 | 395 | ||
| 375 | } // namespace Vulkan | 396 | } // 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) { | |||
| 211 | EndTransformFeedback(); | 211 | EndTransformFeedback(); |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | #pragma optimize("", off) | ||
| 215 | |||
| 216 | void RasterizerVulkan::Clear() { | 214 | void RasterizerVulkan::Clear() { |
| 217 | MICROPROFILE_SCOPE(Vulkan_Clearing); | 215 | MICROPROFILE_SCOPE(Vulkan_Clearing); |
| 218 | 216 | ||
| @@ -284,13 +282,14 @@ void RasterizerVulkan::Clear() { | |||
| 284 | std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color)); | 282 | std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color)); |
| 285 | } else if (!is_signed) { | 283 | } else if (!is_signed) { |
| 286 | for (size_t i = 0; i < 4; i++) { | 284 | for (size_t i = 0; i < 4; i++) { |
| 287 | clear_value.color.uint32[i] = | 285 | clear_value.color.uint32[i] = static_cast<u32>( |
| 288 | static_cast<u32>(static_cast<u64>(int_size << 1U) * regs.clear_color[i]); | 286 | static_cast<f32>(static_cast<u64>(int_size) << 1U) * regs.clear_color[i]); |
| 289 | } | 287 | } |
| 290 | } else { | 288 | } else { |
| 291 | for (size_t i = 0; i < 4; i++) { | 289 | for (size_t i = 0; i < 4; i++) { |
| 292 | clear_value.color.int32[i] = static_cast<s32>( | 290 | clear_value.color.int32[i] = |
| 293 | (static_cast<s32>(int_size - 1) << 1) * (regs.clear_color[i] - 0.5f)); | 291 | static_cast<s32>(static_cast<f32>(static_cast<s64>(int_size - 1) << 1) * |
| 292 | (regs.clear_color[i] - 0.5f)); | ||
| 294 | } | 293 | } |
| 295 | } | 294 | } |
| 296 | 295 | ||
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 | |||
| 600 | .width = info.size.width, | 600 | .width = info.size.width, |
| 601 | .height = info.size.height, | 601 | .height = info.size.height, |
| 602 | }; | 602 | }; |
| 603 | const bool is_zeta = (aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT) != 0; | ||
| 604 | const bool is_int_format = IsPixelFormatInteger(info.format); | ||
| 605 | const VkFilter vk_filter = is_bilinear ? VK_FILTER_LINEAR : VK_FILTER_NEAREST; | 603 | const VkFilter vk_filter = is_bilinear ? VK_FILTER_LINEAR : VK_FILTER_NEAREST; |
| 606 | 604 | ||
| 607 | scheduler.RequestOutsideRenderPassOperationContext(); | 605 | scheduler.RequestOutsideRenderPassOperationContext(); |