KhronosGroup / KhronosGroup/glslang
HLSL: reject-valid: can't return a boolean
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
The following program is accepted by fxc.exe:
( http://shader-playground.timjones.io/acbd719135ab8a9cb080566f5fa69d6e )
```cpp
struct TVertexOutput
{
bool flag : DUMMY;
};
TVertexOutput vmain()
{
TVertexOutput o = (TVertexOutput)0;
o.flag = true;
return o;
}
```
Howerver, it is rejected by glslang :
```
$ glslangValidator -V100 --spirv-val -S vert -D --target-env vulkan1.0 -e vmain -o test.spv test.vert.hlsl
test.vert.hlsl
error: SPIRV-Tools Validation Errors
error: If OpTypeBool is stored in conjunction with OpVariable, it can only be used with non-externally visible shader Storage Classes: Workgroup, CrossWorkgroup, Private, and Function
%_entryPointOutput_flag = OpVariable %_ptr_Output_bool Output
```
( BTW, is there a way to get rid of the systematic printing of the input filename on stdout ? (i.e the first output line in the above command) )
Contributor guide
Research direction
Start by compiling the supplied HLSL reproducer with glslangValidator using the command shown and compare its SPIR-V validation error with fxc.exe. Trace the HLSL entry-point output handling and SPIR-V validation rules; done means deciding and implementing consistent handling for the boolean output, with regression coverage for this program.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100