summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-03 18:50:06 +0000
committerccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-03 18:50:06 +0000
commit55e136fcea039657a9fb9bd2847169233e67dba1 (patch)
treed7a679bae907b5439441a79a63bc51e3f4b76cb6 /gpu
parentc183fb6f7fbb190d75ff6a5ff57c6cb445524145 (diff)
downloadchromium_src-55e136fcea039657a9fb9bd2847169233e67dba1.zip
chromium_src-55e136fcea039657a9fb9bd2847169233e67dba1.tar.gz
chromium_src-55e136fcea039657a9fb9bd2847169233e67dba1.tar.bz2
Fix GL virtualization warnings on OS X
Stub out GetDisplay for GLSurfaceCGL so that the NOTIMPLEMENTED in GLSurface is not hit. Fix a bug where, when using context virtualization, a GL_INVALD_FRAMEBUFFER_OPERATION is generated by GLES2DecoderImpl::Initialize. This is a use-before-initialization bug wherein GpuCommandBufferStub::Initialize calls MakeCurrent on the virtual context, and because decoder_ is non-NULL in GLContextVirtual::MakeCurrent, we try to restore the state from the decoder (but decoder_ has not yet been initialized). Remove extra logic to prevent calling Destroy on un-initialized decoders, and add a check inside Destroy. BUG=180463 Review URL: https://chromiumcodereview.appspot.com/13430019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192109 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gl_context_virtual.cc3
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc7
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.h9
3 files changed, 17 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/gl_context_virtual.cc b/gpu/command_buffer/service/gl_context_virtual.cc
index 63550d6..5503a94 100644
--- a/gpu/command_buffer/service/gl_context_virtual.cc
+++ b/gpu/command_buffer/service/gl_context_virtual.cc
@@ -5,6 +5,7 @@
#include "gpu/command_buffer/service/gl_context_virtual.h"
#include "gpu/command_buffer/service/gl_state_restorer_impl.h"
+#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "ui/gl/gl_surface.h"
namespace gpu {
@@ -44,7 +45,7 @@ void GLContextVirtual::Destroy() {
}
bool GLContextVirtual::MakeCurrent(gfx::GLSurface* surface) {
- if (decoder_.get())
+ if (decoder_.get() && decoder_->initialized())
shared_context_->MakeVirtuallyCurrent(this, surface);
else
shared_context_->MakeCurrent(surface);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 3767e30..7722442 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -532,7 +532,8 @@ bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id,
}
GLES2Decoder::GLES2Decoder()
- : debug_(false),
+ : initialized_(false),
+ debug_(false),
log_commands_(false),
log_synthesized_gl_errors_(true) {
}
@@ -2284,6 +2285,7 @@ bool GLES2DecoderImpl::Initialize(
DCHECK(context->IsCurrent(surface.get()));
DCHECK(!context_.get());
+ set_initialized();
gpu_tracer_ = GPUTracer::Create();
if (CommandLine::ForCurrentProcess()->HasSwitch(
@@ -3172,6 +3174,9 @@ void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) {
}
void GLES2DecoderImpl::Destroy(bool have_context) {
+ if (!initialized())
+ return;
+
DCHECK(!have_context || context_->IsCurrent(NULL));
ChildList children = children_;
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h
index b797875..9221f1c 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -95,6 +95,14 @@ class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>,
virtual ~GLES2Decoder();
+ bool initialized() const {
+ return initialized_;
+ }
+
+ void set_initialized() {
+ initialized_ = true;
+ }
+
bool debug() const {
return debug_;
}
@@ -306,6 +314,7 @@ class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>,
GLES2Decoder();
private:
+ bool initialized_;
bool debug_;
bool log_commands_;
bool log_synthesized_gl_errors_;