KhronosGroup / KhronosGroup/glslang

HLSL: support fixed-width types

Open
#2,965 0 comments 0 reactions 0 assignees View on GitHub
enhancement HLSL SPIR-V
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

glslang currently does not support fixed-width types (`float16_t`, `int16_t`, `uint16_t`, `float32_t`, `int32_t`, `uint32_t`). `int64_t` and `uint64_t` are also not supported, as reported in #1346.

The issue can be reproduced with the following code snippet:

```hlsl
#define BUFFER_TYPE uint16_t

[[vk::binding(0)]]
StructuredBuffer in_data;

[[vk::binding(1)]]
RWStructuredBuffer out_data;

[numthreads(32, 1, 1)]
void CSMain()
{
BUFFER_TYPE v = in_data[0];
out_data[0] = v;
}
```

and command:
`glslangValidator -D -e CSMain -S comp --target-env vulkan1.1 --hlsl-enable-16bit-types -H issue.hlsl`

All types compile fine with DXC:
`dxc -E CSMain -T cs_6_6 -spirv -fspv-target-env=vulkan1.1 -enable-16bit-types issue.hlsl`

Contributor guide

Open the contributing guide

Research direction

Start with the issue.hlsl reproduction and run the provided glslangValidator command, then compare its behavior with the shown DXC command. Done means glslang accepts the listed 16-, 32-, and 64-bit fixed-width HLSL types under the relevant Vulkan and 16-bit options.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.