KhronosGroup / KhronosGroup/glslang

Unsupported types in HLSL: float16_t2 and float16_t3

Open
#3,093 1 comment 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

When trying to compile the shader from [here](https://github.com/GPUOpen-Effects/Hybrid-Shadows/blob/master/src/Shaders/filter_soft_shadows_pass_d3d12.hlsl) I got the following compilation error:

```
ERROR: 0:21: 'scalar or vector type' : Expected
ERROR: 0:21: 'declaration' : Expected
(21): error at column 22, HLSL parsing failed.
```

So these types (`float16_t2` and `float16_t3`) don't get treated as actual types by the compiler while `float16_t` exists. As a workaround it is possible to make a typedef before the actual code using them. But a proper solution would be better.

To clarify I have tried whether it just depends on the 16bit type feature but independent of me enabling it, the vector types are not treated as existing types.

Contributor guide

Open the contributing guide

Research direction

Start with the linked filter_soft_shadows_pass_d3d12.hlsl shader and reproduce the parser errors for float16_t2 and float16_t3. Trace how the HLSL compiler handles float16_t and its vector forms, then verify that both types compile correctly with and without the 16-bit type feature enabled.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.