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

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

Issue 1739033002: Revert of 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: 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;
581 void ProduceFrontBuffer(const Mailbox& mailbox) override; 580 void ProduceFrontBuffer(const Mailbox& mailbox) override;
582 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; 581 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override;
583 void UpdateParentTextureInfo(); 582 void UpdateParentTextureInfo();
584 bool MakeCurrent() override; 583 bool MakeCurrent() override;
585 GLES2Util* GetGLES2Util() override { return &util_; } 584 GLES2Util* GetGLES2Util() override { return &util_; }
586 gfx::GLContext* GetGLContext() override { return context_.get(); } 585 gfx::GLContext* GetGLContext() override { return context_.get(); }
587 ContextGroup* GetContextGroup() override { return group_.get(); } 586 ContextGroup* GetContextGroup() override { return group_.get(); }
588 Capabilities GetCapabilities() override; 587 Capabilities GetCapabilities() override;
589 void RestoreState(const ContextState* prev_state) override; 588 void RestoreState(const ContextState* prev_state) override;
590 589
(...skipping 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after
3593 state_.UnbindSampler(sampler); 3592 state_.UnbindSampler(sampler);
3594 3593
3595 RemoveSampler(client_ids[ii]); 3594 RemoveSampler(client_ids[ii]);
3596 } 3595 }
3597 } 3596 }
3598 } 3597 }
3599 3598
3600 // } // anonymous namespace 3599 // } // anonymous namespace
3601 3600
3602 bool GLES2DecoderImpl::MakeCurrent() { 3601 bool GLES2DecoderImpl::MakeCurrent() {
3603 DCHECK(surface_);
3604 if (!context_.get()) 3602 if (!context_.get())
3605 return false; 3603 return false;
3606 3604
3607 if (WasContextLost()) { 3605 if (WasContextLost()) {
3608 LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current."; 3606 LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current.";
3609 return false; 3607 return false;
3610 } 3608 }
3611 3609
3612 if (!context_->MakeCurrent(surface_.get())) { 3610 if (!context_->MakeCurrent(surface_.get())) {
3613 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent."; 3611 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent.";
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
4151 it != texture_to_io_surface_map_.end(); ++it) { 4149 it != texture_to_io_surface_map_.end(); ++it) {
4152 CFRelease(it->second); 4150 CFRelease(it->second);
4153 } 4151 }
4154 texture_to_io_surface_map_.clear(); 4152 texture_to_io_surface_map_.clear();
4155 #endif 4153 #endif
4156 } 4154 }
4157 4155
4158 void GLES2DecoderImpl::SetSurface( 4156 void GLES2DecoderImpl::SetSurface(
4159 const scoped_refptr<gfx::GLSurface>& surface) { 4157 const scoped_refptr<gfx::GLSurface>& surface) {
4160 DCHECK(context_->IsCurrent(NULL)); 4158 DCHECK(context_->IsCurrent(NULL));
4161 DCHECK(surface); 4159 DCHECK(surface_.get());
4162 surface_ = surface; 4160 surface_ = surface;
4163 RestoreCurrentFramebufferBindings(); 4161 RestoreCurrentFramebufferBindings();
4164 } 4162 }
4165 4163
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
4177 void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) { 4164 void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) {
4178 if (!offscreen_saved_color_texture_.get()) { 4165 if (!offscreen_saved_color_texture_.get()) {
4179 LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context"; 4166 LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context";
4180 return; 4167 return;
4181 } 4168 }
4182 if (!offscreen_saved_color_texture_info_.get()) { 4169 if (!offscreen_saved_color_texture_info_.get()) {
4183 GLuint service_id = offscreen_saved_color_texture_->id(); 4170 GLuint service_id = offscreen_saved_color_texture_->id();
4184 offscreen_saved_color_texture_info_ = TextureRef::Create( 4171 offscreen_saved_color_texture_info_ = TextureRef::Create(
4185 texture_manager(), 0, service_id); 4172 texture_manager(), 0, service_id);
4186 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), 4173 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(),
(...skipping 11723 matching lines...) Expand 10 before | Expand all | Expand 10 after
15910 } 15897 }
15911 15898
15912 // Include the auto-generated part of this file. We split this because it means 15899 // Include the auto-generated part of this file. We split this because it means
15913 // we can easily edit the non-auto generated parts right here in this file 15900 // we can easily edit the non-auto generated parts right here in this file
15914 // instead of having to edit some template or the code generator. 15901 // instead of having to edit some template or the code generator.
15915 #include "base/macros.h" 15902 #include "base/macros.h"
15916 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15903 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15917 15904
15918 } // namespace gles2 15905 } // namespace gles2
15919 } // namespace gpu 15906 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698