diff --git a/tools/upscale/layer/README.md b/tools/upscale/layer/README.md index 9f90df839f..b9fb14a395 100644 --- a/tools/upscale/layer/README.md +++ b/tools/upscale/layer/README.md @@ -82,7 +82,8 @@ Each key is read as `DROIDDECK_UPSCALE_` first, then `WINLATOR_FSR4_` | `DIR` (then `DM_FSR4_DIR`) | `fsr4_pipeline.c:566`, `:826` | Data dir (layout below). Unset: no backend can load its files, frames get a plain blit. No built-in fallback path | | `POWER` | `fsr4_pipeline.c:575`, `:830` | HTP power vote: `burst`, `turbo` (default), `balanced`/`nom`, `low` | | `BACKEND`, then `ENGINE` | `fsr4_layer.c:458` | Start backend (names under ctrl file). Unset: Auto | -| `FULL_ON_TURNIP` | `fsr4_pipeline.c` `full_black_here` | `1` = run FSR 4.1.1 Full for D3D12 games on Turnip anyway. Default: Lite stands in there (Full writes a black frame in D3D12 on Turnip; Vulkan games are fine) | +| `APP_DESCRIPTOR_BUFFER` | `fsr4_layer.c` `hide_app_descriptor_buffer` | `1` = let the game see `VK_EXT_descriptor_buffer`. Default: hidden from the game (the layer still uses it), because vkd3d-proton's own descriptor buffers make FSR 4.1.1 Full write a black frame on Turnip | +| `FULL_ON_TURNIP` | `fsr4_pipeline.c` `full_black_here` | `1` = run FSR 4.1.1 Full on Turnip even when the game enabled descriptor buffers itself. Default: Lite stands in then | | `NPU_SYNC` | `fsr4_layer.c:462` | `1` = GPU waits for the NPU each frame. Anything else = async (default). `sync`/`true` also mean sync | | `SHARPNESS` | `fsr4_layer.c:464` | RCAS 0.0-1.0, default 0.55 | | `PRESET` | `fsr4_pipeline.c:1239` | `ultraperf` or `performance` forces the preset; else from the game's quality mode / ratio | diff --git a/tools/upscale/layer/fsr411_full_gpu.c b/tools/upscale/layer/fsr411_full_gpu.c index e955a0e4b2..ce4d9ac445 100644 --- a/tools/upscale/layer/fsr411_full_gpu.c +++ b/tools/upscale/layer/fsr411_full_gpu.c @@ -1206,19 +1206,8 @@ int wl_fsr411_full_gpu_dispatch(WlFsr411FullGpu *p, VkCommandBuffer cb, return 0; } - // Test switches for the D3D12-on-Turnip black frame: DROIDDECK_UPSCALE_FULL_DIRECT_OUT=0 writes to Full's own - // image and copies (as Vulkan games get), DROIDDECK_UPSCALE_FULL_AUTO_EXPOSURE=0 skips the pass-00 exposure pass. - static int sw_direct = -1, sw_spd = -1; - if (sw_direct < 0) { - const char *d = dd_upscale_env("FULL_DIRECT_OUT"); - const char *e = dd_upscale_env("FULL_AUTO_EXPOSURE"); - sw_direct = (d && d[0] == '0') ? 0 : 1; - sw_spd = (e && e[0] == '0') ? 0 : 1; - if (!sw_direct || !sw_spd) F411_LOGI("FSR 4.1.1 Full test switches: direct_out=%d auto_exposure=%d", sw_direct, sw_spd); - } - // Tier 1.1: Direct output write from pass-27 straight into game's out_img (skip CmdBlitImage!) - int direct_out = sw_direct && (ow == F411_UW && oh == F411_UH && + int direct_out = (ow == F411_UW && oh == F411_UH && (out_usage & VK_IMAGE_USAGE_STORAGE_BIT) != 0u && f411_fmt_storage_ok(out_fmt) && frame->output.subrect_x == 0u && frame->output.subrect_y == 0u); @@ -1268,7 +1257,7 @@ int wl_fsr411_full_gpu_dispatch(WlFsr411FullGpu *p, VkCommandBuffer cb, int have_ext_exp = !force_auto_exp && (exp_img != VK_NULL_HANDLE && exp_fmt != VK_FORMAT_UNDEFINED); int is_hdr = (frame->flags & WLFSR4_FLAG_HDR) != 0u; int has_custom_pe = (isfinite(frame->pre_exposure) && frame->pre_exposure > 1e-4f && fabsf(frame->pre_exposure - 1.0f) > 1e-3f); - int run_spd = sw_spd && (force_auto_exp || !(have_ext_exp || !is_hdr || has_custom_pe)); + int run_spd = force_auto_exp || !(have_ext_exp || !is_hdr || has_custom_pe); F411Consts k; memset(&k, 0, sizeof k); diff --git a/tools/upscale/layer/fsr4_layer.c b/tools/upscale/layer/fsr4_layer.c index f731d0d824..9de68130c6 100644 --- a/tools/upscale/layer/fsr4_layer.c +++ b/tools/upscale/layer/fsr4_layer.c @@ -673,6 +673,16 @@ static void write_live_status(const WlFsr4Pipeline *pipe, const LiveCtrlState *c } // ---- GPU & DLSS spoof helpers ---- +// vkd3d-proton binds its own descriptor buffers in the command buffers the upscaler records into; with that, Full +// FSR 4.1's descriptor-buffer passes write a black frame on Turnip (Red Magic 12 Pro A850, Dec 2026: XeSS DX12 sample +// black in 9/9 shots, picture back with VKD3D_DISABLE_EXTENSIONS=VK_EXT_descriptor_buffer). The layer hides the +// extension from the game, which then uses its classic descriptors, and still enables it for itself. +// DROIDDECK_UPSCALE_APP_DESCRIPTOR_BUFFER=1 shows it to the game again. +static int hide_app_descriptor_buffer(void) { + const char *v = dd_upscale_env("APP_DESCRIPTOR_BUFFER"); + return !(v && v[0] == '1'); +} + static int spoof_dlss_enabled(void) { const char *v = dd_upscale_env("SPOOF_DLSS"); return (v && v[0] == '1') || (g_rdr2_patched > 0); @@ -956,7 +966,9 @@ static VkResult VKAPI_CALL hook_vkEnumerateDeviceExtensionProperties(VkPhysicalD pthread_mutex_unlock(&g_mu); if (!down) return VK_ERROR_INITIALIZATION_FAILED; - if (pLayerName || !spoof_dlss_enabled()) { + int spoof = spoof_dlss_enabled(); + int hide_db = hide_app_descriptor_buffer(); + if (pLayerName || (!spoof && !hide_db)) { return down(pd, pLayerName, pPropertyCount, pProperties); } @@ -967,10 +979,17 @@ static VkResult VKAPI_CALL hook_vkEnumerateDeviceExtensionProperties(VkPhysicalD if (!real_exts) return VK_ERROR_OUT_OF_HOST_MEMORY; r = down(pd, NULL, &real_count, real_exts); if (r != VK_SUCCESS) { free(real_exts); return r; } + if (hide_db) { + uint32_t kept = 0; + for (uint32_t i = 0; i < real_count; i++) { + if (strcmp(real_exts[i].extensionName, "VK_EXT_descriptor_buffer")) real_exts[kept++] = real_exts[i]; + } + real_count = kept; + } static const char *const k_fake_nvx[] = {"VK_NVX_binary_import", "VK_NVX_image_view_handle"}; uint32_t extra = 0; - for (int i = 0; i < 2; i++) { + for (int i = 0; spoof && i < 2; i++) { if (!ext_in_list(real_exts, real_count, k_fake_nvx[i])) extra++; } uint32_t total = real_count + extra; @@ -982,7 +1001,7 @@ static VkResult VKAPI_CALL hook_vkEnumerateDeviceExtensionProperties(VkPhysicalD uint32_t cap = *pPropertyCount; uint32_t out_n = 0; for (uint32_t i = 0; i < real_count && out_n < cap; i++) pProperties[out_n++] = real_exts[i]; - for (int i = 0; i < 2 && out_n < cap; i++) { + for (int i = 0; spoof && i < 2 && out_n < cap; i++) { if (!ext_in_list(real_exts, real_count, k_fake_nvx[i])) { memset(&pProperties[out_n], 0, sizeof pProperties[out_n]); snprintf(pProperties[out_n].extensionName, sizeof pProperties[out_n].extensionName, "%s", k_fake_nvx[i]); @@ -1128,9 +1147,11 @@ static VkResult VKAPI_CALL hook_vkCreateDevice(VkPhysicalDevice pd, uint32_t max_exts = pCreateInfo->enabledExtensionCount + 20; const char **exts = (const char **)calloc(max_exts, sizeof(char *)); uint32_t ext_n = 0; + int app_db = 0; for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { const char *en = pCreateInfo->ppEnabledExtensionNames[i]; if (!en) continue; + if (!strcmp(en, "VK_EXT_descriptor_buffer")) app_db = 1; if ((!strcmp(en, "VK_NVX_binary_import") || !strcmp(en, "VK_NVX_image_view_handle")) && !(avail && ext_in_list(avail, avail_n, en))) { continue; @@ -1342,6 +1363,7 @@ static VkResult VKAPI_CALL hook_vkCreateDevice(VkPhysicalDevice pd, v->device = *pDevice; v->graphics_qf = pCreateInfo->queueCreateInfoCount > 0 ? pCreateInfo->pQueueCreateInfos[0].queueFamilyIndex : 0u; v->has_desc_buf = want_db; + v->app_desc_buf = app_db; v->has_mut_desc = want_mut; v->has_ext_ahb = can_ahb; v->has_bda = want_bda; diff --git a/tools/upscale/layer/fsr4_pipeline.c b/tools/upscale/layer/fsr4_pipeline.c index fc90e30381..e5a520e47b 100644 --- a/tools/upscale/layer/fsr4_pipeline.c +++ b/tools/upscale/layer/fsr4_pipeline.c @@ -799,15 +799,13 @@ static int run_fsr411_full(WlFsr4Pipeline *p, VkCommandBuffer cb, return 0; } -// FSR 4.1.1 Full writes a black frame in D3D12 games on Turnip (Red Magic 12 Pro A850 Dec 2026, Elite A830 Nov 2026; -// 0 coloured pixels in 9/9 shots of the XeSS DX12 sample, GPU and NPU) while Vulkan games show it (XeSS Vulkan sample). -// FSR 4.1.2 Lite stands in there; DROIDDECK_UPSCALE_FULL_ON_TURNIP=1 runs Full anyway, for testing. +// FSR 4.1.1 Full writes a black frame on Turnip when the game itself uses VK_EXT_descriptor_buffer in the command +// buffers the upscaler records into (vkd3d-proton: XeSS DX12 sample black in 9/9 shots, picture back once vkd3d stops +// using the extension; Red Magic 12 Pro A850, Dec 2026). The layer hides the extension from games, so this only +// triggers when a game enables it anyway: FSR 4.1.2 Lite stands in. DROIDDECK_UPSCALE_FULL_ON_TURNIP=1 runs Full anyway. static int full_black_here(WlFsr4Pipeline *p, const WlFsr4FrameDesc *frame) { - switch (frame->api_source) { - case WLFSR4_API_FFX_DX12: case WLFSR4_API_NGX_DX12: case WLFSR4_API_XESS_DX12: - case WLFSR4_API_FSR3_DX12: case WLFSR4_API_FSR2_DX12: break; - default: return 0; - } + (void)frame; + if (!p->vk.app_desc_buf) return 0; if (p->turnip < 0) { VkPhysicalDeviceDriverProperties drv = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES }; VkPhysicalDeviceProperties2 dp2 = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &drv }; @@ -822,7 +820,7 @@ static int full_black_here(WlFsr4Pipeline *p, const WlFsr4FrameDesc *frame) { if (force && force[0] == '1') return 0; if (!p->full_dx12_logged) { p->full_dx12_logged = 1; - F4_LOGW("FSR 4.1.1 Full off for D3D12 on Turnip (black frame) - FSR 4.1.2 Lite stands in"); + F4_LOGW("FSR 4.1.1 Full off: the game uses descriptor buffers on Turnip (black frame) - FSR 4.1.2 Lite stands in"); } return 1; } diff --git a/tools/upscale/layer/fsr4_pipeline.h b/tools/upscale/layer/fsr4_pipeline.h index 028876001d..37ff082de0 100644 --- a/tools/upscale/layer/fsr4_pipeline.h +++ b/tools/upscale/layer/fsr4_pipeline.h @@ -17,6 +17,7 @@ typedef struct WlVkDispatch { // Detected optional extension/feature availability int has_desc_buf; + int app_desc_buf; // the game itself enabled VK_EXT_descriptor_buffer int has_mut_desc; int has_ext_ahb; int has_bda;