Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index c8ffe3aefc86438c5095093c8539a25325b3e31b..774eb0b388be8c29e0bd4c404e1c835de83f63c1 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -6445,9 +6445,16 @@ void GLES2DecoderImpl::DoFramebufferTexture2DCommon( |
void GLES2DecoderImpl::DoFramebufferTextureLayer( |
GLenum target, GLenum attachment, GLuint client_texture_id, |
GLint level, GLint layer) { |
- // TODO(zmo): Unsafe ES3 API, missing states update. |
+ // TODO(zmo): Add full validation. |
GLuint service_id = 0; |
TextureRef* texture_ref = NULL; |
+ Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); |
+ if (!framebuffer) { |
+ LOCAL_SET_GL_ERROR( |
+ GL_INVALID_OPERATION, |
+ "glFramebufferTextureLayer", "no framebuffer bound."); |
+ return; |
+ } |
if (client_texture_id) { |
texture_ref = GetTexture(client_texture_id); |
if (!texture_ref) { |
@@ -6458,7 +6465,14 @@ void GLES2DecoderImpl::DoFramebufferTextureLayer( |
} |
service_id = texture_ref->service_id(); |
} |
+ LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glFramebufferTextureLayer"); |
glFramebufferTextureLayer(target, attachment, service_id, level, layer); |
+ GLenum error = LOCAL_PEEK_GL_ERROR("glFramebufferTextureLayer"); |
+ if (error == GL_NO_ERROR) { |
+ framebuffer->AttachTextureLayer(attachment, texture_ref, |
+ texture_ref ? texture_ref->texture()->target() : 0, |
+ level, layer); |
+ } |
} |
void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( |