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

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

Issue 1929973003: 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, 7 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 586
587 // Overridden from GLES2Decoder. 587 // Overridden from GLES2Decoder.
588 bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, 588 bool Initialize(const scoped_refptr<gfx::GLSurface>& surface,
589 const scoped_refptr<gfx::GLContext>& context, 589 const scoped_refptr<gfx::GLContext>& context,
590 bool offscreen, 590 bool offscreen,
591 const gfx::Size& offscreen_size, 591 const gfx::Size& offscreen_size,
592 const DisallowedFeatures& disallowed_features, 592 const DisallowedFeatures& disallowed_features,
593 const std::vector<int32_t>& attribs) override; 593 const std::vector<int32_t>& attribs) override;
594 void Destroy(bool have_context) override; 594 void Destroy(bool have_context) override;
595 void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override; 595 void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override;
596 void ReleaseSurface() override;
597 void ProduceFrontBuffer(const Mailbox& mailbox) override; 596 void ProduceFrontBuffer(const Mailbox& mailbox) override;
598 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; 597 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override;
599 void UpdateParentTextureInfo(); 598 void UpdateParentTextureInfo();
600 bool MakeCurrent() override; 599 bool MakeCurrent() override;
601 GLES2Util* GetGLES2Util() override { return &util_; } 600 GLES2Util* GetGLES2Util() override { return &util_; }
602 gfx::GLContext* GetGLContext() override { return context_.get(); } 601 gfx::GLContext* GetGLContext() override { return context_.get(); }
603 ContextGroup* GetContextGroup() override { return group_.get(); } 602 ContextGroup* GetContextGroup() override { return group_.get(); }
604 Capabilities GetCapabilities() override; 603 Capabilities GetCapabilities() override;
605 void RestoreState(const ContextState* prev_state) override; 604 void RestoreState(const ContextState* prev_state) override;
606 605
(...skipping 3031 matching lines...) Expand 10 before | Expand all | Expand 10 after
3638 state_.UnbindSampler(sampler); 3637 state_.UnbindSampler(sampler);
3639 3638
3640 RemoveSampler(client_ids[ii]); 3639 RemoveSampler(client_ids[ii]);
3641 } 3640 }
3642 } 3641 }
3643 } 3642 }
3644 3643
3645 // } // anonymous namespace 3644 // } // anonymous namespace
3646 3645
3647 bool GLES2DecoderImpl::MakeCurrent() { 3646 bool GLES2DecoderImpl::MakeCurrent() {
3648 DCHECK(surface_);
3649 if (!context_.get()) 3647 if (!context_.get())
3650 return false; 3648 return false;
3651 3649
3652 if (WasContextLost()) { 3650 if (WasContextLost()) {
3653 LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current."; 3651 LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current.";
3654 return false; 3652 return false;
3655 } 3653 }
3656 3654
3657 if (!context_->MakeCurrent(surface_.get())) { 3655 if (!context_->MakeCurrent(surface_.get())) {
3658 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent."; 3656 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent.";
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
4195 it != texture_to_io_surface_map_.end(); ++it) { 4193 it != texture_to_io_surface_map_.end(); ++it) {
4196 CFRelease(it->second); 4194 CFRelease(it->second);
4197 } 4195 }
4198 texture_to_io_surface_map_.clear(); 4196 texture_to_io_surface_map_.clear();
4199 #endif 4197 #endif
4200 } 4198 }
4201 4199
4202 void GLES2DecoderImpl::SetSurface( 4200 void GLES2DecoderImpl::SetSurface(
4203 const scoped_refptr<gfx::GLSurface>& surface) { 4201 const scoped_refptr<gfx::GLSurface>& surface) {
4204 DCHECK(context_->IsCurrent(NULL)); 4202 DCHECK(context_->IsCurrent(NULL));
4205 DCHECK(surface); 4203 DCHECK(surface_.get());
4206 surface_ = surface; 4204 surface_ = surface;
4207 RestoreCurrentFramebufferBindings(); 4205 RestoreCurrentFramebufferBindings();
4208 } 4206 }
4209 4207
4210 void GLES2DecoderImpl::ReleaseSurface() {
4211 if (!context_.get())
4212 return;
4213 if (WasContextLost()) {
4214 DLOG(ERROR) << " GLES2DecoderImpl: Trying to release lost context.";
4215 return;
4216 }
4217 context_->ReleaseCurrent(surface_.get());
4218 surface_ = nullptr;
4219 }
4220
4221 void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) { 4208 void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) {
4222 if (!offscreen_saved_color_texture_.get()) { 4209 if (!offscreen_saved_color_texture_.get()) {
4223 LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context"; 4210 LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context";
4224 return; 4211 return;
4225 } 4212 }
4226 if (!offscreen_saved_color_texture_info_.get()) { 4213 if (!offscreen_saved_color_texture_info_.get()) {
4227 GLuint service_id = offscreen_saved_color_texture_->id(); 4214 GLuint service_id = offscreen_saved_color_texture_->id();
4228 offscreen_saved_color_texture_info_ = TextureRef::Create( 4215 offscreen_saved_color_texture_info_ = TextureRef::Create(
4229 texture_manager(), 0, service_id); 4216 texture_manager(), 0, service_id);
4230 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), 4217 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(),
(...skipping 12169 matching lines...) Expand 10 before | Expand all | Expand 10 after
16400 } 16387 }
16401 16388
16402 // Include the auto-generated part of this file. We split this because it means 16389 // Include the auto-generated part of this file. We split this because it means
16403 // we can easily edit the non-auto generated parts right here in this file 16390 // we can easily edit the non-auto generated parts right here in this file
16404 // instead of having to edit some template or the code generator. 16391 // instead of having to edit some template or the code generator.
16405 #include "base/macros.h" 16392 #include "base/macros.h"
16406 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16393 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16407 16394
16408 } // namespace gles2 16395 } // namespace gles2
16409 } // namespace gpu 16396 } // 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