Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Expose floating point format conversion operations (16 <-> 32 bits)? #707

@hrydgard

Description

@hrydgard

HLSL and GLSL both have operations that convert between 16 and 32-bit floating point formats.

In GLSL they look like this, packing/unpacking two 16-bit floats to/from an uint:

vec2 unpackHalf2x16(uint v);
uint packHalf2x16(vec2 v);

HLSL has scalar (non-pack/unpack) operations only:

uint f32tof16(in float value);
float f16tof32(in uint value);

I have not looked in detail yet about what actual SPIR-V the GLSL operations become. Possibly there's some capability required to get these natively?

Metadata

Metadata

Assignees

No one assigned

    Labels

    t: enhancementA new feature or improvement to an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions