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?