upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/depth24_convert.comp
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-22 05:45:58 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-22 05:45:58 -0500
commit4cfde416f85c60cafe5c2d7329f4c0e028006562 (patch)
treeddbeed5b59589d305595cc38bcf0314f81c5520f /runtime/src/depth24_convert.comp
parent70178d307cb87146a42414eefa19aa4ff0e0c40a (diff)
parentf85582e23d4ab9e19acbf694358f137d6b8531b1 (diff)
Merge main (f85582e) into runtime/compute-path
On top of the merge candidate 70178d3 (Ryx69/Leonida#6, which merged main at 426023a): the 219 commits main gained since. Three hunks conflicted, in two files; both follow the notes on #291 (ItsNotRexed 08:27 UTC, Vonsek 09:58 UTC on 2026-11-22). runtime/shims/d3d12_vulkan_device.cpp, device setup after the VulkanContext: - the branch's GPU address arena is created first, as before; - main's block that configures predication and the predicated byte copy (#1277) follows it; - one load_host_image_copy call and main's lazy D24 converter (enabled only where D24_UNORM_S8_UINT is not usable) replace the branch's unconditional enable_depth24, which was the same code before main changed it. runtime/src/vulkan_replay.h: - CopyBuffer: main's version. It already adds ResourceBinding::buffer_offset to both offsets, as the branch did, and adds the overflow and overlap checks and the predicated copy. With the arena, source and destination are often the same VkBuffer; the overlap check compares the adjusted ranges. - Predication: main's version. prepare() passes buffer_offset + the command's offset to prepare_predicate, so a default-heap buffer inside the arena is read at its own range; emit() captures the word and tests the capture's scratch slot, not the application's buffer. Everything else merged without conflicts. Nothing in main's 219 commits adds a caller that takes a buffer's Vulkan device address for its GPU VA. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/depth24_convert.comp')
-rw-r--r--runtime/src/depth24_convert.comp11
1 files changed, 6 insertions, 5 deletions
diff --git a/runtime/src/depth24_convert.comp b/runtime/src/depth24_convert.comp
index eb4795a35..688f68d78 100644
--- a/runtime/src/depth24_convert.comp
+++ b/runtime/src/depth24_convert.comp
@@ -36,10 +36,11 @@ float depth24_to_float(uint d) {
36// The 24-bit UNORM of f as WARP and AMD's D3D12 drivers write it: the product with 2^24 - 1 is rounded to a float 36// The 24-bit UNORM of f as WARP and AMD's D3D12 drivers write it: the product with 2^24 - 1 is rounded to a float
37// first, then to the nearest integer with ties to even (NVIDIA's hardware breaks some ties the other way; see 37// first, then to the nearest integer with ties to even (NVIDIA's hardware breaks some ties the other way; see
38// depth24.h). NaN and negatives give 0, 1 and above the maximum. 38// depth24.h). NaN and negatives give 0, 1 and above the maximum.
39uint depth24_from_float(float f) { 39uint depth24_from_bits(uint bits) {
40 if (!(f > 0.0)) return 0u; 40 // In unsigned order, all negative encodings and positive NaNs lie above positive infinity.
41 if (f >= 1.0) return 0xffffffu; 41 if (bits > 0x7f800000u) return 0u;
42 return uint(roundEven(f * 16777215.0)); 42 if (bits >= 0x3f800000u) return 0xffffffu;
43 return uint(roundEven(uintBitsToFloat(bits) * 16777215.0));
43} 44}
44 45
45void main() { 46void main() {
@@ -48,5 +49,5 @@ void main() {
48 uint a = pc.app_base + g.z * pc.app_slice + g.y * pc.app_row + g.x; 49 uint a = pc.app_base + g.z * pc.app_slice + g.y * pc.app_row + g.x;
49 uint s = pc.scratch_base + (g.z * pc.height + g.y) * pc.width + g.x; 50 uint s = pc.scratch_base + (g.z * pc.height + g.y) * pc.width + g.x;
50 if (pc.to_float != 0u) scratch[s] = floatBitsToUint(depth24_to_float(app[a] & 0xffffffu)); 51 if (pc.to_float != 0u) scratch[s] = floatBitsToUint(depth24_to_float(app[a] & 0xffffffu));
51 else app[a] = depth24_from_float(uintBitsToFloat(scratch[s])); 52 else app[a] = depth24_from_bits(scratch[s]);
52} 53}