- [Interop] MarkerPollUs = auto is the new default: the input-marker wait learns when each feature's inputs become ready, sleeps in <=200 us chunks, yields near the prediction and backs off when late (d4r_input_wait.h); a number keeps fixed pacing (0 yields). d4r_config.py no longer exports 200 when the key is unset - D4R_SHIM_GPU_INPUT_WAIT=1 (experimental, split VRAM, age 0): NGX's null stream waits on a coherent Vulkan word imported into HIP (d4rStreamWaitValue32Eq) instead of CPU polling. The original readback marker stays the authority; a CPU watchdog releases discarded lists and timeouts. Denoiser, verify, capture and dilation frames keep the CPU wait - D4R_SHIM_GPU_COMPLETION=1 (needs GPU_INPUT_WAIT): the bridge writes a completion word right after the native output kernel (d4rNgxWriteValue32), and the game's queue polls it with a bounded compute wait (kernels/support/vulkan_wait.comp), replacing the split list's CPU timeline signal. frame_retired writes the same word on every failure path - D4R_SHIM_NATIVE_COMPLETION=1: a null-stream callback in the bridge signals the split timeline (d4rNgxTimeline*); D4rFrameCompletion::can_signal only releases the oldest outstanding frame - RGBA8 output: tex_common.h adds an 'R4' redirect tag, so K's native output kernel stores packed RGBA8 directly (D4R_SHIM_OUTPUT_RGBA8=1, checked against the kernel manifest by d4rOutputKernelRgba8). Host packing handles RGBA8 too. patches/vkd3d-proton/0004 (VKD3D_D4R_LINEAR_RGBA8=WxH) makes such outputs linear and exportable so the result can be written in place - D4R_SHIM_FUSE_RGBA8_INPUT=1: one Vulkan pass converts and copies RGBA8 color input (vulkan_read.comp mode 5 matches the blit's toward-zero halves, plus a row stride) - profiling: thread CPU time from the Unix bridge (Wine's GetThreadTimes ticks at 10 ms); game-queue D3D12 timestamps (vk_input/vk_dlss_wait/vk_output/vk_total); gpu_eval split into input_gpu_wait and dlss_gpu; D4R_PROFILE_GPU_EVENTS, _TIMESTAMPS, _LOG and _CPU_TIME=0 switch off individual parts for bisection - bridge: D4R_NGX_STREAM_PRIORITY=high|normal runs NGX on a priority stream (off by default; no gain measured) - release_feature: a feature already marked retiring by a failed drain can still be released normally - harness: RGBA8 with motion and jitter scenes (re-quantized each frame), D4R_HARNESS_RGBA8_RAMP, D4R_HARNESS_THRASH_MB to evict L2/Infinity Cache before each evaluation - kernels/native: in_hoist.py and split_output_paths.py (opt-in scheduling experiments); scripts/build_k_ldr_output.sh builds K's LDR output with an optional D4R_LDR_OUTPUT_MAX_VGPR cap - tests: test_input_wait.py and test_latency_optimizations.py; MarkerPollUs and frame-completion tests updated
58 lines
2.6 KiB
Plaintext
58 lines
2.6 KiB
Plaintext
#version 450
|
|
layout(local_size_x=8, local_size_y=8) in;
|
|
layout(set=0, binding=0) uniform sampler2D sourceImage;
|
|
layout(std430, set=0, binding=1) writeonly buffer Pixels { uint pixels[]; };
|
|
layout(push_constant) uniform Size { uint width; uint height; uint mode; uint stride; } size;
|
|
// Match the CPU canonical conversion, including round-to-even and subnormals.
|
|
uint halfBits(float value) {
|
|
uint bits = floatBitsToUint(value);
|
|
uint sign = (bits >> 16) & 0x8000u;
|
|
uint exponent = (bits >> 23) & 0xffu;
|
|
uint mantissa = bits & 0x7fffffu;
|
|
if (exponent == 255u) return sign | 0x7c00u | (mantissa != 0u ? 0x200u : 0u);
|
|
int e = int(exponent) - 112;
|
|
if (e >= 31) return sign | 0x7c00u;
|
|
uint shift = 13u;
|
|
if (e <= 0) {
|
|
if (e < -10) return sign;
|
|
mantissa |= 0x800000u;
|
|
shift = uint(14 - e); e = 0;
|
|
}
|
|
uint m = mantissa >> shift;
|
|
uint remainder = mantissa & ((1u << shift) - 1u);
|
|
uint halfway = 1u << (shift - 1u);
|
|
uint result = sign | (uint(e) << 10);
|
|
result += m & (e == 0 ? 0x7ffu : 0x3ffu);
|
|
if (remainder > halfway || (remainder == halfway && (m & 1u) != 0u)) ++result;
|
|
return result;
|
|
}
|
|
// Mode 5 is only for RGBA8 UNORM: values are zero or normal positive halves. Preserve
|
|
// the blit's toward-zero conversion; other modes keep the canonical round-to-even path.
|
|
uint halfRtz(float value) {
|
|
uint b = floatBitsToUint(value);
|
|
if (value == 0.0) return 0u;
|
|
return (((b >> 23) - 112u) << 10) | ((b & 0x7fffffu) >> 13);
|
|
}
|
|
void main() {
|
|
uvec2 p = gl_GlobalInvocationID.xy;
|
|
if (p.x >= size.width || p.y >= size.height) return;
|
|
ivec2 extent = textureSize(sourceImage, 0);
|
|
uint index = p.y * size.stride + p.x;
|
|
vec4 value = all(lessThan(ivec2(p), extent))
|
|
? texelFetch(sourceImage, ivec2(p), 0) : vec4(0.0);
|
|
if (size.mode == 5u) {
|
|
pixels[index * 2u] = halfRtz(value.x) | (halfRtz(value.y) << 16);
|
|
pixels[index * 2u + 1u] = halfRtz(value.z) | (halfRtz(value.w) << 16);
|
|
} else if (size.mode == 1u) { // canonical RGBA16F color
|
|
pixels[index * 2u] = halfBits(value.x) | (halfBits(value.y) << 16);
|
|
pixels[index * 2u + 1u] = halfBits(value.z) | (halfBits(value.w) << 16);
|
|
} else if (size.mode == 3u) { // canonical RG16F motion
|
|
pixels[index] = halfBits(value.x) | (halfBits(value.y) << 16);
|
|
} else if (size.mode == 2u || size.mode == 4u) { // R32F depth/exposure
|
|
pixels[index] = floatBitsToUint(value.x);
|
|
} else {
|
|
uvec4 bits = floatBitsToUint(value);
|
|
for (uint c = 0u; c < 4u; ++c) pixels[index * 4u + c] = bits[c];
|
|
}
|
|
}
|