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

Unified Diff: webkit/common/gpu/webgraphicscontext3d_impl.h

Issue 305643004: Reducing code duplication between WGC3D(InProcess)CommandBufferImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added WEBKIT_GPU_EXPORT Created 6 years, 7 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/client/gles2_implementation.h ('k') | webkit/common/gpu/webgraphicscontext3d_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/common/gpu/webgraphicscontext3d_impl.h
diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/common/gpu/webgraphicscontext3d_impl.h
similarity index 85%
copy from webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
copy to webkit/common/gpu/webgraphicscontext3d_impl.h
index 5909c36c97e7990aaa8cfd0193903e23206983f3..ccc9046e2e4544e542d264eec447304499f36318 100644
--- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
+++ b/webkit/common/gpu/webgraphicscontext3d_impl.h
@@ -2,24 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_
-#define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_
+#ifndef WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IMPL_H_
+#define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IMPL_H_
+#include <string>
#include <vector>
-#include "base/compiler_specific.h"
+#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/WebKit/public/platform/WebString.h"
-#include "ui/gfx/native_widget_types.h"
#include "webkit/common/gpu/webkit_gpu_export.h"
namespace gpu {
-class ContextSupport;
namespace gles2 {
class GLES2Interface;
-class GLES2Implementation;
+class GLES2ImplementationErrorMessageCallback;
}
}
@@ -38,48 +37,25 @@ using blink::WGC3Dclampf;
using blink::WGC3Dintptr;
using blink::WGC3Dsizeiptr;
-namespace gpu {
-class GLInProcessContext;
-struct GLInProcessContextAttribs;
-}
+namespace content {
jamesr 2014/06/03 21:22:56 what on earth? why are we defining symbols in name
bajones 2014/06/03 21:25:13 Ack! That's a mistake. (File was originally a copy
-namespace webkit {
-namespace gpu {
+class WebGraphicsContext3DErrorMessageCallback;
-class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
+class WEBKIT_GPU_EXPORT WebGraphicsContext3DImpl
: public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) {
public:
- static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
- CreateViewContext(
- const blink::WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory,
- gfx::AcceleratedWidget window);
-
- static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
- CreateOffscreenContext(
- const blink::WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory);
-
- static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
- WrapContext(
- scoped_ptr< ::gpu::GLInProcessContext> context,
- const blink::WebGraphicsContext3D::Attributes& attributes);
-
- 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();
virtual uint32_t lastFlushID();
- virtual void reshapeWithScaleFactor(int width, int height, float scaleFactor);
+ virtual unsigned int insertSyncPoint();
+ virtual void waitSyncPoint(unsigned int sync_point);
+
+ virtual void loseContextCHROMIUM(WGC3Denum current, WGC3Denum other);
+
+ virtual void reshapeWithScaleFactor(
+ int width, int height, float scale_factor);
virtual void prepareTexture();
virtual void postSubBufferCHROMIUM(int x, int y, int width, int height);
@@ -204,8 +180,6 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
virtual WGC3Denum getError();
- virtual bool isContextLost();
-
virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value);
virtual void getFramebufferAttachmentParameteriv(WGC3Denum target,
@@ -446,7 +420,6 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
virtual void discardFramebufferEXT(WGC3Denum target,
WGC3Dsizei numAttachments,
const WGC3Denum* attachments);
-
virtual void copyTextureToParentTextureCHROMIUM(
WebGLId texture, WebGLId parentTexture);
@@ -465,30 +438,21 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
virtual void setContextLostCallback(
WebGraphicsContext3D::WebGraphicsContextLostCallback* callback);
- virtual WGC3Denum getGraphicsResetStatusARB();
+
+ virtual void setErrorMessageCallback(
+ WebGraphicsContext3D::WebGraphicsErrorMessageCallback* callback);
virtual void texImageIOSurface2DCHROMIUM(
WGC3Denum target, WGC3Dint width, WGC3Dint height,
WGC3Duint ioSurfaceId, WGC3Duint plane);
- virtual void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId);
- virtual void releaseTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId);
-
virtual void texStorage2DEXT(
WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat,
WGC3Dint width, WGC3Dint height);
- virtual WGC3Duint createImageCHROMIUM(WGC3Dsizei width,
- WGC3Dsizei height,
- WGC3Denum internalformat,
- WGC3Denum usage);
- virtual void destroyImageCHROMIUM(WGC3Duint image_id);
- virtual void getImageParameterivCHROMIUM(
- WGC3Duint image_id, WGC3Denum pname, WGC3Dint* params);
- virtual void* mapImageCHROMIUM(WGC3Duint image_id);
- virtual void unmapImageCHROMIUM(WGC3Duint image_id);
+
virtual WebGLId createQueryEXT();
virtual void deleteQueryEXT(WebGLId query);
- virtual WGC3Dboolean isQueryEXT(WebGLId query);
+ virtual WGC3Dboolean isQueryEXT(WGC3Duint query);
virtual void beginQueryEXT(WGC3Denum target, WebGLId query);
virtual void endQueryEXT(WGC3Denum target);
virtual void getQueryivEXT(
@@ -496,8 +460,8 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
virtual void getQueryObjectuivEXT(
WebGLId query, WGC3Denum pname, WGC3Duint* params);
- virtual void copyTextureCHROMIUM(WGC3Denum target, WGC3Duint source_id,
- WGC3Duint dest_id, WGC3Dint level,
+ virtual void copyTextureCHROMIUM(WGC3Denum target, WebGLId source_id,
+ WebGLId dest_id, WGC3Dint level,
WGC3Denum internal_format,
WGC3Denum dest_type);
@@ -517,21 +481,17 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
virtual void pushGroupMarkerEXT(const WGC3Dchar* marker);
virtual void popGroupMarkerEXT();
- virtual void* mapBufferCHROMIUM(WGC3Denum target, WGC3Denum access);
- virtual WGC3Dboolean unmapBufferCHROMIUM(WGC3Denum target);
+ // GL_OES_vertex_array_object
+ virtual WebGLId createVertexArrayOES();
+ virtual void deleteVertexArrayOES(WebGLId array);
+ virtual WGC3Dboolean isVertexArrayOES(WebGLId array);
+ virtual void bindVertexArrayOES(WebGLId array);
- virtual void framebufferTexture2DMultisampleEXT(WGC3Denum target,
- WGC3Denum attachment,
- WGC3Denum textarget,
- WebGLId texture,
- WGC3Dint level,
- WGC3Dsizei samples);
- virtual void renderbufferStorageMultisampleEXT(WGC3Denum target,
- WGC3Dsizei samples,
- WGC3Denum internalformat,
- WGC3Dsizei width,
- WGC3Dsizei height);
+ virtual void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint image_id);
+ virtual void releaseTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint image_id);
+ virtual void* mapBufferCHROMIUM(WGC3Denum target, WGC3Denum access);
+ virtual WGC3Dboolean unmapBufferCHROMIUM(WGC3Denum target);
// Async pixel transfer functions.
virtual void asyncTexImage2DCHROMIUM(
@@ -556,62 +516,83 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
const void* pixels);
virtual void waitAsyncTexImage2DCHROMIUM(WGC3Denum target);
- virtual void drawBuffersEXT(WGC3Dsizei n, const WGC3Denum* bufs);
+ // GL_EXT_draw_buffers
+ virtual void drawBuffersEXT(
+ WGC3Dsizei n,
+ const WGC3Denum* bufs);
- virtual unsigned insertSyncPoint();
+ // GL_ANGLE_instanced_arrays
+ virtual void drawArraysInstancedANGLE(WGC3Denum mode, WGC3Dint first,
+ WGC3Dsizei count, WGC3Dsizei primcount);
+ virtual void drawElementsInstancedANGLE(WGC3Denum mode, WGC3Dsizei count,
+ WGC3Denum type, WGC3Dintptr offset, WGC3Dsizei primcount);
+ virtual void vertexAttribDivisorANGLE(WGC3Duint index, WGC3Duint divisor);
- virtual void loseContextCHROMIUM(WGC3Denum current, WGC3Denum other);
+ // GL_CHROMIUM_map_image
+ virtual WGC3Duint createImageCHROMIUM(WGC3Dsizei width,
+ WGC3Dsizei height,
+ WGC3Denum internalformat,
+ WGC3Denum usage);
+ virtual void destroyImageCHROMIUM(WGC3Duint image_id);
+ virtual void getImageParameterivCHROMIUM(
+ WGC3Duint image_id, WGC3Denum pname, WGC3Dint* params);
+ virtual void* mapImageCHROMIUM(WGC3Duint image_id);
+ virtual void unmapImageCHROMIUM(WGC3Duint image_id);
- virtual GrGLInterface* createGrGLInterface();
+ // GL_EXT_multisampled_render_to_texture
+ virtual void framebufferTexture2DMultisampleEXT(WGC3Denum target,
+ WGC3Denum attachment,
+ WGC3Denum textarget,
+ WebGLId texture,
+ WGC3Dint level,
+ WGC3Dsizei samples);
+ virtual void renderbufferStorageMultisampleEXT(
+ WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat,
+ WGC3Dsizei width, WGC3Dsizei height);
- ::gpu::gles2::GLES2Interface* GetGLInterface();
- ::gpu::ContextSupport* GetContextSupport();
+ virtual GrGLInterface* createGrGLInterface();
- ::gpu::gles2::GLES2Implementation* GetImplementation() {
+ gpu::gles2::GLES2Interface* GetGLInterface() {
return gl_;
}
- private:
- WebGraphicsContext3DInProcessCommandBufferImpl(
- scoped_ptr< ::gpu::GLInProcessContext> context,
- const blink::WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory,
- bool is_offscreen,
- gfx::AcceleratedWidget window);
+ protected:
+ friend class WebGraphicsContext3DErrorMessageCallback;
- void OnContextLost();
+ WebGraphicsContext3DImpl(
+ const Attributes& attributes,
+ bool lose_context_when_out_of_memory);
+ virtual ~WebGraphicsContext3DImpl();
- bool MaybeInitializeGL();
+ gpu::gles2::GLES2ImplementationErrorMessageCallback*
+ getErrorMessageCallback();
+ virtual void OnErrorMessage(const std::string& message, int id);
- // Used to try to find bugs in code that calls gl directly through the gl api
- // instead of going through WebGraphicsContext3D.
- void ClearContext();
-
- bool is_offscreen_;
- // Only used when not offscreen.
- gfx::AcceleratedWidget window_;
+ void setGLInterface(gpu::gles2::GLES2Interface* gl) {
+ gl_ = gl;
+ }
bool initialized_;
bool initialize_failed_;
- // The context we use for OpenGL rendering.
- scoped_ptr< ::gpu::GLInProcessContext> context_;
- // The GLES2Implementation we use for OpenGL rendering.
- ::gpu::gles2::GLES2Implementation* gl_;
-
WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_;
WGC3Denum context_lost_reason_;
+ WebGraphicsContext3D::WebGraphicsErrorMessageCallback*
+ error_message_callback_;
+ scoped_ptr<WebGraphicsContext3DErrorMessageCallback>
+ client_error_message_callback_;
+
blink::WebGraphicsContext3D::Attributes attributes_;
- bool lose_context_when_out_of_memory_;
// Errors raised by synthesizeGLError().
std::vector<WGC3Denum> synthetic_errors_;
+ gpu::gles2::GLES2Interface* gl_;
+ bool lose_context_when_out_of_memory_;
uint32_t flush_id_;
};
-} // namespace gpu
-} // namespace webkit
+} // namespace content
-#endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_
+#endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IMPL_H_
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | webkit/common/gpu/webgraphicscontext3d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698