mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 21:55:57 +00:00
Merge pull request #281: Add HDR10 output (ProSep)
# Conflicts: # THIRD_PARTY_NOTICES.md # runtime/cfg.c # runtime/vk.h # runtime/vk_device.c
This commit is contained in:
commit
f30bbf048a
28 files changed
+1222
-22
No files matched your search
+19
-2
@@ -41,6 +41,17 @@ static int layer_present(const char *name) {
|
||||
return found;
|
||||
}
|
||||
|
||||
static int instance_ext_present(const char *name) {
|
||||
uint32_t n = 0;
|
||||
vkEnumerateInstanceExtensionProperties(NULL, &n, NULL);
|
||||
VkExtensionProperties *e = calloc(n ? n : 1, sizeof *e);
|
||||
vkEnumerateInstanceExtensionProperties(NULL, &n, e);
|
||||
int found = 0;
|
||||
for (uint32_t i = 0; i < n; i++) if (!strcmp(e[i].extensionName, name)) found = 1;
|
||||
free(e);
|
||||
return found;
|
||||
}
|
||||
|
||||
// Mesa's drivers (RADV on Linux and the Steam Deck) keep a shader cache of their own beside our pipeline cache, by
|
||||
// default in ~/.cache and up to 1 GB: about 35 MB in a minute of the title screen. A Deck's /home is small and the game
|
||||
// usually sits on the SD card, so unless MESA_SHADER_CACHE_DIR names a folder, it goes to mesa-cache beside the exe.
|
||||
@@ -57,7 +68,7 @@ static void mesa_cache_beside_exe(void) {
|
||||
static int create_instance(void) {
|
||||
mesa_cache_beside_exe();
|
||||
const char *ext[8];
|
||||
uint32_t n_ext = (uint32_t)gfx_window_vk_extensions(ext, 7);
|
||||
uint32_t n_ext = (uint32_t)gfx_window_vk_extensions(ext, 6);
|
||||
const char *layers[] = {"VK_LAYER_KHRONOS_validation"};
|
||||
int validate = cfg_bool("TOTK_VK_VALIDATION");
|
||||
if (validate && !layer_present(layers[0])) {
|
||||
@@ -65,6 +76,8 @@ static int create_instance(void) {
|
||||
validate = 0;
|
||||
}
|
||||
if (validate) ext[n_ext++] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
|
||||
if (vk_hdr_wanted() && instance_ext_present(VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME)) // HDR10 surface formats
|
||||
ext[n_ext++] = VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME;
|
||||
VkApplicationInfo app = {.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .pApplicationName = "TotK Recomp",
|
||||
.pEngineName = "TotK Recomp", .apiVersion = VK_API_VERSION_1_3};
|
||||
VkInstanceCreateInfo ci = {.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pApplicationInfo = &app,
|
||||
@@ -209,7 +222,7 @@ static int create_device(void) {
|
||||
vkEnumerateDeviceExtensionProperties(g_vk.phys, NULL, &ne, NULL);
|
||||
VkExtensionProperties *ep = calloc(ne ? ne : 1, sizeof *ep);
|
||||
vkEnumerateDeviceExtensionProperties(g_vk.phys, NULL, &ne, ep);
|
||||
const char *ext[28];
|
||||
const char *ext[32];
|
||||
uint32_t n_ext = 0;
|
||||
for (size_t i = 0; i < sizeof k_required_ext / sizeof *k_required_ext; i++) ext[n_ext++] = k_required_ext[i];
|
||||
|
||||
@@ -250,6 +263,10 @@ static int create_device(void) {
|
||||
// GPU timestamps on the CPU clock (vk_sync.c): the perf line splits GPU idle time into waiting for a submission or not.
|
||||
if (has_ext(ep, ne, VK_KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME)) { g_vk.has_calibrated = 2; ext[n_ext++] = VK_KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME; }
|
||||
else if (has_ext(ep, ne, VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME)) { g_vk.has_calibrated = 1; ext[n_ext++] = VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME; }
|
||||
if (vk_hdr_wanted() && has_ext(ep, ne, VK_EXT_HDR_METADATA_EXTENSION_NAME)) { // the display's peak (vk_hdr_metadata)
|
||||
g_vk.has_hdr_metadata = 1;
|
||||
ext[n_ext++] = VK_EXT_HDR_METADATA_EXTENSION_NAME;
|
||||
}
|
||||
// GPU breadcrumbs for a lost device (vk_crumbs.c): AMD's drivers and RADV report it.
|
||||
if (has_ext(ep, ne, VK_AMD_BUFFER_MARKER_EXTENSION_NAME)) { g_vk.has_buffer_marker = 1; ext[n_ext++] = VK_AMD_BUFFER_MARKER_EXTENSION_NAME; }
|
||||
// Graphics pipeline library: chained last so it can be dropped again when vk_caps_gpl declines it.
|
||||
|
||||
Reference in new issue
Block a user