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

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

Issue 1714883002: command_buffer_gles2: Implement EGL default Display as a global object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@command_buffer_gles2-multiple-contexts
Patch Set: win fixes Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 570
571 // Overridden from GLES2Decoder. 571 // Overridden from GLES2Decoder.
572 bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, 572 bool Initialize(const scoped_refptr<gfx::GLSurface>& surface,
573 const scoped_refptr<gfx::GLContext>& context, 573 const scoped_refptr<gfx::GLContext>& context,
574 bool offscreen, 574 bool offscreen,
575 const gfx::Size& offscreen_size, 575 const gfx::Size& offscreen_size,
576 const DisallowedFeatures& disallowed_features, 576 const DisallowedFeatures& disallowed_features,
577 const std::vector<int32_t>& attribs) override; 577 const std::vector<int32_t>& attribs) override;
578 void Destroy(bool have_context) override; 578 void Destroy(bool have_context) override;
579 void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override; 579 void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override;
580 void ReleaseSurface() override;
580 void ProduceFrontBuffer(const Mailbox& mailbox) override; 581 void ProduceFrontBuffer(const Mailbox& mailbox) override;
581 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; 582 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override;
582 void UpdateParentTextureInfo(); 583 void UpdateParentTextureInfo();
583 bool MakeCurrent() override; 584 bool MakeCurrent() override;
584 GLES2Util* GetGLES2Util() override { return &util_; } 585 GLES2Util* GetGLES2Util() override { return &util_; }
585 gfx::GLContext* GetGLContext() override { return context_.get(); } 586 gfx::GLContext* GetGLContext() override { return context_.get(); }
586 ContextGroup* GetContextGroup() override { return group_.get(); } 587 ContextGroup* GetContextGroup() override { return group_.get(); }
587 Capabilities GetCapabilities() override; 588 Capabilities GetCapabilities() override;
588 void RestoreState(const ContextState* prev_state) override; 589 void RestoreState(const ContextState* prev_state) override;
589 590
(...skipping 3003 matching lines...) Expand 10 before | Expand all | Expand 10 after
3593 3594
3594 RemoveSampler(client_ids[ii]); 3595 RemoveSampler(client_ids[ii]);
3595 } 3596 }
3596 } 3597 }
3597 } 3598 }
3598 3599
3599 // } // anonymous namespace 3600 // } // anonymous namespace
3600 3601
3601 bool GLES2DecoderImpl::MakeCurrent() { 3602 bool GLES2DecoderImpl::MakeCurrent() {
3602 if (!context_.get()) 3603 if (!context_.get())
3603 return false; 3604 return false;
piman 2016/02/23 23:37:16 nit: add a DCHECK(surface_), that should catch cas
Kimmo Kinnunen 2016/02/24 07:33:26 Done.
3604 3605
3605 if (WasContextLost()) { 3606 if (WasContextLost()) {
3606 LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current."; 3607 LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current.";
3607 return false; 3608 return false;
3608 } 3609 }
3609 3610
3610 if (!context_->MakeCurrent(surface_.get())) { 3611 if (!context_->MakeCurrent(surface_.get())) {
3611 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent."; 3612 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent.";
3612 MarkContextLost(error::kMakeCurrentFailed); 3613 MarkContextLost(error::kMakeCurrentFailed);
3613 group_->LoseContexts(error::kUnknown); 3614 group_->LoseContexts(error::kUnknown);
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
4149 it != texture_to_io_surface_map_.end(); ++it) { 4150 it != texture_to_io_surface_map_.end(); ++it) {
4150 CFRelease(it->second); 4151 CFRelease(it->second);
4151 } 4152 }
4152 texture_to_io_surface_map_.clear(); 4153 texture_to_io_surface_map_.clear();
4153 #endif 4154 #endif
4154 } 4155 }
4155 4156
4156 void GLES2DecoderImpl::SetSurface( 4157 void GLES2DecoderImpl::SetSurface(
4157 const scoped_refptr<gfx::GLSurface>& surface) { 4158 const scoped_refptr<gfx::GLSurface>& surface) {
4158 DCHECK(context_->IsCurrent(NULL)); 4159 DCHECK(context_->IsCurrent(NULL));
4159 DCHECK(surface_.get()); 4160 DCHECK(surface);
4160 surface_ = surface; 4161 surface_ = surface;
4161 RestoreCurrentFramebufferBindings(); 4162 RestoreCurrentFramebufferBindings();
4162 } 4163 }
4163 4164
4165 void GLES2DecoderImpl::ReleaseSurface() {
4166 if (!context_.get())
4167 return;
4168 if (WasContextLost()) {
4169 LOG(ERROR) << " GLES2DecoderImpl: Trying to release lost context.";
piman 2016/02/23 23:37:16 nit: DLOG
Kimmo Kinnunen 2016/02/24 07:33:26 Done.
4170 return;
4171 }
4172 context_->ReleaseCurrent(surface_.get());
4173 surface_ = nullptr;
4174 }
4175
4164 void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) { 4176 void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) {
4165 if (!offscreen_saved_color_texture_.get()) { 4177 if (!offscreen_saved_color_texture_.get()) {
4166 LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context"; 4178 LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context";
4167 return; 4179 return;
4168 } 4180 }
4169 if (!offscreen_saved_color_texture_info_.get()) { 4181 if (!offscreen_saved_color_texture_info_.get()) {
4170 GLuint service_id = offscreen_saved_color_texture_->id(); 4182 GLuint service_id = offscreen_saved_color_texture_->id();
4171 offscreen_saved_color_texture_info_ = TextureRef::Create( 4183 offscreen_saved_color_texture_info_ = TextureRef::Create(
4172 texture_manager(), 0, service_id); 4184 texture_manager(), 0, service_id);
4173 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), 4185 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(),
(...skipping 11723 matching lines...) Expand 10 before | Expand all | Expand 10 after
15897 } 15909 }
15898 15910
15899 // Include the auto-generated part of this file. We split this because it means 15911 // Include the auto-generated part of this file. We split this because it means
15900 // we can easily edit the non-auto generated parts right here in this file 15912 // we can easily edit the non-auto generated parts right here in this file
15901 // instead of having to edit some template or the code generator. 15913 // instead of having to edit some template or the code generator.
15902 #include "base/macros.h" 15914 #include "base/macros.h"
15903 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15915 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15904 15916
15905 } // namespace gles2 15917 } // namespace gles2
15906 } // namespace gpu 15918 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698