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

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: Fix compile 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
559 const unsigned int GLES2Decoder::kDefaultStencilMask =
560 static_cast<unsigned int>(-1);
561
559 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id, 562 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id,
560 uint32* service_texture_id) { 563 uint32* service_texture_id) {
561 return false; 564 return false;
562 } 565 }
563 566
564 GLES2Decoder::GLES2Decoder() 567 GLES2Decoder::GLES2Decoder()
565 : initialized_(false), 568 : initialized_(false),
566 debug_(false), 569 debug_(false),
567 log_commands_(false) { 570 log_commands_(false) {
568 } 571 }
(...skipping 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after
3100 3103
3101 bool GLES2DecoderImpl::CheckFramebufferValid( 3104 bool GLES2DecoderImpl::CheckFramebufferValid(
3102 Framebuffer* framebuffer, 3105 Framebuffer* framebuffer,
3103 GLenum target, const char* func_name) { 3106 GLenum target, const char* func_name) {
3104 if (!framebuffer) { 3107 if (!framebuffer) {
3105 if (backbuffer_needs_clear_bits_) { 3108 if (backbuffer_needs_clear_bits_) {
3106 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat( 3109 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat(
3107 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1); 3110 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1);
3108 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 3111 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
3109 glClearStencil(0); 3112 glClearStencil(0);
3110 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); 3113 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
3111 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); 3114 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
3112 glClearDepth(1.0f); 3115 glClearDepth(1.0f);
3113 state_.SetDeviceDepthMask(GL_TRUE); 3116 state_.SetDeviceDepthMask(GL_TRUE);
3114 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 3117 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
3115 bool reset_draw_buffer = false; 3118 bool reset_draw_buffer = false;
3116 if ((backbuffer_needs_clear_bits_ | GL_COLOR_BUFFER_BIT) != 0 && 3119 if ((backbuffer_needs_clear_bits_ | GL_COLOR_BUFFER_BIT) != 0 &&
3117 group_->draw_buffer() == GL_NONE) { 3120 group_->draw_buffer() == GL_NONE) {
3118 reset_draw_buffer = true; 3121 reset_draw_buffer = true;
3119 GLenum buf = GL_BACK; 3122 GLenum buf = GL_BACK;
3120 if (GetBackbufferServiceId() != 0) // emulated backbuffer 3123 if (GetBackbufferServiceId() != 0) // emulated backbuffer
3121 buf = GL_COLOR_ATTACHMENT0; 3124 buf = GL_COLOR_ATTACHMENT0;
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
3622 return false; 3625 return false;
3623 } 3626 }
3624 3627
3625 // Clear the target frame buffer. 3628 // Clear the target frame buffer.
3626 { 3629 {
3627 ScopedFrameBufferBinder binder(this, offscreen_target_frame_buffer_->id()); 3630 ScopedFrameBufferBinder binder(this, offscreen_target_frame_buffer_->id());
3628 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat( 3631 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat(
3629 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1); 3632 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1);
3630 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 3633 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
3631 glClearStencil(0); 3634 glClearStencil(0);
3632 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); 3635 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
3633 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); 3636 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
3634 glClearDepth(0); 3637 glClearDepth(0);
3635 state_.SetDeviceDepthMask(GL_TRUE); 3638 state_.SetDeviceDepthMask(GL_TRUE);
3636 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 3639 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
3637 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 3640 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
3638 RestoreClearState(); 3641 RestoreClearState();
3639 } 3642 }
3640 3643
3641 // Destroy the offscreen resolved framebuffers. 3644 // Destroy the offscreen resolved framebuffers.
3642 if (offscreen_resolved_frame_buffer_.get()) 3645 if (offscreen_resolved_frame_buffer_.get())
3643 offscreen_resolved_frame_buffer_->Destroy(); 3646 offscreen_resolved_frame_buffer_->Destroy();
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
5053 framebuffer->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f : 5056 framebuffer->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f :
5054 1.0f); 5057 1.0f);
5055 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 5058 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
5056 clear_bits |= GL_COLOR_BUFFER_BIT; 5059 clear_bits |= GL_COLOR_BUFFER_BIT;
5057 framebuffer->PrepareDrawBuffersForClear(); 5060 framebuffer->PrepareDrawBuffersForClear();
5058 } 5061 }
5059 5062
5060 if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) || 5063 if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) ||
5061 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { 5064 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
5062 glClearStencil(0); 5065 glClearStencil(0);
5063 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); 5066 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
5064 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); 5067 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
5065 clear_bits |= GL_STENCIL_BUFFER_BIT; 5068 clear_bits |= GL_STENCIL_BUFFER_BIT;
5066 } 5069 }
5067 5070
5068 if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) || 5071 if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) ||
5069 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { 5072 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
5070 glClearDepth(1.0f); 5073 glClearDepth(1.0f);
5071 state_.SetDeviceDepthMask(GL_TRUE); 5074 state_.SetDeviceDepthMask(GL_TRUE);
5072 clear_bits |= GL_DEPTH_BUFFER_BIT; 5075 clear_bits |= GL_DEPTH_BUFFER_BIT;
5073 } 5076 }
5074 5077
(...skipping 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after
7853 GL_DEPTH_ATTACHMENT; 7856 GL_DEPTH_ATTACHMENT;
7854 7857
7855 glFramebufferTexture2DEXT( 7858 glFramebufferTexture2DEXT(
7856 GL_DRAW_FRAMEBUFFER_EXT, attachment, target, service_id, level); 7859 GL_DRAW_FRAMEBUFFER_EXT, attachment, target, service_id, level);
7857 // ANGLE promises a depth only attachment ok. 7860 // ANGLE promises a depth only attachment ok.
7858 if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) != 7861 if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) !=
7859 GL_FRAMEBUFFER_COMPLETE) { 7862 GL_FRAMEBUFFER_COMPLETE) {
7860 return false; 7863 return false;
7861 } 7864 }
7862 glClearStencil(0); 7865 glClearStencil(0);
7863 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); 7866 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
7864 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); 7867 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
7865 glClearDepth(1.0f); 7868 glClearDepth(1.0f);
7866 state_.SetDeviceDepthMask(GL_TRUE); 7869 state_.SetDeviceDepthMask(GL_TRUE);
7867 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 7870 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
7868 glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0)); 7871 glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0));
7869 7872
7870 RestoreClearState(); 7873 RestoreClearState();
7871 7874
7872 glDeleteFramebuffersEXT(1, &fb); 7875 glDeleteFramebuffersEXT(1, &fb);
7873 Framebuffer* framebuffer = 7876 Framebuffer* framebuffer =
7874 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); 7877 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. 10001 // needed because it takes 10s of milliseconds to initialize.
9999 if (!copy_texture_CHROMIUM_.get()) { 10002 if (!copy_texture_CHROMIUM_.get()) {
10000 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); 10003 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM");
10001 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); 10004 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager());
10002 copy_texture_CHROMIUM_->Initialize(this); 10005 copy_texture_CHROMIUM_->Initialize(this);
10003 RestoreCurrentFramebufferBindings(); 10006 RestoreCurrentFramebufferBindings();
10004 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR) 10007 if (LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM") != GL_NO_ERROR)
10005 return; 10008 return;
10006 } 10009 }
10007 10010
10008 GLenum dest_type_previous; 10011 GLenum dest_type_previous = dest_type;
10009 GLenum dest_internal_format; 10012 GLenum dest_internal_format = internal_format;
10010 bool dest_level_defined = dest_texture->GetLevelSize( 10013 bool dest_level_defined = dest_texture->GetLevelSize(
10011 GL_TEXTURE_2D, level, &dest_width, &dest_height); 10014 GL_TEXTURE_2D, level, &dest_width, &dest_height);
10012 10015
10013 if (dest_level_defined) { 10016 if (dest_level_defined) {
10014 dest_texture->GetLevelType(GL_TEXTURE_2D, level, &dest_type_previous, 10017 dest_texture->GetLevelType(GL_TEXTURE_2D, level, &dest_type_previous,
10015 &dest_internal_format); 10018 &dest_internal_format);
10016 } 10019 }
10017 10020
10018 // Resize the destination texture to the dimensions of the source texture. 10021 // Resize the destination texture to the dimensions of the source texture.
10019 if (!dest_level_defined || dest_width != source_width || 10022 if (!dest_level_defined || dest_width != source_width ||
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
10882 } 10885 }
10883 } 10886 }
10884 10887
10885 // Include the auto-generated part of this file. We split this because it means 10888 // 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 10889 // 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. 10890 // instead of having to edit some template or the code generator.
10888 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10891 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10889 10892
10890 } // namespace gles2 10893 } // namespace gles2
10891 } // namespace gpu 10894 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698