[UI] Image post-processing and full presentation/window rework

[GPU] Add FXAA post-processing
[UI] Add FidelityFX FSR and CAS post-processing
[UI] Add blue noise dithering from 10bpc to 8bpc
[GPU] Apply the DC PWL gamma ramp closer to the spec, supporting fully white color
[UI] Allow the GPU CP thread to present on the host directly, bypassing the UI thread OS paint event
[UI] Allow variable refresh rate (or tearing)
[UI] Present the newest frame (restart) on DXGI
[UI] Replace GraphicsContext with a far more advanced Presenter with more coherent surface connection and UI overlay state management
[UI] Connect presentation to windows via the Surface class, not native window handles
[Vulkan] Switch to simpler Vulkan setup with no instance/device separation due to interdependencies and to pass fewer objects around
[Vulkan] Lower the minimum required Vulkan version to 1.0
[UI/GPU] Various cleanup, mainly ComPtr usage
[UI] Support per-monitor DPI awareness v2 on Windows
[UI] DPI-scale Dear ImGui
[UI] Replace the remaining non-detachable window delegates with unified window event and input listeners
[UI] Allow listeners to safely destroy or close the window, and to register/unregister listeners without use-after-free and the ABA problem
[UI] Explicit Z ordering of input listeners and UI overlays, top-down for input, bottom-up for drawing
[UI] Add explicit window lifecycle phases
[UI] Replace Window virtual functions with explicit desired state, its application, actual state, its feedback
[UI] GTK: Apply the initial size to the drawing area
[UI] Limit internal UI frame rate to that of the monitor
[UI] Hide the cursor using a timer instead of polling due to no repeated UI thread paints with GPU CP thread presentation, and only within the window
This commit is contained in:
Triang3l
2022-01-29 13:22:03 +03:00
parent 372bdd3ec9
commit fe3f0f26e4
428 changed files with 75942 additions and 18360 deletions

View File

@@ -13,26 +13,27 @@
#include "xenia/base/assert.h"
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
#include "xenia/ui/vulkan/vulkan_device.h"
#include "xenia/ui/vulkan/vulkan_util.h"
namespace xe {
namespace gpu {
namespace vulkan {
using xe::ui::vulkan::CheckResult;
using xe::ui::vulkan::util::CheckResult;
VulkanShader::VulkanShader(ui::vulkan::VulkanDevice* device,
VulkanShader::VulkanShader(const ui::vulkan::VulkanProvider& provider,
xenos::ShaderType shader_type, uint64_t data_hash,
const uint32_t* dword_ptr, uint32_t dword_count)
: Shader(shader_type, data_hash, dword_ptr, dword_count), device_(device) {}
: Shader(shader_type, data_hash, dword_ptr, dword_count),
provider_(provider) {}
VulkanShader::VulkanTranslation::~VulkanTranslation() {
if (shader_module_) {
const VulkanShader& vulkan_shader = static_cast<VulkanShader&>(shader());
const ui::vulkan::VulkanDevice* device = vulkan_shader.device_;
const ui::vulkan::VulkanDevice::DeviceFunctions& dfn = device->dfn();
dfn.vkDestroyShaderModule(*device, shader_module_, nullptr);
const ui::vulkan::VulkanProvider& provider =
static_cast<VulkanShader&>(shader()).provider_;
const ui::vulkan::VulkanProvider::DeviceFunctions& dfn = provider.dfn();
VkDevice device = provider.device();
dfn.vkDestroyShaderModule(device, shader_module_, nullptr);
shader_module_ = nullptr;
}
}
@@ -42,8 +43,9 @@ bool VulkanShader::VulkanTranslation::Prepare() {
assert_true(is_valid());
const VulkanShader& vulkan_shader = static_cast<VulkanShader&>(shader());
const ui::vulkan::VulkanDevice* device = vulkan_shader.device_;
const ui::vulkan::VulkanDevice::DeviceFunctions& dfn = device->dfn();
const ui::vulkan::VulkanProvider& provider = vulkan_shader.provider_;
const ui::vulkan::VulkanProvider::DeviceFunctions& dfn = provider.dfn();
VkDevice device = provider.device();
// Create the shader module.
VkShaderModuleCreateInfo shader_info;
@@ -54,7 +56,7 @@ bool VulkanShader::VulkanTranslation::Prepare() {
shader_info.pCode =
reinterpret_cast<const uint32_t*>(translated_binary().data());
auto status =
dfn.vkCreateShaderModule(*device, &shader_info, nullptr, &shader_module_);
dfn.vkCreateShaderModule(device, &shader_info, nullptr, &shader_module_);
CheckResult(status, "vkCreateShaderModule");
char type_char;
@@ -68,10 +70,10 @@ bool VulkanShader::VulkanTranslation::Prepare() {
default:
type_char = 'u';
}
device->DbgSetObjectName(uint64_t(shader_module_),
VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT,
fmt::format("S({}): {:016X}", type_char,
vulkan_shader.ucode_data_hash()));
provider.SetDeviceObjectName(
VK_OBJECT_TYPE_SHADER_MODULE, uint64_t(shader_module_),
fmt::format("S({}): {:016X}", type_char, vulkan_shader.ucode_data_hash())
.c_str());
return status == VK_SUCCESS;
}