KhronosGroup / KhronosGroup/OpenGL-API
GLES How to read the depth of GL_DEPTH24_STENCIL8 in compute shader.
- 主要语言
- 没有语言数据
- 星标
- 42
- 派生
- 8
- PR 合并指标
- 30 天内没有已合并 PR
描述
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?
贡献指南
这个仓库没有索引到贡献指南
调研方向
从提供的 GLES 计算着色器代码片段开始,比较 texelFetch、imageStore 和 glReadPixels 周围的 GL_DEPTH24_STENCIL8 与 GL_R32F 路径。重现列出的源值和目标值,然后确定复制深度数据的正确方式,并通过匹配的回读值证明问题已解决。
由索引模型根据 Issue 内容生成。
评估
- 领域
- computer-graphics
- Issue 类型
- 缺陷
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100