[PR #2268] Quantize RGB565 render-target clears at each channel width #2273

Open
opened 2026-11-26 21:20:38 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2268
Author: @Bonchaloo
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/rgb565-rtv-clear


📝 Commits (1)

  • 1e0de21 Quantize RGB565 render-target clears at each channel width

📊 Changes

2 files changed (+3 additions, -0 deletions)

View changed files

📝 runtime/src/vulkan_replay.h (+1 -0)
📝 runtime/test/clear_color_test.cpp (+2 -0)

📄 Description

Claimed in the coordination issue as RT-CLEAR-RGB565-UNORM.

What and why

The RTV replay path already pre-rounds normalized clear values so the conversion is independent of the driver’s tie handling. RGB565 fell through to the raw float path. Apply the existing converter with channel maxima of 31, 63 and 31. Cover full and rectangle clears, midpoint rounding, NaN and clamping.

Tested

On the parent revision the new midpoint case failed (red 0.5, expected 16/31). With the change all 519 clear replay checks passed. The no-game-data check passed for both changed files.

GPUs tested: Apple M5 Max, Apple Metal driver on macOS 27.3. A separate native Metal RGB565 clear and readback produced 0x8410 for both the raw and pre-rounded midpoint. That device already rounds this case the same way. The failing regression was at the renderer’s Vulkan command boundary; the replay test uses synthetic inputs and captures the clear without a GPU.

Full native runtime CTest suite on Apple M5 Max with MoltenVK 1.4.2: 105 passed, 0 failed, 3 skipped (shader_library_corpus, vk_device_markers, vk_sync_validation).

AI-assisted: yes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2268 **Author:** [@Bonchaloo](https://github.com/Bonchaloo) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/rgb565-rtv-clear` --- ### 📝 Commits (1) - [`1e0de21`](https://github.com/ubiquitarianism/leonida/commit/1e0de21b0694a522f8c67ad6a3dc88d81d7216c0) Quantize RGB565 render-target clears at each channel width ### 📊 Changes **2 files changed** (+3 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/vulkan_replay.h` (+1 -0) 📝 `runtime/test/clear_color_test.cpp` (+2 -0) </details> ### 📄 Description Claimed in the coordination issue as [RT-CLEAR-RGB565-UNORM](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7191106625). ### What and why The RTV replay path already pre-rounds normalized clear values so the conversion is independent of the driver’s tie handling. RGB565 fell through to the raw float path. Apply the existing converter with channel maxima of 31, 63 and 31. Cover full and rectangle clears, midpoint rounding, NaN and clamping. ### Tested On the parent revision the new midpoint case failed (red 0.5, expected 16/31). With the change all 519 clear replay checks passed. The no-game-data check passed for both changed files. GPUs tested: Apple M5 Max, Apple Metal driver on macOS 27.3. A separate native Metal RGB565 clear and readback produced 0x8410 for both the raw and pre-rounded midpoint. That device already rounds this case the same way. The failing regression was at the renderer’s Vulkan command boundary; the replay test uses synthetic inputs and captures the clear without a GPU. Full native runtime CTest suite on Apple M5 Max with MoltenVK 1.4.2: 105 passed, 0 failed, 3 skipped (shader_library_corpus, vk_device_markers, vk_sync_validation). AI-assisted: yes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2273
No description provided.