Index: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h |
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h |
index dc51c80fc32ace4a89b957c6e95c68ed30dc3957..3b6aaa89b769a32b7510d0af18a85e1b14a7c23c 100644 |
--- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h |
+++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h |
@@ -4,24 +4,30 @@ |
#ifndef WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
#define WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
+#pragma once |
-#include <list> |
-#include <set> |
+#if defined(ENABLE_GPU) |
-#include "base/hash_tables.h" |
-#include "base/memory/ref_counted.h" |
-#include "third_party/angle/include/GLSLANG/ShaderLang.h" |
+#include <vector> |
+ |
+#include "base/memory/scoped_ptr.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
+#include "ui/gfx/native_widget_types.h" |
#if !defined(OS_MACOSX) |
#define FLIP_FRAMEBUFFER_VERTICALLY |
#endif |
-namespace gfx { |
-class GLContext; |
-class GLSurface; |
+ |
+namespace gpu { |
+namespace gles2 { |
+class GLES2Implementation; |
+} |
} |
+using WebKit::WebGLId; |
+ |
using WebKit::WGC3Dchar; |
using WebKit::WGC3Denum; |
using WebKit::WGC3Dboolean; |
@@ -34,28 +40,24 @@ using WebKit::WGC3Dclampf; |
using WebKit::WGC3Dintptr; |
using WebKit::WGC3Dsizeiptr; |
-using WebKit::WebGLId; |
- |
-using WebKit::WebString; |
-using WebKit::WebView; |
- |
-using WebKit::WebGraphicsContext3D; |
- |
namespace webkit { |
namespace gpu { |
-// TODO(gman): This is a copy of WebGraphicsContext3DInProcessImpl. I will |
-// refactor it to actually use the command buffer. |
+class GLInProcessContext; |
-class WebGraphicsContext3DInProcessCommandBufferImpl : public WebGraphicsContext3D { |
+class WebGraphicsContext3DInProcessCommandBufferImpl |
+ : public WebKit::WebGraphicsContext3D { |
public: |
+ |
WebGraphicsContext3DInProcessCommandBufferImpl(); |
virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); |
//---------------------------------------------------------------------- |
// WebGraphicsContext3D methods |
- virtual bool initialize( |
- WebGraphicsContext3D::Attributes attributes, WebView*, bool); |
+ virtual bool initialize(WebGraphicsContext3D::Attributes attributes, |
+ WebKit::WebView*, |
+ bool renderDirectlyToWebView); |
+ |
virtual bool makeContextCurrent(); |
virtual int width(); |
@@ -65,95 +67,61 @@ class WebGraphicsContext3DInProcessCommandBufferImpl : public WebGraphicsContext |
virtual void reshape(int width, int height); |
- virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize); |
+ virtual bool readBackFramebuffer(unsigned char* pixels, size_t buffer_size); |
virtual WebGLId getPlatformTextureId(); |
virtual void prepareTexture(); |
- virtual void synthesizeGLError(WGC3Denum error); |
- virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset, |
- WGC3Dsizeiptr size, WGC3Denum access); |
- virtual void unmapBufferSubDataCHROMIUM(const void*); |
- virtual void* mapTexSubImage2DCHROMIUM( |
- WGC3Denum target, |
- WGC3Dint level, |
- WGC3Dint xoffset, |
- WGC3Dint yoffset, |
- WGC3Dsizei width, |
- WGC3Dsizei height, |
- WGC3Denum format, |
- WGC3Denum type, |
- WGC3Denum access); |
- virtual void unmapTexSubImage2DCHROMIUM(const void*); |
- virtual void copyTextureToParentTextureCHROMIUM( |
- WebGLId texture, WebGLId parentTexture); |
- |
- virtual void getParentToChildLatchCHROMIUM(WGC3Duint* latch_id); |
- virtual void getChildToParentLatchCHROMIUM(WGC3Duint* latch_id); |
- virtual void waitLatchCHROMIUM(WGC3Duint latch_id); |
- virtual void setLatchCHROMIUM(WGC3Duint latch_id); |
- |
- virtual WebString getRequestableExtensionsCHROMIUM(); |
- virtual void requestExtensionCHROMIUM(const char*); |
- |
- virtual void blitFramebufferCHROMIUM( |
- WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, |
- WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, |
- WGC3Dbitfield mask, WGC3Denum filter); |
- virtual void renderbufferStorageMultisampleCHROMIUM( |
- WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, |
- WGC3Dsizei width, WGC3Dsizei height); |
- |
virtual void activeTexture(WGC3Denum texture); |
virtual void attachShader(WebGLId program, WebGLId shader); |
- virtual void bindAttribLocation( |
- WebGLId program, WGC3Duint index, const WGC3Dchar* name); |
+ virtual void bindAttribLocation(WebGLId program, WGC3Duint index, |
+ const WGC3Dchar* name); |
virtual void bindBuffer(WGC3Denum target, WebGLId buffer); |
virtual void bindFramebuffer(WGC3Denum target, WebGLId framebuffer); |
- virtual void bindRenderbuffer( |
- WGC3Denum target, WebGLId renderbuffer); |
+ virtual void bindRenderbuffer(WGC3Denum target, WebGLId renderbuffer); |
virtual void bindTexture(WGC3Denum target, WebGLId texture); |
- virtual void blendColor( |
- WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha); |
+ virtual void blendColor(WGC3Dclampf red, WGC3Dclampf green, |
+ WGC3Dclampf blue, WGC3Dclampf alpha); |
virtual void blendEquation(WGC3Denum mode); |
- virtual void blendEquationSeparate(WGC3Denum modeRGB, WGC3Denum modeAlpha); |
+ virtual void blendEquationSeparate(WGC3Denum modeRGB, |
+ WGC3Denum modeAlpha); |
virtual void blendFunc(WGC3Denum sfactor, WGC3Denum dfactor); |
- virtual void blendFuncSeparate(WGC3Denum srcRGB, WGC3Denum dstRGB, |
- WGC3Denum srcAlpha, WGC3Denum dstAlpha); |
+ virtual void blendFuncSeparate(WGC3Denum srcRGB, |
+ WGC3Denum dstRGB, |
+ WGC3Denum srcAlpha, |
+ WGC3Denum dstAlpha); |
- virtual void bufferData( |
- WGC3Denum target, WGC3Dsizeiptr size, const void* data, WGC3Denum usage); |
+ virtual void bufferData(WGC3Denum target, WGC3Dsizeiptr size, |
+ const void* data, WGC3Denum usage); |
virtual void bufferSubData(WGC3Denum target, WGC3Dintptr offset, |
WGC3Dsizeiptr size, const void* data); |
virtual WGC3Denum checkFramebufferStatus(WGC3Denum target); |
virtual void clear(WGC3Dbitfield mask); |
- virtual void clearColor( |
- WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha); |
+ virtual void clearColor(WGC3Dclampf red, WGC3Dclampf green, |
+ WGC3Dclampf blue, WGC3Dclampf alpha); |
virtual void clearDepth(WGC3Dclampf depth); |
virtual void clearStencil(WGC3Dint s); |
virtual void colorMask(WGC3Dboolean red, WGC3Dboolean green, |
WGC3Dboolean blue, WGC3Dboolean alpha); |
virtual void compileShader(WebGLId shader); |
- virtual void copyTexImage2D( |
- WGC3Denum target, |
- WGC3Dint level, |
- WGC3Denum internalformat, |
- WGC3Dint x, |
- WGC3Dint y, |
- WGC3Dsizei width, |
- WGC3Dsizei height, |
- WGC3Dint border); |
- virtual void copyTexSubImage2D( |
- WGC3Denum target, |
- WGC3Dint level, |
- WGC3Dint xoffset, |
- WGC3Dint yoffset, |
- WGC3Dint x, |
- WGC3Dint y, |
- WGC3Dsizei width, |
- WGC3Dsizei height); |
+ virtual void copyTexImage2D(WGC3Denum target, |
+ WGC3Dint level, |
+ WGC3Denum internalformat, |
+ WGC3Dint x, |
+ WGC3Dint y, |
+ WGC3Dsizei width, |
+ WGC3Dsizei height, |
+ WGC3Dint border); |
+ virtual void copyTexSubImage2D(WGC3Denum target, |
+ WGC3Dint level, |
+ WGC3Dint xoffset, |
+ WGC3Dint yoffset, |
+ WGC3Dint x, |
+ WGC3Dint y, |
+ WGC3Dsizei width, |
+ WGC3Dsizei height); |
virtual void cullFace(WGC3Denum mode); |
virtual void depthFunc(WGC3Denum func); |
virtual void depthMask(WGC3Dboolean flag); |
@@ -162,42 +130,46 @@ class WebGraphicsContext3DInProcessCommandBufferImpl : public WebGraphicsContext |
virtual void disable(WGC3Denum cap); |
virtual void disableVertexAttribArray(WGC3Duint index); |
virtual void drawArrays(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count); |
- virtual void drawElements( |
- WGC3Denum mode, |
- WGC3Dsizei count, |
- WGC3Denum type, |
- WGC3Dintptr offset); |
+ virtual void drawElements(WGC3Denum mode, |
+ WGC3Dsizei count, |
+ WGC3Denum type, |
+ WGC3Dintptr offset); |
virtual void enable(WGC3Denum cap); |
virtual void enableVertexAttribArray(WGC3Duint index); |
virtual void finish(); |
virtual void flush(); |
- virtual void framebufferRenderbuffer( |
- WGC3Denum target, |
- WGC3Denum attachment, |
- WGC3Denum renderbuffertarget, |
- WebGLId renderbuffer); |
- virtual void framebufferTexture2D( |
- WGC3Denum target, |
- WGC3Denum attachment, |
- WGC3Denum textarget, |
- WebGLId texture, |
- WGC3Dint level); |
+ virtual void framebufferRenderbuffer(WGC3Denum target, |
+ WGC3Denum attachment, |
+ WGC3Denum renderbuffertarget, |
+ WebGLId renderbuffer); |
+ virtual void framebufferTexture2D(WGC3Denum target, |
+ WGC3Denum attachment, |
+ WGC3Denum textarget, |
+ WebGLId texture, |
+ WGC3Dint level); |
virtual void frontFace(WGC3Denum mode); |
virtual void generateMipmap(WGC3Denum target); |
- virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&); |
- virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&); |
+ virtual bool getActiveAttrib(WebGLId program, |
+ WGC3Duint index, |
+ ActiveInfo&); |
+ virtual bool getActiveUniform(WebGLId program, |
+ WGC3Duint index, |
+ ActiveInfo&); |
- virtual void getAttachedShaders(WebGLId program, WGC3Dsizei maxCount, |
- WGC3Dsizei* count, WebGLId* shaders); |
+ virtual void getAttachedShaders(WebGLId program, |
+ WGC3Dsizei maxCount, |
+ WGC3Dsizei* count, |
+ WebGLId* shaders); |
- virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name); |
+ virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name); |
virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value); |
- virtual void getBufferParameteriv( |
- WGC3Denum target, WGC3Denum pname, WGC3Dint* value); |
+ virtual void getBufferParameteriv(WGC3Denum target, |
+ WGC3Denum pname, |
+ WGC3Dint* value); |
virtual Attributes getContextAttributes(); |
@@ -207,54 +179,56 @@ class WebGraphicsContext3DInProcessCommandBufferImpl : public WebGraphicsContext |
virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value); |
- virtual void getFramebufferAttachmentParameteriv( |
- WGC3Denum target, |
- WGC3Denum attachment, |
- WGC3Denum pname, |
- WGC3Dint* value); |
+ virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, |
+ WGC3Denum attachment, |
+ WGC3Denum pname, |
+ WGC3Dint* value); |
virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value); |
- virtual void getProgramiv( |
- WebGLId program, WGC3Denum pname, WGC3Dint* value); |
+ virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value); |
- virtual WebString getProgramInfoLog(WebGLId program); |
+ virtual WebKit::WebString getProgramInfoLog(WebGLId program); |
- virtual void getRenderbufferParameteriv( |
- WGC3Denum target, WGC3Denum pname, WGC3Dint* value); |
+ virtual void getRenderbufferParameteriv(WGC3Denum target, |
+ WGC3Denum pname, |
+ WGC3Dint* value); |
- virtual void getShaderiv( |
- WebGLId shader, WGC3Denum pname, WGC3Dint* value); |
+ virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value); |
- virtual WebString getShaderInfoLog(WebGLId shader); |
+ virtual WebKit::WebString getShaderInfoLog(WebGLId shader); |
// TBD |
- // void glGetShaderPrecisionFormat( |
- // GLenum shadertype, GLenum precisiontype, |
- // GLint* range, GLint* precision); |
- |
- virtual WebString getShaderSource(WebGLId shader); |
- virtual WebString getString(WGC3Denum name); |
- |
- virtual void getTexParameterfv( |
- WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value); |
- virtual void getTexParameteriv( |
- WGC3Denum target, WGC3Denum pname, WGC3Dint* value); |
- |
- virtual void getUniformfv( |
- WebGLId program, WGC3Dint location, WGC3Dfloat* value); |
- virtual void getUniformiv( |
- WebGLId program, WGC3Dint location, WGC3Dint* value); |
+ // void glGetShaderPrecisionFormat (GLenum shadertype, |
+ // GLenum precisiontype, |
+ // GLint* range, |
+ // GLint* precision); |
+ |
+ virtual WebKit::WebString getShaderSource(WebGLId shader); |
+ virtual WebKit::WebString getString(WGC3Denum name); |
+ |
+ virtual void getTexParameterfv(WGC3Denum target, |
+ WGC3Denum pname, |
+ WGC3Dfloat* value); |
+ virtual void getTexParameteriv(WGC3Denum target, |
+ WGC3Denum pname, |
+ WGC3Dint* value); |
+ |
+ virtual void getUniformfv(WebGLId program, |
+ WGC3Dint location, |
+ WGC3Dfloat* value); |
+ virtual void getUniformiv(WebGLId program, |
+ WGC3Dint location, |
+ WGC3Dint* value); |
virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name); |
- virtual void getVertexAttribfv( |
- WGC3Duint index, WGC3Denum pname, WGC3Dfloat* value); |
- virtual void getVertexAttribiv( |
- WGC3Duint index, WGC3Denum pname, WGC3Dint* value); |
+ virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, |
+ WGC3Dfloat* value); |
+ virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, |
+ WGC3Dint* value); |
- virtual WGC3Dsizeiptr getVertexAttribOffset( |
- WGC3Duint index, WGC3Denum pname); |
+ virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname); |
virtual void hint(WGC3Denum target, WGC3Denum mode); |
virtual WGC3Dboolean isBuffer(WebGLId buffer); |
@@ -264,103 +238,111 @@ class WebGraphicsContext3DInProcessCommandBufferImpl : public WebGraphicsContext |
virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer); |
virtual WGC3Dboolean isShader(WebGLId shader); |
virtual WGC3Dboolean isTexture(WebGLId texture); |
- virtual void lineWidth(WGC3Dfloat width); |
+ virtual void lineWidth(WGC3Dfloat); |
virtual void linkProgram(WebGLId program); |
virtual void pixelStorei(WGC3Denum pname, WGC3Dint param); |
virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units); |
- virtual void readPixels( |
- WGC3Dint x, WGC3Dint y, |
- WGC3Dsizei width, WGC3Dsizei height, |
- WGC3Denum format, |
- WGC3Denum type, |
- void* pixels); |
+ virtual void readPixels(WGC3Dint x, |
+ WGC3Dint y, |
+ WGC3Dsizei width, |
+ WGC3Dsizei height, |
+ WGC3Denum format, |
+ WGC3Denum type, |
+ void* pixels); |
virtual void releaseShaderCompiler(); |
- virtual void renderbufferStorage( |
- WGC3Denum target, |
- WGC3Denum internalformat, |
- WGC3Dsizei width, |
- WGC3Dsizei height); |
- virtual void sampleCoverage(WGC3Dclampf value, WGC3Dboolean invert); |
- virtual void scissor( |
- WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height); |
- virtual void shaderSource(WebGLId shader, const WGC3Dchar* source); |
+ virtual void renderbufferStorage(WGC3Denum target, |
+ WGC3Denum internalformat, |
+ WGC3Dsizei width, |
+ WGC3Dsizei height); |
+ virtual void sampleCoverage(WGC3Dfloat value, WGC3Dboolean invert); |
+ virtual void scissor(WGC3Dint x, WGC3Dint y, |
+ WGC3Dsizei width, WGC3Dsizei height); |
+ virtual void shaderSource(WebGLId shader, const WGC3Dchar* string); |
virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask); |
- virtual void stencilFuncSeparate( |
- WGC3Denum face, WGC3Denum func, WGC3Dint ref, WGC3Duint mask); |
+ virtual void stencilFuncSeparate(WGC3Denum face, |
+ WGC3Denum func, |
+ WGC3Dint ref, |
+ WGC3Duint mask); |
virtual void stencilMask(WGC3Duint mask); |
virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask); |
- virtual void stencilOp(WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass); |
- virtual void stencilOpSeparate( |
- WGC3Denum face, |
- WGC3Denum fail, |
- WGC3Denum zfail, |
- WGC3Denum zpass); |
- |
- virtual void texImage2D( |
- WGC3Denum target, |
- WGC3Dint level, |
- WGC3Denum internalformat, |
- WGC3Dsizei width, |
- WGC3Dsizei height, |
- WGC3Dint border, |
- WGC3Denum format, |
- WGC3Denum type, |
- const void* pixels); |
- |
- virtual void texParameterf( |
- WGC3Denum target, WGC3Denum pname, WGC3Dfloat param); |
- virtual void texParameteri( |
- WGC3Denum target, WGC3Denum pname, WGC3Dint param); |
- |
- virtual void texSubImage2D( |
- WGC3Denum target, |
- WGC3Dint level, |
- WGC3Dint xoffset, |
- WGC3Dint yoffset, |
- WGC3Dsizei width, |
- WGC3Dsizei height, |
- WGC3Denum format, |
- WGC3Denum type, |
- const void* pixels); |
+ virtual void stencilOp(WGC3Denum fail, |
+ WGC3Denum zfail, |
+ WGC3Denum zpass); |
+ virtual void stencilOpSeparate(WGC3Denum face, |
+ WGC3Denum fail, |
+ WGC3Denum zfail, |
+ WGC3Denum zpass); |
+ |
+ virtual void texImage2D(WGC3Denum target, |
+ WGC3Dint level, |
+ WGC3Denum internalformat, |
+ WGC3Dsizei width, |
+ WGC3Dsizei height, |
+ WGC3Dint border, |
+ WGC3Denum format, |
+ WGC3Denum type, |
+ const void* pixels); |
+ |
+ virtual void texParameterf(WGC3Denum target, |
+ WGC3Denum pname, |
+ WGC3Dfloat param); |
+ virtual void texParameteri(WGC3Denum target, |
+ WGC3Denum pname, |
+ WGC3Dint param); |
+ |
+ virtual void texSubImage2D(WGC3Denum target, |
+ WGC3Dint level, |
+ WGC3Dint xoffset, |
+ WGC3Dint yoffset, |
+ WGC3Dsizei width, |
+ WGC3Dsizei height, |
+ WGC3Denum format, |
+ WGC3Denum type, |
+ const void* pixels); |
virtual void uniform1f(WGC3Dint location, WGC3Dfloat x); |
- virtual void uniform1fv(WGC3Dint location, WGC3Dsizei count, |
- const WGC3Dfloat* v); |
+ virtual void uniform1fv(WGC3Dint location, |
+ WGC3Dsizei count, const WGC3Dfloat* v); |
virtual void uniform1i(WGC3Dint location, WGC3Dint x); |
- virtual void uniform1iv(WGC3Dint location, WGC3Dsizei count, |
- const WGC3Dint* v); |
+ virtual void uniform1iv(WGC3Dint location, |
+ WGC3Dsizei count, const WGC3Dint* v); |
virtual void uniform2f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y); |
- virtual void uniform2fv(WGC3Dint location, WGC3Dsizei count, |
- const WGC3Dfloat* v); |
+ virtual void uniform2fv(WGC3Dint location, |
+ WGC3Dsizei count, const WGC3Dfloat* v); |
virtual void uniform2i(WGC3Dint location, WGC3Dint x, WGC3Dint y); |
- virtual void uniform2iv(WGC3Dint location, WGC3Dsizei count, |
- const WGC3Dint* v); |
+ virtual void uniform2iv(WGC3Dint location, |
+ WGC3Dsizei count, const WGC3Dint* v); |
virtual void uniform3f(WGC3Dint location, |
WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z); |
- virtual void uniform3fv(WGC3Dint location, WGC3Dsizei count, |
- const WGC3Dfloat* v); |
- virtual void uniform3i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z); |
- virtual void uniform3iv(WGC3Dint location, WGC3Dsizei count, |
- const WGC3Dint* v); |
- virtual void uniform4f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, |
+ virtual void uniform3fv(WGC3Dint location, |
+ WGC3Dsizei count, const WGC3Dfloat* v); |
+ virtual void uniform3i(WGC3Dint location, |
+ WGC3Dint x, WGC3Dint y, WGC3Dint z); |
+ virtual void uniform3iv(WGC3Dint location, |
+ WGC3Dsizei count, const WGC3Dint* v); |
+ virtual void uniform4f(WGC3Dint location, |
+ WGC3Dfloat x, WGC3Dfloat y, |
WGC3Dfloat z, WGC3Dfloat w); |
- virtual void uniform4fv(WGC3Dint location, WGC3Dsizei count, |
- const WGC3Dfloat* v); |
- virtual void uniform4i(WGC3Dint location, WGC3Dint x, WGC3Dint y, |
- WGC3Dint z, WGC3Dint w); |
- virtual void uniform4iv(WGC3Dint location, WGC3Dsizei count, |
- const WGC3Dint* v); |
- virtual void uniformMatrix2fv( |
- WGC3Dint location, WGC3Dsizei count, |
- WGC3Dboolean transpose, const WGC3Dfloat* value); |
- virtual void uniformMatrix3fv( |
- WGC3Dint location, WGC3Dsizei count, |
- WGC3Dboolean transpose, const WGC3Dfloat* value); |
- virtual void uniformMatrix4fv( |
- WGC3Dint location, WGC3Dsizei count, |
- WGC3Dboolean transpose, const WGC3Dfloat* value); |
+ virtual void uniform4fv(WGC3Dint location, |
+ WGC3Dsizei count, const WGC3Dfloat* v); |
+ virtual void uniform4i(WGC3Dint location, |
+ WGC3Dint x, WGC3Dint y, WGC3Dint z, WGC3Dint w); |
+ virtual void uniform4iv(WGC3Dint location, |
+ WGC3Dsizei count, const WGC3Dint* v); |
+ virtual void uniformMatrix2fv(WGC3Dint location, |
+ WGC3Dsizei count, |
+ WGC3Dboolean transpose, |
+ const WGC3Dfloat* value); |
+ virtual void uniformMatrix3fv(WGC3Dint location, |
+ WGC3Dsizei count, |
+ WGC3Dboolean transpose, |
+ const WGC3Dfloat* value); |
+ virtual void uniformMatrix4fv(WGC3Dint location, |
+ WGC3Dsizei count, |
+ WGC3Dboolean transpose, |
+ const WGC3Dfloat* value); |
virtual void useProgram(WebGLId program); |
virtual void validateProgram(WebGLId program); |
@@ -369,22 +351,22 @@ class WebGraphicsContext3DInProcessCommandBufferImpl : public WebGraphicsContext |
virtual void vertexAttrib1fv(WGC3Duint index, const WGC3Dfloat* values); |
virtual void vertexAttrib2f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y); |
virtual void vertexAttrib2fv(WGC3Duint index, const WGC3Dfloat* values); |
- virtual void vertexAttrib3f( |
- WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z); |
+ virtual void vertexAttrib3f(WGC3Duint index, |
+ WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z); |
virtual void vertexAttrib3fv(WGC3Duint index, const WGC3Dfloat* values); |
- virtual void vertexAttrib4f( |
- WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w); |
+ virtual void vertexAttrib4f(WGC3Duint index, |
+ WGC3Dfloat x, WGC3Dfloat y, |
+ WGC3Dfloat z, WGC3Dfloat w); |
virtual void vertexAttrib4fv(WGC3Duint index, const WGC3Dfloat* values); |
- virtual void vertexAttribPointer( |
- WGC3Duint index, |
- WGC3Dint size, |
- WGC3Denum type, |
- WGC3Dboolean normalized, |
- WGC3Dsizei stride, |
- WGC3Dintptr offset); |
+ virtual void vertexAttribPointer(WGC3Duint index, |
+ WGC3Dint size, |
+ WGC3Denum type, |
+ WGC3Dboolean normalized, |
+ WGC3Dsizei stride, |
+ WGC3Dintptr offset); |
- virtual void viewport( |
- WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height); |
+ virtual void viewport(WGC3Dint x, WGC3Dint y, |
+ WGC3Dsizei width, WGC3Dsizei height); |
// Support for buffer creation and deletion |
virtual WebGLId createBuffer(); |
@@ -401,80 +383,96 @@ class WebGraphicsContext3DInProcessCommandBufferImpl : public WebGraphicsContext |
virtual void deleteShader(WebGLId); |
virtual void deleteTexture(WebGLId); |
- virtual void setContextLostCallback( |
- WebGraphicsContext3D::WebGraphicsContextLostCallback* callback) {} |
+ virtual void synthesizeGLError(WGC3Denum); |
- private: |
- // ANGLE related. |
- struct ShaderSourceEntry; |
+ virtual void* mapBufferSubDataCHROMIUM( |
+ WGC3Denum target, WGC3Dintptr offset, |
+ WGC3Dsizeiptr size, WGC3Denum access); |
+ virtual void unmapBufferSubDataCHROMIUM(const void*); |
+ virtual void* mapTexSubImage2DCHROMIUM( |
+ WGC3Denum target, |
+ WGC3Dint level, |
+ WGC3Dint xoffset, |
+ WGC3Dint yoffset, |
+ WGC3Dsizei width, |
+ WGC3Dsizei height, |
+ WGC3Denum format, |
+ WGC3Denum type, |
+ WGC3Denum access); |
+ virtual void unmapTexSubImage2DCHROMIUM(const void*); |
- typedef base::hash_map<WebGLId, ShaderSourceEntry*> ShaderSourceMap; |
+ virtual void copyTextureToParentTextureCHROMIUM( |
+ WebGLId texture, WebGLId parentTexture); |
-#ifdef FLIP_FRAMEBUFFER_VERTICALLY |
- void FlipVertically(unsigned char* framebuffer, |
- unsigned int width, |
- unsigned int height); |
-#endif |
+ virtual void getParentToChildLatchCHROMIUM(WGC3Duint* latch_id); |
+ virtual void getChildToParentLatchCHROMIUM(WGC3Duint* latch_id); |
+ virtual void waitLatchCHROMIUM(WGC3Duint latch_id); |
+ virtual void setLatchCHROMIUM(WGC3Duint latch_id); |
- // Take into account the user's requested context creation attributes, in |
- // particular stencil and antialias, and determine which could or could |
- // not be honored based on the capabilities of the OpenGL implementation. |
- void ValidateAttributes(); |
- |
- // Resolve the given rectangle of the multisampled framebuffer if necessary. |
- void ResolveMultisampledFramebuffer( |
- WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height); |
- |
- bool AngleCreateCompilers(); |
- void AngleDestroyCompilers(); |
- bool AngleValidateShaderSource(ShaderSourceEntry* entry); |
- |
- WebGraphicsContext3D::Attributes attributes_; |
- bool initialized_; |
- bool render_directly_to_web_view_; |
- bool is_gles2_; |
- bool have_ext_framebuffer_object_; |
- bool have_ext_framebuffer_multisample_; |
- bool have_angle_framebuffer_multisample_; |
- |
- WebGLId texture_; |
- WebGLId fbo_; |
- WebGLId depth_stencil_buffer_; |
- int cached_width_, cached_height_; |
+ virtual void rateLimitOffscreenContextCHROMIUM(); |
- // For multisampling |
- WebGLId multisample_fbo_; |
- WebGLId multisample_depth_stencil_buffer_; |
- WebGLId multisample_color_buffer_; |
+ virtual WebKit::WebString getRequestableExtensionsCHROMIUM(); |
+ virtual void requestExtensionCHROMIUM(const char*); |
- // For tracking which FBO is bound |
- WebGLId bound_fbo_; |
+ virtual void blitFramebufferCHROMIUM( |
+ WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, |
+ WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, |
+ WGC3Dbitfield mask, WGC3Denum filter); |
+ virtual void renderbufferStorageMultisampleCHROMIUM( |
+ WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, |
+ WGC3Dsizei width, WGC3Dsizei height); |
- // For tracking which texture is bound |
- WebGLId bound_texture_; |
+ virtual WebGLId createCompositorTexture(WGC3Dsizei width, WGC3Dsizei height); |
+ virtual void deleteCompositorTexture(WebGLId parent_texture); |
+ virtual void copyTextureToCompositor(WebGLId texture, |
+ WebGLId parent_texture); |
- // FBO used for copying child texture to parent texture. |
- WebGLId copy_texture_to_parent_texture_fbo_; |
+ virtual void setContextLostCallback( |
+ WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); |
-#ifdef FLIP_FRAMEBUFFER_VERTICALLY |
- unsigned char* scanline_; |
+ private: |
+ // SwapBuffers callback. |
+ void OnSwapBuffersComplete(); |
+ virtual void OnContextLost(); |
+ |
+ // Used to try to find bugs in code that calls gl directly through the gl api |
+ // instead of going through WebGraphicsContext3D. |
+ void ClearContext(); |
+ |
+ // The context we use for OpenGL rendering. |
+ GLInProcessContext* context_; |
+ // The GLES2Implementation we use for OpenGL rendering. |
+ ::gpu::gles2::GLES2Implementation* gl_; |
+ |
+ // If rendering directly to WebView, weak pointer to it. |
+ WebKit::WebView* web_view_; |
+#if defined(OS_MACOSX) |
+ // "Fake" plugin window handle in browser process for the compositor's output. |
+ gfx::PluginWindowHandle plugin_handle_; |
#endif |
+ WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; |
- // Errors raised by synthesizeGLError(). |
- std::list<WGC3Denum> synthetic_errors_list_; |
- std::set<WGC3Denum> synthetic_errors_set_; |
+ WebKit::WebGraphicsContext3D::Attributes attributes_; |
+ int cached_width_, cached_height_; |
- scoped_refptr<gfx::GLContext> gl_context_; |
- scoped_refptr<gfx::GLSurface> gl_surface_; |
+ // For tracking which FBO is bound. |
+ WebGLId bound_fbo_; |
- ShaderSourceMap shader_source_map_; |
+ // Errors raised by synthesizeGLError(). |
+ std::vector<WGC3Denum> synthetic_errors_; |
- ShHandle fragment_compiler_; |
- ShHandle vertex_compiler_; |
+#ifdef FLIP_FRAMEBUFFER_VERTICALLY |
+ scoped_array<uint8> scanline_; |
+ void FlipVertically(uint8* framebuffer, |
+ unsigned int width, |
+ unsigned int height); |
+#endif |
}; |
} // namespace gpu |
} // namespace webkit |
+#endif // defined(ENABLE_GPU) |
#endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
+ |