KhronosGroup / KhronosGroup/glslang

HLSL: unwanted implicit conversion from Texture2DArray to Texture2D

Open
#3,338 4 comments 0 reactions 0 assignees View on GitHub
bug HLSL
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

Hi,

The following code is rejected by fxc and dxc.
However, it is accepted by glslang - which will produce invalid SPIR-V code, if one tries to access `texture` in `f`.

```
void f(Texture2D texture) {}
void g(Texture2DArray array) { f(array); }
```

https://shader-playground.timjones.io/85b34b00156e57adb4bd6c401925fb7c

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported Texture2DArray-to-Texture2D conversion with glslang and compare its behavior with fxc and dxc. Trace the HLSL type-checking and conversion handling, then add coverage for the snippet; done means the invalid implicit conversion is rejected and cannot produce invalid SPIR-V.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.