summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoroetuaho@nvidia.com <oetuaho@nvidia.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-13 11:50:40 +0000
committeroetuaho@nvidia.com <oetuaho@nvidia.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-13 11:51:59 +0000
commit845c4e3f17bde2c8bd1322e17c832bb15f315186 (patch)
tree41a1a63430dbcb223724c30a1d976299ae22a4cc /webkit
parent7d7b9587f4f1b7feff557b70a2bb876a7ba09d0d (diff)
downloadchromium_src-845c4e3f17bde2c8bd1322e17c832bb15f315186.zip
chromium_src-845c4e3f17bde2c8bd1322e17c832bb15f315186.tar.gz
chromium_src-845c4e3f17bde2c8bd1322e17c832bb15f315186.tar.bz2
GPU context creation code duplication cleanup
Use ContextCreationAttribHelper through the context creation in both in-process and out-of-process cases, instead of duplicate structures such as GLInProcessContextAttribs. Enums used for serializing the attributes are now defined in only one place, instead of three. Remove small pieces of dead code related to share groups. share_resources_ attrib is removed since it is not in use anywhere. gpu_unittests are changed to better model how bind_generates_resource gets set, and new checks are added to make sure it is set consistently everywhere. TEST=WebGL conformance tests (with and without --in-process-gpu), cc_unittests, gpu_unittests BUG= Review URL: https://codereview.chromium.org/455783002 Cr-Commit-Position: refs/heads/master@{#289269} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289269 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/common/gpu/webgraphicscontext3d_impl.cc15
-rw-r--r--webkit/common/gpu/webgraphicscontext3d_impl.h7
-rw-r--r--webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc14
-rw-r--r--webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h10
4 files changed, 25 insertions, 21 deletions
diff --git a/webkit/common/gpu/webgraphicscontext3d_impl.cc b/webkit/common/gpu/webgraphicscontext3d_impl.cc
index 86df14a..abf9d95 100644
--- a/webkit/common/gpu/webgraphicscontext3d_impl.cc
+++ b/webkit/common/gpu/webgraphicscontext3d_impl.cc
@@ -10,6 +10,7 @@
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_lib.h"
+#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
#include "third_party/khronos/GLES2/gl2.h"
@@ -980,5 +981,19 @@ void WebGraphicsContext3DImpl::copyTextureToParentTextureCHROMIUM(
void WebGraphicsContext3DImpl::releaseShaderCompiler() {
}
+// static
+void WebGraphicsContext3DImpl::ConvertAttributes(
+ const blink::WebGraphicsContext3D::Attributes& attributes,
+ ::gpu::gles2::ContextCreationAttribHelper* output_attribs) {
+ output_attribs->alpha_size = attributes.alpha ? 8 : 0;
+ output_attribs->depth_size = attributes.depth ? 24 : 0;
+ output_attribs->stencil_size = attributes.stencil ? 8 : 0;
+ output_attribs->samples = attributes.antialias ? 4 : 0;
+ output_attribs->sample_buffers = attributes.antialias ? 1 : 0;
+ output_attribs->fail_if_major_perf_caveat =
+ attributes.failIfMajorPerformanceCaveat;
+ output_attribs->bind_generates_resource = false;
+}
+
} // namespace gpu
} // namespace webkit
diff --git a/webkit/common/gpu/webgraphicscontext3d_impl.h b/webkit/common/gpu/webgraphicscontext3d_impl.h
index 83af0b4..5cb055d 100644
--- a/webkit/common/gpu/webgraphicscontext3d_impl.h
+++ b/webkit/common/gpu/webgraphicscontext3d_impl.h
@@ -19,6 +19,7 @@ namespace gpu {
namespace gles2 {
class GLES2Interface;
class GLES2ImplementationErrorMessageCallback;
+struct ContextCreationAttribHelper;
}
}
@@ -559,6 +560,12 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DImpl
return gl_;
}
+ // Convert WebGL context creation attributes into command buffer / EGL size
+ // requests.
+ static void ConvertAttributes(
+ const blink::WebGraphicsContext3D::Attributes& attributes,
+ ::gpu::gles2::ContextCreationAttribHelper* output_attribs);
+
protected:
friend class WebGraphicsContext3DErrorMessageCallback;
diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
index 5f2ebef..afd843a 100644
--- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
+++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
@@ -21,6 +21,7 @@
#include "base/logging.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_lib.h"
+#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
#include "ui/gfx/size.h"
#include "ui/gl/gl_implementation.h"
@@ -117,19 +118,6 @@ WebGraphicsContext3DInProcessCommandBufferImpl::
~WebGraphicsContext3DInProcessCommandBufferImpl() {
}
-// static
-void WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes(
- const blink::WebGraphicsContext3D::Attributes& attributes,
- ::gpu::GLInProcessContextAttribs* output_attribs) {
- output_attribs->alpha_size = attributes.alpha ? 8 : 0;
- output_attribs->depth_size = attributes.depth ? 24 : 0;
- output_attribs->stencil_size = attributes.stencil ? 8 : 0;
- output_attribs->samples = attributes.antialias ? 4 : 0;
- output_attribs->sample_buffers = attributes.antialias ? 1 : 0;
- output_attribs->fail_if_major_perf_caveat =
- attributes.failIfMajorPerformanceCaveat ? 1 : 0;
-}
-
bool WebGraphicsContext3DInProcessCommandBufferImpl::MaybeInitializeGL() {
if (initialized_)
return true;
diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
index 5ab1a17..54d7f17 100644
--- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
+++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
@@ -22,12 +22,12 @@ class ContextSupport;
namespace gles2 {
class GLES2Interface;
class GLES2Implementation;
+struct ContextCreationAttribHelper;
}
}
namespace gpu {
class GLInProcessContext;
-struct GLInProcessContextAttribs;
}
namespace webkit {
@@ -54,12 +54,6 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
virtual ~WebGraphicsContext3DInProcessCommandBufferImpl();
- // Convert WebGL context creation attributes into GLInProcessContext / EGL
- // size requests.
- static void ConvertAttributes(
- const blink::WebGraphicsContext3D::Attributes& attributes,
- ::gpu::GLInProcessContextAttribs* output_attribs);
-
//----------------------------------------------------------------------
// WebGraphicsContext3D methods
virtual bool makeContextCurrent();
@@ -90,7 +84,7 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
// instead of going through WebGraphicsContext3D.
void ClearContext();
- ::gpu::GLInProcessContextAttribs attribs_;
+ ::gpu::gles2::ContextCreationAttribHelper attribs_;
bool share_resources_;
bool webgl_context_;