mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-19 04:15:57 +00:00
Discard as demote runs only where shaderDemoteToHelperInvocation is enabled, and the log says whether it is on (#164)
vk_device.c create_device records the feature from the Vulkan 1.3 chain it passes to vkCreateDevice. spirv_demote leaves the module as the translator wrote it without the feature, also under TOTK_DEMOTE=1, since the DemoteToHelperInvocation capability needs it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fda4e62405
commit
7b5265d1fd
3 files changed
+11
-2
No files matched your search
@@ -61,6 +61,7 @@ typedef struct {
|
||||
int amd_sc; // AMD's Windows driver branch for RDNA 1 and 2 ("AMD proprietary shader compiler")
|
||||
int mesa; // a Mesa driver the game runs on: RADV, ANV or NVK
|
||||
int intel_igpu_win; // Intel's Windows driver on an integrated GPU (UHD, Iris Xe, Core Ultra graphics)
|
||||
int demote; // shaderDemoteToHelperInvocation enabled: modules may use OpDemoteToHelperInvocation
|
||||
} VkCaps;
|
||||
extern VkCaps vk_caps;
|
||||
void vk_caps_driver(VkPhysicalDevice p); // first, before vkCreateDevice: vk_caps.amd, amd_sc, mesa, intel_igpu_win
|
||||
|
||||
@@ -401,6 +401,9 @@ static int create_device(void) {
|
||||
else if (!h->textureCompressionBC) miss = "textureCompressionBC";
|
||||
if (miss) { rt_log("vk: required feature missing on %s: %s", g_vk.props.deviceName, miss); free(c); return 0; }
|
||||
if (!c->fault.deviceFault) g_vk.has_device_fault = 0; // vkGetDeviceFaultInfoEXT needs the feature, not just the extension
|
||||
// Vulkan 1.3 requires the feature, and the chain goes to vkCreateDevice as the driver filled it, so it is enabled
|
||||
// wherever reported; vk_pipeline.c spirv_demote emits OpDemoteToHelperInvocation only when it is.
|
||||
vk_caps.demote = c->f13.shaderDemoteToHelperInvocation;
|
||||
rt_log("vk: GPU address map for device faults: %s",
|
||||
has_abr && c->abr.reportAddressBinding ? "on (VK_EXT_device_address_binding_report; TOTK_ADDR_REPORT=0 turns it off)"
|
||||
: !ab_want ? "off (TOTK_ADDR_REPORT=0 or no VK_EXT_debug_utils)"
|
||||
|
||||
@@ -883,13 +883,18 @@ out:
|
||||
// that selection's merge block, so the fragment goes on computing and writes nothing. An OpKill anywhere else (the end
|
||||
// of a function, a switch case) stays. NULL: nothing to change.
|
||||
// On by default on AMD's own drivers, where the fringe shows; other drivers keep the translator's OpKill, their output
|
||||
// unchanged. TOTK_DEMOTE=1 or 0 overrides on any driver.
|
||||
// unchanged. TOTK_DEMOTE=1 or 0 overrides on any driver that enables shaderDemoteToHelperInvocation (vk_caps.demote,
|
||||
// set in vk_device.c create_device); without the feature the module keeps OpKill, since the capability would be invalid.
|
||||
static uint32_t *spirv_demote(const uint32_t *w, uint64_t n, uint64_t *out_n) {
|
||||
enum { OP_EXTENSION = 10, OP_CAPABILITY = 17, OP_SELECTION_MERGE = 247, OP_LABEL = 248, OP_BRANCH = 249,
|
||||
OP_BRANCH_CONDITIONAL = 250, OP_KILL = 252, OP_DEMOTE = 5380, CAP_DEMOTE = 5379 };
|
||||
static const char ext_name[36] = "SPV_EXT_demote_to_helper_invocation"; // 35 characters and the terminator: 9 words
|
||||
static int on = -1;
|
||||
if (on < 0) on = rt_knob("DEMOTE", vk_caps.amd && !vk_caps.mesa ? "1" : "0");
|
||||
if (on < 0) {
|
||||
on = vk_caps.demote && rt_knob("DEMOTE", vk_caps.amd && !vk_caps.mesa ? "1" : "0");
|
||||
rt_log("vk_pipeline: discard as demote: %s (shaderDemoteToHelperInvocation %d, TOTK_DEMOTE)", on ? "on" : "off",
|
||||
vk_caps.demote);
|
||||
}
|
||||
if (!on || n < 5) return NULL;
|
||||
uint64_t kills = 0;
|
||||
for (uint64_t i = 5; i < n;) {
|
||||
|
||||
Reference in new issue
Block a user