| OLD | NEW |
| 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 <cmath> | 10 #include <cmath> |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 bool enforce_internal_framebuffer, | 632 bool enforce_internal_framebuffer, |
| 633 bool internal); | 633 bool internal); |
| 634 ~ScopedResolvedFrameBufferBinder(); | 634 ~ScopedResolvedFrameBufferBinder(); |
| 635 | 635 |
| 636 private: | 636 private: |
| 637 GLES2DecoderImpl* decoder_; | 637 GLES2DecoderImpl* decoder_; |
| 638 bool resolve_and_bind_; | 638 bool resolve_and_bind_; |
| 639 DISALLOW_COPY_AND_ASSIGN(ScopedResolvedFrameBufferBinder); | 639 DISALLOW_COPY_AND_ASSIGN(ScopedResolvedFrameBufferBinder); |
| 640 }; | 640 }; |
| 641 | 641 |
| 642 class ScopedModifyPixels { | |
| 643 public: | |
| 644 explicit ScopedModifyPixels(TextureRef* ref); | |
| 645 ~ScopedModifyPixels(); | |
| 646 | |
| 647 private: | |
| 648 TextureRef* ref_; | |
| 649 }; | |
| 650 | |
| 651 ScopedModifyPixels::ScopedModifyPixels(TextureRef* ref) : ref_(ref) { | |
| 652 if (ref_) | |
| 653 ref_->texture()->OnWillModifyPixels(); | |
| 654 } | |
| 655 | |
| 656 ScopedModifyPixels::~ScopedModifyPixels() { | |
| 657 if (ref_) | |
| 658 ref_->texture()->OnDidModifyPixels(); | |
| 659 } | |
| 660 | |
| 661 class ScopedRenderTo { | |
| 662 public: | |
| 663 explicit ScopedRenderTo(Framebuffer* framebuffer) | |
| 664 : ScopedRenderTo(framebuffer, 0) {} | |
| 665 ScopedRenderTo(Framebuffer* framebuffer, GLenum attachment); | |
| 666 ~ScopedRenderTo(); | |
| 667 | |
| 668 private: | |
| 669 const Framebuffer* framebuffer_; | |
| 670 GLenum attachment_; | |
| 671 }; | |
| 672 | |
| 673 ScopedRenderTo::ScopedRenderTo(Framebuffer* framebuffer, GLenum attachment) | |
| 674 : framebuffer_(framebuffer), | |
| 675 attachment_(attachment) { | |
| 676 if (framebuffer_) | |
| 677 framebuffer_->OnWillRenderTo(attachment_); | |
| 678 } | |
| 679 | |
| 680 ScopedRenderTo::~ScopedRenderTo() { | |
| 681 if (framebuffer_) | |
| 682 framebuffer_->OnDidRenderTo(attachment_); | |
| 683 } | |
| 684 | |
| 685 // Encapsulates an OpenGL texture. | 642 // Encapsulates an OpenGL texture. |
| 686 class BackTexture { | 643 class BackTexture { |
| 687 public: | 644 public: |
| 688 explicit BackTexture(MemoryTracker* memory_tracker, ContextState* state); | 645 explicit BackTexture(MemoryTracker* memory_tracker, ContextState* state); |
| 689 ~BackTexture(); | 646 ~BackTexture(); |
| 690 | 647 |
| 691 // Create a new render texture. | 648 // Create a new render texture. |
| 692 void Create(); | 649 void Create(); |
| 693 | 650 |
| 694 // Set the initial size and format of a render texture or resize it. | 651 // Set the initial size and format of a render texture or resize it. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 | 784 |
| 828 GLES2Decoder::~GLES2Decoder() { | 785 GLES2Decoder::~GLES2Decoder() { |
| 829 } | 786 } |
| 830 | 787 |
| 831 void GLES2Decoder::BeginDecoding() {} | 788 void GLES2Decoder::BeginDecoding() {} |
| 832 | 789 |
| 833 void GLES2Decoder::EndDecoding() {} | 790 void GLES2Decoder::EndDecoding() {} |
| 834 | 791 |
| 835 // This class implements GLES2Decoder so we don't have to expose all the GLES2 | 792 // This class implements GLES2Decoder so we don't have to expose all the GLES2 |
| 836 // cmd stuff to outside this class. | 793 // cmd stuff to outside this class. |
| 837 class GLES2DecoderImpl : public GLES2Decoder, | 794 class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
| 838 public FramebufferManager::TextureDetachObserver, | |
| 839 public ErrorStateClient { | |
| 840 public: | 795 public: |
| 841 explicit GLES2DecoderImpl(ContextGroup* group); | 796 explicit GLES2DecoderImpl(ContextGroup* group); |
| 842 ~GLES2DecoderImpl() override; | 797 ~GLES2DecoderImpl() override; |
| 843 | 798 |
| 844 // Overridden from AsyncAPIInterface. | 799 // Overridden from AsyncAPIInterface. |
| 845 Error DoCommand(unsigned int command, | 800 Error DoCommand(unsigned int command, |
| 846 unsigned int arg_count, | 801 unsigned int arg_count, |
| 847 const void* args) override; | 802 const void* args) override; |
| 848 | 803 |
| 849 error::Error DoCommands(unsigned int num_commands, | 804 error::Error DoCommands(unsigned int num_commands, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 | 913 |
| 959 // These check the state of the currently bound framebuffer or the | 914 // These check the state of the currently bound framebuffer or the |
| 960 // backbuffer if no framebuffer is bound. | 915 // backbuffer if no framebuffer is bound. |
| 961 // Check with all attached and enabled color attachments. | 916 // Check with all attached and enabled color attachments. |
| 962 bool BoundFramebufferHasColorAttachmentWithAlpha(); | 917 bool BoundFramebufferHasColorAttachmentWithAlpha(); |
| 963 bool BoundFramebufferHasDepthAttachment(); | 918 bool BoundFramebufferHasDepthAttachment(); |
| 964 bool BoundFramebufferHasStencilAttachment(); | 919 bool BoundFramebufferHasStencilAttachment(); |
| 965 | 920 |
| 966 error::ContextLostReason GetContextLostReason() override; | 921 error::ContextLostReason GetContextLostReason() override; |
| 967 | 922 |
| 968 // Overridden from FramebufferManager::TextureDetachObserver: | |
| 969 void OnTextureRefDetachedFromFramebuffer(TextureRef* texture) override; | |
| 970 | |
| 971 // Overriden from ErrorStateClient. | 923 // Overriden from ErrorStateClient. |
| 972 void OnContextLostError() override; | 924 void OnContextLostError() override; |
| 973 void OnOutOfMemoryError() override; | 925 void OnOutOfMemoryError() override; |
| 974 | 926 |
| 975 // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound. | 927 // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound. |
| 976 void EnsureRenderbufferBound(); | 928 void EnsureRenderbufferBound(); |
| 977 | 929 |
| 978 // Helpers to facilitate calling into compatible extensions. | 930 // Helpers to facilitate calling into compatible extensions. |
| 979 static void RenderbufferStorageMultisampleHelper( | 931 static void RenderbufferStorageMultisampleHelper( |
| 980 const FeatureInfo* feature_info, | 932 const FeatureInfo* feature_info, |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1959 bool IsDrawValid( | 1911 bool IsDrawValid( |
| 1960 const char* function_name, GLuint max_vertex_accessed, bool instanced, | 1912 const char* function_name, GLuint max_vertex_accessed, bool instanced, |
| 1961 GLsizei primcount); | 1913 GLsizei primcount); |
| 1962 | 1914 |
| 1963 // Returns true if successful, simulated will be true if attrib0 was | 1915 // Returns true if successful, simulated will be true if attrib0 was |
| 1964 // simulated. | 1916 // simulated. |
| 1965 bool SimulateAttrib0( | 1917 bool SimulateAttrib0( |
| 1966 const char* function_name, GLuint max_vertex_accessed, bool* simulated); | 1918 const char* function_name, GLuint max_vertex_accessed, bool* simulated); |
| 1967 void RestoreStateForAttrib(GLuint attrib, bool restore_array_binding); | 1919 void RestoreStateForAttrib(GLuint attrib, bool restore_array_binding); |
| 1968 | 1920 |
| 1969 // If an image is bound to texture, this will call Will/DidUseTexImage | 1921 // Copies the image to the texture currently bound to |textarget|. The image |
| 1970 // if needed. | 1922 // state of |texture| is updated to reflect the new state. |
| 1971 void DoWillUseTexImageIfNeeded(Texture* texture, GLenum textarget); | 1923 void DoCopyTexImage(Texture* texture, GLenum textarget, gfx::GLImage* image); |
| 1972 void DoDidUseTexImageIfNeeded(Texture* texture, GLenum textarget); | 1924 |
| 1925 // This will call DoCopyTexImage if texture has an image but that image is |
| 1926 // not bound or copied to the texture. |
| 1927 void DoCopyTexImageIfNeeded(Texture* texture, GLenum textarget); |
| 1973 | 1928 |
| 1974 // Returns false if textures were replaced. | 1929 // Returns false if textures were replaced. |
| 1975 bool PrepareTexturesForRender(); | 1930 bool PrepareTexturesForRender(); |
| 1976 void RestoreStateForTextures(); | 1931 void RestoreStateForTextures(); |
| 1977 | 1932 |
| 1978 // Returns true if GL_FIXED attribs were simulated. | 1933 // Returns true if GL_FIXED attribs were simulated. |
| 1979 bool SimulateFixedAttribs( | 1934 bool SimulateFixedAttribs( |
| 1980 const char* function_name, | 1935 const char* function_name, |
| 1981 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount); | 1936 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount); |
| 1982 void RestoreStateForSimulatedFixedAttribs(); | 1937 void RestoreStateForSimulatedFixedAttribs(); |
| (...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3282 } | 3237 } |
| 3283 | 3238 |
| 3284 if (workarounds().gl_clear_broken) { | 3239 if (workarounds().gl_clear_broken) { |
| 3285 DCHECK(!clear_framebuffer_blit_.get()); | 3240 DCHECK(!clear_framebuffer_blit_.get()); |
| 3286 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glClearWorkaroundInit"); | 3241 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glClearWorkaroundInit"); |
| 3287 clear_framebuffer_blit_.reset(new ClearFramebufferResourceManager(this)); | 3242 clear_framebuffer_blit_.reset(new ClearFramebufferResourceManager(this)); |
| 3288 if (LOCAL_PEEK_GL_ERROR("glClearWorkaroundInit") != GL_NO_ERROR) | 3243 if (LOCAL_PEEK_GL_ERROR("glClearWorkaroundInit") != GL_NO_ERROR) |
| 3289 return false; | 3244 return false; |
| 3290 } | 3245 } |
| 3291 | 3246 |
| 3292 framebuffer_manager()->AddObserver(this); | |
| 3293 | |
| 3294 return true; | 3247 return true; |
| 3295 } | 3248 } |
| 3296 | 3249 |
| 3297 Capabilities GLES2DecoderImpl::GetCapabilities() { | 3250 Capabilities GLES2DecoderImpl::GetCapabilities() { |
| 3298 DCHECK(initialized()); | 3251 DCHECK(initialized()); |
| 3299 Capabilities caps; | 3252 Capabilities caps; |
| 3300 caps.VisitPrecisions([](GLenum shader, GLenum type, | 3253 caps.VisitPrecisions([](GLenum shader, GLenum type, |
| 3301 Capabilities::ShaderPrecision* shader_precision) { | 3254 Capabilities::ShaderPrecision* shader_precision) { |
| 3302 GLint range[2] = {0, 0}; | 3255 GLint range[2] = {0, 0}; |
| 3303 GLint precision = 0; | 3256 GLint precision = 0; |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4370 fragment_translator_ = NULL; | 4323 fragment_translator_ = NULL; |
| 4371 vertex_translator_ = NULL; | 4324 vertex_translator_ = NULL; |
| 4372 | 4325 |
| 4373 // Destroy the GPU Tracer which may own some in process GPU Timings. | 4326 // Destroy the GPU Tracer which may own some in process GPU Timings. |
| 4374 if (gpu_tracer_) { | 4327 if (gpu_tracer_) { |
| 4375 gpu_tracer_->Destroy(have_context); | 4328 gpu_tracer_->Destroy(have_context); |
| 4376 gpu_tracer_.reset(); | 4329 gpu_tracer_.reset(); |
| 4377 } | 4330 } |
| 4378 | 4331 |
| 4379 if (group_.get()) { | 4332 if (group_.get()) { |
| 4380 framebuffer_manager()->RemoveObserver(this); | |
| 4381 group_->Destroy(this, have_context); | 4333 group_->Destroy(this, have_context); |
| 4382 group_ = NULL; | 4334 group_ = NULL; |
| 4383 } | 4335 } |
| 4384 | 4336 |
| 4385 if (context_.get()) { | 4337 if (context_.get()) { |
| 4386 context_->ReleaseCurrent(NULL); | 4338 context_->ReleaseCurrent(NULL); |
| 4387 context_ = NULL; | 4339 context_ = NULL; |
| 4388 } | 4340 } |
| 4389 | 4341 |
| 4390 #if defined(OS_MACOSX) | 4342 #if defined(OS_MACOSX) |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5214 attachment = GL_STENCIL_ATTACHMENT; | 5166 attachment = GL_STENCIL_ATTACHMENT; |
| 5215 break; | 5167 break; |
| 5216 default: | 5168 default: |
| 5217 NOTREACHED(); | 5169 NOTREACHED(); |
| 5218 return; | 5170 return; |
| 5219 } | 5171 } |
| 5220 } | 5172 } |
| 5221 translated_attachments[i] = attachment; | 5173 translated_attachments[i] = attachment; |
| 5222 } | 5174 } |
| 5223 | 5175 |
| 5224 ScopedRenderTo do_render(framebuffer); | |
| 5225 if (feature_info_->gl_version_info().is_es3) { | 5176 if (feature_info_->gl_version_info().is_es3) { |
| 5226 glInvalidateFramebuffer( | 5177 glInvalidateFramebuffer( |
| 5227 target, numAttachments, translated_attachments.get()); | 5178 target, numAttachments, translated_attachments.get()); |
| 5228 } else { | 5179 } else { |
| 5229 glDiscardFramebufferEXT( | 5180 glDiscardFramebufferEXT( |
| 5230 target, numAttachments, translated_attachments.get()); | 5181 target, numAttachments, translated_attachments.get()); |
| 5231 } | 5182 } |
| 5232 } | 5183 } |
| 5233 | 5184 |
| 5234 void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) { | 5185 void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) { |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5992 } | 5943 } |
| 5993 return error::kNoError; | 5944 return error::kNoError; |
| 5994 } | 5945 } |
| 5995 | 5946 |
| 5996 error::Error GLES2DecoderImpl::DoClear(GLbitfield mask) { | 5947 error::Error GLES2DecoderImpl::DoClear(GLbitfield mask) { |
| 5997 DCHECK(!ShouldDeferDraws()); | 5948 DCHECK(!ShouldDeferDraws()); |
| 5998 if (CheckBoundFramebuffersValid("glClear")) { | 5949 if (CheckBoundFramebuffersValid("glClear")) { |
| 5999 ApplyDirtyState(); | 5950 ApplyDirtyState(); |
| 6000 // TODO(zmo): Filter out INTEGER/SIGNED INTEGER images to avoid | 5951 // TODO(zmo): Filter out INTEGER/SIGNED INTEGER images to avoid |
| 6001 // undefined results. | 5952 // undefined results. |
| 6002 ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get()); | |
| 6003 if (workarounds().gl_clear_broken) { | 5953 if (workarounds().gl_clear_broken) { |
| 6004 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::ClearWorkaround", | 5954 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::ClearWorkaround", |
| 6005 GetErrorState()); | 5955 GetErrorState()); |
| 6006 if (!BoundFramebufferHasDepthAttachment()) | 5956 if (!BoundFramebufferHasDepthAttachment()) |
| 6007 mask &= ~GL_DEPTH_BUFFER_BIT; | 5957 mask &= ~GL_DEPTH_BUFFER_BIT; |
| 6008 if (!BoundFramebufferHasStencilAttachment()) | 5958 if (!BoundFramebufferHasStencilAttachment()) |
| 6009 mask &= ~GL_STENCIL_BUFFER_BIT; | 5959 mask &= ~GL_STENCIL_BUFFER_BIT; |
| 6010 clear_framebuffer_blit_->ClearFramebuffer( | 5960 clear_framebuffer_blit_->ClearFramebuffer( |
| 6011 this, GetBoundReadFrameBufferSize(), mask, state_.color_clear_red, | 5961 this, GetBoundReadFrameBufferSize(), mask, state_.color_clear_red, |
| 6012 state_.color_clear_green, state_.color_clear_blue, | 5962 state_.color_clear_green, state_.color_clear_blue, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 6026 | 5976 |
| 6027 switch (buffer) { | 5977 switch (buffer) { |
| 6028 case GL_COLOR: | 5978 case GL_COLOR: |
| 6029 case GL_STENCIL: | 5979 case GL_STENCIL: |
| 6030 break; | 5980 break; |
| 6031 default: | 5981 default: |
| 6032 LOCAL_SET_GL_ERROR( | 5982 LOCAL_SET_GL_ERROR( |
| 6033 GL_INVALID_ENUM, "glClearBufferiv", "invalid buffer"); | 5983 GL_INVALID_ENUM, "glClearBufferiv", "invalid buffer"); |
| 6034 return; | 5984 return; |
| 6035 } | 5985 } |
| 6036 GLenum attachment = 0; | |
| 6037 if (buffer == GL_COLOR) { | 5986 if (buffer == GL_COLOR) { |
| 6038 if (drawbuffer < 0 || | 5987 if (drawbuffer < 0 || |
| 6039 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { | 5988 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { |
| 6040 LOCAL_SET_GL_ERROR( | 5989 LOCAL_SET_GL_ERROR( |
| 6041 GL_INVALID_VALUE, "glClearBufferiv", "invalid drawBuffer"); | 5990 GL_INVALID_VALUE, "glClearBufferiv", "invalid drawBuffer"); |
| 6042 return; | 5991 return; |
| 6043 } | 5992 } |
| 6044 GLenum internal_format = | 5993 GLenum internal_format = |
| 6045 GetBoundColorDrawBufferInternalFormat(drawbuffer); | 5994 GetBoundColorDrawBufferInternalFormat(drawbuffer); |
| 6046 if (!GLES2Util::IsSignedIntegerFormat(internal_format)) { | 5995 if (!GLES2Util::IsSignedIntegerFormat(internal_format)) { |
| 6047 // To avoid undefined results, return without calling the gl function. | 5996 // To avoid undefined results, return without calling the gl function. |
| 6048 return; | 5997 return; |
| 6049 } | 5998 } |
| 6050 attachment = static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + drawbuffer); | |
| 6051 } else { | 5999 } else { |
| 6052 DCHECK(buffer == GL_STENCIL); | 6000 DCHECK(buffer == GL_STENCIL); |
| 6053 if (drawbuffer != 0) { | 6001 if (drawbuffer != 0) { |
| 6054 LOCAL_SET_GL_ERROR( | 6002 LOCAL_SET_GL_ERROR( |
| 6055 GL_INVALID_VALUE, "glClearBufferiv", "invalid drawBuffer"); | 6003 GL_INVALID_VALUE, "glClearBufferiv", "invalid drawBuffer"); |
| 6056 return; | 6004 return; |
| 6057 } | 6005 } |
| 6058 if (!BoundFramebufferHasStencilAttachment()) { | 6006 if (!BoundFramebufferHasStencilAttachment()) { |
| 6059 return; | 6007 return; |
| 6060 } | 6008 } |
| 6061 attachment = GL_STENCIL_ATTACHMENT; | |
| 6062 } | 6009 } |
| 6063 MarkDrawBufferAsCleared(buffer, drawbuffer); | 6010 MarkDrawBufferAsCleared(buffer, drawbuffer); |
| 6064 { | 6011 glClearBufferiv(buffer, drawbuffer, value); |
| 6065 ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get(), | |
| 6066 attachment); | |
| 6067 glClearBufferiv(buffer, drawbuffer, value); | |
| 6068 } | |
| 6069 } | 6012 } |
| 6070 | 6013 |
| 6071 void GLES2DecoderImpl::DoClearBufferuiv( | 6014 void GLES2DecoderImpl::DoClearBufferuiv( |
| 6072 GLenum buffer, GLint drawbuffer, const GLuint* value) { | 6015 GLenum buffer, GLint drawbuffer, const GLuint* value) { |
| 6073 if (!CheckBoundDrawFramebufferValid("glClearBufferuiv")) | 6016 if (!CheckBoundDrawFramebufferValid("glClearBufferuiv")) |
| 6074 return; | 6017 return; |
| 6075 ApplyDirtyState(); | 6018 ApplyDirtyState(); |
| 6076 | 6019 |
| 6077 switch (buffer) { | 6020 switch (buffer) { |
| 6078 case GL_COLOR: | 6021 case GL_COLOR: |
| 6079 break; | 6022 break; |
| 6080 default: | 6023 default: |
| 6081 LOCAL_SET_GL_ERROR( | 6024 LOCAL_SET_GL_ERROR( |
| 6082 GL_INVALID_ENUM, "glClearBufferuiv", "invalid buffer"); | 6025 GL_INVALID_ENUM, "glClearBufferuiv", "invalid buffer"); |
| 6083 return; | 6026 return; |
| 6084 } | 6027 } |
| 6085 if (drawbuffer < 0 || | 6028 if (drawbuffer < 0 || |
| 6086 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { | 6029 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { |
| 6087 LOCAL_SET_GL_ERROR( | 6030 LOCAL_SET_GL_ERROR( |
| 6088 GL_INVALID_VALUE, "glClearBufferuiv", "invalid drawBuffer"); | 6031 GL_INVALID_VALUE, "glClearBufferuiv", "invalid drawBuffer"); |
| 6089 return; | 6032 return; |
| 6090 } | 6033 } |
| 6091 GLenum internal_format = | 6034 GLenum internal_format = |
| 6092 GetBoundColorDrawBufferInternalFormat(drawbuffer); | 6035 GetBoundColorDrawBufferInternalFormat(drawbuffer); |
| 6093 if (!GLES2Util::IsUnsignedIntegerFormat(internal_format)) { | 6036 if (!GLES2Util::IsUnsignedIntegerFormat(internal_format)) { |
| 6094 // To avoid undefined results, return without calling the gl function. | 6037 // To avoid undefined results, return without calling the gl function. |
| 6095 return; | 6038 return; |
| 6096 } | 6039 } |
| 6097 MarkDrawBufferAsCleared(buffer, drawbuffer); | 6040 MarkDrawBufferAsCleared(buffer, drawbuffer); |
| 6098 GLenum attachment = static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + drawbuffer); | 6041 glClearBufferuiv(buffer, drawbuffer, value); |
| 6099 { | |
| 6100 ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get(), | |
| 6101 attachment); | |
| 6102 glClearBufferuiv(buffer, drawbuffer, value); | |
| 6103 } | |
| 6104 } | 6042 } |
| 6105 | 6043 |
| 6106 void GLES2DecoderImpl::DoClearBufferfv( | 6044 void GLES2DecoderImpl::DoClearBufferfv( |
| 6107 GLenum buffer, GLint drawbuffer, const GLfloat* value) { | 6045 GLenum buffer, GLint drawbuffer, const GLfloat* value) { |
| 6108 if (!CheckBoundDrawFramebufferValid("glClearBufferfv")) | 6046 if (!CheckBoundDrawFramebufferValid("glClearBufferfv")) |
| 6109 return; | 6047 return; |
| 6110 ApplyDirtyState(); | 6048 ApplyDirtyState(); |
| 6111 | 6049 |
| 6112 switch (buffer) { | 6050 switch (buffer) { |
| 6113 case GL_COLOR: | 6051 case GL_COLOR: |
| 6114 case GL_DEPTH: | 6052 case GL_DEPTH: |
| 6115 break; | 6053 break; |
| 6116 default: | 6054 default: |
| 6117 LOCAL_SET_GL_ERROR( | 6055 LOCAL_SET_GL_ERROR( |
| 6118 GL_INVALID_ENUM, "glClearBufferfv", "invalid buffer"); | 6056 GL_INVALID_ENUM, "glClearBufferfv", "invalid buffer"); |
| 6119 return; | 6057 return; |
| 6120 } | 6058 } |
| 6121 GLenum attachment = 0; | |
| 6122 if (buffer == GL_COLOR) { | 6059 if (buffer == GL_COLOR) { |
| 6123 if (drawbuffer < 0 || | 6060 if (drawbuffer < 0 || |
| 6124 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { | 6061 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { |
| 6125 LOCAL_SET_GL_ERROR( | 6062 LOCAL_SET_GL_ERROR( |
| 6126 GL_INVALID_VALUE, "glClearBufferfv", "invalid drawBuffer"); | 6063 GL_INVALID_VALUE, "glClearBufferfv", "invalid drawBuffer"); |
| 6127 return; | 6064 return; |
| 6128 } | 6065 } |
| 6129 GLenum internal_format = | 6066 GLenum internal_format = |
| 6130 GetBoundColorDrawBufferInternalFormat(drawbuffer); | 6067 GetBoundColorDrawBufferInternalFormat(drawbuffer); |
| 6131 if (GLES2Util::IsIntegerFormat(internal_format)) { | 6068 if (GLES2Util::IsIntegerFormat(internal_format)) { |
| 6132 // To avoid undefined results, return without calling the gl function. | 6069 // To avoid undefined results, return without calling the gl function. |
| 6133 return; | 6070 return; |
| 6134 } | 6071 } |
| 6135 attachment = static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + drawbuffer); | |
| 6136 } else { | 6072 } else { |
| 6137 DCHECK(buffer == GL_DEPTH); | 6073 DCHECK(buffer == GL_DEPTH); |
| 6138 if (drawbuffer != 0) { | 6074 if (drawbuffer != 0) { |
| 6139 LOCAL_SET_GL_ERROR( | 6075 LOCAL_SET_GL_ERROR( |
| 6140 GL_INVALID_VALUE, "glClearBufferfv", "invalid drawBuffer"); | 6076 GL_INVALID_VALUE, "glClearBufferfv", "invalid drawBuffer"); |
| 6141 return; | 6077 return; |
| 6142 } | 6078 } |
| 6143 if (!BoundFramebufferHasDepthAttachment()) { | 6079 if (!BoundFramebufferHasDepthAttachment()) { |
| 6144 return; | 6080 return; |
| 6145 } | 6081 } |
| 6146 attachment = GL_DEPTH_ATTACHMENT; | |
| 6147 } | 6082 } |
| 6148 MarkDrawBufferAsCleared(buffer, drawbuffer); | 6083 MarkDrawBufferAsCleared(buffer, drawbuffer); |
| 6149 { | 6084 glClearBufferfv(buffer, drawbuffer, value); |
| 6150 ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get(), | |
| 6151 attachment); | |
| 6152 glClearBufferfv(buffer, drawbuffer, value); | |
| 6153 } | |
| 6154 } | 6085 } |
| 6155 | 6086 |
| 6156 void GLES2DecoderImpl::DoClearBufferfi( | 6087 void GLES2DecoderImpl::DoClearBufferfi( |
| 6157 GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { | 6088 GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { |
| 6158 if (!CheckBoundDrawFramebufferValid("glClearBufferfi")) | 6089 if (!CheckBoundDrawFramebufferValid("glClearBufferfi")) |
| 6159 return; | 6090 return; |
| 6160 ApplyDirtyState(); | 6091 ApplyDirtyState(); |
| 6161 | 6092 |
| 6162 switch (buffer) { | 6093 switch (buffer) { |
| 6163 case GL_DEPTH_STENCIL: | 6094 case GL_DEPTH_STENCIL: |
| 6164 break; | 6095 break; |
| 6165 default: | 6096 default: |
| 6166 LOCAL_SET_GL_ERROR( | 6097 LOCAL_SET_GL_ERROR( |
| 6167 GL_INVALID_ENUM, "glClearBufferfi", "invalid buffer"); | 6098 GL_INVALID_ENUM, "glClearBufferfi", "invalid buffer"); |
| 6168 return; | 6099 return; |
| 6169 } | 6100 } |
| 6170 if (drawbuffer != 0) { | 6101 if (drawbuffer != 0) { |
| 6171 LOCAL_SET_GL_ERROR( | 6102 LOCAL_SET_GL_ERROR( |
| 6172 GL_INVALID_VALUE, "glClearBufferfi", "invalid drawBuffer"); | 6103 GL_INVALID_VALUE, "glClearBufferfi", "invalid drawBuffer"); |
| 6173 return; | 6104 return; |
| 6174 } | 6105 } |
| 6175 if (!BoundFramebufferHasDepthAttachment() && | 6106 if (!BoundFramebufferHasDepthAttachment() && |
| 6176 !BoundFramebufferHasStencilAttachment()) { | 6107 !BoundFramebufferHasStencilAttachment()) { |
| 6177 return; | 6108 return; |
| 6178 } | 6109 } |
| 6179 MarkDrawBufferAsCleared(GL_DEPTH, drawbuffer); | 6110 MarkDrawBufferAsCleared(GL_DEPTH, drawbuffer); |
| 6180 MarkDrawBufferAsCleared(GL_STENCIL, drawbuffer); | 6111 MarkDrawBufferAsCleared(GL_STENCIL, drawbuffer); |
| 6181 { | 6112 glClearBufferfi(buffer, drawbuffer, depth, stencil); |
| 6182 ScopedRenderTo do_render_depth( | |
| 6183 framebuffer_state_.bound_draw_framebuffer.get(), | |
| 6184 GL_DEPTH_ATTACHMENT); | |
| 6185 ScopedRenderTo do_render_stencil( | |
| 6186 framebuffer_state_.bound_draw_framebuffer.get(), | |
| 6187 GL_STENCIL_ATTACHMENT); | |
| 6188 glClearBufferfi(buffer, drawbuffer, depth, stencil); | |
| 6189 } | |
| 6190 } | 6113 } |
| 6191 | 6114 |
| 6192 void GLES2DecoderImpl::DoFramebufferRenderbuffer( | 6115 void GLES2DecoderImpl::DoFramebufferRenderbuffer( |
| 6193 GLenum target, GLenum attachment, GLenum renderbuffertarget, | 6116 GLenum target, GLenum attachment, GLenum renderbuffertarget, |
| 6194 GLuint client_renderbuffer_id) { | 6117 GLuint client_renderbuffer_id) { |
| 6195 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); | 6118 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); |
| 6196 if (!framebuffer) { | 6119 if (!framebuffer) { |
| 6197 LOCAL_SET_GL_ERROR( | 6120 LOCAL_SET_GL_ERROR( |
| 6198 GL_INVALID_OPERATION, | 6121 GL_INVALID_OPERATION, |
| 6199 "glFramebufferRenderbuffer", "no framebuffer bound"); | 6122 "glFramebufferRenderbuffer", "no framebuffer bound"); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6390 } | 6313 } |
| 6391 | 6314 |
| 6392 if (!texture_manager()->ValidForTarget(textarget, level, 0, 0, 1)) { | 6315 if (!texture_manager()->ValidForTarget(textarget, level, 0, 0, 1)) { |
| 6393 LOCAL_SET_GL_ERROR( | 6316 LOCAL_SET_GL_ERROR( |
| 6394 GL_INVALID_VALUE, | 6317 GL_INVALID_VALUE, |
| 6395 name, "level out of range"); | 6318 name, "level out of range"); |
| 6396 return; | 6319 return; |
| 6397 } | 6320 } |
| 6398 | 6321 |
| 6399 if (texture_ref) | 6322 if (texture_ref) |
| 6400 DoWillUseTexImageIfNeeded(texture_ref->texture(), textarget); | 6323 DoCopyTexImageIfNeeded(texture_ref->texture(), textarget); |
| 6401 | 6324 |
| 6402 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(name); | 6325 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(name); |
| 6403 if (0 == samples) { | 6326 if (0 == samples) { |
| 6404 glFramebufferTexture2DEXT(target, attachment, textarget, service_id, level); | 6327 glFramebufferTexture2DEXT(target, attachment, textarget, service_id, level); |
| 6405 } else { | 6328 } else { |
| 6406 if (features().use_img_for_multisampled_render_to_texture) { | 6329 if (features().use_img_for_multisampled_render_to_texture) { |
| 6407 glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, | 6330 glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, |
| 6408 service_id, level, samples); | 6331 service_id, level, samples); |
| 6409 } else { | 6332 } else { |
| 6410 glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, | 6333 glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, |
| 6411 service_id, level, samples); | 6334 service_id, level, samples); |
| 6412 } | 6335 } |
| 6413 } | 6336 } |
| 6414 GLenum error = LOCAL_PEEK_GL_ERROR(name); | 6337 GLenum error = LOCAL_PEEK_GL_ERROR(name); |
| 6415 if (error == GL_NO_ERROR) { | 6338 if (error == GL_NO_ERROR) { |
| 6416 framebuffer->AttachTexture(attachment, texture_ref, textarget, level, | 6339 framebuffer->AttachTexture(attachment, texture_ref, textarget, level, |
| 6417 samples); | 6340 samples); |
| 6418 } | 6341 } |
| 6419 if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { | 6342 if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { |
| 6420 framebuffer_state_.clear_state_dirty = true; | 6343 framebuffer_state_.clear_state_dirty = true; |
| 6421 } | 6344 } |
| 6422 | 6345 |
| 6423 if (texture_ref) | |
| 6424 DoDidUseTexImageIfNeeded(texture_ref->texture(), textarget); | |
| 6425 | |
| 6426 OnFboChanged(); | 6346 OnFboChanged(); |
| 6427 } | 6347 } |
| 6428 | 6348 |
| 6429 void GLES2DecoderImpl::DoFramebufferTextureLayer( | 6349 void GLES2DecoderImpl::DoFramebufferTextureLayer( |
| 6430 GLenum target, GLenum attachment, GLuint client_texture_id, | 6350 GLenum target, GLenum attachment, GLuint client_texture_id, |
| 6431 GLint level, GLint layer) { | 6351 GLint level, GLint layer) { |
| 6432 // TODO(zmo): Unsafe ES3 API, missing states update. | 6352 // TODO(zmo): Unsafe ES3 API, missing states update. |
| 6433 GLuint service_id = 0; | 6353 GLuint service_id = 0; |
| 6434 TextureRef* texture_ref = NULL; | 6354 TextureRef* texture_ref = NULL; |
| 6435 if (client_texture_id) { | 6355 if (client_texture_id) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6555 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, | 6475 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, |
| 6556 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, | 6476 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, |
| 6557 GLbitfield mask, GLenum filter) { | 6477 GLbitfield mask, GLenum filter) { |
| 6558 DCHECK(!ShouldDeferReads() && !ShouldDeferDraws()); | 6478 DCHECK(!ShouldDeferReads() && !ShouldDeferDraws()); |
| 6559 | 6479 |
| 6560 if (!CheckBoundFramebuffersValid("glBlitFramebufferCHROMIUM")) { | 6480 if (!CheckBoundFramebuffersValid("glBlitFramebufferCHROMIUM")) { |
| 6561 return; | 6481 return; |
| 6562 } | 6482 } |
| 6563 | 6483 |
| 6564 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); | 6484 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); |
| 6565 ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get()); | |
| 6566 BlitFramebufferHelper( | 6485 BlitFramebufferHelper( |
| 6567 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | 6486 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 6568 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, | 6487 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, |
| 6569 state_.enable_flags.scissor_test); | 6488 state_.enable_flags.scissor_test); |
| 6570 } | 6489 } |
| 6571 | 6490 |
| 6572 void GLES2DecoderImpl::EnsureRenderbufferBound() { | 6491 void GLES2DecoderImpl::EnsureRenderbufferBound() { |
| 6573 if (!state_.bound_renderbuffer_valid) { | 6492 if (!state_.bound_renderbuffer_valid) { |
| 6574 state_.bound_renderbuffer_valid = true; | 6493 state_.bound_renderbuffer_valid = true; |
| 6575 glBindRenderbufferEXT(GL_RENDERBUFFER, | 6494 glBindRenderbufferEXT(GL_RENDERBUFFER, |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7615 const char* filename, int line, const std::string& msg) { | 7534 const char* filename, int line, const std::string& msg) { |
| 7616 logger_.LogMessage(filename, line, std::string("RENDER WARNING: ") + msg); | 7535 logger_.LogMessage(filename, line, std::string("RENDER WARNING: ") + msg); |
| 7617 } | 7536 } |
| 7618 | 7537 |
| 7619 void GLES2DecoderImpl::PerformanceWarning( | 7538 void GLES2DecoderImpl::PerformanceWarning( |
| 7620 const char* filename, int line, const std::string& msg) { | 7539 const char* filename, int line, const std::string& msg) { |
| 7621 logger_.LogMessage(filename, line, | 7540 logger_.LogMessage(filename, line, |
| 7622 std::string("PERFORMANCE WARNING: ") + msg); | 7541 std::string("PERFORMANCE WARNING: ") + msg); |
| 7623 } | 7542 } |
| 7624 | 7543 |
| 7625 void GLES2DecoderImpl::DoWillUseTexImageIfNeeded( | 7544 void GLES2DecoderImpl::DoCopyTexImage(Texture* texture, |
| 7626 Texture* texture, GLenum textarget) { | 7545 GLenum textarget, |
| 7546 gfx::GLImage* image) { |
| 7547 // Note: We update the state to COPIED prior to calling CopyTexImage() |
| 7548 // as that allows the GLImage implemenatation to set it back to UNBOUND |
| 7549 // and ensure that CopyTexImage() is called each time the texture is |
| 7550 // used. |
| 7551 texture->SetLevelImage(textarget, 0, image, Texture::COPIED); |
| 7552 bool rv = image->CopyTexImage(textarget); |
| 7553 DCHECK(rv) << "Both BindTexImage() and CopyTexImage() failed"; |
| 7554 } |
| 7555 |
| 7556 void GLES2DecoderImpl::DoCopyTexImageIfNeeded(Texture* texture, |
| 7557 GLenum textarget) { |
| 7627 // Image is already in use if texture is attached to a framebuffer. | 7558 // Image is already in use if texture is attached to a framebuffer. |
| 7628 if (texture && !texture->IsAttachedToFramebuffer()) { | 7559 if (texture && !texture->IsAttachedToFramebuffer()) { |
| 7629 gfx::GLImage* image = texture->GetLevelImage(textarget, 0); | 7560 Texture::ImageState image_state; |
| 7630 if (image) { | 7561 gfx::GLImage* image = texture->GetLevelImage(textarget, 0, &image_state); |
| 7562 if (image && image_state == Texture::UNBOUND) { |
| 7631 ScopedGLErrorSuppressor suppressor( | 7563 ScopedGLErrorSuppressor suppressor( |
| 7632 "GLES2DecoderImpl::DoWillUseTexImageIfNeeded", | 7564 "GLES2DecoderImpl::DoCopyTexImageIfNeeded", GetErrorState()); |
| 7633 GetErrorState()); | |
| 7634 glBindTexture(textarget, texture->service_id()); | 7565 glBindTexture(textarget, texture->service_id()); |
| 7635 image->WillUseTexImage(); | 7566 DoCopyTexImage(texture, textarget, image); |
| 7636 RestoreCurrentTextureBindings(&state_, textarget); | 7567 RestoreCurrentTextureBindings(&state_, textarget); |
| 7637 } | 7568 } |
| 7638 } | 7569 } |
| 7639 } | |
| 7640 | |
| 7641 void GLES2DecoderImpl::DoDidUseTexImageIfNeeded( | |
| 7642 Texture* texture, GLenum textarget) { | |
| 7643 // Image is still in use if texture is attached to a framebuffer. | |
| 7644 if (texture && !texture->IsAttachedToFramebuffer()) { | |
| 7645 gfx::GLImage* image = texture->GetLevelImage(textarget, 0); | |
| 7646 if (image) { | |
| 7647 ScopedGLErrorSuppressor suppressor( | |
| 7648 "GLES2DecoderImpl::DoDidUseTexImageIfNeeded", | |
| 7649 GetErrorState()); | |
| 7650 glBindTexture(textarget, texture->service_id()); | |
| 7651 image->DidUseTexImage(); | |
| 7652 RestoreCurrentTextureBindings(&state_, textarget); | |
| 7653 } | |
| 7654 } | |
| 7655 } | 7570 } |
| 7656 | 7571 |
| 7657 bool GLES2DecoderImpl::PrepareTexturesForRender() { | 7572 bool GLES2DecoderImpl::PrepareTexturesForRender() { |
| 7658 DCHECK(state_.current_program.get()); | 7573 DCHECK(state_.current_program.get()); |
| 7659 if (!texture_manager()->HaveUnrenderableTextures() && | 7574 if (!texture_manager()->HaveUnrenderableTextures() && |
| 7660 !texture_manager()->HaveImages()) { | 7575 !texture_manager()->HaveImages()) { |
| 7661 return true; | 7576 return true; |
| 7662 } | 7577 } |
| 7663 bool textures_set = false; | 7578 bool textures_set = false; |
| 7664 const Program::SamplerIndices& sampler_indices = | 7579 const Program::SamplerIndices& sampler_indices = |
| (...skipping 24 matching lines...) Expand all Loading... |
| 7689 std::string("texture bound to texture unit ") + | 7604 std::string("texture bound to texture unit ") + |
| 7690 base::UintToString(texture_unit_index) + | 7605 base::UintToString(texture_unit_index) + |
| 7691 " is not renderable. It maybe non-power-of-2 and have" | 7606 " is not renderable. It maybe non-power-of-2 and have" |
| 7692 " incompatible texture filtering."); | 7607 " incompatible texture filtering."); |
| 7693 } | 7608 } |
| 7694 continue; | 7609 continue; |
| 7695 } | 7610 } |
| 7696 | 7611 |
| 7697 if (textarget != GL_TEXTURE_CUBE_MAP) { | 7612 if (textarget != GL_TEXTURE_CUBE_MAP) { |
| 7698 Texture* texture = texture_ref->texture(); | 7613 Texture* texture = texture_ref->texture(); |
| 7699 gfx::GLImage* image = texture->GetLevelImage(textarget, 0); | 7614 Texture::ImageState image_state; |
| 7700 if (image && !texture->IsAttachedToFramebuffer()) { | 7615 gfx::GLImage* image = |
| 7616 texture->GetLevelImage(textarget, 0, &image_state); |
| 7617 if (image && image_state == Texture::UNBOUND && |
| 7618 !texture->IsAttachedToFramebuffer()) { |
| 7701 ScopedGLErrorSuppressor suppressor( | 7619 ScopedGLErrorSuppressor suppressor( |
| 7702 "GLES2DecoderImpl::PrepareTexturesForRender", GetErrorState()); | 7620 "GLES2DecoderImpl::PrepareTexturesForRender", GetErrorState()); |
| 7703 textures_set = true; | 7621 textures_set = true; |
| 7704 glActiveTexture(GL_TEXTURE0 + texture_unit_index); | 7622 glActiveTexture(GL_TEXTURE0 + texture_unit_index); |
| 7705 image->WillUseTexImage(); | 7623 DoCopyTexImage(texture, textarget, image); |
| 7706 continue; | 7624 continue; |
| 7707 } | 7625 } |
| 7708 } | 7626 } |
| 7709 } | 7627 } |
| 7710 // else: should this be an error? | 7628 // else: should this be an error? |
| 7711 } | 7629 } |
| 7712 } | 7630 } |
| 7713 return !textures_set; | 7631 return !textures_set; |
| 7714 } | 7632 } |
| 7715 | 7633 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 7730 if (!texture_ref || !texture_manager()->CanRender(texture_ref)) { | 7648 if (!texture_ref || !texture_manager()->CanRender(texture_ref)) { |
| 7731 glActiveTexture(GL_TEXTURE0 + texture_unit_index); | 7649 glActiveTexture(GL_TEXTURE0 + texture_unit_index); |
| 7732 // Get the texture_ref info that was previously bound here. | 7650 // Get the texture_ref info that was previously bound here. |
| 7733 texture_ref = texture_unit.bind_target == GL_TEXTURE_2D | 7651 texture_ref = texture_unit.bind_target == GL_TEXTURE_2D |
| 7734 ? texture_unit.bound_texture_2d.get() | 7652 ? texture_unit.bound_texture_2d.get() |
| 7735 : texture_unit.bound_texture_cube_map.get(); | 7653 : texture_unit.bound_texture_cube_map.get(); |
| 7736 glBindTexture(texture_unit.bind_target, | 7654 glBindTexture(texture_unit.bind_target, |
| 7737 texture_ref ? texture_ref->service_id() : 0); | 7655 texture_ref ? texture_ref->service_id() : 0); |
| 7738 continue; | 7656 continue; |
| 7739 } | 7657 } |
| 7740 | |
| 7741 if (texture_unit.bind_target != GL_TEXTURE_CUBE_MAP) { | |
| 7742 Texture* texture = texture_ref->texture(); | |
| 7743 gfx::GLImage* image = | |
| 7744 texture->GetLevelImage(texture_unit.bind_target, 0); | |
| 7745 if (image && !texture->IsAttachedToFramebuffer()) { | |
| 7746 ScopedGLErrorSuppressor suppressor( | |
| 7747 "GLES2DecoderImpl::RestoreStateForTextures", GetErrorState()); | |
| 7748 glActiveTexture(GL_TEXTURE0 + texture_unit_index); | |
| 7749 image->DidUseTexImage(); | |
| 7750 continue; | |
| 7751 } | |
| 7752 } | |
| 7753 } | 7658 } |
| 7754 } | 7659 } |
| 7755 } | 7660 } |
| 7756 // Set the active texture back to whatever the user had it as. | 7661 // Set the active texture back to whatever the user had it as. |
| 7757 glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit); | 7662 glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit); |
| 7758 } | 7663 } |
| 7759 | 7664 |
| 7760 bool GLES2DecoderImpl::ClearUnclearedTextures() { | 7665 bool GLES2DecoderImpl::ClearUnclearedTextures() { |
| 7761 // Only check if there are some uncleared textures. | 7666 // Only check if there are some uncleared textures. |
| 7762 if (!texture_manager()->HaveUnsafeTextures()) { | 7667 if (!texture_manager()->HaveUnsafeTextures()) { |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8098 if (!SimulateAttrib0( | 8003 if (!SimulateAttrib0( |
| 8099 function_name, max_vertex_accessed, &simulated_attrib_0)) { | 8004 function_name, max_vertex_accessed, &simulated_attrib_0)) { |
| 8100 return error::kNoError; | 8005 return error::kNoError; |
| 8101 } | 8006 } |
| 8102 bool simulated_fixed_attribs = false; | 8007 bool simulated_fixed_attribs = false; |
| 8103 if (SimulateFixedAttribs( | 8008 if (SimulateFixedAttribs( |
| 8104 function_name, max_vertex_accessed, &simulated_fixed_attribs, | 8009 function_name, max_vertex_accessed, &simulated_fixed_attribs, |
| 8105 primcount)) { | 8010 primcount)) { |
| 8106 bool textures_set = !PrepareTexturesForRender(); | 8011 bool textures_set = !PrepareTexturesForRender(); |
| 8107 ApplyDirtyState(); | 8012 ApplyDirtyState(); |
| 8108 ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get()); | |
| 8109 if (!instanced) { | 8013 if (!instanced) { |
| 8110 glDrawArrays(mode, first, count); | 8014 glDrawArrays(mode, first, count); |
| 8111 } else { | 8015 } else { |
| 8112 glDrawArraysInstancedANGLE(mode, first, count, primcount); | 8016 glDrawArraysInstancedANGLE(mode, first, count, primcount); |
| 8113 } | 8017 } |
| 8114 if (textures_set) { | 8018 if (textures_set) { |
| 8115 RestoreStateForTextures(); | 8019 RestoreStateForTextures(); |
| 8116 } | 8020 } |
| 8117 if (simulated_fixed_attribs) { | 8021 if (simulated_fixed_attribs) { |
| 8118 RestoreStateForSimulatedFixedAttribs(); | 8022 RestoreStateForSimulatedFixedAttribs(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8235 // TODO(gman): Refactor to hide these details in BufferManager or | 8139 // TODO(gman): Refactor to hide these details in BufferManager or |
| 8236 // VertexAttribManager. | 8140 // VertexAttribManager. |
| 8237 const GLvoid* indices = reinterpret_cast<const GLvoid*>(offset); | 8141 const GLvoid* indices = reinterpret_cast<const GLvoid*>(offset); |
| 8238 bool used_client_side_array = false; | 8142 bool used_client_side_array = false; |
| 8239 if (element_array_buffer->IsClientSideArray()) { | 8143 if (element_array_buffer->IsClientSideArray()) { |
| 8240 used_client_side_array = true; | 8144 used_client_side_array = true; |
| 8241 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); | 8145 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); |
| 8242 indices = element_array_buffer->GetRange(offset, 0); | 8146 indices = element_array_buffer->GetRange(offset, 0); |
| 8243 } | 8147 } |
| 8244 | 8148 |
| 8245 ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get()); | |
| 8246 if (!instanced) { | 8149 if (!instanced) { |
| 8247 glDrawElements(mode, count, type, indices); | 8150 glDrawElements(mode, count, type, indices); |
| 8248 } else { | 8151 } else { |
| 8249 glDrawElementsInstancedANGLE(mode, count, type, indices, primcount); | 8152 glDrawElementsInstancedANGLE(mode, count, type, indices, primcount); |
| 8250 } | 8153 } |
| 8251 | 8154 |
| 8252 if (used_client_side_array) { | 8155 if (used_client_side_array) { |
| 8253 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, | 8156 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, |
| 8254 element_array_buffer->service_id()); | 8157 element_array_buffer->service_id()); |
| 8255 } | 8158 } |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9466 const void* cmd_data) { | 9369 const void* cmd_data) { |
| 9467 const gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c = | 9370 const gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c = |
| 9468 *static_cast<const gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(cmd_data); | 9371 *static_cast<const gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(cmd_data); |
| 9469 TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id); | 9372 TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id); |
| 9470 if (!ref) { | 9373 if (!ref) { |
| 9471 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | 9374 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, |
| 9472 "glScheduleOverlayPlaneCHROMIUM", | 9375 "glScheduleOverlayPlaneCHROMIUM", |
| 9473 "unknown texture"); | 9376 "unknown texture"); |
| 9474 return error::kNoError; | 9377 return error::kNoError; |
| 9475 } | 9378 } |
| 9379 Texture::ImageState image_state; |
| 9476 gfx::GLImage* image = | 9380 gfx::GLImage* image = |
| 9477 ref->texture()->GetLevelImage(ref->texture()->target(), 0); | 9381 ref->texture()->GetLevelImage(ref->texture()->target(), 0, &image_state); |
| 9478 if (!image) { | 9382 if (!image || image_state != Texture::BOUND) { |
| 9479 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | 9383 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, |
| 9480 "glScheduleOverlayPlaneCHROMIUM", | 9384 "glScheduleOverlayPlaneCHROMIUM", |
| 9481 "unsupported texture format"); | 9385 "unsupported texture format"); |
| 9482 return error::kNoError; | 9386 return error::kNoError; |
| 9483 } | 9387 } |
| 9484 gfx::OverlayTransform transform = GetGFXOverlayTransform(c.plane_transform); | 9388 gfx::OverlayTransform transform = GetGFXOverlayTransform(c.plane_transform); |
| 9485 if (transform == gfx::OVERLAY_TRANSFORM_INVALID) { | 9389 if (transform == gfx::OVERLAY_TRANSFORM_INVALID) { |
| 9486 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, | 9390 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, |
| 9487 "glScheduleOverlayPlaneCHROMIUM", | 9391 "glScheduleOverlayPlaneCHROMIUM", |
| 9488 "invalid transform enum"); | 9392 "invalid transform enum"); |
| (...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11058 Clip(x, width, size.width(), ©X, ©Width); | 10962 Clip(x, width, size.width(), ©X, ©Width); |
| 11059 Clip(y, height, size.height(), ©Y, ©Height); | 10963 Clip(y, height, size.height(), ©Y, ©Height); |
| 11060 | 10964 |
| 11061 if (copyX != x || | 10965 if (copyX != x || |
| 11062 copyY != y || | 10966 copyY != y || |
| 11063 copyWidth != width || | 10967 copyWidth != width || |
| 11064 copyHeight != height) { | 10968 copyHeight != height) { |
| 11065 // some part was clipped so clear the rect. | 10969 // some part was clipped so clear the rect. |
| 11066 scoped_ptr<char[]> zero(new char[pixels_size]); | 10970 scoped_ptr<char[]> zero(new char[pixels_size]); |
| 11067 memset(zero.get(), 0, pixels_size); | 10971 memset(zero.get(), 0, pixels_size); |
| 11068 ScopedModifyPixels modify(texture_ref); | |
| 11069 glTexImage2D(target, level, internal_format, width, height, border, | 10972 glTexImage2D(target, level, internal_format, width, height, border, |
| 11070 format, type, zero.get()); | 10973 format, type, zero.get()); |
| 11071 if (copyHeight > 0 && copyWidth > 0) { | 10974 if (copyHeight > 0 && copyWidth > 0) { |
| 11072 GLint dx = copyX - x; | 10975 GLint dx = copyX - x; |
| 11073 GLint dy = copyY - y; | 10976 GLint dy = copyY - y; |
| 11074 GLint destX = dx; | 10977 GLint destX = dx; |
| 11075 GLint destY = dy; | 10978 GLint destY = dy; |
| 11076 glCopyTexSubImage2D(target, level, | 10979 glCopyTexSubImage2D(target, level, |
| 11077 destX, destY, copyX, copyY, | 10980 destX, destY, copyX, copyY, |
| 11078 copyWidth, copyHeight); | 10981 copyWidth, copyHeight); |
| 11079 } | 10982 } |
| 11080 } else { | 10983 } else { |
| 11081 ScopedModifyPixels modify(texture_ref); | |
| 11082 glCopyTexImage2D(target, level, internal_format, | 10984 glCopyTexImage2D(target, level, internal_format, |
| 11083 copyX, copyY, copyWidth, copyHeight, border); | 10985 copyX, copyY, copyWidth, copyHeight, border); |
| 11084 } | 10986 } |
| 11085 GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTexImage2D"); | 10987 GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTexImage2D"); |
| 11086 if (error == GL_NO_ERROR) { | 10988 if (error == GL_NO_ERROR) { |
| 11087 texture_manager()->SetLevelInfo(texture_ref, target, level, internal_format, | 10989 texture_manager()->SetLevelInfo(texture_ref, target, level, internal_format, |
| 11088 width, height, 1, border, format, | 10990 width, height, 1, border, format, |
| 11089 type, gfx::Rect(width, height)); | 10991 type, gfx::Rect(width, height)); |
| 11090 } | 10992 } |
| 11091 | 10993 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11198 uint32 pixels_size = 0; | 11100 uint32 pixels_size = 0; |
| 11199 if (!GLES2Util::ComputeImageDataSizes( | 11101 if (!GLES2Util::ComputeImageDataSizes( |
| 11200 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, | 11102 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, |
| 11201 NULL, NULL)) { | 11103 NULL, NULL)) { |
| 11202 LOCAL_SET_GL_ERROR( | 11104 LOCAL_SET_GL_ERROR( |
| 11203 GL_INVALID_VALUE, "glCopyTexSubImage2D", "dimensions too large"); | 11105 GL_INVALID_VALUE, "glCopyTexSubImage2D", "dimensions too large"); |
| 11204 return; | 11106 return; |
| 11205 } | 11107 } |
| 11206 scoped_ptr<char[]> zero(new char[pixels_size]); | 11108 scoped_ptr<char[]> zero(new char[pixels_size]); |
| 11207 memset(zero.get(), 0, pixels_size); | 11109 memset(zero.get(), 0, pixels_size); |
| 11208 ScopedModifyPixels modify(texture_ref); | |
| 11209 glTexSubImage2D( | 11110 glTexSubImage2D( |
| 11210 target, level, xoffset, yoffset, width, height, | 11111 target, level, xoffset, yoffset, width, height, |
| 11211 format, type, zero.get()); | 11112 format, type, zero.get()); |
| 11212 } | 11113 } |
| 11213 | 11114 |
| 11214 if (copyHeight > 0 && copyWidth > 0) { | 11115 if (copyHeight > 0 && copyWidth > 0) { |
| 11215 GLint dx = copyX - x; | 11116 GLint dx = copyX - x; |
| 11216 GLint dy = copyY - y; | 11117 GLint dy = copyY - y; |
| 11217 GLint destX = xoffset + dx; | 11118 GLint destX = xoffset + dx; |
| 11218 GLint destY = yoffset + dy; | 11119 GLint destY = yoffset + dy; |
| 11219 ScopedModifyPixels modify(texture_ref); | |
| 11220 glCopyTexSubImage2D(target, level, | 11120 glCopyTexSubImage2D(target, level, |
| 11221 destX, destY, copyX, copyY, | 11121 destX, destY, copyX, copyY, |
| 11222 copyWidth, copyHeight); | 11122 copyWidth, copyHeight); |
| 11223 } | 11123 } |
| 11224 | 11124 |
| 11225 // This may be a slow command. Exit command processing to allow for | 11125 // This may be a slow command. Exit command processing to allow for |
| 11226 // context preemption and GPU watchdog checks. | 11126 // context preemption and GPU watchdog checks. |
| 11227 ExitCommandProcessingEarly(); | 11127 ExitCommandProcessingEarly(); |
| 11228 } | 11128 } |
| 11229 | 11129 |
| (...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13186 | 13086 |
| 13187 texture_manager()->SetLevelInfo( | 13087 texture_manager()->SetLevelInfo( |
| 13188 dest_texture_ref, GL_TEXTURE_2D, 0, internal_format, source_width, | 13088 dest_texture_ref, GL_TEXTURE_2D, 0, internal_format, source_width, |
| 13189 source_height, 1, 0, internal_format, dest_type, | 13089 source_height, 1, 0, internal_format, dest_type, |
| 13190 gfx::Rect(source_width, source_height)); | 13090 gfx::Rect(source_width, source_height)); |
| 13191 } else { | 13091 } else { |
| 13192 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 13092 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, |
| 13193 true); | 13093 true); |
| 13194 } | 13094 } |
| 13195 | 13095 |
| 13196 ScopedModifyPixels modify(dest_texture_ref); | 13096 // Try using GLImage::CopyTexImage when possible. |
| 13197 | |
| 13198 // Try using GLImage::CopyTexSubImage when possible. | |
| 13199 bool unpack_premultiply_alpha_change = | 13097 bool unpack_premultiply_alpha_change = |
| 13200 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 13098 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| 13201 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 13099 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
| 13202 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); | 13100 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); |
| 13203 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(0, 0), | 13101 if (image->CopyTexImage(GL_TEXTURE_2D)) |
| 13204 gfx::Rect(0, 0, source_width, source_height))) { | |
| 13205 return; | 13102 return; |
| 13206 } | |
| 13207 } | 13103 } |
| 13208 | 13104 |
| 13209 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); | 13105 DoCopyTexImageIfNeeded(source_texture, source_texture->target()); |
| 13210 | 13106 |
| 13211 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix | 13107 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| 13212 // before presenting. | 13108 // before presenting. |
| 13213 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { | 13109 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { |
| 13214 // TODO(hkuang): get the StreamTexture transform matrix in GPU process | 13110 // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
| 13215 // instead of using kIdentityMatrix crbug.com/226218. | 13111 // instead of using kIdentityMatrix crbug.com/226218. |
| 13216 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( | 13112 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| 13217 this, source_texture->target(), source_texture->service_id(), | 13113 this, source_texture->target(), source_texture->service_id(), |
| 13218 dest_texture->service_id(), source_width, source_height, | 13114 dest_texture->service_id(), source_width, source_height, |
| 13219 unpack_flip_y == GL_TRUE, | 13115 unpack_flip_y == GL_TRUE, |
| 13220 unpack_premultiply_alpha == GL_TRUE, | 13116 unpack_premultiply_alpha == GL_TRUE, |
| 13221 unpack_unmultiply_alpha == GL_TRUE, | 13117 unpack_unmultiply_alpha == GL_TRUE, |
| 13222 kIdentityMatrix); | 13118 kIdentityMatrix); |
| 13223 } else { | 13119 } else { |
| 13224 copy_texture_CHROMIUM_->DoCopyTexture( | 13120 copy_texture_CHROMIUM_->DoCopyTexture( |
| 13225 this, source_texture->target(), source_texture->service_id(), | 13121 this, source_texture->target(), source_texture->service_id(), |
| 13226 source_internal_format, dest_texture->service_id(), internal_format, | 13122 source_internal_format, dest_texture->service_id(), internal_format, |
| 13227 source_width, source_height, | 13123 source_width, source_height, |
| 13228 unpack_flip_y == GL_TRUE, | 13124 unpack_flip_y == GL_TRUE, |
| 13229 unpack_premultiply_alpha == GL_TRUE, | 13125 unpack_premultiply_alpha == GL_TRUE, |
| 13230 unpack_unmultiply_alpha == GL_TRUE); | 13126 unpack_unmultiply_alpha == GL_TRUE); |
| 13231 } | 13127 } |
| 13232 | |
| 13233 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); | |
| 13234 } | 13128 } |
| 13235 | 13129 |
| 13236 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( | 13130 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| 13237 GLenum target, | 13131 GLenum target, |
| 13238 GLuint source_id, | 13132 GLuint source_id, |
| 13239 GLuint dest_id, | 13133 GLuint dest_id, |
| 13240 GLint xoffset, | 13134 GLint xoffset, |
| 13241 GLint yoffset, | 13135 GLint yoffset, |
| 13242 GLint x, | 13136 GLint x, |
| 13243 GLint y, | 13137 GLint y, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13356 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopySubTextureCHROMIUM", | 13250 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopySubTextureCHROMIUM", |
| 13357 "destination texture dimensions too big"); | 13251 "destination texture dimensions too big"); |
| 13358 return; | 13252 return; |
| 13359 } | 13253 } |
| 13360 } | 13254 } |
| 13361 } else { | 13255 } else { |
| 13362 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 13256 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, |
| 13363 true); | 13257 true); |
| 13364 } | 13258 } |
| 13365 | 13259 |
| 13366 ScopedModifyPixels modify(dest_texture_ref); | |
| 13367 | |
| 13368 // Try using GLImage::CopyTexSubImage when possible. | 13260 // Try using GLImage::CopyTexSubImage when possible. |
| 13369 bool unpack_premultiply_alpha_change = | 13261 bool unpack_premultiply_alpha_change = |
| 13370 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 13262 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| 13371 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 13263 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
| 13372 ScopedTextureBinder binder( | 13264 ScopedTextureBinder binder( |
| 13373 &state_, dest_texture->service_id(), GL_TEXTURE_2D); | 13265 &state_, dest_texture->service_id(), GL_TEXTURE_2D); |
| 13374 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), | 13266 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), |
| 13375 gfx::Rect(x, y, width, height))) { | 13267 gfx::Rect(x, y, width, height))) { |
| 13376 return; | 13268 return; |
| 13377 } | 13269 } |
| 13378 } | 13270 } |
| 13379 | 13271 |
| 13380 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); | 13272 DoCopyTexImageIfNeeded(source_texture, source_texture->target()); |
| 13381 | 13273 |
| 13382 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. | 13274 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. |
| 13383 // crbug.com/226218. | 13275 // crbug.com/226218. |
| 13384 copy_texture_CHROMIUM_->DoCopySubTexture( | 13276 copy_texture_CHROMIUM_->DoCopySubTexture( |
| 13385 this, source_texture->target(), source_texture->service_id(), | 13277 this, source_texture->target(), source_texture->service_id(), |
| 13386 source_internal_format, dest_texture->service_id(), dest_internal_format, | 13278 source_internal_format, dest_texture->service_id(), dest_internal_format, |
| 13387 xoffset, yoffset, x, y, width, height, dest_width, dest_height, | 13279 xoffset, yoffset, x, y, width, height, dest_width, dest_height, |
| 13388 source_width, source_height, | 13280 source_width, source_height, |
| 13389 unpack_flip_y == GL_TRUE, | 13281 unpack_flip_y == GL_TRUE, |
| 13390 unpack_premultiply_alpha == GL_TRUE, | 13282 unpack_premultiply_alpha == GL_TRUE, |
| 13391 unpack_unmultiply_alpha == GL_TRUE); | 13283 unpack_unmultiply_alpha == GL_TRUE); |
| 13392 | |
| 13393 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); | |
| 13394 } | 13284 } |
| 13395 | 13285 |
| 13396 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, | 13286 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, |
| 13397 GLuint source_id, | 13287 GLuint source_id, |
| 13398 GLuint dest_id) { | 13288 GLuint dest_id) { |
| 13399 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); | 13289 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); |
| 13400 | 13290 |
| 13401 TextureRef* source_texture_ref = GetTexture(source_id); | 13291 TextureRef* source_texture_ref = GetTexture(source_id); |
| 13402 TextureRef* dest_texture_ref = GetTexture(dest_id); | 13292 TextureRef* dest_texture_ref = GetTexture(dest_id); |
| 13403 Texture* source_texture = source_texture_ref->texture(); | 13293 Texture* source_texture = source_texture_ref->texture(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13469 if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, | 13359 if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, |
| 13470 source_texture->target(), 0)) { | 13360 source_texture->target(), 0)) { |
| 13471 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCompressedCopyTextureCHROMIUM", | 13361 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCompressedCopyTextureCHROMIUM", |
| 13472 "dimensions too big"); | 13362 "dimensions too big"); |
| 13473 return; | 13363 return; |
| 13474 } | 13364 } |
| 13475 | 13365 |
| 13476 ScopedTextureBinder binder( | 13366 ScopedTextureBinder binder( |
| 13477 &state_, dest_texture->service_id(), GL_TEXTURE_2D); | 13367 &state_, dest_texture->service_id(), GL_TEXTURE_2D); |
| 13478 | 13368 |
| 13479 ScopedModifyPixels modify(dest_texture_ref); | |
| 13480 | |
| 13481 // Try using GLImage::CopyTexImage when possible. | 13369 // Try using GLImage::CopyTexImage when possible. |
| 13482 if (image) { | 13370 if (image) { |
| 13483 GLenum dest_type = 0; | 13371 GLenum dest_type = 0; |
| 13484 GLenum dest_internal_format = 0; | 13372 GLenum dest_internal_format = 0; |
| 13485 int dest_width = 0; | 13373 int dest_width = 0; |
| 13486 int dest_height = 0; | 13374 int dest_height = 0; |
| 13487 bool dest_level_defined = dest_texture->GetLevelSize( | 13375 bool dest_level_defined = dest_texture->GetLevelSize( |
| 13488 GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); | 13376 GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); |
| 13489 | 13377 |
| 13490 if (dest_level_defined) { | 13378 if (dest_level_defined) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 13516 | 13404 |
| 13517 texture_manager()->SetLevelInfo( | 13405 texture_manager()->SetLevelInfo( |
| 13518 dest_texture_ref, GL_TEXTURE_2D, 0, source_internal_format, | 13406 dest_texture_ref, GL_TEXTURE_2D, 0, source_internal_format, |
| 13519 source_width, source_height, 1, 0, source_internal_format, | 13407 source_width, source_height, 1, 0, source_internal_format, |
| 13520 source_type, gfx::Rect(source_width, source_height)); | 13408 source_type, gfx::Rect(source_width, source_height)); |
| 13521 } else { | 13409 } else { |
| 13522 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 13410 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, |
| 13523 true); | 13411 true); |
| 13524 } | 13412 } |
| 13525 | 13413 |
| 13526 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(0, 0), | 13414 if (image->CopyTexImage(GL_TEXTURE_2D)) |
| 13527 gfx::Rect(0, 0, source_width, source_height))) { | |
| 13528 return; | 13415 return; |
| 13529 } | |
| 13530 } | 13416 } |
| 13531 | 13417 |
| 13532 TRACE_EVENT0( | 13418 TRACE_EVENT0( |
| 13533 "gpu", | 13419 "gpu", |
| 13534 "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM, fallback"); | 13420 "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM, fallback"); |
| 13535 | 13421 |
| 13536 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); | 13422 DoCopyTexImageIfNeeded(source_texture, source_texture->target()); |
| 13537 | 13423 |
| 13538 // As a fallback, copy into a non-compressed GL_RGBA texture. | 13424 // As a fallback, copy into a non-compressed GL_RGBA texture. |
| 13539 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedCopyTextureCHROMIUM"); | 13425 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedCopyTextureCHROMIUM"); |
| 13540 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, source_width, source_height, | 13426 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, source_width, source_height, |
| 13541 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); | 13427 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); |
| 13542 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedCopyTextureCHROMIUM"); | 13428 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedCopyTextureCHROMIUM"); |
| 13543 if (error != GL_NO_ERROR) { | 13429 if (error != GL_NO_ERROR) { |
| 13544 RestoreCurrentTextureBindings(&state_, GL_TEXTURE_2D); | 13430 RestoreCurrentTextureBindings(&state_, GL_TEXTURE_2D); |
| 13545 return; | 13431 return; |
| 13546 } | 13432 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 13558 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( | 13444 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| 13559 this, source_texture->target(), source_texture->service_id(), | 13445 this, source_texture->target(), source_texture->service_id(), |
| 13560 dest_texture->service_id(), source_width, source_height, | 13446 dest_texture->service_id(), source_width, source_height, |
| 13561 false, false, false, kIdentityMatrix); | 13447 false, false, false, kIdentityMatrix); |
| 13562 } else { | 13448 } else { |
| 13563 copy_texture_CHROMIUM_->DoCopyTexture( | 13449 copy_texture_CHROMIUM_->DoCopyTexture( |
| 13564 this, source_texture->target(), source_texture->service_id(), | 13450 this, source_texture->target(), source_texture->service_id(), |
| 13565 source_internal_format, dest_texture->service_id(), GL_RGBA, | 13451 source_internal_format, dest_texture->service_id(), GL_RGBA, |
| 13566 source_width, source_height, false, false, false); | 13452 source_width, source_height, false, false, false); |
| 13567 } | 13453 } |
| 13568 | |
| 13569 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); | |
| 13570 } | 13454 } |
| 13571 | 13455 |
| 13572 void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, | 13456 void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, |
| 13573 GLuint source_id, | 13457 GLuint source_id, |
| 13574 GLuint dest_id, | 13458 GLuint dest_id, |
| 13575 GLint xoffset, | 13459 GLint xoffset, |
| 13576 GLint yoffset, | 13460 GLint yoffset, |
| 13577 GLint x, | 13461 GLint x, |
| 13578 GLint y, | 13462 GLint y, |
| 13579 GLsizei width, | 13463 GLsizei width, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13708 } | 13592 } |
| 13709 } | 13593 } |
| 13710 } else { | 13594 } else { |
| 13711 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, | 13595 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, |
| 13712 true); | 13596 true); |
| 13713 } | 13597 } |
| 13714 | 13598 |
| 13715 ScopedTextureBinder binder( | 13599 ScopedTextureBinder binder( |
| 13716 &state_, dest_texture->service_id(), GL_TEXTURE_2D); | 13600 &state_, dest_texture->service_id(), GL_TEXTURE_2D); |
| 13717 | 13601 |
| 13718 ScopedModifyPixels modify(dest_texture_ref); | |
| 13719 | |
| 13720 // Try using GLImage::CopyTexSubImage when possible. | 13602 // Try using GLImage::CopyTexSubImage when possible. |
| 13721 if (image) { | 13603 if (image && |
| 13722 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), | 13604 image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), |
| 13723 gfx::Rect(x, y, width, height))) { | 13605 gfx::Rect(x, y, width, height))) { |
| 13724 return; | 13606 return; |
| 13725 } | |
| 13726 } | 13607 } |
| 13727 | 13608 |
| 13728 TRACE_EVENT0( | 13609 TRACE_EVENT0( |
| 13729 "gpu", | 13610 "gpu", |
| 13730 "GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM, fallback"); | 13611 "GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM, fallback"); |
| 13731 | 13612 |
| 13732 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); | 13613 DoCopyTexImageIfNeeded(source_texture, source_texture->target()); |
| 13733 | 13614 |
| 13734 // As a fallback, copy into a non-compressed GL_RGBA texture. | 13615 // As a fallback, copy into a non-compressed GL_RGBA texture. |
| 13735 if (dest_internal_format != GL_RGBA) { | 13616 if (dest_internal_format != GL_RGBA) { |
| 13736 // To preserve the contents of the original destination texture we must | 13617 // To preserve the contents of the original destination texture we must |
| 13737 // first copy the original destination texture to a temporary storage, then | 13618 // first copy the original destination texture to a temporary storage, then |
| 13738 // copy it back to the original destination texture. | 13619 // copy it back to the original destination texture. |
| 13739 GLuint tmp_service_id; | 13620 GLuint tmp_service_id; |
| 13740 glGenTextures(1, &tmp_service_id); | 13621 glGenTextures(1, &tmp_service_id); |
| 13741 DCHECK_NE(0u, tmp_service_id); | 13622 DCHECK_NE(0u, tmp_service_id); |
| 13742 | 13623 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13775 glDeleteTextures(1, &tmp_service_id); | 13656 glDeleteTextures(1, &tmp_service_id); |
| 13776 } | 13657 } |
| 13777 | 13658 |
| 13778 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. | 13659 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. |
| 13779 // crbug.com/226218. | 13660 // crbug.com/226218. |
| 13780 copy_texture_CHROMIUM_->DoCopySubTexture( | 13661 copy_texture_CHROMIUM_->DoCopySubTexture( |
| 13781 this, source_texture->target(), source_texture->service_id(), | 13662 this, source_texture->target(), source_texture->service_id(), |
| 13782 source_internal_format, dest_texture->service_id(), GL_RGBA, | 13663 source_internal_format, dest_texture->service_id(), GL_RGBA, |
| 13783 xoffset, yoffset, x, y, width, height, dest_width, dest_height, | 13664 xoffset, yoffset, x, y, width, height, dest_width, dest_height, |
| 13784 source_width, source_height, false, false, false); | 13665 source_width, source_height, false, false, false); |
| 13785 | |
| 13786 DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); | |
| 13787 } | 13666 } |
| 13788 | 13667 |
| 13789 void GLES2DecoderImpl::DoTexStorage2DEXT( | 13668 void GLES2DecoderImpl::DoTexStorage2DEXT( |
| 13790 GLenum target, | 13669 GLenum target, |
| 13791 GLint levels, | 13670 GLint levels, |
| 13792 GLenum internal_format, | 13671 GLenum internal_format, |
| 13793 GLsizei width, | 13672 GLsizei width, |
| 13794 GLsizei height) { | 13673 GLsizei height) { |
| 13795 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoTexStorage2DEXT", | 13674 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoTexStorage2DEXT", |
| 13796 "width", width, "height", height); | 13675 "width", width, "height", height); |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14189 // accidents. | 14068 // accidents. |
| 14190 TextureRef* texture_ref = | 14069 TextureRef* texture_ref = |
| 14191 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); | 14070 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); |
| 14192 if (!texture_ref) { | 14071 if (!texture_ref) { |
| 14193 LOCAL_SET_GL_ERROR( | 14072 LOCAL_SET_GL_ERROR( |
| 14194 GL_INVALID_OPERATION, | 14073 GL_INVALID_OPERATION, |
| 14195 "glBindTexImage2DCHROMIUM", "no texture bound"); | 14074 "glBindTexImage2DCHROMIUM", "no texture bound"); |
| 14196 return; | 14075 return; |
| 14197 } | 14076 } |
| 14198 | 14077 |
| 14199 gfx::GLImage* gl_image = image_manager()->LookupImage(image_id); | 14078 gfx::GLImage* image = image_manager()->LookupImage(image_id); |
| 14200 if (!gl_image) { | 14079 if (!image) { |
| 14201 LOCAL_SET_GL_ERROR( | 14080 LOCAL_SET_GL_ERROR( |
| 14202 GL_INVALID_OPERATION, | 14081 GL_INVALID_OPERATION, |
| 14203 "glBindTexImage2DCHROMIUM", "no image found with the given ID"); | 14082 "glBindTexImage2DCHROMIUM", "no image found with the given ID"); |
| 14204 return; | 14083 return; |
| 14205 } | 14084 } |
| 14206 | 14085 |
| 14086 Texture::ImageState image_state = Texture::UNBOUND; |
| 14087 |
| 14207 { | 14088 { |
| 14208 ScopedGLErrorSuppressor suppressor( | 14089 ScopedGLErrorSuppressor suppressor( |
| 14209 "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM", GetErrorState()); | 14090 "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM", GetErrorState()); |
| 14210 if (!gl_image->BindTexImage(target)) { | 14091 |
| 14211 LOCAL_SET_GL_ERROR( | 14092 // Note: We fallback to using CopyTexImage() before the texture is used |
| 14212 GL_INVALID_OPERATION, | 14093 // when BindTexImage() fails. |
| 14213 "glBindTexImage2DCHROMIUM", "fail to bind image with the given ID"); | 14094 if (image->BindTexImage(target)) |
| 14214 return; | 14095 image_state = Texture::BOUND; |
| 14215 } | |
| 14216 } | 14096 } |
| 14217 | 14097 |
| 14218 gfx::Size size = gl_image->GetSize(); | 14098 gfx::Size size = image->GetSize(); |
| 14099 GLenum internalformat = image->GetInternalFormat(); |
| 14219 texture_manager()->SetLevelInfo( | 14100 texture_manager()->SetLevelInfo( |
| 14220 texture_ref, target, 0, gl_image->GetInternalFormat(), size.width(), | 14101 texture_ref, target, 0, internalformat, size.width(), size.height(), 1, 0, |
| 14221 size.height(), 1, 0, gl_image->GetInternalFormat(), GL_UNSIGNED_BYTE, | 14102 internalformat, GL_UNSIGNED_BYTE, gfx::Rect(size)); |
| 14222 gfx::Rect(size)); | 14103 texture_manager()->SetLevelImage(texture_ref, target, 0, image, image_state); |
| 14223 texture_manager()->SetLevelImage(texture_ref, target, 0, gl_image); | |
| 14224 } | 14104 } |
| 14225 | 14105 |
| 14226 void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM( | 14106 void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM( |
| 14227 GLenum target, GLint image_id) { | 14107 GLenum target, GLint image_id) { |
| 14228 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM"); | 14108 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM"); |
| 14229 | 14109 |
| 14230 // Default target might be conceptually valid, but disallow it to avoid | 14110 // Default target might be conceptually valid, but disallow it to avoid |
| 14231 // accidents. | 14111 // accidents. |
| 14232 TextureRef* texture_ref = | 14112 TextureRef* texture_ref = |
| 14233 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); | 14113 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); |
| 14234 if (!texture_ref) { | 14114 if (!texture_ref) { |
| 14235 LOCAL_SET_GL_ERROR( | 14115 LOCAL_SET_GL_ERROR( |
| 14236 GL_INVALID_OPERATION, | 14116 GL_INVALID_OPERATION, |
| 14237 "glReleaseTexImage2DCHROMIUM", "no texture bound"); | 14117 "glReleaseTexImage2DCHROMIUM", "no texture bound"); |
| 14238 return; | 14118 return; |
| 14239 } | 14119 } |
| 14240 | 14120 |
| 14241 gfx::GLImage* gl_image = image_manager()->LookupImage(image_id); | 14121 gfx::GLImage* image = image_manager()->LookupImage(image_id); |
| 14242 if (!gl_image) { | 14122 if (!image) { |
| 14243 LOCAL_SET_GL_ERROR( | 14123 LOCAL_SET_GL_ERROR( |
| 14244 GL_INVALID_OPERATION, | 14124 GL_INVALID_OPERATION, |
| 14245 "glReleaseTexImage2DCHROMIUM", "no image found with the given ID"); | 14125 "glReleaseTexImage2DCHROMIUM", "no image found with the given ID"); |
| 14246 return; | 14126 return; |
| 14247 } | 14127 } |
| 14248 | 14128 |
| 14129 Texture::ImageState image_state; |
| 14130 |
| 14249 // Do nothing when image is not currently bound. | 14131 // Do nothing when image is not currently bound. |
| 14250 if (texture_ref->texture()->GetLevelImage(target, 0) != gl_image) | 14132 if (texture_ref->texture()->GetLevelImage(target, 0, &image_state) != image) |
| 14251 return; | 14133 return; |
| 14252 | 14134 |
| 14253 { | 14135 if (image_state == Texture::BOUND) { |
| 14254 ScopedGLErrorSuppressor suppressor( | 14136 ScopedGLErrorSuppressor suppressor( |
| 14255 "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM", GetErrorState()); | 14137 "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM", GetErrorState()); |
| 14256 gl_image->ReleaseTexImage(target); | 14138 |
| 14139 image->ReleaseTexImage(target); |
| 14140 texture_manager()->SetLevelInfo(texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0, |
| 14141 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); |
| 14257 } | 14142 } |
| 14258 | 14143 |
| 14259 texture_manager()->SetLevelInfo( | 14144 texture_manager()->SetLevelImage(texture_ref, target, 0, nullptr, |
| 14260 texture_ref, target, 0, gl_image->GetInternalFormat(), 0, 0, 1, 0, | 14145 Texture::UNBOUND); |
| 14261 gl_image->GetInternalFormat(), GL_UNSIGNED_BYTE, gfx::Rect()); | |
| 14262 } | 14146 } |
| 14263 | 14147 |
| 14264 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( | 14148 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( |
| 14265 uint32 immediate_data_size, | 14149 uint32 immediate_data_size, |
| 14266 const void* cmd_data) { | 14150 const void* cmd_data) { |
| 14267 const gles2::cmds::TraceBeginCHROMIUM& c = | 14151 const gles2::cmds::TraceBeginCHROMIUM& c = |
| 14268 *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); | 14152 *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); |
| 14269 Bucket* category_bucket = GetBucket(c.category_bucket_id); | 14153 Bucket* category_bucket = GetBucket(c.category_bucket_id); |
| 14270 Bucket* name_bucket = GetBucket(c.name_bucket_id); | 14154 Bucket* name_bucket = GetBucket(c.name_bucket_id); |
| 14271 if (!category_bucket || category_bucket->size() == 0 || | 14155 if (!category_bucket || category_bucket->size() == 0 || |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14606 // the contexts in the share group. | 14490 // the contexts in the share group. |
| 14607 LOG(ERROR) << "glUnmapBuffer unexpectedly returned GL_FALSE"; | 14491 LOG(ERROR) << "glUnmapBuffer unexpectedly returned GL_FALSE"; |
| 14608 // Need to lose current context before broadcasting! | 14492 // Need to lose current context before broadcasting! |
| 14609 MarkContextLost(error::kGuilty); | 14493 MarkContextLost(error::kGuilty); |
| 14610 group_->LoseContexts(error::kInnocent); | 14494 group_->LoseContexts(error::kInnocent); |
| 14611 return error::kLostContext; | 14495 return error::kLostContext; |
| 14612 } | 14496 } |
| 14613 return error::kNoError; | 14497 return error::kNoError; |
| 14614 } | 14498 } |
| 14615 | 14499 |
| 14616 void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( | |
| 14617 TextureRef* texture_ref) { | |
| 14618 Texture* texture = texture_ref->texture(); | |
| 14619 DoDidUseTexImageIfNeeded(texture, texture->target()); | |
| 14620 } | |
| 14621 | |
| 14622 // Note that GL_LOST_CONTEXT is specific to GLES. | 14500 // Note that GL_LOST_CONTEXT is specific to GLES. |
| 14623 // For desktop GL we have to query the reset status proactively. | 14501 // For desktop GL we have to query the reset status proactively. |
| 14624 void GLES2DecoderImpl::OnContextLostError() { | 14502 void GLES2DecoderImpl::OnContextLostError() { |
| 14625 if (!WasContextLost()) { | 14503 if (!WasContextLost()) { |
| 14626 // Need to lose current context before broadcasting! | 14504 // Need to lose current context before broadcasting! |
| 14627 CheckResetStatus(); | 14505 CheckResetStatus(); |
| 14628 group_->LoseContexts(error::kUnknown); | 14506 group_->LoseContexts(error::kUnknown); |
| 14629 reset_by_robustness_extension_ = true; | 14507 reset_by_robustness_extension_ = true; |
| 14630 } | 14508 } |
| 14631 } | 14509 } |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15066 return error::kNoError; | 14944 return error::kNoError; |
| 15067 } | 14945 } |
| 15068 | 14946 |
| 15069 // Include the auto-generated part of this file. We split this because it means | 14947 // Include the auto-generated part of this file. We split this because it means |
| 15070 // we can easily edit the non-auto generated parts right here in this file | 14948 // we can easily edit the non-auto generated parts right here in this file |
| 15071 // instead of having to edit some template or the code generator. | 14949 // instead of having to edit some template or the code generator. |
| 15072 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 14950 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15073 | 14951 |
| 15074 } // namespace gles2 | 14952 } // namespace gles2 |
| 15075 } // namespace gpu | 14953 } // namespace gpu |
| OLD | NEW |