| 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 03ce04134dc62c31df4633c1137cbb290af7591c..e778bdc8364fae812bb947e4628601f0a507cbbc 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| @@ -6971,11 +6971,11 @@ void GLES2DecoderImpl::DoClearBufferfi(
|
| void GLES2DecoderImpl::DoFramebufferRenderbuffer(
|
| GLenum target, GLenum attachment, GLenum renderbuffertarget,
|
| GLuint client_renderbuffer_id) {
|
| + const char* func_name = "glFramebufferRenderbuffer";
|
| Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
|
| if (!framebuffer) {
|
| LOCAL_SET_GL_ERROR(
|
| - GL_INVALID_OPERATION,
|
| - "glFramebufferRenderbuffer", "no framebuffer bound");
|
| + GL_INVALID_OPERATION, func_name, "no framebuffer bound");
|
| return;
|
| }
|
| GLuint service_id = 0;
|
| @@ -6985,12 +6985,12 @@ void GLES2DecoderImpl::DoFramebufferRenderbuffer(
|
| if (!renderbuffer) {
|
| LOCAL_SET_GL_ERROR(
|
| GL_INVALID_OPERATION,
|
| - "glFramebufferRenderbuffer", "unknown renderbuffer");
|
| + func_name, "unknown renderbuffer");
|
| return;
|
| }
|
| service_id = renderbuffer->service_id();
|
| }
|
| - LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glFramebufferRenderbuffer");
|
| + LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(func_name);
|
| if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
|
| glFramebufferRenderbufferEXT(
|
| target, GL_DEPTH_ATTACHMENT, renderbuffertarget, service_id);
|
| @@ -7000,9 +7000,14 @@ void GLES2DecoderImpl::DoFramebufferRenderbuffer(
|
| glFramebufferRenderbufferEXT(
|
| target, attachment, renderbuffertarget, service_id);
|
| }
|
| - GLenum error = LOCAL_PEEK_GL_ERROR("glFramebufferRenderbuffer");
|
| + GLenum error = LOCAL_PEEK_GL_ERROR(func_name);
|
| if (error == GL_NO_ERROR) {
|
| - framebuffer->AttachRenderbuffer(attachment, renderbuffer);
|
| + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
|
| + framebuffer->AttachRenderbuffer(GL_DEPTH_ATTACHMENT, renderbuffer);
|
| + framebuffer->AttachRenderbuffer(GL_STENCIL_ATTACHMENT, renderbuffer);
|
| + } else {
|
| + framebuffer->AttachRenderbuffer(attachment, renderbuffer);
|
| + }
|
| }
|
| if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) {
|
| framebuffer_state_.clear_state_dirty = true;
|
| @@ -7090,16 +7095,14 @@ void GLES2DecoderImpl::ClearUnclearedAttachments(
|
| }
|
| }
|
|
|
| - if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) ||
|
| - framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
|
| + if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)) {
|
| glClearStencil(0);
|
| state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
|
| state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
|
| clear_bits |= GL_STENCIL_BUFFER_BIT;
|
| }
|
|
|
| - if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) ||
|
| - framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
|
| + if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)) {
|
| glClearDepth(1.0f);
|
| state_.SetDeviceDepthMask(GL_TRUE);
|
| clear_bits |= GL_DEPTH_BUFFER_BIT;
|
| @@ -7244,8 +7247,15 @@ void GLES2DecoderImpl::DoFramebufferTexture2DCommon(
|
| }
|
| GLenum error = LOCAL_PEEK_GL_ERROR(name);
|
| if (error == GL_NO_ERROR) {
|
| - framebuffer->AttachTexture(attachment, texture_ref, textarget, level,
|
| - samples);
|
| + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
|
| + framebuffer->AttachTexture(
|
| + GL_DEPTH_ATTACHMENT, texture_ref, textarget, level, samples);
|
| + framebuffer->AttachTexture(
|
| + GL_STENCIL_ATTACHMENT, texture_ref, textarget, level, samples);
|
| + } else {
|
| + framebuffer->AttachTexture(
|
| + attachment, texture_ref, textarget, level, samples);
|
| + }
|
| }
|
| if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) {
|
| framebuffer_state_.clear_state_dirty = true;
|
| @@ -7294,9 +7304,27 @@ void GLES2DecoderImpl::DoFramebufferTextureLayer(
|
| return;
|
| }
|
| }
|
| - glFramebufferTextureLayer(target, attachment, service_id, level, layer);
|
| - framebuffer->AttachTextureLayer(
|
| - attachment, texture_ref, texture_target, level, layer);
|
| + LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name);
|
| + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
|
| + glFramebufferTextureLayer(
|
| + target, GL_DEPTH_ATTACHMENT, service_id, level, layer);
|
| + glFramebufferTextureLayer(
|
| + target, GL_STENCIL_ATTACHMENT, service_id, level, layer);
|
| + } else {
|
| + glFramebufferTextureLayer(target, attachment, service_id, level, layer);
|
| + }
|
| + GLenum error = LOCAL_PEEK_GL_ERROR(function_name);
|
| + if (error == GL_NO_ERROR) {
|
| + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
|
| + framebuffer->AttachTextureLayer(
|
| + GL_DEPTH_ATTACHMENT, texture_ref, texture_target, level, layer);
|
| + framebuffer->AttachTextureLayer(
|
| + GL_STENCIL_ATTACHMENT, texture_ref, texture_target, level, layer);
|
| + } else {
|
| + framebuffer->AttachTextureLayer(
|
| + attachment, texture_ref, texture_target, level, layer);
|
| + }
|
| + }
|
| if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) {
|
| framebuffer_state_.clear_state_dirty = true;
|
| }
|
|
|