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

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

Issue 375733004: Fixes for re-enabling more MSVC level 4 warnings: gpu/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "gpu/command_buffer/service/program_manager.h" 51 #include "gpu/command_buffer/service/program_manager.h"
52 #include "gpu/command_buffer/service/query_manager.h" 52 #include "gpu/command_buffer/service/query_manager.h"
53 #include "gpu/command_buffer/service/renderbuffer_manager.h" 53 #include "gpu/command_buffer/service/renderbuffer_manager.h"
54 #include "gpu/command_buffer/service/shader_manager.h" 54 #include "gpu/command_buffer/service/shader_manager.h"
55 #include "gpu/command_buffer/service/shader_translator.h" 55 #include "gpu/command_buffer/service/shader_translator.h"
56 #include "gpu/command_buffer/service/shader_translator_cache.h" 56 #include "gpu/command_buffer/service/shader_translator_cache.h"
57 #include "gpu/command_buffer/service/texture_manager.h" 57 #include "gpu/command_buffer/service/texture_manager.h"
58 #include "gpu/command_buffer/service/vertex_array_manager.h" 58 #include "gpu/command_buffer/service/vertex_array_manager.h"
59 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 59 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
60 #include "third_party/smhasher/src/City.h" 60 #include "third_party/smhasher/src/City.h"
61 #include "ui/gl/gl_bindings.h"
62 #include "ui/gl/gl_fence.h" 61 #include "ui/gl/gl_fence.h"
63 #include "ui/gl/gl_image.h" 62 #include "ui/gl/gl_image.h"
64 #include "ui/gl/gl_implementation.h" 63 #include "ui/gl/gl_implementation.h"
65 #include "ui/gl/gl_surface.h" 64 #include "ui/gl/gl_surface.h"
66 65
67 #if defined(OS_MACOSX) 66 #if defined(OS_MACOSX)
68 #include <IOSurface/IOSurfaceAPI.h> 67 #include <IOSurface/IOSurfaceAPI.h>
69 // Note that this must be included after gl_bindings.h to avoid conflicts. 68 // Note that this must be included after gl_bindings.h to avoid conflicts.
70 #include <OpenGL/CGLIOSurface.h> 69 #include <OpenGL/CGLIOSurface.h>
71 #endif 70 #endif
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 virtual ~AsyncUploadTokenCompletionObserver() { 548 virtual ~AsyncUploadTokenCompletionObserver() {
550 } 549 }
551 550
552 uint32 async_upload_token_; 551 uint32 async_upload_token_;
553 552
554 DISALLOW_COPY_AND_ASSIGN(AsyncUploadTokenCompletionObserver); 553 DISALLOW_COPY_AND_ASSIGN(AsyncUploadTokenCompletionObserver);
555 }; 554 };
556 555
557 // } // anonymous namespace. 556 // } // anonymous namespace.
558 557
558 static const GLuint kDefaultStencilMask = static_cast<GLuint>(-1);
559
559 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id, 560 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id,
560 uint32* service_texture_id) { 561 uint32* service_texture_id) {
561 return false; 562 return false;
562 } 563 }
563 564
564 GLES2Decoder::GLES2Decoder() 565 GLES2Decoder::GLES2Decoder()
565 : initialized_(false), 566 : initialized_(false),
566 debug_(false), 567 debug_(false),
567 log_commands_(false) { 568 log_commands_(false) {
568 } 569 }
(...skipping 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after
3100 3101
3101 bool GLES2DecoderImpl::CheckFramebufferValid( 3102 bool GLES2DecoderImpl::CheckFramebufferValid(
3102 Framebuffer* framebuffer, 3103 Framebuffer* framebuffer,
3103 GLenum target, const char* func_name) { 3104 GLenum target, const char* func_name) {
3104 if (!framebuffer) { 3105 if (!framebuffer) {
3105 if (backbuffer_needs_clear_bits_) { 3106 if (backbuffer_needs_clear_bits_) {
3106 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat( 3107 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat(
3107 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1); 3108 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1);
3108 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 3109 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
3109 glClearStencil(0); 3110 glClearStencil(0);
3110 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); 3111 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
3111 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); 3112 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
3112 glClearDepth(1.0f); 3113 glClearDepth(1.0f);
3113 state_.SetDeviceDepthMask(GL_TRUE); 3114 state_.SetDeviceDepthMask(GL_TRUE);
3114 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 3115 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
3115 bool reset_draw_buffer = false; 3116 bool reset_draw_buffer = false;
3116 if ((backbuffer_needs_clear_bits_ | GL_COLOR_BUFFER_BIT) != 0 && 3117 if ((backbuffer_needs_clear_bits_ | GL_COLOR_BUFFER_BIT) != 0 &&
3117 group_->draw_buffer() == GL_NONE) { 3118 group_->draw_buffer() == GL_NONE) {
3118 reset_draw_buffer = true; 3119 reset_draw_buffer = true;
3119 GLenum buf = GL_BACK; 3120 GLenum buf = GL_BACK;
3120 if (GetBackbufferServiceId() != 0) // emulated backbuffer 3121 if (GetBackbufferServiceId() != 0) // emulated backbuffer
3121 buf = GL_COLOR_ATTACHMENT0; 3122 buf = GL_COLOR_ATTACHMENT0;
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
3622 return false; 3623 return false;
3623 } 3624 }
3624 3625
3625 // Clear the target frame buffer. 3626 // Clear the target frame buffer.
3626 { 3627 {
3627 ScopedFrameBufferBinder binder(this, offscreen_target_frame_buffer_->id()); 3628 ScopedFrameBufferBinder binder(this, offscreen_target_frame_buffer_->id());
3628 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat( 3629 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat(
3629 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1); 3630 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1);
3630 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 3631 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
3631 glClearStencil(0); 3632 glClearStencil(0);
3632 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); 3633 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
3633 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); 3634 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
3634 glClearDepth(0); 3635 glClearDepth(0);
3635 state_.SetDeviceDepthMask(GL_TRUE); 3636 state_.SetDeviceDepthMask(GL_TRUE);
3636 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 3637 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
3637 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 3638 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
3638 RestoreClearState(); 3639 RestoreClearState();
3639 } 3640 }
3640 3641
3641 // Destroy the offscreen resolved framebuffers. 3642 // Destroy the offscreen resolved framebuffers.
3642 if (offscreen_resolved_frame_buffer_.get()) 3643 if (offscreen_resolved_frame_buffer_.get())
3643 offscreen_resolved_frame_buffer_->Destroy(); 3644 offscreen_resolved_frame_buffer_->Destroy();
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
5053 framebuffer->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f : 5054 framebuffer->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f :
5054 1.0f); 5055 1.0f);
5055 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 5056 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
5056 clear_bits |= GL_COLOR_BUFFER_BIT; 5057 clear_bits |= GL_COLOR_BUFFER_BIT;
5057 framebuffer->PrepareDrawBuffersForClear(); 5058 framebuffer->PrepareDrawBuffersForClear();
5058 } 5059 }
5059 5060
5060 if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) || 5061 if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) ||
5061 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { 5062 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
5062 glClearStencil(0); 5063 glClearStencil(0);
5063 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); 5064 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
5064 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); 5065 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
5065 clear_bits |= GL_STENCIL_BUFFER_BIT; 5066 clear_bits |= GL_STENCIL_BUFFER_BIT;
5066 } 5067 }
5067 5068
5068 if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) || 5069 if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) ||
5069 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { 5070 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
5070 glClearDepth(1.0f); 5071 glClearDepth(1.0f);
5071 state_.SetDeviceDepthMask(GL_TRUE); 5072 state_.SetDeviceDepthMask(GL_TRUE);
5072 clear_bits |= GL_DEPTH_BUFFER_BIT; 5073 clear_bits |= GL_DEPTH_BUFFER_BIT;
5073 } 5074 }
5074 5075
(...skipping 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after
7853 GL_DEPTH_ATTACHMENT; 7854 GL_DEPTH_ATTACHMENT;
7854 7855
7855 glFramebufferTexture2DEXT( 7856 glFramebufferTexture2DEXT(
7856 GL_DRAW_FRAMEBUFFER_EXT, attachment, target, service_id, level); 7857 GL_DRAW_FRAMEBUFFER_EXT, attachment, target, service_id, level);
7857 // ANGLE promises a depth only attachment ok. 7858 // ANGLE promises a depth only attachment ok.
7858 if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) != 7859 if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) !=
7859 GL_FRAMEBUFFER_COMPLETE) { 7860 GL_FRAMEBUFFER_COMPLETE) {
7860 return false; 7861 return false;
7861 } 7862 }
7862 glClearStencil(0); 7863 glClearStencil(0);
7863 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); 7864 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
7864 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); 7865 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
7865 glClearDepth(1.0f); 7866 glClearDepth(1.0f);
7866 state_.SetDeviceDepthMask(GL_TRUE); 7867 state_.SetDeviceDepthMask(GL_TRUE);
7867 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 7868 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
7868 glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0)); 7869 glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0));
7869 7870
7870 RestoreClearState(); 7871 RestoreClearState();
7871 7872
7872 glDeleteFramebuffersEXT(1, &fb); 7873 glDeleteFramebuffersEXT(1, &fb);
7873 Framebuffer* framebuffer = 7874 Framebuffer* framebuffer =
7874 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); 7875 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after
9998 // needed because it takes 10s of milliseconds to initialize. 9999 // needed because it takes 10s of milliseconds to initialize.
9999 if (!copy_texture_CHROMIUM_.get()) { 10000 if (!copy_texture_CHROMIUM_.get()) {
10000 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); 10001 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM");
10001 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); 10002 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager());
10002 copy_texture_CHROMIUM_->Initialize(this); 10003 copy_texture_CHROMIUM_->Initialize(this);
10003 RestoreCurrentFramebufferBindings(); 10004 RestoreCurrentFramebufferBindings();
10004 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR) 10005 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR)
10005 return; 10006 return;
10006 } 10007 }
10007 10008
10008 GLenum dest_type_previous; 10009 GLenum dest_type_previous = dest_type;
10009 GLenum dest_internal_format; 10010 GLenum dest_internal_format = internal_format;
10010 bool dest_level_defined = dest_texture->GetLevelSize( 10011 bool dest_level_defined = dest_texture->GetLevelSize(
10011 GL_TEXTURE_2D, level, &dest_width, &dest_height); 10012 GL_TEXTURE_2D, level, &dest_width, &dest_height);
10012 10013
10013 if (dest_level_defined) { 10014 if (dest_level_defined) {
10014 dest_texture->GetLevelType(GL_TEXTURE_2D, level, &dest_type_previous, 10015 dest_texture->GetLevelType(GL_TEXTURE_2D, level, &dest_type_previous,
10015 &dest_internal_format); 10016 &dest_internal_format);
10016 } 10017 }
10017 10018
10018 // Resize the destination texture to the dimensions of the source texture. 10019 // Resize the destination texture to the dimensions of the source texture.
10019 if (!dest_level_defined || dest_width != source_width || 10020 if (!dest_level_defined || dest_width != source_width ||
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
10882 } 10883 }
10883 } 10884 }
10884 10885
10885 // Include the auto-generated part of this file. We split this because it means 10886 // Include the auto-generated part of this file. We split this because it means
10886 // we can easily edit the non-auto generated parts right here in this file 10887 // we can easily edit the non-auto generated parts right here in this file
10887 // instead of having to edit some template or the code generator. 10888 // instead of having to edit some template or the code generator.
10888 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10889 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10889 10890
10890 } // namespace gles2 10891 } // namespace gles2
10891 } // namespace gpu 10892 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698