| 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 534c5ee536b50860d0f76e71e1fb79727ed5716d..b78e7345e87f68092bbfef0aa6ef1ae7ec4cd590 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| @@ -407,7 +407,10 @@ class BackRenderbuffer {
|
| void Create();
|
|
|
| // Set the initial size and format of a render buffer or resize it.
|
| - bool AllocateStorage(const gfx::Size& size, GLenum format, GLsizei samples);
|
| + bool AllocateStorage(GLES2DecoderImpl* decoder,
|
| + const gfx::Size& size,
|
| + GLenum format,
|
| + GLsizei samples);
|
|
|
| // Destroy the render buffer. This must be explicitly called before destroying
|
| // this object.
|
| @@ -642,6 +645,23 @@ class GLES2DecoderImpl : public GLES2Decoder,
|
| virtual void OnTextureRefDetachedFromFramebuffer(
|
| TextureRef* texture) OVERRIDE;
|
|
|
| + // Helpers to facilitate calling into compatible extensions.
|
| + void RenderbufferStorageMultisampleHelper(GLenum target,
|
| + GLsizei samples,
|
| + GLenum internal_format,
|
| + GLsizei width,
|
| + GLsizei height);
|
| + void BlitFramebufferHelper(GLint srcX0,
|
| + GLint srcY0,
|
| + GLint srcX1,
|
| + GLint srcY1,
|
| + GLint dstX0,
|
| + GLint dstY0,
|
| + GLint dstX1,
|
| + GLint dstY1,
|
| + GLbitfield mask,
|
| + GLenum filter);
|
| +
|
| private:
|
| friend class ScopedFrameBufferBinder;
|
| friend class ScopedResolvedFrameBufferBinder;
|
| @@ -1817,13 +1837,16 @@ ScopedResolvedFrameBufferBinder::ScopedResolvedFrameBufferBinder(
|
| const int width = decoder_->offscreen_size_.width();
|
| const int height = decoder_->offscreen_size_.height();
|
| glDisable(GL_SCISSOR_TEST);
|
| - if (GLES2Decoder::IsAngle()) {
|
| - glBlitFramebufferANGLE(0, 0, width, height, 0, 0, width, height,
|
| - GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
| - } else {
|
| - glBlitFramebufferEXT(0, 0, width, height, 0, 0, width, height,
|
| - GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
| - }
|
| + decoder->BlitFramebufferHelper(0,
|
| + 0,
|
| + width,
|
| + height,
|
| + 0,
|
| + 0,
|
| + width,
|
| + height,
|
| + GL_COLOR_BUFFER_BIT,
|
| + GL_NEAREST);
|
| glBindFramebufferEXT(GL_FRAMEBUFFER, targetid);
|
| }
|
|
|
| @@ -1975,7 +1998,9 @@ void BackRenderbuffer::Create() {
|
| glGenRenderbuffersEXT(1, &id_);
|
| }
|
|
|
| -bool BackRenderbuffer::AllocateStorage(const gfx::Size& size, GLenum format,
|
| +bool BackRenderbuffer::AllocateStorage(GLES2DecoderImpl* decoder,
|
| + const gfx::Size& size,
|
| + GLenum format,
|
| GLsizei samples) {
|
| ScopedGLErrorSuppressor suppressor(
|
| "BackRenderbuffer::AllocateStorage", state_->GetErrorState());
|
| @@ -1997,19 +2022,8 @@ bool BackRenderbuffer::AllocateStorage(const gfx::Size& size, GLenum format,
|
| size.width(),
|
| size.height());
|
| } else {
|
| - if (GLES2Decoder::IsAngle()) {
|
| - glRenderbufferStorageMultisampleANGLE(GL_RENDERBUFFER,
|
| - samples,
|
| - format,
|
| - size.width(),
|
| - size.height());
|
| - } else {
|
| - glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER,
|
| - samples,
|
| - format,
|
| - size.width(),
|
| - size.height());
|
| - }
|
| + decoder->RenderbufferStorageMultisampleHelper(
|
| + GL_RENDERBUFFER, samples, format, size.width(), size.height());
|
| }
|
| bool success = glGetError() == GL_NO_ERROR;
|
| if (success) {
|
| @@ -2310,7 +2324,7 @@ bool GLES2DecoderImpl::Initialize(
|
| // ANGLE only supports packed depth/stencil formats, so use it if it is
|
| // available.
|
| const bool depth24_stencil8_supported =
|
| - context_->HasExtension("GL_OES_packed_depth_stencil");
|
| + feature_info_->feature_flags().packed_depth24_stencil8;
|
| VLOG(1) << "GL_OES_packed_depth_stencil "
|
| << (depth24_stencil8_supported ? "" : "not ") << "supported.";
|
| if ((attrib_parser.depth_size_ > 0 || attrib_parser.stencil_size_ > 0) &&
|
| @@ -2333,7 +2347,7 @@ bool GLES2DecoderImpl::Initialize(
|
| // it's available, as some desktop GL drivers don't support any non-packed
|
| // formats for depth attachments.
|
| const bool depth24_stencil8_supported =
|
| - context_->HasExtension("GL_EXT_packed_depth_stencil");
|
| + feature_info_->feature_flags().packed_depth24_stencil8;
|
| VLOG(1) << "GL_EXT_packed_depth_stencil "
|
| << (depth24_stencil8_supported ? "" : "not ") << "supported.";
|
|
|
| @@ -3328,7 +3342,7 @@ bool GLES2DecoderImpl::ResizeOffscreenFrameBuffer(const gfx::Size& size) {
|
| DCHECK(offscreen_target_color_format_);
|
| if (IsOffscreenBufferMultisampled()) {
|
| if (!offscreen_target_color_render_buffer_->AllocateStorage(
|
| - offscreen_size_, offscreen_target_color_format_,
|
| + this, offscreen_size_, offscreen_target_color_format_,
|
| offscreen_target_samples_)) {
|
| LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
|
| << "to allocate storage for offscreen target color buffer.";
|
| @@ -3344,7 +3358,7 @@ bool GLES2DecoderImpl::ResizeOffscreenFrameBuffer(const gfx::Size& size) {
|
| }
|
| if (offscreen_target_depth_format_ &&
|
| !offscreen_target_depth_render_buffer_->AllocateStorage(
|
| - offscreen_size_, offscreen_target_depth_format_,
|
| + this, offscreen_size_, offscreen_target_depth_format_,
|
| offscreen_target_samples_)) {
|
| LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
|
| << "to allocate storage for offscreen target depth buffer.";
|
| @@ -3352,7 +3366,7 @@ bool GLES2DecoderImpl::ResizeOffscreenFrameBuffer(const gfx::Size& size) {
|
| }
|
| if (offscreen_target_stencil_format_ &&
|
| !offscreen_target_stencil_render_buffer_->AllocateStorage(
|
| - offscreen_size_, offscreen_target_stencil_format_,
|
| + this, offscreen_size_, offscreen_target_stencil_format_,
|
| offscreen_target_samples_)) {
|
| LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
|
| << "to allocate storage for offscreen target stencil buffer.";
|
| @@ -5004,14 +5018,53 @@ void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM(
|
| }
|
|
|
| glDisable(GL_SCISSOR_TEST);
|
| + BlitFramebufferHelper(
|
| + srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
| + EnableDisable(GL_SCISSOR_TEST, state_.enable_flags.scissor_test);
|
| +}
|
| +
|
| +void GLES2DecoderImpl::RenderbufferStorageMultisampleHelper(
|
| + GLenum target,
|
| + GLsizei samples,
|
| + GLenum internal_format,
|
| + GLsizei width,
|
| + GLsizei height) {
|
| + // TODO(sievers): This could be resolved at the GL binding level, but the
|
| + // binding process is currently a bit too 'brute force'.
|
| + if (IsAngle()) {
|
| + glRenderbufferStorageMultisampleANGLE(
|
| + target, samples, internal_format, width, height);
|
| + } else if (feature_info_->feature_flags().core_framebuffer_multisample) {
|
| + glRenderbufferStorageMultisample(
|
| + target, samples, internal_format, width, height);
|
| + } else {
|
| + glRenderbufferStorageMultisampleEXT(
|
| + target, samples, internal_format, width, height);
|
| + }
|
| +}
|
| +
|
| +void GLES2DecoderImpl::BlitFramebufferHelper(GLint srcX0,
|
| + GLint srcY0,
|
| + GLint srcX1,
|
| + GLint srcY1,
|
| + GLint dstX0,
|
| + GLint dstY0,
|
| + GLint dstX1,
|
| + GLint dstY1,
|
| + GLbitfield mask,
|
| + GLenum filter) {
|
| + // TODO(sievers): This could be resolved at the GL binding level, but the
|
| + // binding process is currently a bit too 'brute force'.
|
| if (IsAngle()) {
|
| glBlitFramebufferANGLE(
|
| srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
| + } else if (feature_info_->feature_flags().core_framebuffer_multisample) {
|
| + glBlitFramebuffer(
|
| + srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
| } else {
|
| glBlitFramebufferEXT(
|
| srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
| }
|
| - EnableDisable(GL_SCISSOR_TEST, state_.enable_flags.scissor_test);
|
| }
|
|
|
| bool GLES2DecoderImpl::ValidateRenderbufferStorageMultisample(
|
| @@ -5081,13 +5134,8 @@ void GLES2DecoderImpl::DoRenderbufferStorageMultisampleCHROMIUM(
|
| internalformat);
|
| LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(
|
| "glRenderbufferStorageMultisampleCHROMIUM");
|
| - if (IsAngle()) {
|
| - glRenderbufferStorageMultisampleANGLE(
|
| - target, samples, impl_format, width, height);
|
| - } else {
|
| - glRenderbufferStorageMultisampleEXT(
|
| - target, samples, impl_format, width, height);
|
| - }
|
| + RenderbufferStorageMultisampleHelper(
|
| + target, samples, impl_format, width, height);
|
| GLenum error =
|
| LOCAL_PEEK_GL_ERROR("glRenderbufferStorageMultisampleCHROMIUM");
|
| if (error == GL_NO_ERROR) {
|
| @@ -5227,7 +5275,8 @@ bool GLES2DecoderImpl::VerifyMultisampleRenderbufferIntegrity(
|
| glBindFramebufferEXT(GL_READ_FRAMEBUFFER, validation_fbo_multisample_);
|
| glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, validation_fbo_);
|
|
|
| - glBlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
| + BlitFramebufferHelper(
|
| + 0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
|
|
| // Read a pixel from the buffer.
|
| glBindFramebufferEXT(GL_FRAMEBUFFER, validation_fbo_);
|
|
|