#include "platform/Timer.h"
#include "platform/graphics/GraphicsTypes3D.h"
#include "platform/graphics/ImageBuffer.h"
+#include "platform/graphics/gpu/DrawingBuffer.h"
#include "platform/graphics/gpu/Extensions3DUtil.h"
#include "platform/graphics/gpu/WebGLImageConversion.h"
#include "public/platform/WebGraphicsContext3D.h"
namespace WebCore {
class ANGLEInstancedArrays;
-class DrawingBuffer;
class EXTFragDepth;
+class EXTShaderTextureLOD;
class EXTTextureFilterAnisotropic;
class ExceptionState;
class HTMLImageElement;
class WebGLActiveInfo;
class WebGLBuffer;
class WebGLCompressedTextureATC;
+class WebGLCompressedTextureETC1;
class WebGLCompressedTexturePVRTC;
class WebGLCompressedTextureS3TC;
class WebGLContextAttributes;
class WebGLRenderingContextLostCallback;
class WebGLRenderingContextErrorMessageCallback;
-class WebGLRenderingContextBase: public CanvasRenderingContext, public ActiveDOMObject, private Page::MultisamplingChangedObserver {
+class WebGLRenderingContextBase: public CanvasRenderingContext, public ActiveDOMObject, public Page::MultisamplingChangedObserver {
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase);
public:
virtual ~WebGLRenderingContextBase();
void drawElements(GLenum mode, GLsizei count, GLenum type, long long offset);
void drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
- void drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount);
+ void drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, long long offset, GLsizei primcount);
void enable(GLenum cap);
void enableVertexAttribArray(GLuint index);
void hint(GLenum target, GLenum mode);
GLboolean isBuffer(WebGLBuffer*);
- bool isContextLost();
+ bool isContextLost() const;
GLboolean isEnabled(GLenum cap);
GLboolean isFramebuffer(WebGLFramebuffer*);
GLboolean isProgram(WebGLProgram*);
void forceRestoreContext();
void loseContextImpl(LostContextMode);
- blink::WebGraphicsContext3D* webGraphicsContext3D() const { return m_context.get(); }
+ blink::WebGraphicsContext3D* webContext() const { return m_drawingBuffer->context(); }
WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); }
virtual blink::WebLayer* platformLayer() const OVERRIDE;
Extensions3DUtil* extensionsUtil();
void markLayerComposited();
virtual void paintRenderingResultsToCanvas() OVERRIDE;
- PassRefPtr<ImageData> paintRenderingResultsToImageData();
+ PassRefPtrWillBeRawPtr<ImageData> paintRenderingResultsToImageData();
void removeSharedObject(WebGLSharedObject*);
void removeContextObject(WebGLContextObject*);
friend class OESVertexArrayObject;
friend class WebGLDebugShaders;
friend class WebGLCompressedTextureATC;
+ friend class WebGLCompressedTextureETC1;
friend class WebGLCompressedTexturePVRTC;
friend class WebGLCompressedTextureS3TC;
friend class WebGLRenderingContextErrorMessageCallback;
WebGLRenderbuffer* ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer*);
- OwnPtr<blink::WebGraphicsContext3D> m_context;
- RefPtr<WebGLContextGroup> m_contextGroup;
-
// Structure for rendering to a DrawingBuffer, instead of directly
// to the back-buffer of m_context.
RefPtr<DrawingBuffer> m_drawingBuffer;
+ RefPtr<WebGLContextGroup> m_contextGroup;
// Dispatches a context lost event once it is determined that one is needed.
// This is used both for synthetic and real context losses. For real ones, it's
// Generates GL error and returns false if level is invalid.
bool validateTexFuncLevel(const char* functionName, GLenum target, GLint level);
+ // Helper function to check if a 64-bit value is non-negative and can fit into a 32-bit integer.
+ // Generates GL error and returns false if not.
+ bool validateValueFitNonNegInt32(const char* functionName, const char* paramName, long long value);
+
enum TexFuncValidationFunctionType {
NotTexSubImage2D,
TexSubImage2D,
bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GLboolean transpose, Float32Array*, GLsizei mod);
bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GLboolean transpose, void*, GLsizei, GLsizei mod);
- // Helper function to validate parameters for bufferData.
- // Return the current bound buffer to target, or 0 if parameters are invalid.
- WebGLBuffer* validateBufferDataParameters(const char* functionName, GLenum target, GLenum usage);
+ // Helper function to validate the target for bufferData.
+ // Return the current bound buffer to target, or 0 if the target is invalid.
+ WebGLBuffer* validateBufferDataTarget(const char* functionName, GLenum target);
// Helper function for tex{Sub}Image2D to make sure image is ready and wouldn't taint Origin.
bool validateHTMLImageElement(const char* functionName, HTMLImageElement*, ExceptionState&);
void vertexAttribfvImpl(const char* functionName, GLuint index, Float32Array*, GLsizei expectedSize);
void vertexAttribfvImpl(const char* functionName, GLuint index, GLfloat*, GLsizei, GLsizei expectedSize);
+ // Helper functions to bufferData() and bufferSubData().
+ void bufferDataImpl(GLenum target, long long size, const void* data, GLenum usage);
+ void bufferSubDataImpl(GLenum target, long long offset, GLsizeiptr size, const void* data);
+
// Helper function for delete* (deleteBuffer, deleteProgram, etc) functions.
// Return false if caller should return without further processing.
bool deleteObject(WebGLObject*);