KhronosGroup / KhronosGroup/glslang
Support a relaxed casting mode
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
Currently, if you want to set any limited-precision number in any situation, you have to cast.
```
uint16_t val = uint16_t(0);
const uint16_t arr[4] = { uint16_t(0), uint16_t(0), uint16_t(0), uint16_t(0) };
```
This leads to code interacting with mixed-precision numbers requiring casts in every single line, such as throughout this [entire file](https://github.com/FFmpeg/FFmpeg/blob/c3d3377fe14645dbb63d937c45df12f3f6746d17/libavcodec/vulkan/rangecoder.comp#L49).
Everything here was designed to not overflow. Generally programmers know whether something will overflow or not.
Having a `#pragma releaxed_casting` would be a good quality of life improvement.
Contributor guide
Research direction
Start by reading the referenced FFmpeg file, libavcodec/vulkan/rangecoder.comp, to understand the repeated limited-precision casts motivating this request. Then trace glslang's existing pragma handling and tests; done requires a defined relaxed-casting mode with documented behavior and coverage for the mixed-precision cases described here.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100