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

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

Issue 13613006: Add a new parameter dest_type to the GL_CHROMIUM_copy_texture extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 GLsizei width, 903 GLsizei width,
904 GLsizei height, 904 GLsizei height,
905 GLuint io_surface_id, 905 GLuint io_surface_id,
906 GLuint plane); 906 GLuint plane);
907 907
908 void DoCopyTextureCHROMIUM( 908 void DoCopyTextureCHROMIUM(
909 GLenum target, 909 GLenum target,
910 GLuint source_id, 910 GLuint source_id,
911 GLuint target_id, 911 GLuint target_id,
912 GLint level, 912 GLint level,
913 GLenum internal_format); 913 GLenum internal_format,
914 GLenum dest_type);
914 915
915 // Wrapper for TexStorage2DEXT. 916 // Wrapper for TexStorage2DEXT.
916 void DoTexStorage2DEXT( 917 void DoTexStorage2DEXT(
917 GLenum target, 918 GLenum target,
918 GLint levels, 919 GLint levels,
919 GLenum internal_format, 920 GLenum internal_format,
920 GLsizei width, 921 GLsizei width,
921 GLsizei height); 922 GLsizei height);
922 923
923 void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key); 924 void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key);
(...skipping 8822 matching lines...) Expand 10 before | Expand all | Expand 10 after
9746 return GL_LUMINANCE_ALPHA; 9747 return GL_LUMINANCE_ALPHA;
9747 case GL_BGRA8_EXT: 9748 case GL_BGRA8_EXT:
9748 return GL_BGRA_EXT; 9749 return GL_BGRA_EXT;
9749 default: 9750 default:
9750 return GL_NONE; 9751 return GL_NONE;
9751 } 9752 }
9752 } 9753 }
9753 9754
9754 void GLES2DecoderImpl::DoCopyTextureCHROMIUM( 9755 void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
9755 GLenum target, GLuint source_id, GLuint dest_id, GLint level, 9756 GLenum target, GLuint source_id, GLuint dest_id, GLint level,
9756 GLenum internal_format) { 9757 GLenum internal_format, GLenum dest_type) {
9757 Texture* dest_texture = GetTexture(dest_id); 9758 Texture* dest_texture = GetTexture(dest_id);
9758 Texture* source_texture = GetTexture(source_id); 9759 Texture* source_texture = GetTexture(source_id);
9759 9760
9760 if (!source_texture || !dest_texture) { 9761 if (!source_texture || !dest_texture) {
9761 LOCAL_SET_GL_ERROR( 9762 LOCAL_SET_GL_ERROR(
9762 GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "unknown texture id"); 9763 GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "unknown texture id");
9763 return; 9764 return;
9764 } 9765 }
9765 9766
9766 if (GL_TEXTURE_2D != target) { 9767 if (GL_TEXTURE_2D != target) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
9812 // needed because it takes 10s of milliseconds to initialize. 9813 // needed because it takes 10s of milliseconds to initialize.
9813 if (!copy_texture_CHROMIUM_.get()) { 9814 if (!copy_texture_CHROMIUM_.get()) {
9814 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); 9815 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM");
9815 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); 9816 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager());
9816 copy_texture_CHROMIUM_->Initialize(this); 9817 copy_texture_CHROMIUM_->Initialize(this);
9817 RestoreCurrentFramebufferBindings(); 9818 RestoreCurrentFramebufferBindings();
9818 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR) 9819 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR)
9819 return; 9820 return;
9820 } 9821 }
9821 9822
9822 GLenum dest_type; 9823 GLenum dest_type_previous;
9823 GLenum dest_internal_format; 9824 GLenum dest_internal_format;
9824 bool dest_level_defined = dest_texture->GetLevelSize( 9825 bool dest_level_defined = dest_texture->GetLevelSize(
9825 GL_TEXTURE_2D, level, &dest_width, &dest_height); 9826 GL_TEXTURE_2D, level, &dest_width, &dest_height);
9826 9827
9827 if (dest_level_defined) { 9828 if (dest_level_defined) {
9828 dest_texture->GetLevelType(GL_TEXTURE_2D, level, &dest_type, 9829 dest_texture->GetLevelType(GL_TEXTURE_2D, level, &dest_type_previous,
9829 &dest_internal_format); 9830 &dest_internal_format);
9830 } else {
9831 GLenum source_internal_format;
9832 source_texture->GetLevelType(GL_TEXTURE_2D, 0, &dest_type,
9833 &source_internal_format);
9834 } 9831 }
9835 9832
9836 // Set source texture's width and height to be the same as 9833 // Set source texture's width and height to be the same as
9837 // destination texture when source is GL_TEXTURE_EXTERNAL_OES. 9834 // destination texture when source is GL_TEXTURE_EXTERNAL_OES.
9838 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { 9835 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) {
9839 source_width = dest_width; 9836 source_width = dest_width;
9840 source_height = dest_height; 9837 source_height = dest_height;
9841 } 9838 }
9842 9839
9843 // Resize the destination texture to the dimensions of the source texture. 9840 // Resize the destination texture to the dimensions of the source texture.
9844 if (!dest_level_defined || dest_width != source_width || 9841 if (!dest_level_defined || dest_width != source_width ||
9845 dest_height != source_height || 9842 dest_height != source_height ||
9846 dest_internal_format != internal_format) { 9843 dest_internal_format != internal_format ||
9844 dest_type_previous != dest_type) {
9847 // Ensure that the glTexImage2D succeeds. 9845 // Ensure that the glTexImage2D succeeds.
9848 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); 9846 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM");
9849 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); 9847 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id());
9850 WrappedTexImage2D( 9848 WrappedTexImage2D(
9851 GL_TEXTURE_2D, level, internal_format, source_width, source_height, 9849 GL_TEXTURE_2D, level, internal_format, source_width, source_height,
9852 0, internal_format, dest_type, NULL); 9850 0, internal_format, dest_type, NULL);
9853 GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM"); 9851 GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM");
9854 if (error != GL_NO_ERROR) { 9852 if (error != GL_NO_ERROR) {
9855 RestoreCurrentTexture2DBindings(); 9853 RestoreCurrentTexture2DBindings();
9856 return; 9854 return;
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
10508 return error::kNoError; 10506 return error::kNoError;
10509 } 10507 }
10510 10508
10511 // Include the auto-generated part of this file. We split this because it means 10509 // Include the auto-generated part of this file. We split this because it means
10512 // we can easily edit the non-auto generated parts right here in this file 10510 // we can easily edit the non-auto generated parts right here in this file
10513 // instead of having to edit some template or the code generator. 10511 // instead of having to edit some template or the code generator.
10514 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10512 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10515 10513
10516 } // namespace gles2 10514 } // namespace gles2
10517 } // namespace gpu 10515 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698