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

Unified Diff: Source/core/html/canvas/WebGLRenderingContext.h

Issue 17230006: Implement WEBGL_shared_resources Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | « Source/core/html/canvas/WebGLRenderbuffer.idl ('k') | Source/core/html/canvas/WebGLRenderingContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/WebGLRenderingContext.h
diff --git a/Source/core/html/canvas/WebGLRenderingContext.h b/Source/core/html/canvas/WebGLRenderingContext.h
index 358b94b3391948b660b60b701dd7877a3fab8189..60f1208d4e3845e2e3dccc85cb53c169070056e6 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.h
+++ b/Source/core/html/canvas/WebGLRenderingContext.h
@@ -80,6 +80,7 @@ class WebGLProgram;
class WebGLRenderbuffer;
class WebGLShader;
class WebGLSharedObject;
+class WebGLSharedResources;
class WebGLShaderPrecisionFormat;
class WebGLTexture;
class WebGLUniformLocation;
@@ -98,6 +99,10 @@ public:
int drawingBufferWidth() const;
int drawingBufferHeight() const;
+ unsigned contextIndex() const;
+ unsigned resourceSyncCount() const;
+ void flushResourceChanges();
+
void activeTexture(GC3Denum texture, ExceptionCode&);
void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode&);
void bindAttribLocation(WebGLProgram*, GC3Duint index, const String& name, ExceptionCode&);
@@ -196,7 +201,7 @@ public:
void hint(GC3Denum target, GC3Denum mode);
GC3Dboolean isBuffer(WebGLBuffer*);
- bool isContextLost();
+ bool isContextLost() const;
GC3Dboolean isEnabled(GC3Denum cap);
GC3Dboolean isFramebuffer(WebGLFramebuffer*);
GC3Dboolean isProgram(WebGLProgram*);
@@ -300,6 +305,10 @@ public:
void viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height);
+ long acquireSharedResource(WebGLSharedObject*, WebGLSharedObject::AcquireMode, PassRefPtr<WebGLAcquireSharedResourceCallback>, ExceptionCode&);
+ void releaseSharedResource(WebGLSharedObject*, ExceptionCode&);
+ void cancelAcquireSharedResource(long);
+
// WEBKIT_lose_context support
enum LostContextMode {
// Lost context occurred at the graphics system level.
@@ -334,6 +343,15 @@ public:
virtual bool hasPendingActivity() const;
virtual void stop();
+ enum ConsoleDisplayPreference {
+ DisplayInConsole,
+ DontDisplayInConsole
+ };
+
+ // Wrapper for GraphicsContext3D::synthesizeGLError that sends a message
+ // to the JavaScript console.
+ void synthesizeGLError(GC3Denum, const char* functionName, const char* description, ConsoleDisplayPreference = DisplayInConsole);
+
private:
friend class WebGLDrawBuffers;
friend class WebGLFramebuffer;
@@ -346,7 +364,7 @@ public:
friend class WebGLRenderingContextErrorMessageCallback;
friend class WebGLVertexArrayObjectOES;
- WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, GraphicsContext3D::Attributes, GraphicsContext3D::Attributes);
+ WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, GraphicsContext3D::Attributes, GraphicsContext3D::Attributes, PassRefPtr<WebGLContextGroup>);
void initializeNewContext();
void setupFlags();
@@ -367,14 +385,17 @@ public:
unsigned int sizeInBytes(GC3Denum type);
// Check if each enabled vertex attribute is bound to a buffer.
- bool validateRenderingState();
+ bool validateRenderingState(const char*);
- bool validateWebGLObject(const char*, WebGLObject*);
+ bool validateWebGLContextObject(const char*, WebGLContextObject*);
+ bool validateWebGLSharedObject(const char*, WebGLSharedObject*, WebGLSharedObject::AcquireMode);
// Adds a compressed texture format.
void addCompressedTextureFormat(GC3Denum);
void removeAllCompressedTextureFormats();
+ WebGLBuffer* getBufferForTarget(const char* functionName, GC3Denum target);
+
PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy, ExceptionCode&);
WebGLRenderbuffer* ensureEmulatedStencilBuffer(GC3Denum target, WebGLRenderbuffer*);
@@ -527,6 +548,7 @@ public:
RefPtr<WebGLCompressedTexturePVRTC> m_webglCompressedTexturePVRTC;
RefPtr<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC;
RefPtr<WebGLDepthTexture> m_webglDepthTexture;
+ RefPtr<WebGLSharedResources> m_webglSharedResources;
class ExtensionTracker {
public:
@@ -639,6 +661,9 @@ public:
WebGLGetInfo getWebGLFloatArrayParameter(GC3Denum);
WebGLGetInfo getWebGLIntArrayParameter(GC3Denum);
+ bool isAcquiredForModification(const char*, WebGLSharedObject*);
+ bool isAcquiredForReading(const char*, WebGLSharedObject*);
+
// Clear the backbuffer if it was composited since the last operation.
// clearMask is set to the bitfield of any clear that would happen anyway at this time
// and the function returns true if that clear is now unnecessary.
@@ -652,7 +677,7 @@ public:
void texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels, ExceptionCode&);
void texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, Image*, GraphicsContext3D::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha, ExceptionCode&);
- void handleTextureCompleteness(const char*, bool);
+ bool handleTextureCompleteness(const char*, bool, bool*);
void createFallbackBlackTextures1x1();
// Helper function for copyTex{Sub}Image, check whether the internalformat
@@ -684,7 +709,7 @@ public:
// Helper function to check target and texture bound to the target.
// Generate GL errors and return 0 if target is invalid or texture bound is
// null. Otherwise, return the texture bound to the target.
- WebGLTexture* validateTextureBinding(const char* functionName, GC3Denum target, bool useSixEnumsForCubeMap);
+ WebGLTexture* validateTextureBinding(const char* functionName, GC3Denum target, bool useSixEnumsForCubeMap, WebGLSharedObject::AcquireMode);
// Helper function to check input format/type for functions {copy}Tex{Sub}Image.
// Generates GL error and returns false if parameters are invalid.
@@ -793,6 +818,7 @@ public:
bool validateCapability(const char* functionName, GC3Denum);
// Helper function to validate input parameters for uniform functions.
+ bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*);
bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, Float32Array*, GC3Dsizei mod);
bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, Int32Array*, GC3Dsizei mod);
bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, void*, GC3Dsizei, GC3Dsizei mod);
@@ -828,12 +854,14 @@ public:
// Helper function for delete* (deleteBuffer, deleteProgram, etc) functions.
// Return false if caller should return without further processing.
- bool deleteObject(WebGLObject*);
+ bool deleteContextObject(const char* functionName, WebGLContextObject*);
+ bool deleteSharedObject(const char* functionName, WebGLSharedObject*);
// Helper function for bind* (bindBuffer, bindTexture, etc) and useProgram.
// If the object has already been deleted, set deleted to true upon return.
// Return false if caller should return without further processing.
- bool checkObjectToBeBound(const char* functionName, WebGLObject*, bool& deleted);
+ bool checkContextObjectToBeBound(const char* functionName, WebGLContextObject*, bool& deleted);
+ bool checkSharedObjectToBeBound(const char* functionName, WebGLSharedObject*, bool& deleted, bool& boundSinceLastAcquire);
void dispatchContextLostEvent(Timer<WebGLRenderingContext>*);
// Helper for restoration after context lost.
@@ -843,15 +871,6 @@ public:
// a Safari or Chrome extension.
bool allowPrivilegedExtensions() const;
- enum ConsoleDisplayPreference {
- DisplayInConsole,
- DontDisplayInConsole
- };
-
- // Wrapper for GraphicsContext3D::synthesizeGLError that sends a message
- // to the JavaScript console.
- void synthesizeGLError(GC3Denum, const char* functionName, const char* description, ConsoleDisplayPreference = DisplayInConsole);
-
String ensureNotNull(const String&) const;
// Enable or disable stencil test based on user setting and
« no previous file with comments | « Source/core/html/canvas/WebGLRenderbuffer.idl ('k') | Source/core/html/canvas/WebGLRenderingContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698