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

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

Issue 1878133003: 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, 8 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 // Overridden from GLES2Decoder. 588 // Overridden from GLES2Decoder.
589 bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, 589 bool Initialize(const scoped_refptr<gfx::GLSurface>& surface,
590 const scoped_refptr<gfx::GLContext>& context, 590 const scoped_refptr<gfx::GLContext>& context,
591 bool offscreen, 591 bool offscreen,
592 const gfx::Size& offscreen_size, 592 const gfx::Size& offscreen_size,
593 const DisallowedFeatures& disallowed_features, 593 const DisallowedFeatures& disallowed_features,
594 const std::vector<int32_t>& attribs) override; 594 const std::vector<int32_t>& attribs) override;
595 void Destroy(bool have_context) override; 595 void Destroy(bool have_context) override;
596 void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override; 596 void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override;
597 void ReleaseSurface() override;
598 void ProduceFrontBuffer(const Mailbox& mailbox) override; 597 void ProduceFrontBuffer(const Mailbox& mailbox) override;
599 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; 598 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override;
600 void UpdateParentTextureInfo(); 599 void UpdateParentTextureInfo();
601 bool MakeCurrent() override; 600 bool MakeCurrent() override;
602 GLES2Util* GetGLES2Util() override { return &util_; } 601 GLES2Util* GetGLES2Util() override { return &util_; }
603 gfx::GLContext* GetGLContext() override { return context_.get(); } 602 gfx::GLContext* GetGLContext() override { return context_.get(); }
604 ContextGroup* GetContextGroup() override { return group_.get(); } 603 ContextGroup* GetContextGroup() override { return group_.get(); }
605 Capabilities GetCapabilities() override; 604 Capabilities GetCapabilities() override;
606 void RestoreState(const ContextState* prev_state) override; 605 void RestoreState(const ContextState* prev_state) override;
607 606
(...skipping 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after
3677 state_.UnbindSampler(sampler); 3676 state_.UnbindSampler(sampler);
3678 3677
3679 RemoveSampler(client_ids[ii]); 3678 RemoveSampler(client_ids[ii]);
3680 } 3679 }
3681 } 3680 }
3682 } 3681 }
3683 3682
3684 // } // anonymous namespace 3683 // } // anonymous namespace
3685 3684
3686 bool GLES2DecoderImpl::MakeCurrent() { 3685 bool GLES2DecoderImpl::MakeCurrent() {
3687 DCHECK(surface_);
3688 if (!context_.get()) 3686 if (!context_.get())
3689 return false; 3687 return false;
3690 3688
3691 if (WasContextLost()) { 3689 if (WasContextLost()) {
3692 LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current."; 3690 LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current.";
3693 return false; 3691 return false;
3694 } 3692 }
3695 3693
3696 if (!context_->MakeCurrent(surface_.get())) { 3694 if (!context_->MakeCurrent(surface_.get())) {
3697 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent."; 3695 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent.";
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
4235 it != texture_to_io_surface_map_.end(); ++it) { 4233 it != texture_to_io_surface_map_.end(); ++it) {
4236 CFRelease(it->second); 4234 CFRelease(it->second);
4237 } 4235 }
4238 texture_to_io_surface_map_.clear(); 4236 texture_to_io_surface_map_.clear();
4239 #endif 4237 #endif
4240 } 4238 }
4241 4239
4242 void GLES2DecoderImpl::SetSurface( 4240 void GLES2DecoderImpl::SetSurface(
4243 const scoped_refptr<gfx::GLSurface>& surface) { 4241 const scoped_refptr<gfx::GLSurface>& surface) {
4244 DCHECK(context_->IsCurrent(NULL)); 4242 DCHECK(context_->IsCurrent(NULL));
4245 DCHECK(surface); 4243 DCHECK(surface_.get());
4246 surface_ = surface; 4244 surface_ = surface;
4247 RestoreCurrentFramebufferBindings(); 4245 RestoreCurrentFramebufferBindings();
4248 } 4246 }
4249 4247
4250 void GLES2DecoderImpl::ReleaseSurface() {
4251 if (!context_.get())
4252 return;
4253 if (WasContextLost()) {
4254 DLOG(ERROR) << " GLES2DecoderImpl: Trying to release lost context.";
4255 return;
4256 }
4257 context_->ReleaseCurrent(surface_.get());
4258 surface_ = nullptr;
4259 }
4260
4261 void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) { 4248 void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) {
4262 if (!offscreen_saved_color_texture_.get()) { 4249 if (!offscreen_saved_color_texture_.get()) {
4263 LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context"; 4250 LOG(ERROR) << "Called ProduceFrontBuffer on a non-offscreen context";
4264 return; 4251 return;
4265 } 4252 }
4266 if (!offscreen_saved_color_texture_info_.get()) { 4253 if (!offscreen_saved_color_texture_info_.get()) {
4267 GLuint service_id = offscreen_saved_color_texture_->id(); 4254 GLuint service_id = offscreen_saved_color_texture_->id();
4268 offscreen_saved_color_texture_info_ = TextureRef::Create( 4255 offscreen_saved_color_texture_info_ = TextureRef::Create(
4269 texture_manager(), 0, service_id); 4256 texture_manager(), 0, service_id);
4270 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), 4257 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(),
(...skipping 12119 matching lines...) Expand 10 before | Expand all | Expand 10 after
16390 } 16377 }
16391 16378
16392 // Include the auto-generated part of this file. We split this because it means 16379 // Include the auto-generated part of this file. We split this because it means
16393 // we can easily edit the non-auto generated parts right here in this file 16380 // we can easily edit the non-auto generated parts right here in this file
16394 // instead of having to edit some template or the code generator. 16381 // instead of having to edit some template or the code generator.
16395 #include "base/macros.h" 16382 #include "base/macros.h"
16396 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16383 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16397 16384
16398 } // namespace gles2 16385 } // namespace gles2
16399 } // namespace gpu 16386 } // 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