Chromium Code Reviews| 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 35f446c720f89f2752691a06f5e8eb770fafe581..14b025af72327f9fc7773a2af20418e563658cf9 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -899,6 +899,10 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
| // or regular back buffer). |
| gfx::Size GetBoundReadFrameBufferSize(); |
| + // Get the service side ID for the bound read frame buffer. |
| + // If it's back buffer, 0 is returned. |
| + GLuint GetBoundReadFrameBufferServiceId(); |
| + |
| // Get the format/type of the currently bound frame buffer (either FBO or |
| // regular back buffer). |
| // If the color image is a renderbuffer, returns 0 for type. |
| @@ -4314,6 +4318,21 @@ gfx::Size GLES2DecoderImpl::GetBoundReadFrameBufferSize() { |
| } |
| } |
| +GLuint GLES2DecoderImpl::GetBoundReadFrameBufferServiceId() { |
| + Framebuffer* framebuffer = |
| + GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT); |
| + if (framebuffer) { |
| + return framebuffer->service_id(); |
| + } |
| + if (offscreen_resolved_frame_buffer_.get()) { |
| + return offscreen_resolved_frame_buffer_->id(); |
| + } |
| + if (offscreen_target_frame_buffer_.get()) { |
| + return offscreen_target_frame_buffer_->id(); |
| + } |
| + return 0; |
|
piman
2016/08/17 20:30:45
You need return surface_.get() ? surface_->GetBack
|
| +} |
| + |
| GLenum GLES2DecoderImpl::GetBoundReadFrameBufferTextureType() { |
| Framebuffer* framebuffer = |
| GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT); |
| @@ -13023,12 +13042,11 @@ void GLES2DecoderImpl::DoCopyTexImage2D( |
| GLint destX = dx; |
| GLint destY = dy; |
| if (requires_luma_blit) { |
| - copy_tex_image_blit_->DoCopyTexSubImage2DToLUMAComatabilityTexture( |
| + copy_tex_image_blit_->DoCopyTexSubImage2DToLUMACompatabilityTexture( |
| this, texture->service_id(), texture->target(), target, format, |
| type, level, destX, destY, copyX, copyY, copyWidth, copyHeight, |
| - framebuffer_state_.bound_read_framebuffer->service_id(), |
| - framebuffer_state_.bound_read_framebuffer |
| - ->GetReadBufferInternalFormat()); |
| + GetBoundReadFrameBufferServiceId(), |
| + GetBoundReadFrameBufferInternalFormat()); |
| } else { |
| glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, |
| copyWidth, copyHeight); |
| @@ -13046,12 +13064,11 @@ void GLES2DecoderImpl::DoCopyTexImage2D( |
| final_internal_format, channels_exist, &source_texture_service_id, |
| &source_texture_target); |
| if (requires_luma_blit) { |
| - copy_tex_image_blit_->DoCopyTexImage2DToLUMAComatabilityTexture( |
| + copy_tex_image_blit_->DoCopyTexImage2DToLUMACompatabilityTexture( |
| this, texture->service_id(), texture->target(), target, format, |
| type, level, internal_format, copyX, copyY, copyWidth, copyHeight, |
| - framebuffer_state_.bound_read_framebuffer->service_id(), |
| - framebuffer_state_.bound_read_framebuffer |
| - ->GetReadBufferInternalFormat()); |
| + GetBoundReadFrameBufferServiceId(), |
| + GetBoundReadFrameBufferInternalFormat()); |
| } else if (use_workaround) { |
| GLenum dest_texture_target = target; |
| GLenum framebuffer_target = features().chromium_framebuffer_multisample |
| @@ -13199,12 +13216,11 @@ void GLES2DecoderImpl::DoCopyTexSubImage2D( |
| if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { |
| return; |
| } |
| - copy_tex_image_blit_->DoCopyTexSubImage2DToLUMAComatabilityTexture( |
| + copy_tex_image_blit_->DoCopyTexSubImage2DToLUMACompatabilityTexture( |
| this, texture->service_id(), texture->target(), target, |
| internal_format, type, level, xoffset, yoffset, x, y, width, height, |
| - framebuffer_state_.bound_read_framebuffer->service_id(), |
| - framebuffer_state_.bound_read_framebuffer |
| - ->GetReadBufferInternalFormat()); |
| + GetBoundReadFrameBufferServiceId(), |
| + GetBoundReadFrameBufferInternalFormat()); |
| } else { |
| glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, |
| copyHeight); |