Skip to content

GLES How to read the depth of GL_DEPTH24_STENCIL8 in compute shader. #95

@Koker-chen

Description

@Koker-chen

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions