diff --git a/runtime/cfg.c b/runtime/cfg.c index b122690a..7a58cfc9 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -112,7 +112,7 @@ static const CfgMeta metas[] = { // shaders and pipelines {"PIPE_WAIT", "default", "default|draw", RESTART}, {"PIPE_SKIP", "fullscreen", "strict|any|fullscreen", RESTART}, {"LIB_PREBUILD", "1", "0|1", RESTART}, {"LIB_PREBUILD_THREADS", "", "1..64", RESTART}, - {"PIPE_PREBUILD", "1", "0|1", RESTART}, {"PREWARM_XLATE", "", "1..64", RESTART}, {"GPL", "1", "0|1", RESTART}, + {"PIPE_PREBUILD", "1", "0|1", RESTART}, {"PREWARM_XLATE", "", "1..64", RESTART}, {"GPL", "", "0|1", RESTART}, // textures and memory {"ASTC", "auto", "auto|gpu|native|cpu", RESTART}, {"MEMORY", "auto", "auto|import|mirror|verify", RESTART}, {"TEX_ALIAS", "1", "0|1", RESTART}, {"ZSTD_NATIVE", "1", "0|1", RESTART}, {"ZSTD_CHECK", "0", "0|1", RESTART}, diff --git a/runtime/gfx_window.c b/runtime/gfx_window.c index ffb7f1cf..718474b3 100644 --- a/runtime/gfx_window.c +++ b/runtime/gfx_window.c @@ -849,6 +849,8 @@ static void present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w VkCommandBufferBeginInfo bi = {.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT}; vkBeginCommandBuffer(cb, &bi); + uint64_t crumb = __atomic_load_n(&gfx_counters.frames, __ATOMIC_RELAXED); + vk_crumb(cb, VK_CRUMB_PRESENT, crumb); VkImage dst = g_sc_img[idx]; sync_barrier(cb, dst, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_PIPELINE_STAGE_2_TRANSFER_BIT, 0, VK_PIPELINE_STAGE_2_TRANSFER_BIT, VK_ACCESS_2_TRANSFER_WRITE_BIT); @@ -909,6 +911,7 @@ static void present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w record_thumb(cb, dst, slot); } sync_barrier(cb, dst, last, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, last_stage, last_write, VK_PIPELINE_STAGE_2_NONE, 0); + vk_crumb(cb, VK_CRUMB_PRESENT_END, crumb); vkEndCommandBuffer(cb); VkSemaphoreSubmitInfo wait = {.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO, .semaphore = g_acquire[slot], diff --git a/runtime/vk.h b/runtime/vk.h index f6302678..f7050892 100644 --- a/runtime/vk.h +++ b/runtime/vk.h @@ -36,7 +36,7 @@ typedef struct VkCtx { int validation; // layer active int has_custom_border_color, has_eds, has_eds2, has_eds3, has_vertex_input_dynamic_state, has_conditional_rendering, has_transform_feedback, has_provoking_vertex, has_device_fault, has_memory_budget, - has_robustness2, has_buffer_device_address, has_fragment_shader_interlock, + has_robustness2, has_buffer_device_address, has_fragment_shader_interlock, has_buffer_marker, has_astc_ldr; // textureCompressionASTC_LDR (enabled when reported) // Feedback loops (maxwell.md 1.9, vk_exec_draw.c feedback_prepare): a draw samples a target of its open pass that // an earlier draw of the pass wrote. TOTK_FEEDBACK=0: VK_FEEDBACK_OFF (sampled in GENERAL without a barrier, the @@ -56,8 +56,11 @@ typedef struct { uint32_t sg_size; // requiredSubgroupSize on sg_pin_stages (32) VkShaderStageFlags sg_pin_stages; // 0: no pin, stages run at the device's subgroupSize int gpl; // VK_EXT_graphics_pipeline_library enabled with fast linking (TOTK_GPL=0: off) + int amd; // an AMD GPU (vendor 0x1002), any driver + int amd_sc; // AMD's Windows driver branch for RDNA 1 and 2 ("AMD proprietary shader compiler") } VkCaps; extern VkCaps vk_caps; +void vk_caps_driver(VkPhysicalDevice p); // first, before vkCreateDevice: vk_caps.amd, amd_sc void vk_caps_features(VkPhysicalDeviceFeatures *f); // before vkCreateDevice (TOTK_VK_NO_FLOAT64 clears shaderFloat64) // Before vkCreateDevice, with the driver's graphics pipeline library feature and properties: sets vk_caps.gpl, // 1 = enable the extensions (VK_KHR_pipeline_library, VK_EXT_graphics_pipeline_library) and the feature. @@ -71,9 +74,21 @@ void vk_shutdown(void); int vk_selftest(void); // 0 on success // Call with the result of a failed queue submit, present or wait before stopping on it: VK_ERROR_DEVICE_LOST logs // what VK_EXT_device_fault reports (description, faulting addresses with their precision, vendor codes) once per -// process. Any other result returns at once. +// process, after the GPU breadcrumbs (vk_crumbs_report). Any other result returns at once. void vk_device_fault_report(VkResult r); +// ---- GPU breadcrumbs (vk_crumbs.c): with VK_AMD_buffer_marker, each crumb has the GPU write its code into host memory +// twice, when the command processor reaches it and when all work before it has finished. After a lost device the two +// codes bracket the work that hung. Without the extension every call returns at once. +enum { VK_CRUMB_SUBMIT = 1, VK_CRUMB_SUBMIT_END, VK_CRUMB_UPLOAD, VK_CRUMB_UPLOAD_END, VK_CRUMB_ASTC, VK_CRUMB_PRESENT, + VK_CRUMB_PRESENT_END }; +void vk_crumbs_init(VkCtx *c); // after the allocator exists +void vk_crumbs_release(void); +// Records crumb kind with number n (a timeline value, a batch number; the low 28 bits are kept) into cb. Only the +// thread that records cb may call it: never into a replay part while the recorder thread owns it (vk_rec.h). +void vk_crumb(VkCommandBuffer cb, int kind, uint64_t n); +void vk_crumbs_report(void); // logs the two codes and what they name + // ---- window and present (gfx_window.c). Host threads only. // vk_present_image: blits the crop rectangle {x, y, w, h} of src (NULL, or w/h <= 0: the whole w x h image), scaled // to the swapchain extent, into the acquired swapchain image and presents it. src is in layout, which is diff --git a/runtime/vk_astc.c b/runtime/vk_astc.c index 70ba539d..62afe30d 100644 --- a/runtime/vk_astc.c +++ b/runtime/vk_astc.c @@ -104,7 +104,7 @@ static struct { VmaAllocation tab_alloc; int tab_uploaded; } G = {.mode = -1}; -static uint64_t n_dispatch, n_texels; +static uint64_t n_dispatch, n_texels, n_chunks; // n_chunks: the breadcrumb number of the next scratch chunk // TOTK_ASTC_TIME=1 (or vk_astc_time_enable): timestamps around the dispatches of each scratch chunk (the decode // alone) and around a whole vk_astc_record call (one texture upload or WriteTexels: copies and barriers included), @@ -449,6 +449,7 @@ int vk_astc_record(VkCommandBuffer cb, VkBuffer src, VkDeviceSize src_size, cons bcp[i1 - i0] = (VkBufferCopy){rg[i1].src, in, region_in(&rg[i1], bw, bh)}; in += region_in(&rg[i1], bw, bh), out += region_out(&rg[i1]); } + vk_crumb(cb, VK_CRUMB_ASTC, ++n_chunks); if (chunks) // the previous chunk's dispatches and image copy are done with the scratch mem_barrier(cb, VK_PIPELINE_STAGE_2_COPY_BIT | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, VK_ACCESS_2_TRANSFER_READ_BIT | VK_ACCESS_2_SHADER_STORAGE_READ_BIT, diff --git a/runtime/vk_caps.c b/runtime/vk_caps.c index c07b32dc..ca4c527b 100644 --- a/runtime/vk_caps.c +++ b/runtime/vk_caps.c @@ -6,8 +6,8 @@ // - minStorageBufferOffsetAlignment above 4 (TOTK_VK_SSBO_ALIGN= raises it): the translator computes // storage offsets from the guest address rounded down to that alignment (Ryujinx's unaligned storage path), and // vk_exec_draw.c ssbo_info binds the rounded-down address, so shader writes reach guest memory instead of a copy. -// - no graphics pipeline library with fast linking (TOTK_GPL=0 forces it): vk_caps.gpl = 0, the extension stays -// disabled, and pipelines are built whole. +// - no graphics pipeline library with fast linking (TOTK_GPL=0 forces it; the default on AMD's RDNA 1/2 driver): +// vk_caps.gpl = 0, the extension stays disabled, and pipelines are built whole. // - no 32-lane pin (no subgroupSizeControl, 32 outside min..max, or TOTK_VK_SUBGROUP_PIN=0): stages run at the // device's subgroupSize (SPIR-V 1.3 without a required size) and the translator is told that size. // TOTK_VK_SUBGROUP= pins n instead of 32 where the driver allows it. @@ -36,11 +36,25 @@ void vk_caps_features(VkPhysicalDeviceFeatures *f) { vk_caps.float64 = f->shaderFloat64; } +void vk_caps_driver(VkPhysicalDevice p) { + VkPhysicalDeviceDriverProperties drv = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES}; + VkPhysicalDeviceProperties2 p2 = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .pNext = &drv}; + vkGetPhysicalDeviceProperties2(p, &p2); + vk_caps.amd = p2.properties.vendorID == 0x1002; + // AMD split RDNA 1 and 2 off into a driver branch of their own; its driverInfo reads + // "26.10.1 (AMD proprietary shader compiler)" where the RDNA 3 and 4 driver names LLPC. + vk_caps.amd_sc = drv.driverID == VK_DRIVER_ID_AMD_PROPRIETARY && strstr(drv.driverInfo, "shader compiler"); +} + +// TOTK_GPL=0/1 forces graphics pipeline libraries off or on. Default off on AMD's RDNA 1/2 driver branch: every boot +// that lost the device there had a cold pipeline cache and draws waiting on fast-linked pipelines, and a run with GPL +// off booted (issue #5); Savage Wind Recomp turns GPL off on RDNA 4 under RADV for a GPU hang at the title screen. int vk_caps_gpl(const VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT *f, const VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT *p) { gpl_lib = f->graphicsPipelineLibrary; gpl_fast = p->graphicsPipelineLibraryFastLinking; - vk_caps.gpl = gpl_lib && gpl_fast && cfg_bool("TOTK_GPL"); + const char *e = cfg_get("TOTK_GPL"); // no fixed default: it depends on the driver, see above + vk_caps.gpl = gpl_lib && gpl_fast && (e && *e ? strcmp(e, "0") != 0 : !vk_caps.amd_sc); return vk_caps.gpl; } @@ -117,8 +131,10 @@ void vk_caps_init(VkCtx *c) { has_ext(ep, ne, "VK_EXT_graphics_pipeline_library"), depth_ok(p, VK_FORMAT_D16_UNORM), depth_ok(p, VK_FORMAT_D24_UNORM_S8_UINT), depth_ok(p, VK_FORMAT_X8_D24_UNORM_PACK32), depth_ok(p, VK_FORMAT_D32_SFLOAT), depth_ok(p, VK_FORMAT_D32_SFLOAT_S8_UINT)); + const char *ge = cfg_get("TOTK_GPL"); rt_log("vk caps: gpl %s fast-link %s (graphicsPipelineLibrary %u%s)", vk_caps.gpl ? "yes" : "no", - gpl_fast ? "yes" : "no", (unsigned)gpl_lib, gpl_lib && gpl_fast && !vk_caps.gpl ? ", off by TOTK_GPL=0" : ""); + gpl_fast ? "yes" : "no", (unsigned)gpl_lib, + !gpl_lib || !gpl_fast || vk_caps.gpl ? "" : ge && *ge ? ", off by TOTK_GPL=0" : ", off on AMD's RDNA 1/2 driver"); rt_log("vk caps: fallbacks: float64 %s, storage buffers %s %u, subgroup pin %u on stages %#x, translator subgroup vs/fs/cs %u/%u/%u", vk_caps.float64 ? "native" : "softfloat64", vk_caps.sbuf_align ? "rounded down to" : "exact, alignment", (unsigned)l->minStorageBufferOffsetAlignment, want, (unsigned)vk_caps.sg_pin_stages, told[0], told[1], told[2]); diff --git a/runtime/vk_crumbs.c b/runtime/vk_crumbs.c new file mode 100644 index 00000000..74a391a2 --- /dev/null +++ b/runtime/vk_crumbs.c @@ -0,0 +1,67 @@ +// GPU breadcrumbs for a lost device (vk.h vk_crumb). VK_AMD_buffer_marker writes a 32-bit code into a buffer from +// the command stream: at TOP_OF_PIPE once the command processor reaches the marker, at BOTTOM_OF_PIPE once every +// command before it has finished. Each crumb writes both, into two words of one host-coherent buffer, so after a +// device loss word 0 names the newest point the GPU reached and word 1 the newest point it had finished: the hang lies +// between them. A code is the crumb kind in the top 4 bits and its number in the low 28. The markers cost two small +// writes per crumb, and crumbs mark submissions, upload batches, ASTC chunks and presents, not draws. +#include +#include + +#include "host.h" +#include "vk.h" + +static PFN_vkCmdWriteBufferMarkerAMD write_marker; +static VkBuffer buf; +static VmaAllocation alloc; +static volatile uint32_t *words; + +void vk_crumbs_init(VkCtx *c) { + if (!c->has_buffer_marker) return; + write_marker = (PFN_vkCmdWriteBufferMarkerAMD)vkGetDeviceProcAddr(c->device, "vkCmdWriteBufferMarkerAMD"); + VkBufferCreateInfo bi = {.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .size = 16, + .usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT}; + VmaAllocationCreateInfo ai = {.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST, + .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT, + .requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT}; + VmaAllocationInfo info; + if (!write_marker || vmaCreateBuffer(c->vma, &bi, &ai, &buf, &alloc, &info) != VK_SUCCESS) { + rt_log("vk: GPU breadcrumbs unavailable"); + write_marker = NULL; + return; + } + words = info.pMappedData; + words[0] = words[1] = 0; + rt_log("vk: GPU breadcrumbs on (VK_AMD_buffer_marker)"); +} + +void vk_crumbs_release(void) { + VkCtx *c = vk_ctx(); + if (buf && c) vmaDestroyBuffer(c->vma, buf, alloc); + buf = VK_NULL_HANDLE, alloc = NULL, words = NULL, write_marker = NULL; +} + +void vk_crumb(VkCommandBuffer cb, int kind, uint64_t n) { + if (!write_marker || !cb) return; + uint32_t code = (uint32_t)kind << 28 | (uint32_t)(n & 0x0fffffff); + write_marker(cb, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, buf, 0, code); + write_marker(cb, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, buf, 4, code); +} + +static void describe(uint32_t code, char *o, size_t size) { + static const char *const kinds[] = {"nothing", "the start of a part of submission", "the end of submission", + "the start of upload batch", "the end of upload batch", + "ASTC decode chunk", "the start of present", + "the end of present"}; + unsigned k = code >> 28; + if (!code) snprintf(o, size, "nothing yet"); + else if (k < sizeof kinds / sizeof *kinds) snprintf(o, size, "%s %u", kinds[k], code & 0x0fffffff); + else snprintf(o, size, "unknown code %#x", code); +} + +void vk_crumbs_report(void) { + if (!words) return; + char reached[96], finished[96]; + describe(words[0], reached, sizeof reached); + describe(words[1], finished, sizeof finished); + rt_log("vk: GPU breadcrumbs: the GPU last reached %s; everything before %s had finished", reached, finished); +} diff --git a/runtime/vk_device.c b/runtime/vk_device.c index 26881a68..98fb84f9 100644 --- a/runtime/vk_device.c +++ b/runtime/vk_device.c @@ -233,6 +233,8 @@ static int create_device(void) { CHAIN(lr, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_LOCAL_READ_FEATURES_KHR); } if (has_ext(ep, ne, VK_EXT_MEMORY_BUDGET_EXTENSION_NAME)) { g_vk.has_memory_budget = 1; ext[n_ext++] = VK_EXT_MEMORY_BUDGET_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. void **gpl_link = NULL; if (has_ext(ep, ne, VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME) && has_ext(ep, ne, VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME)) { @@ -246,6 +248,7 @@ static int create_device(void) { // The driver fills the chain with what it supports; the same chain then enables all of it (robustBufferAccess // stays on: guest shaders index constant buffers freely and out-of-range reads must stay harmless). vkGetPhysicalDeviceFeatures2(g_vk.phys, &c->f2); + vk_caps_driver(g_vk.phys); vk_caps_features(&c->f2.features); if (gpl_link) { VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT gp = { @@ -320,6 +323,7 @@ static int create_device(void) { rt_log("vk: timeline semaphore creation failed (%d)", (int)r); return 0; } + vk_crumbs_init(&g_vk); return 1; } @@ -329,6 +333,7 @@ static void destroy_all(void) { gfx_window_release_vk(); if (g_vk.device) vkDeviceWaitIdle(g_vk.device); if (g_vk.device) vk_astc_release(); + if (g_vk.device) vk_crumbs_release(); if (g_vk.timeline) vkDestroySemaphore(g_vk.device, g_vk.timeline, NULL); vk_headroom_stop(); if (g_vk.vma) vmaDestroyAllocator(g_vk.vma); @@ -387,6 +392,7 @@ void vk_device_fault_report(VkResult r) { AcquireSRWLockExclusive(&lock); if (done) { ReleaseSRWLockExclusive(&lock); return; } done = 1; + vk_crumbs_report(); VkCtx *c = vk_ctx(); PFN_vkGetDeviceFaultInfoEXT get = c && c->has_device_fault ? (PFN_vkGetDeviceFaultInfoEXT)vkGetDeviceProcAddr(c->device, "vkGetDeviceFaultInfoEXT") diff --git a/runtime/vk_fsr.c b/runtime/vk_fsr.c index ad6fd601..b88ac12c 100644 --- a/runtime/vk_fsr.c +++ b/runtime/vk_fsr.c @@ -99,7 +99,11 @@ static void free_images(VkCtx *c) { static int ensure_images(VkCtx *c, uint32_t w, uint32_t h) { if (F.img[0] && F.w == w && F.h == h) return 1; - vkDeviceWaitIdle(c->device); // a swapchain size change: earlier presents may still read the old images + // A swapchain size change: earlier presents may still read the old images. vkDeviceWaitIdle needs every queue + // externally synchronized, so it holds the queue lock like a submission. + vk_queue_lock(); + vkDeviceWaitIdle(c->device); + vk_queue_unlock(); free_images(c); for (int i = 0; i < 2; i++) { VkImageCreateInfo ci = {.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, .imageType = VK_IMAGE_TYPE_2D, diff --git a/runtime/vk_memory.c b/runtime/vk_memory.c index 7d8192a6..36e050c1 100644 --- a/runtime/vk_memory.c +++ b/runtime/vk_memory.c @@ -1657,6 +1657,7 @@ VkCommandBuffer vk_upload_begin(void) { .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT}; vkBeginCommandBuffer(open_b.cb, &bi); open_b.seq = ++next_seq; + vk_crumb(open_b.cb, VK_CRUMB_UPLOAD, open_b.seq); open_active = 1; return open_b.cb; } @@ -1717,6 +1718,7 @@ uint64_t vk_upload_flush(int wait) { uint64_t seq = next_seq; if (c && open_active) { for (int i = 0; i < open_b.nstg; i++) vmaFlushAllocation(c->vma, open_b.stg[i].alloc, 0, VK_WHOLE_SIZE); + vk_crumb(open_b.cb, VK_CRUMB_UPLOAD_END, open_b.seq); vkEndCommandBuffer(open_b.cb); VkSubmitInfo si = {.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, .commandBufferCount = 1, .pCommandBuffers = &open_b.cb}; vk_queue_lock(); diff --git a/runtime/vk_rec.c b/runtime/vk_rec.c index 2329be22..4ebfeb79 100644 --- a/runtime/vk_rec.c +++ b/runtime/vk_rec.c @@ -12,6 +12,7 @@ #include #include +#include "cfg.h" #include "host.h" #include "vk.h" @@ -128,7 +129,13 @@ void rec_drain(void) { void rec_begin(VkCommandBuffer cb) { static int mode = -1; if (mode < 0) { - mode = rt_knob("VK_RECORDER", "1"); + // Default off on AMD GPUs: with the recorder their drivers lost the device within the first frames or at menu + // opens, 1 boot in 3 on an RX 9070 XT, and TOTK_VK_RECORDER=0 ended it for three users (issue #5); under RADV + // the kernel saw an illegal opcode at the end of a command buffer (issue #40). The cause is not found. + const char *set = cfg_get("TOTK_VK_RECORDER"); + mode = rt_knob("VK_RECORDER", vk_caps.amd ? "0" : "1"); + if (!mode && vk_caps.amd && !(set && *set)) + rt_log("vk_rec: no recorder thread on AMD GPUs (TOTK_VK_RECORDER=1 turns it on)"); if (mode) { wake_ev = CreateEventA(NULL, FALSE, FALSE, NULL); rec_thread = wake_ev ? CreateThread(NULL, 0, rec_main, NULL, 0, NULL) : NULL; diff --git a/runtime/vk_sync.c b/runtime/vk_sync.c index 2dd32c58..671a803e 100644 --- a/runtime/vk_sync.c +++ b/runtime/vk_sync.c @@ -314,6 +314,7 @@ VkCommandBuffer vk_sync_split(void) { VkCommandBufferBeginInfo bi = {.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT}; vkBeginCommandBuffer(s->cb, &bi); + vk_crumb(s->cb, VK_CRUMB_SUBMIT, cur_fence); ts_begin(s->cb); rec_begin(s->cb); return s->cb; @@ -342,11 +343,13 @@ uint64_t vk_sync_submit(const uint64_t *handles, int n) { .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT}; uint64_t t0 = perf_begin(); vkBeginCommandBuffer(s->cb, &bi); + vk_crumb(s->cb, VK_CRUMB_SUBMIT, fence); ts_begin(s->cb); rec_begin(s->cb); int recorded = vk_exec_record(s->cb, handles, n, fence); s = &slots[cur_slot]; // the last part (vk_sync_split) rec_end(); + vk_crumb(s->cb, VK_CRUMB_SUBMIT_END, fence); // the recorder is done with the part if (recorded) ts_end(s->cb, fence); else ts_drop(); vkEndCommandBuffer(s->cb); diff --git a/totk.ini.example b/totk.ini.example index 1f3b11f7..30c3a2af 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -44,7 +44,7 @@ # pipe_prebuild = 1 # Threads that translate known shaders at start (1 to 64; default: half the CPU threads, at most 16). # prewarm_xlate = 8 -# Vulkan graphics pipeline library. 0 if the driver misbehaves with it. +# Vulkan graphics pipeline library, 0 or 1. Default: on, except on AMD's driver for RDNA 1 and 2 (RX 5000 and 6000). # gpl = 1 # Textures and memory. @@ -87,6 +87,8 @@ # Vulkan. # Vulkan validation layer: checks every call and slows the game down a lot. Needs the layer installed (Vulkan SDK). # vk_validation = 0 +# A thread of its own makes the Vulkan calls of each frame, 0 or 1. Default: on, except on AMD GPUs. +# vk_recorder = 1 # Dynamic vertex input, 0 or 1. Default: on, except on Intel's older integrated GPU drivers (Vulkan 1.3.215 and older). # vk_dyn_vertex = 1 # Pin the shader subgroup size to 32 when the GPU allows it.