Skip to content

Commit

Permalink
gles: Fix reading of cubemap rendertargets
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-clayton committed Nov 28, 2017
1 parent c95f4f8 commit 7b7e818
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions gapis/api/gles/read_texture.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,21 @@ func (t *readTexture) add(ctx context.Context, r *ReadGPUTextureDataResolveable,
return
}

if r.Layer == 0 {
out.MutateAndWrite(ctx, dID, cb.GlFramebufferTexture(GLenum_GL_DRAW_FRAMEBUFFER, attachment, tex.ID, GLint(r.Level)))
} else {
switch tex.Kind {
case GLenum_GL_TEXTURE_3D,
GLenum_GL_IMAGE_CUBE_MAP_ARRAY,
GLenum_GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
GLenum_GL_TEXTURE_2D_ARRAY,
GLenum_GL_TEXTURE_1D_ARRAY:

out.MutateAndWrite(ctx, dID, cb.GlFramebufferTextureLayer(GLenum_GL_DRAW_FRAMEBUFFER, attachment, tex.ID, GLint(r.Level), GLint(r.Layer)))

case GLenum_GL_TEXTURE_CUBE_MAP:
face := GLenum_GL_TEXTURE_CUBE_MAP_POSITIVE_X + GLenum(r.Layer)
out.MutateAndWrite(ctx, dID, cb.GlFramebufferTexture2D(GLenum_GL_DRAW_FRAMEBUFFER, attachment, face, tex.ID, GLint(r.Level)))

default:
out.MutateAndWrite(ctx, dID, cb.GlFramebufferTexture(GLenum_GL_DRAW_FRAMEBUFFER, attachment, tex.ID, GLint(r.Level)))
}

// Compat may have altered the texture format.
Expand Down

0 comments on commit 7b7e818

Please sign in to comment.