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

Unified Diff: gpu/command_buffer/tests/gl_manager.cc

Issue 1325433003: command_buffer: Add support for creating non-WebGL ES 3 contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/tests/gl_manager.cc
diff --git a/gpu/command_buffer/tests/gl_manager.cc b/gpu/command_buffer/tests/gl_manager.cc
index c5f70877703c8fb7d519bcd6eb18cf97274e0132..88d901b92cd907ca6bc955d4f4bf3bb2c7f8e68c 100644
--- a/gpu/command_buffer/tests/gl_manager.cc
+++ b/gpu/command_buffer/tests/gl_manager.cc
@@ -109,8 +109,7 @@ GLManager::Options::Options()
bind_generates_resource(false),
lose_context_when_out_of_memory(false),
context_lost_allowed(false),
- webgl_version(0) {
-}
+ context_type(CONTEXT_TYPE_OPENGLES2) {}
GLManager::GLManager() : context_lost_allowed_(false) {
SetupBaseContext();
@@ -197,7 +196,25 @@ void GLManager::InitializeWithCommandLine(const GLManager::Options& options,
attrib_helper.alpha_size = 8;
attrib_helper.depth_size = 16;
attrib_helper.stencil_size = 8;
- attrib_helper.webgl_version = options.webgl_version;
+ switch (options.context_type) {
+ case CONTEXT_TYPE_WEBGL1:
+ attrib_helper.context_type =
+ gles2::ContextCreationAttribHelper::CONTEXT_TYPE_WEBGL1;
+ break;
+ case CONTEXT_TYPE_WEBGL2:
+ attrib_helper.context_type =
+ gles2::ContextCreationAttribHelper::CONTEXT_TYPE_WEBGL2;
+ break;
+ case CONTEXT_TYPE_OPENGLES2:
+ attrib_helper.context_type =
+ gles2::ContextCreationAttribHelper::CONTEXT_TYPE_OPENGLES2;
+ break;
+ case CONTEXT_TYPE_OPENGLES3:
+ attrib_helper.context_type =
+ gles2::ContextCreationAttribHelper::CONTEXT_TYPE_OPENGLES3;
+ break;
+ }
+
attrib_helper.Serialize(&attribs);
DCHECK(!command_line || !context_group);
@@ -248,13 +265,10 @@ void GLManager::InitializeWithCommandLine(const GLManager::Options& options,
ASSERT_TRUE(context_->MakeCurrent(surface_.get()));
- ASSERT_TRUE(decoder_->Initialize(
- surface_.get(),
- context_.get(),
- true,
- options.size,
- ::gpu::gles2::DisallowedFeatures(),
- attribs)) << "could not initialize decoder";
+ if (!decoder_->Initialize(surface_.get(), context_.get(), true, options.size,
+ ::gpu::gles2::DisallowedFeatures(), attribs)) {
+ return;
+ }
command_buffer_->SetPutOffsetChangeCallback(
base::Bind(&GLManager::PumpCommands, base::Unretained(this)));
@@ -326,7 +340,8 @@ void GLManager::Destroy() {
gles2_helper_.reset();
command_buffer_.reset();
if (decoder_.get()) {
- bool have_context = decoder_->GetGLContext()->MakeCurrent(surface_.get());
+ bool have_context = decoder_->GetGLContext() &&
+ decoder_->GetGLContext()->MakeCurrent(surface_.get());
decoder_->Destroy(have_context);
decoder_.reset();
}

Powered by Google App Engine
This is Rietveld 408576698