Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2831733003: Fix blits from multisampled renderbuffers to alpha:false WebGL back buffer. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 void EnsureTextureForClientId(GLenum target, GLuint client_id); 1034 void EnsureTextureForClientId(GLenum target, GLuint client_id);
1035 void DoConsumeTextureCHROMIUM(GLenum target, const volatile GLbyte* key); 1035 void DoConsumeTextureCHROMIUM(GLenum target, const volatile GLbyte* key);
1036 void DoCreateAndConsumeTextureINTERNAL(GLenum target, 1036 void DoCreateAndConsumeTextureINTERNAL(GLenum target,
1037 GLuint client_id, 1037 GLuint client_id,
1038 const volatile GLbyte* key); 1038 const volatile GLbyte* key);
1039 void DoApplyScreenSpaceAntialiasingCHROMIUM(); 1039 void DoApplyScreenSpaceAntialiasingCHROMIUM();
1040 1040
1041 void DoBindTexImage2DCHROMIUM( 1041 void DoBindTexImage2DCHROMIUM(
1042 GLenum target, 1042 GLenum target,
1043 GLint image_id); 1043 GLint image_id);
1044 void DoBindTexImage2DWithInternalformatCHROMIUM(GLenum target,
1045 GLenum internalformat,
1046 GLint image_id);
1047 // Common implementation of DoBindTexImage2DCHROMIUM entry points.
1048 void BindTexImage2DCHROMIUMImpl(const char* function_name,
1049 GLenum target,
1050 GLenum internalformat,
1051 GLint image_id);
1044 void DoReleaseTexImage2DCHROMIUM( 1052 void DoReleaseTexImage2DCHROMIUM(
1045 GLenum target, 1053 GLenum target,
1046 GLint image_id); 1054 GLint image_id);
1047 1055
1048 void DoTraceEndCHROMIUM(void); 1056 void DoTraceEndCHROMIUM(void);
1049 1057
1050 void DoDrawBuffersEXT(GLsizei count, const volatile GLenum* bufs); 1058 void DoDrawBuffersEXT(GLsizei count, const volatile GLenum* bufs);
1051 1059
1052 void DoLoseContextCHROMIUM(GLenum current, GLenum other); 1060 void DoLoseContextCHROMIUM(GLenum current, GLenum other);
1053 1061
(...skipping 16675 matching lines...) Expand 10 before | Expand all | Expand 10 after
17729 GLsizei /*length*/, const GLchar* /*marker*/) { 17737 GLsizei /*length*/, const GLchar* /*marker*/) {
17730 } 17738 }
17731 17739
17732 void GLES2DecoderImpl::DoPopGroupMarkerEXT(void) { 17740 void GLES2DecoderImpl::DoPopGroupMarkerEXT(void) {
17733 } 17741 }
17734 17742
17735 void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM( 17743 void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM(
17736 GLenum target, GLint image_id) { 17744 GLenum target, GLint image_id) {
17737 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM"); 17745 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM");
17738 17746
17747 BindTexImage2DCHROMIUMImpl("glBindTexImage2DCHROMIUM", target, 0, image_id);
17748 }
17749
17750 void GLES2DecoderImpl::DoBindTexImage2DWithInternalformatCHROMIUM(
17751 GLenum target,
17752 GLenum internalformat,
17753 GLint image_id) {
17754 TRACE_EVENT0("gpu",
17755 "GLES2DecoderImpl::DoBindTexImage2DWithInternalformatCHROMIUM");
17756
17757 BindTexImage2DCHROMIUMImpl("glBindTexImage2DWithInternalformatCHROMIUM",
17758 target, internalformat, image_id);
17759 }
17760
17761 void GLES2DecoderImpl::BindTexImage2DCHROMIUMImpl(const char* function_name,
17762 GLenum target,
17763 GLenum internalformat,
17764 GLint image_id) {
17739 if (target == GL_TEXTURE_CUBE_MAP) { 17765 if (target == GL_TEXTURE_CUBE_MAP) {
17740 LOCAL_SET_GL_ERROR( 17766 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, function_name, "invalid target");
17741 GL_INVALID_ENUM,
17742 "glBindTexImage2DCHROMIUM", "invalid target");
17743 return; 17767 return;
17744 } 17768 }
17745 17769
17746 // Default target might be conceptually valid, but disallow it to avoid 17770 // Default target might be conceptually valid, but disallow it to avoid
17747 // accidents. 17771 // accidents.
17748 TextureRef* texture_ref = 17772 TextureRef* texture_ref =
17749 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); 17773 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target);
17750 if (!texture_ref) { 17774 if (!texture_ref) {
17751 LOCAL_SET_GL_ERROR( 17775 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "no texture bound");
17752 GL_INVALID_OPERATION,
17753 "glBindTexImage2DCHROMIUM", "no texture bound");
17754 return; 17776 return;
17755 } 17777 }
17756 17778
17757 gl::GLImage* image = image_manager()->LookupImage(image_id); 17779 gl::GLImage* image = image_manager()->LookupImage(image_id);
17758 if (!image) { 17780 if (!image) {
17759 LOCAL_SET_GL_ERROR( 17781 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name,
17760 GL_INVALID_OPERATION, 17782 "no image found with the given ID");
17761 "glBindTexImage2DCHROMIUM", "no image found with the given ID");
17762 return; 17783 return;
17763 } 17784 }
17764 17785
17765 Texture::ImageState image_state = Texture::UNBOUND; 17786 Texture::ImageState image_state = Texture::UNBOUND;
17766 17787
17767 { 17788 {
17768 ScopedGLErrorSuppressor suppressor( 17789 ScopedGLErrorSuppressor suppressor(
17769 "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM", GetErrorState()); 17790 "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM", GetErrorState());
17770 17791
17771 // Note: We fallback to using CopyTexImage() before the texture is used 17792 // Note: We fallback to using CopyTexImage() before the texture is used
17772 // when BindTexImage() fails. 17793 // when BindTexImage() fails.
17773 if (image->BindTexImage(target)) 17794 if (internalformat) {
17774 image_state = Texture::BOUND; 17795 if (image->BindTexImageWithInternalformat(target, internalformat))
17796 image_state = Texture::BOUND;
17797 } else {
17798 if (image->BindTexImage(target))
17799 image_state = Texture::BOUND;
17800 }
17775 } 17801 }
17776 17802
17777 gfx::Size size = image->GetSize(); 17803 gfx::Size size = image->GetSize();
17778 GLenum internalformat = image->GetInternalFormat(); 17804 GLenum texture_internalformat =
17779 texture_manager()->SetLevelInfo( 17805 internalformat ? internalformat : image->GetInternalFormat();
17780 texture_ref, target, 0, internalformat, size.width(), size.height(), 1, 0, 17806 texture_manager()->SetLevelInfo(texture_ref, target, 0,
17781 internalformat, GL_UNSIGNED_BYTE, gfx::Rect(size)); 17807 texture_internalformat, size.width(),
17808 size.height(), 1, 0, texture_internalformat,
17809 GL_UNSIGNED_BYTE, gfx::Rect(size));
17782 texture_manager()->SetLevelImage(texture_ref, target, 0, image, image_state); 17810 texture_manager()->SetLevelImage(texture_ref, target, 0, image, image_state);
17783 } 17811 }
17784 17812
17785 void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM( 17813 void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM(
17786 GLenum target, GLint image_id) { 17814 GLenum target, GLint image_id) {
17787 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM"); 17815 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM");
17788 17816
17789 // Default target might be conceptually valid, but disallow it to avoid 17817 // Default target might be conceptually valid, but disallow it to avoid
17790 // accidents. 17818 // accidents.
17791 TextureRef* texture_ref = 17819 TextureRef* texture_ref =
(...skipping 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after
19577 } 19605 }
19578 19606
19579 // Include the auto-generated part of this file. We split this because it means 19607 // Include the auto-generated part of this file. We split this because it means
19580 // we can easily edit the non-auto generated parts right here in this file 19608 // we can easily edit the non-auto generated parts right here in this file
19581 // instead of having to edit some template or the code generator. 19609 // instead of having to edit some template or the code generator.
19582 #include "base/macros.h" 19610 #include "base/macros.h"
19583 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19611 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19584 19612
19585 } // namespace gles2 19613 } // namespace gles2
19586 } // namespace gpu 19614 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698