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

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: workaround gtf 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 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after
3592 state_.UnbindSampler(sampler); 3593 state_.UnbindSampler(sampler);
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() {
3603 DCHECK(surface_);
3602 if (!context_.get()) 3604 if (!context_.get())
3603 return false; 3605 return false;
3604 3606
3605 if (WasContextLost()) { 3607 if (WasContextLost()) {
3606 LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current."; 3608 LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current.";
3607 return false; 3609 return false;
3608 } 3610 }
3609 3611
3610 if (!context_->MakeCurrent(surface_.get())) { 3612 if (!context_->MakeCurrent(surface_.get())) {
3611 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent."; 3613 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent.";
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
4149 it != texture_to_io_surface_map_.end(); ++it) { 4151 it != texture_to_io_surface_map_.end(); ++it) {
4150 CFRelease(it->second); 4152 CFRelease(it->second);
4151 } 4153 }
4152 texture_to_io_surface_map_.clear(); 4154 texture_to_io_surface_map_.clear();
4153 #endif 4155 #endif
4154 } 4156 }
4155 4157
4156 void GLES2DecoderImpl::SetSurface( 4158 void GLES2DecoderImpl::SetSurface(
4157 const scoped_refptr<gfx::GLSurface>& surface) { 4159 const scoped_refptr<gfx::GLSurface>& surface) {
4158 DCHECK(context_->IsCurrent(NULL)); 4160 DCHECK(context_->IsCurrent(NULL));
4159 DCHECK(surface_.get()); 4161 DCHECK(surface);
4160 surface_ = surface; 4162 surface_ = surface;
4161 RestoreCurrentFramebufferBindings(); 4163 RestoreCurrentFramebufferBindings();
4162 } 4164 }
4163 4165
4166 void GLES2DecoderImpl::ReleaseSurface() {
4167 if (!context_.get())
4168 return;
4169 if (WasContextLost()) {
4170 DLOG(ERROR) << " GLES2DecoderImpl: Trying to release lost context.";
4171 return;
4172 }
4173 context_->ReleaseCurrent(surface_.get());
4174 surface_ = nullptr;
4175 }
4176
4164 void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) { 4177 void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) {
4165 if (!offscreen_saved_color_texture_.get()) { 4178 if (!offscreen_saved_color_texture_.get()) {
4166 LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context"; 4179 LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context";
4167 return; 4180 return;
4168 } 4181 }
4169 if (!offscreen_saved_color_texture_info_.get()) { 4182 if (!offscreen_saved_color_texture_info_.get()) {
4170 GLuint service_id = offscreen_saved_color_texture_->id(); 4183 GLuint service_id = offscreen_saved_color_texture_->id();
4171 offscreen_saved_color_texture_info_ = TextureRef::Create( 4184 offscreen_saved_color_texture_info_ = TextureRef::Create(
4172 texture_manager(), 0, service_id); 4185 texture_manager(), 0, service_id);
4173 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), 4186 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(),
(...skipping 11723 matching lines...) Expand 10 before | Expand all | Expand 10 after
15897 } 15910 }
15898 15911
15899 // Include the auto-generated part of this file. We split this because it means 15912 // 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 15913 // 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. 15914 // instead of having to edit some template or the code generator.
15902 #include "base/macros.h" 15915 #include "base/macros.h"
15903 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15916 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15904 15917
15905 } // namespace gles2 15918 } // namespace gles2
15906 } // namespace gpu 15919 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698