KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
2.91k stars 817 forks source link

Converting sampler2d to texture_depth_2d #3479

Open ragarg opened 6 months ago

ragarg commented 6 months ago

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?