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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 978593003: Distinguish ES2/ES3 contexts in GPU command buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webgl2
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils.cc ('k') | gpu/command_buffer/service/shader_translator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 8c24d3cd1df5f8e04a458d173ec5106f5d3971bd..12efe0acb3e17c307ff9a4f529b36b34cd235a30 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2441,6 +2441,10 @@ bool GLES2DecoderImpl::Initialize(
DCHECK(context->IsCurrent(surface.get()));
DCHECK(!context_.get());
+ ContextCreationAttribHelper attrib_parser;
+ if (!attrib_parser.Parse(attribs))
+ return false;
+
surfaceless_ = surface->IsSurfaceless() && !offscreen;
set_initialized();
@@ -2457,7 +2461,10 @@ bool GLES2DecoderImpl::Initialize(
}
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableUnsafeES3APIs)) {
+ switches::kEnableUnsafeES3APIs) &&
+ attrib_parser.es3_context_required) {
+ // TODO(zmo): We need to implement capabilities check to ensure we can
+ // actually create ES3 contexts.
set_unsafe_es3_apis_enabled(true);
}
@@ -2470,10 +2477,6 @@ bool GLES2DecoderImpl::Initialize(
context_ = context;
surface_ = surface;
- ContextCreationAttribHelper attrib_parser;
- if (!attrib_parser.Parse(attribs))
- return false;
-
// Create GPU Tracer for timing values.
gpu_tracer_.reset(new GPUTracer(this));
@@ -2956,9 +2959,15 @@ bool GLES2DecoderImpl::InitializeShaderTranslator() {
features().nv_draw_buffers ? 1 : 0;
}
- ShShaderSpec shader_spec = force_webgl_glsl_validation_ ? SH_WEBGL_SPEC
- : SH_GLES2_SPEC;
- if (shader_spec == SH_WEBGL_SPEC && features().enable_shader_name_hashing)
+ ShShaderSpec shader_spec;
+ if (force_webgl_glsl_validation_) {
+ shader_spec = unsafe_es3_apis_enabled() ? SH_WEBGL2_SPEC : SH_WEBGL_SPEC;
+ } else {
+ shader_spec = unsafe_es3_apis_enabled() ? SH_GLES3_SPEC : SH_GLES2_SPEC;
+ }
+
+ if ((shader_spec == SH_WEBGL_SPEC || shader_spec == SH_WEBGL2_SPEC) &&
+ features().enable_shader_name_hashing)
resources.HashFunction = &CityHash64;
else
resources.HashFunction = NULL;
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils.cc ('k') | gpu/command_buffer/service/shader_translator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698