KhronosGroup / KhronosGroup/OpenGL-API
GLES How to read the depth of GL_DEPTH24_STENCIL8 in compute shader.
- Dominant language
- No language data
- Stars
- 42
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
I want to copy GL_DEPTH24_STENCIL8 to GL_R32F with compute shader. here is my gles code:
#version 310 es
precision highp float;
layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
uniform sampler2D depthTexSrc;
layout (binding = 1, r32f) writeonly uniform highp image2D depthTexDst;
void main()
{
ivec2 pos = ivec2(gl_GlobalInvocationID.xy);
float depth = texelFetch(depthTexSrc, pos, 0).r;
imageStore(depthTexDst, pos, vec4(depth, 0.0, 0.0, 1.0));
}
but it mistach when i use glReadPixels to get the data from depthTexSrc and depthTexDst, like in depthTexSrc, the data are:
(0.972549) (0.172549) (0.4) (0.717647) (0.0470588)
but in depthTexDst, the data are:
(0.983917) (0.984912) (0.98493) (0.985012) (0.984376)
Does anyone know why this happen, and how to copy GL_DEPTH24_STENCIL8 to GL_R32F?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the supplied GLES compute-shader snippet and compare the GL_DEPTH24_STENCIL8 and GL_R32F paths around texelFetch, imageStore, and glReadPixels. Reproduce the listed source and destination values, then establish the correct way to copy the depth data, with matching readback values demonstrating that the issue is resolved.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100