KhronosGroup / KhronosGroup/glslang

Converting sampler2d to texture_depth_2d

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

Description

When working with glslang and webgpu I had a problem when working with depth textures.
On webgl used sampler2D, but for webgpu need to use the texture_deptkh_2d format.

For color textures I change the line:
`uniform sampler2D texture ;`

into these lines:

```
layout(set = 0, binding = 0) uniform sampler sampler ;
layout(set = 0, binding = 1) uniform texture2D texture2d ;
#define texture samplerCube(texture2d, sampler )
```

I tried using sampler2DShadow and it didn't do anything

Is there some way in glslang that the texture is used as a depth texture?

Contributor guide

Open the contributing guide

Research direction

Start by investigating how glslang represents depth textures and how its WebGPU/SPIR-V path handles sampler2DShadow and texture_depth_2d. The issue does not name files, tests, or entry points, so first locate the relevant sampler and texture-type handling. Done would mean documenting or implementing a supported way to use depth textures and verifying the generated output.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.