vk_fsr.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "common/math_util.h"
  5. #include "video_core/vulkan_common/vulkan_memory_allocator.h"
  6. #include "video_core/vulkan_common/vulkan_wrapper.h"
  7. namespace Vulkan {
  8. class Device;
  9. class Scheduler;
  10. class FSR {
  11. public:
  12. explicit FSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count,
  13. VkExtent2D output_size);
  14. VkImageView Draw(Scheduler& scheduler, size_t image_index, VkImageView image_view,
  15. VkExtent2D input_image_extent, const Common::Rectangle<f32>& crop_rect);
  16. private:
  17. void CreateDescriptorPool();
  18. void CreateDescriptorSetLayout();
  19. void CreateDescriptorSets();
  20. void CreateImages();
  21. void CreateSampler();
  22. void CreateShaders();
  23. void CreatePipeline();
  24. void CreatePipelineLayout();
  25. void UpdateDescriptorSet(std::size_t image_index, VkImageView image_view) const;
  26. const Device& device;
  27. MemoryAllocator& memory_allocator;
  28. size_t image_count;
  29. VkExtent2D output_size;
  30. vk::DescriptorPool descriptor_pool;
  31. vk::DescriptorSetLayout descriptor_set_layout;
  32. vk::DescriptorSets descriptor_sets;
  33. vk::PipelineLayout pipeline_layout;
  34. vk::ShaderModule easu_shader;
  35. vk::ShaderModule rcas_shader;
  36. vk::Pipeline easu_pipeline;
  37. vk::Pipeline rcas_pipeline;
  38. vk::Sampler sampler;
  39. std::vector<vk::Image> images;
  40. std::vector<vk::ImageView> image_views;
  41. };
  42. } // namespace Vulkan