Skip to content

Run on GPUs without 16-bit shader types, name each backend's GPUs in the README, and set the version to 1.1 - #347

Merged
LogicalError merged 2 commits into
mainfrom
tachyonui/no-16bit-shader-types
Nov 26, 2026
Merged

LogicalError merged 2 commits into
mainfrom
tachyonui/no-16bit-shader-types

Conversation

@LogicalError

Copy link
Copy Markdown
Owner

The library now runs on GPUs without 16-bit shader types, which adds the GeForce GTX 900 and 10 series and the Radeon RX 400 and 500 series. The README now names the GPUs each backend needs, per platform. The version is 1.1.

What kept those GPUs out

  • The shaders declared some fields of the primitives and styles as 16-bit types: half, int16_t and uint16_t, matching the packed C++ structs.
  • That made each backend need 16-bit support:
    • Vulkan needed shaderFloat16 and shaderInt16.
    • Direct3D 12 needed native 16-bit operations: every DXIL shader said "Use native low precision".
  • GeForce GTX 900 and 10 and Radeon RX 400 and 500 have Vulkan 1.3 and shader model 6.6, but not those.
  • The values were always widened to 32 bits before any math. So the 16-bit types only packed the data; no math was done in 16 bits.

The change

  • Shaders (all_common.slang): the 16-bit fields are read as the 32-bit words holding them, and unpacked with 32-bit operations, through small accessors such as ColorStyle::TransformationX() and Box::SnappedPx().

    • Slang's f16tof32 goes through a half on SPIR-V. So on SPIR-V, UnpackHalf2 uses SPIR-V's own UnpackHalf2x16 instruction instead.
    • The C++ structs and the bytes they write are unchanged.
  • Vulkan (GetDeviceRequirements): no longer requires shaderFloat16, shaderInt16, or 16-bit storage. It also drops shaderInt8 and 8-bit storage, which no shader used.

  • SDL GPU (ApplyDeviceRequirements): asks only for shaderDrawParameters. The header and docs/integration/sdlgpu-device.md say so.

  • README requirements: each platform's section stands on its own, for readers who skip the others:

    • its default renderer
    • the GPUs it needs, by name, for the default backend and for each optional one
    • the optional backends it can add, with their flags

    The GPU lists come from the Vulkan and Direct3D 12 hardware databases (vulkan.gpuinfo.org, d3d12infodb), checked feature by feature.

  • Version 1.1.0: in CMake, the package config's example, the README, the docs, tests/package_consumer and the CHANGELOG.

Checks

  • Pixels: frames of a UI window and of every color type were byte-identical before and after. That held on Vulkan, Direct3D 12, and SDL GPU's Vulkan and Direct3D 12 drivers.
  • Speed: the showcase's --bench 600 gave 0.270 ms of GPU time per frame with both the old and the new shaders (Release, RTX 4070 Ti SUPER).
  • New tests (built_in_resources_test.cpp): both failed on the old shaders.
    • No SPIR-V module declares a 16- or 8-bit capability.
    • No DXIL module asks for native 16-bit operations.
  • Passing on Debug and Release:
    • gui_core_tests
    • gui_vulkan_tests, gui_d3d12_tests and gui_sdlgpu_tests
    • gui_gpu_tests on Vulkan, Direct3D 12 and SDL GPU

Not tested

  • I had none of the newly supported GPUs to run on. The claim rests on the shaders no longer declaring 16-bit features, and on the databases showing those GPUs have everything else.
  • The Metal backend isn't built on Windows. Its shaders cast through half, which every Metal GPU supports. CI builds it on macOS.

…rsion 1.1

The shaders declared the primitives' and styles' 16-bit fields as half,
int16_t and uint16_t. Vulkan then needed shaderFloat16 and shaderInt16,
and Direct3D 12 native 16-bit operations, which GeForce GTX 900 and 10
and Radeon RX 400 and 500 don't have. The values were always widened to
32 bits before any math.

- The shaders read those fields as the 32-bit words holding them and
  unpack them with 32-bit operations; on SPIR-V with UnpackHalf2x16,
  where Slang's f16tof32 goes through a half. The C++ data is unchanged
  and so is what's drawn.
- Vulkan no longer requires shaderFloat16, shaderInt16, shaderInt8 or
  8- and 16-bit storage; SDL GPU's device asks only for draw parameters.
- Tests check that no SPIR-V declares a 16- or 8-bit capability and no
  DXIL asks for native 16-bit operations.
- README: each platform's requirements stand alone, with the GPUs the
  default backend and the optional ones need, by name.
- The version is 1.1.0.
@LogicalError
LogicalError merged commit 8b20761 into main Nov 26, 2026
9 checks passed
@LogicalError
LogicalError deleted the tachyonui/no-16bit-shader-types branch November 26, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant