KhronosGroup / KhronosGroup/GLSL

Should GL_EXT_shader_16bit_storage define int -> float constructors?

Open
#100 2 comments 0 reactions 1 assignee Claimed by @johnkslang View on GitHub
Vulkan
Dominant language
JavaScript
Stars
458
Forks
114
Avg merge
4m
Merged PRs (30d)
1

Description

GL_EXT_shader_16bit_storage added constructors like

```
float16_t(float)
```

But, did not add

```
float16_t(int)
```

Was excluding the latter intentional? Based on the existence of implicit conversions to match function prototypes, one could imagine that it is implied, but it's not really the right reason. Some quotes from the core spec:

> In general, constructors are not built-in functions with predetermined prototypes.

and

> Constructors can be used to request a data type conversion to change from one scalar type to another scalar type

and

> `float(int) // converts a signed integer value to a float`

The cross-basic-type constructors should either be added to the extension specification and then implemented in glslang (the operators already exist, but don't get created for the above), or glslang should be changed to enforce semantic check in the lack of cross-type constructors.

cc @jeffbolznv

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.