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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 class WebGLDebugShaders; 73 class WebGLDebugShaders;
74 class WebGLDepthTexture; 74 class WebGLDepthTexture;
75 class WebGLExtension; 75 class WebGLExtension;
76 class WebGLFramebuffer; 76 class WebGLFramebuffer;
77 class WebGLLoseContext; 77 class WebGLLoseContext;
78 class WebGLObject; 78 class WebGLObject;
79 class WebGLProgram; 79 class WebGLProgram;
80 class WebGLRenderbuffer; 80 class WebGLRenderbuffer;
81 class WebGLShader; 81 class WebGLShader;
82 class WebGLSharedObject; 82 class WebGLSharedObject;
83 class WebGLSharedResources;
83 class WebGLShaderPrecisionFormat; 84 class WebGLShaderPrecisionFormat;
84 class WebGLTexture; 85 class WebGLTexture;
85 class WebGLUniformLocation; 86 class WebGLUniformLocation;
86 class WebGLVertexArrayObjectOES; 87 class WebGLVertexArrayObjectOES;
87 88
88 typedef int ExceptionCode; 89 typedef int ExceptionCode;
89 90
90 class WebGLRenderingContext : public CanvasRenderingContext, public ActiveDOMObj ect, private Page::MultisamplingChangedObserver { 91 class WebGLRenderingContext : public CanvasRenderingContext, public ActiveDOMObj ect, private Page::MultisamplingChangedObserver {
91 public: 92 public:
92 static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*, WebGLCon textAttributes*); 93 static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*, WebGLCon textAttributes*);
93 virtual ~WebGLRenderingContext(); 94 virtual ~WebGLRenderingContext();
94 95
95 virtual bool is3d() const { return true; } 96 virtual bool is3d() const { return true; }
96 virtual bool isAccelerated() const { return true; } 97 virtual bool isAccelerated() const { return true; }
97 98
98 int drawingBufferWidth() const; 99 int drawingBufferWidth() const;
99 int drawingBufferHeight() const; 100 int drawingBufferHeight() const;
100 101
102 unsigned contextIndex() const;
103 unsigned resourceSyncCount() const;
104 void flushResourceChanges();
105
101 void activeTexture(GC3Denum texture, ExceptionCode&); 106 void activeTexture(GC3Denum texture, ExceptionCode&);
102 void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode&); 107 void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode&);
103 void bindAttribLocation(WebGLProgram*, GC3Duint index, const String& name, E xceptionCode&); 108 void bindAttribLocation(WebGLProgram*, GC3Duint index, const String& name, E xceptionCode&);
104 void bindBuffer(GC3Denum target, WebGLBuffer*, ExceptionCode&); 109 void bindBuffer(GC3Denum target, WebGLBuffer*, ExceptionCode&);
105 void bindFramebuffer(GC3Denum target, WebGLFramebuffer*, ExceptionCode&); 110 void bindFramebuffer(GC3Denum target, WebGLFramebuffer*, ExceptionCode&);
106 void bindRenderbuffer(GC3Denum target, WebGLRenderbuffer*, ExceptionCode&); 111 void bindRenderbuffer(GC3Denum target, WebGLRenderbuffer*, ExceptionCode&);
107 void bindTexture(GC3Denum target, WebGLTexture*, ExceptionCode&); 112 void bindTexture(GC3Denum target, WebGLTexture*, ExceptionCode&);
108 void blendColor(GC3Dfloat red, GC3Dfloat green, GC3Dfloat blue, GC3Dfloat al pha); 113 void blendColor(GC3Dfloat red, GC3Dfloat green, GC3Dfloat blue, GC3Dfloat al pha);
109 void blendEquation(GC3Denum mode); 114 void blendEquation(GC3Denum mode);
110 void blendEquationSeparate(GC3Denum modeRGB, GC3Denum modeAlpha); 115 void blendEquationSeparate(GC3Denum modeRGB, GC3Denum modeAlpha);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 String getShaderSource(WebGLShader*, ExceptionCode&); 194 String getShaderSource(WebGLShader*, ExceptionCode&);
190 Vector<String> getSupportedExtensions(); 195 Vector<String> getSupportedExtensions();
191 WebGLGetInfo getTexParameter(GC3Denum target, GC3Denum pname, ExceptionCode& ); 196 WebGLGetInfo getTexParameter(GC3Denum target, GC3Denum pname, ExceptionCode& );
192 WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*, Exceptio nCode&); 197 WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*, Exceptio nCode&);
193 PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const Str ing&, ExceptionCode&); 198 PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const Str ing&, ExceptionCode&);
194 WebGLGetInfo getVertexAttrib(GC3Duint index, GC3Denum pname, ExceptionCode&) ; 199 WebGLGetInfo getVertexAttrib(GC3Duint index, GC3Denum pname, ExceptionCode&) ;
195 long long getVertexAttribOffset(GC3Duint index, GC3Denum pname); 200 long long getVertexAttribOffset(GC3Duint index, GC3Denum pname);
196 201
197 void hint(GC3Denum target, GC3Denum mode); 202 void hint(GC3Denum target, GC3Denum mode);
198 GC3Dboolean isBuffer(WebGLBuffer*); 203 GC3Dboolean isBuffer(WebGLBuffer*);
199 bool isContextLost(); 204 bool isContextLost() const;
200 GC3Dboolean isEnabled(GC3Denum cap); 205 GC3Dboolean isEnabled(GC3Denum cap);
201 GC3Dboolean isFramebuffer(WebGLFramebuffer*); 206 GC3Dboolean isFramebuffer(WebGLFramebuffer*);
202 GC3Dboolean isProgram(WebGLProgram*); 207 GC3Dboolean isProgram(WebGLProgram*);
203 GC3Dboolean isRenderbuffer(WebGLRenderbuffer*); 208 GC3Dboolean isRenderbuffer(WebGLRenderbuffer*);
204 GC3Dboolean isShader(WebGLShader*); 209 GC3Dboolean isShader(WebGLShader*);
205 GC3Dboolean isTexture(WebGLTexture*); 210 GC3Dboolean isTexture(WebGLTexture*);
206 211
207 void lineWidth(GC3Dfloat); 212 void lineWidth(GC3Dfloat);
208 void linkProgram(WebGLProgram*, ExceptionCode&); 213 void linkProgram(WebGLProgram*, ExceptionCode&);
209 void pixelStorei(GC3Denum pname, GC3Dint param); 214 void pixelStorei(GC3Denum pname, GC3Dint param);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 void vertexAttrib4f(GC3Duint index, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, G C3Dfloat w); 298 void vertexAttrib4f(GC3Duint index, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, G C3Dfloat w);
294 void vertexAttrib4fv(GC3Duint index, Float32Array* values); 299 void vertexAttrib4fv(GC3Duint index, Float32Array* values);
295 void vertexAttrib4fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei size); 300 void vertexAttrib4fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei size);
296 void vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dbo olean normalized, 301 void vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dbo olean normalized,
297 GC3Dsizei stride, long long offset, ExceptionCode&) ; 302 GC3Dsizei stride, long long offset, ExceptionCode&) ;
298 303
299 void vertexAttribDivisorANGLE(GC3Duint index, GC3Duint divisor); 304 void vertexAttribDivisorANGLE(GC3Duint index, GC3Duint divisor);
300 305
301 void viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height); 306 void viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height);
302 307
308 long acquireSharedResource(WebGLSharedObject*, WebGLSharedObject::AcquireMod e, PassRefPtr<WebGLAcquireSharedResourceCallback>, ExceptionCode&);
309 void releaseSharedResource(WebGLSharedObject*, ExceptionCode&);
310 void cancelAcquireSharedResource(long);
311
303 // WEBKIT_lose_context support 312 // WEBKIT_lose_context support
304 enum LostContextMode { 313 enum LostContextMode {
305 // Lost context occurred at the graphics system level. 314 // Lost context occurred at the graphics system level.
306 RealLostContext, 315 RealLostContext,
307 316
308 // Lost context provoked by WEBKIT_lose_context. 317 // Lost context provoked by WEBKIT_lose_context.
309 SyntheticLostContext, 318 SyntheticLostContext,
310 319
311 // A synthetic lost context that should attempt to recover automatically 320 // A synthetic lost context that should attempt to recover automatically
312 AutoRecoverSyntheticLostContext 321 AutoRecoverSyntheticLostContext
(...skipping 14 matching lines...) Expand all
327 336
328 void removeSharedObject(WebGLSharedObject*); 337 void removeSharedObject(WebGLSharedObject*);
329 void removeContextObject(WebGLContextObject*); 338 void removeContextObject(WebGLContextObject*);
330 339
331 unsigned getMaxVertexAttribs() const { return m_maxVertexAttribs; } 340 unsigned getMaxVertexAttribs() const { return m_maxVertexAttribs; }
332 341
333 // ActiveDOMObject notifications 342 // ActiveDOMObject notifications
334 virtual bool hasPendingActivity() const; 343 virtual bool hasPendingActivity() const;
335 virtual void stop(); 344 virtual void stop();
336 345
346 enum ConsoleDisplayPreference {
347 DisplayInConsole,
348 DontDisplayInConsole
349 };
350
351 // Wrapper for GraphicsContext3D::synthesizeGLError that sends a message
352 // to the JavaScript console.
353 void synthesizeGLError(GC3Denum, const char* functionName, const char* descr iption, ConsoleDisplayPreference = DisplayInConsole);
354
337 private: 355 private:
338 friend class WebGLDrawBuffers; 356 friend class WebGLDrawBuffers;
339 friend class WebGLFramebuffer; 357 friend class WebGLFramebuffer;
340 friend class WebGLObject; 358 friend class WebGLObject;
341 friend class OESVertexArrayObject; 359 friend class OESVertexArrayObject;
342 friend class WebGLDebugShaders; 360 friend class WebGLDebugShaders;
343 friend class WebGLCompressedTextureATC; 361 friend class WebGLCompressedTextureATC;
344 friend class WebGLCompressedTexturePVRTC; 362 friend class WebGLCompressedTexturePVRTC;
345 friend class WebGLCompressedTextureS3TC; 363 friend class WebGLCompressedTextureS3TC;
346 friend class WebGLRenderingContextErrorMessageCallback; 364 friend class WebGLRenderingContextErrorMessageCallback;
347 friend class WebGLVertexArrayObjectOES; 365 friend class WebGLVertexArrayObjectOES;
348 366
349 WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, Gra phicsContext3D::Attributes, GraphicsContext3D::Attributes); 367 WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, Gra phicsContext3D::Attributes, GraphicsContext3D::Attributes, PassRefPtr<WebGLConte xtGroup>);
350 void initializeNewContext(); 368 void initializeNewContext();
351 void setupFlags(); 369 void setupFlags();
352 370
353 void addSharedObject(WebGLSharedObject*); 371 void addSharedObject(WebGLSharedObject*);
354 void addContextObject(WebGLContextObject*); 372 void addContextObject(WebGLContextObject*);
355 void detachAndRemoveAllObjects(); 373 void detachAndRemoveAllObjects();
356 374
357 void destroyGraphicsContext3D(); 375 void destroyGraphicsContext3D();
358 void markContextChanged(); 376 void markContextChanged();
359 377
360 // Query if the GL implementation is NPOT strict. 378 // Query if the GL implementation is NPOT strict.
361 bool isGLES2NPOTStrict() { return m_isGLES2NPOTStrict; } 379 bool isGLES2NPOTStrict() { return m_isGLES2NPOTStrict; }
362 // Query if depth_stencil buffer is supported. 380 // Query if depth_stencil buffer is supported.
363 bool isDepthStencilSupported() { return m_isDepthStencilSupported; } 381 bool isDepthStencilSupported() { return m_isDepthStencilSupported; }
364 382
365 // Helper to return the size in bytes of OpenGL data types 383 // Helper to return the size in bytes of OpenGL data types
366 // like GL_FLOAT, GL_INT, etc. 384 // like GL_FLOAT, GL_INT, etc.
367 unsigned int sizeInBytes(GC3Denum type); 385 unsigned int sizeInBytes(GC3Denum type);
368 386
369 // Check if each enabled vertex attribute is bound to a buffer. 387 // Check if each enabled vertex attribute is bound to a buffer.
370 bool validateRenderingState(); 388 bool validateRenderingState(const char*);
371 389
372 bool validateWebGLObject(const char*, WebGLObject*); 390 bool validateWebGLContextObject(const char*, WebGLContextObject*);
391 bool validateWebGLSharedObject(const char*, WebGLSharedObject*, WebGLSharedO bject::AcquireMode);
373 392
374 // Adds a compressed texture format. 393 // Adds a compressed texture format.
375 void addCompressedTextureFormat(GC3Denum); 394 void addCompressedTextureFormat(GC3Denum);
376 void removeAllCompressedTextureFormats(); 395 void removeAllCompressedTextureFormats();
377 396
397 WebGLBuffer* getBufferForTarget(const char* functionName, GC3Denum target);
398
378 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy, Exc eptionCode&); 399 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy, Exc eptionCode&);
379 400
380 WebGLRenderbuffer* ensureEmulatedStencilBuffer(GC3Denum target, WebGLRenderb uffer*); 401 WebGLRenderbuffer* ensureEmulatedStencilBuffer(GC3Denum target, WebGLRenderb uffer*);
381 402
382 RefPtr<GraphicsContext3D> m_context; 403 RefPtr<GraphicsContext3D> m_context;
383 RefPtr<WebGLContextGroup> m_contextGroup; 404 RefPtr<WebGLContextGroup> m_contextGroup;
384 405
385 // Structure for rendering to a DrawingBuffer, instead of directly 406 // Structure for rendering to a DrawingBuffer, instead of directly
386 // to the back-buffer of m_context. 407 // to the back-buffer of m_context.
387 RefPtr<DrawingBuffer> m_drawingBuffer; 408 RefPtr<DrawingBuffer> m_drawingBuffer;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 RefPtr<OESVertexArrayObject> m_oesVertexArrayObject; 541 RefPtr<OESVertexArrayObject> m_oesVertexArrayObject;
521 RefPtr<OESElementIndexUint> m_oesElementIndexUint; 542 RefPtr<OESElementIndexUint> m_oesElementIndexUint;
522 RefPtr<WebGLLoseContext> m_webglLoseContext; 543 RefPtr<WebGLLoseContext> m_webglLoseContext;
523 RefPtr<WebGLDebugRendererInfo> m_webglDebugRendererInfo; 544 RefPtr<WebGLDebugRendererInfo> m_webglDebugRendererInfo;
524 RefPtr<WebGLDebugShaders> m_webglDebugShaders; 545 RefPtr<WebGLDebugShaders> m_webglDebugShaders;
525 RefPtr<WebGLDrawBuffers> m_webglDrawBuffers; 546 RefPtr<WebGLDrawBuffers> m_webglDrawBuffers;
526 RefPtr<WebGLCompressedTextureATC> m_webglCompressedTextureATC; 547 RefPtr<WebGLCompressedTextureATC> m_webglCompressedTextureATC;
527 RefPtr<WebGLCompressedTexturePVRTC> m_webglCompressedTexturePVRTC; 548 RefPtr<WebGLCompressedTexturePVRTC> m_webglCompressedTexturePVRTC;
528 RefPtr<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC; 549 RefPtr<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC;
529 RefPtr<WebGLDepthTexture> m_webglDepthTexture; 550 RefPtr<WebGLDepthTexture> m_webglDepthTexture;
551 RefPtr<WebGLSharedResources> m_webglSharedResources;
530 552
531 class ExtensionTracker { 553 class ExtensionTracker {
532 public: 554 public:
533 ExtensionTracker(bool privileged, bool draft, bool prefixed, const char* * prefixes) 555 ExtensionTracker(bool privileged, bool draft, bool prefixed, const char* * prefixes)
534 : m_privileged(privileged) 556 : m_privileged(privileged)
535 , m_draft(draft) 557 , m_draft(draft)
536 , m_prefixed(prefixed) 558 , m_prefixed(prefixed)
537 , m_prefixes(prefixes) 559 , m_prefixes(prefixes)
538 { 560 {
539 } 561 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 654
633 // Helpers for getParameter and others 655 // Helpers for getParameter and others
634 WebGLGetInfo getBooleanParameter(GC3Denum); 656 WebGLGetInfo getBooleanParameter(GC3Denum);
635 WebGLGetInfo getBooleanArrayParameter(GC3Denum); 657 WebGLGetInfo getBooleanArrayParameter(GC3Denum);
636 WebGLGetInfo getFloatParameter(GC3Denum); 658 WebGLGetInfo getFloatParameter(GC3Denum);
637 WebGLGetInfo getIntParameter(GC3Denum); 659 WebGLGetInfo getIntParameter(GC3Denum);
638 WebGLGetInfo getUnsignedIntParameter(GC3Denum); 660 WebGLGetInfo getUnsignedIntParameter(GC3Denum);
639 WebGLGetInfo getWebGLFloatArrayParameter(GC3Denum); 661 WebGLGetInfo getWebGLFloatArrayParameter(GC3Denum);
640 WebGLGetInfo getWebGLIntArrayParameter(GC3Denum); 662 WebGLGetInfo getWebGLIntArrayParameter(GC3Denum);
641 663
664 bool isAcquiredForModification(const char*, WebGLSharedObject*);
665 bool isAcquiredForReading(const char*, WebGLSharedObject*);
666
642 // Clear the backbuffer if it was composited since the last operation. 667 // Clear the backbuffer if it was composited since the last operation.
643 // clearMask is set to the bitfield of any clear that would happen anyway at this time 668 // clearMask is set to the bitfield of any clear that would happen anyway at this time
644 // and the function returns true if that clear is now unnecessary. 669 // and the function returns true if that clear is now unnecessary.
645 bool clearIfComposited(GC3Dbitfield clearMask = 0); 670 bool clearIfComposited(GC3Dbitfield clearMask = 0);
646 671
647 // Helper to restore state that clearing the framebuffer may destroy. 672 // Helper to restore state that clearing the framebuffer may destroy.
648 void restoreStateAfterClear(); 673 void restoreStateAfterClear();
649 674
650 void texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum ty pe, const void* pixels, ExceptionCode&); 675 void texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum ty pe, const void* pixels, ExceptionCode&);
651 void texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Image*, GraphicsContext3D::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha, ExceptionCode&); 676 void texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Image*, GraphicsContext3D::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha, ExceptionCode&);
652 void texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3D int yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels, ExceptionCode&); 677 void texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3D int yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels, ExceptionCode&);
653 void texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3D int yoffset, GC3Denum format, GC3Denum type, Image*, GraphicsContext3D::ImageHtm lDomSource, bool flipY, bool premultiplyAlpha, ExceptionCode&); 678 void texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3D int yoffset, GC3Denum format, GC3Denum type, Image*, GraphicsContext3D::ImageHtm lDomSource, bool flipY, bool premultiplyAlpha, ExceptionCode&);
654 679
655 void handleTextureCompleteness(const char*, bool); 680 bool handleTextureCompleteness(const char*, bool, bool*);
656 void createFallbackBlackTextures1x1(); 681 void createFallbackBlackTextures1x1();
657 682
658 // Helper function for copyTex{Sub}Image, check whether the internalformat 683 // Helper function for copyTex{Sub}Image, check whether the internalformat
659 // and the color buffer format of the current bound framebuffer combination 684 // and the color buffer format of the current bound framebuffer combination
660 // is valid. 685 // is valid.
661 bool isTexInternalFormatColorBufferCombinationValid(GC3Denum texInternalForm at, 686 bool isTexInternalFormatColorBufferCombinationValid(GC3Denum texInternalForm at,
662 GC3Denum colorBufferForm at); 687 GC3Denum colorBufferForm at);
663 688
664 // Helper function to get the bound framebuffer's color buffer format. 689 // Helper function to get the bound framebuffer's color buffer format.
665 GC3Denum getBoundFramebufferColorFormat(); 690 GC3Denum getBoundFramebufferColorFormat();
(...skipping 11 matching lines...) Expand all
677 // Generate GL error and return false for negative inputs; otherwise, return true. 702 // Generate GL error and return false for negative inputs; otherwise, return true.
678 bool validateSize(const char* functionName, GC3Dint x, GC3Dint y); 703 bool validateSize(const char* functionName, GC3Dint x, GC3Dint y);
679 704
680 // Helper function to check if all characters in the string belong to the 705 // Helper function to check if all characters in the string belong to the
681 // ASCII subset as defined in GLSL ES 1.0 spec section 3.1. 706 // ASCII subset as defined in GLSL ES 1.0 spec section 3.1.
682 bool validateString(const char* functionName, const String&); 707 bool validateString(const char* functionName, const String&);
683 708
684 // Helper function to check target and texture bound to the target. 709 // Helper function to check target and texture bound to the target.
685 // Generate GL errors and return 0 if target is invalid or texture bound is 710 // Generate GL errors and return 0 if target is invalid or texture bound is
686 // null. Otherwise, return the texture bound to the target. 711 // null. Otherwise, return the texture bound to the target.
687 WebGLTexture* validateTextureBinding(const char* functionName, GC3Denum targ et, bool useSixEnumsForCubeMap); 712 WebGLTexture* validateTextureBinding(const char* functionName, GC3Denum targ et, bool useSixEnumsForCubeMap, WebGLSharedObject::AcquireMode);
688 713
689 // Helper function to check input format/type for functions {copy}Tex{Sub}Im age. 714 // Helper function to check input format/type for functions {copy}Tex{Sub}Im age.
690 // Generates GL error and returns false if parameters are invalid. 715 // Generates GL error and returns false if parameters are invalid.
691 bool validateTexFuncFormatAndType(const char* functionName, GC3Denum format, GC3Denum type, GC3Dint level); 716 bool validateTexFuncFormatAndType(const char* functionName, GC3Denum format, GC3Denum type, GC3Dint level);
692 717
693 // Helper function to check input level for functions {copy}Tex{Sub}Image. 718 // Helper function to check input level for functions {copy}Tex{Sub}Image.
694 // Generates GL error and returns false if level is invalid. 719 // Generates GL error and returns false if level is invalid.
695 bool validateTexFuncLevel(const char* functionName, GC3Denum target, GC3Dint level); 720 bool validateTexFuncLevel(const char* functionName, GC3Denum target, GC3Dint level);
696 721
697 enum TexFuncValidationFunctionType { 722 enum TexFuncValidationFunctionType {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 // Helper function to validate blend equation mode. 811 // Helper function to validate blend equation mode.
787 bool validateBlendEquation(const char* functionName, GC3Denum); 812 bool validateBlendEquation(const char* functionName, GC3Denum);
788 813
789 // Helper function to validate blend func factors. 814 // Helper function to validate blend func factors.
790 bool validateBlendFuncFactors(const char* functionName, GC3Denum src, GC3Den um dst); 815 bool validateBlendFuncFactors(const char* functionName, GC3Denum src, GC3Den um dst);
791 816
792 // Helper function to validate a GL capability. 817 // Helper function to validate a GL capability.
793 bool validateCapability(const char* functionName, GC3Denum); 818 bool validateCapability(const char* functionName, GC3Denum);
794 819
795 // Helper function to validate input parameters for uniform functions. 820 // Helper function to validate input parameters for uniform functions.
821 bool validateUniformParameters(const char* functionName, const WebGLUniformL ocation*);
796 bool validateUniformParameters(const char* functionName, const WebGLUniformL ocation*, Float32Array*, GC3Dsizei mod); 822 bool validateUniformParameters(const char* functionName, const WebGLUniformL ocation*, Float32Array*, GC3Dsizei mod);
797 bool validateUniformParameters(const char* functionName, const WebGLUniformL ocation*, Int32Array*, GC3Dsizei mod); 823 bool validateUniformParameters(const char* functionName, const WebGLUniformL ocation*, Int32Array*, GC3Dsizei mod);
798 bool validateUniformParameters(const char* functionName, const WebGLUniformL ocation*, void*, GC3Dsizei, GC3Dsizei mod); 824 bool validateUniformParameters(const char* functionName, const WebGLUniformL ocation*, void*, GC3Dsizei, GC3Dsizei mod);
799 bool validateUniformMatrixParameters(const char* functionName, const WebGLUn iformLocation*, GC3Dboolean transpose, Float32Array*, GC3Dsizei mod); 825 bool validateUniformMatrixParameters(const char* functionName, const WebGLUn iformLocation*, GC3Dboolean transpose, Float32Array*, GC3Dsizei mod);
800 bool validateUniformMatrixParameters(const char* functionName, const WebGLUn iformLocation*, GC3Dboolean transpose, void*, GC3Dsizei, GC3Dsizei mod); 826 bool validateUniformMatrixParameters(const char* functionName, const WebGLUn iformLocation*, GC3Dboolean transpose, void*, GC3Dsizei, GC3Dsizei mod);
801 827
802 // Helper function to validate parameters for bufferData. 828 // Helper function to validate parameters for bufferData.
803 // Return the current bound buffer to target, or 0 if parameters are invalid . 829 // Return the current bound buffer to target, or 0 if parameters are invalid .
804 WebGLBuffer* validateBufferDataParameters(const char* functionName, GC3Denum target, GC3Denum usage); 830 WebGLBuffer* validateBufferDataParameters(const char* functionName, GC3Denum target, GC3Denum usage);
805 831
(...skipping 15 matching lines...) Expand all
821 // Helper function to validate draw*Instanced calls 847 // Helper function to validate draw*Instanced calls
822 bool validateDrawInstanced(const char* functionName, GC3Dsizei primcount); 848 bool validateDrawInstanced(const char* functionName, GC3Dsizei primcount);
823 849
824 // Helper functions for vertexAttribNf{v}. 850 // Helper functions for vertexAttribNf{v}.
825 void vertexAttribfImpl(const char* functionName, GC3Duint index, GC3Dsizei e xpectedSize, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat); 851 void vertexAttribfImpl(const char* functionName, GC3Duint index, GC3Dsizei e xpectedSize, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat);
826 void vertexAttribfvImpl(const char* functionName, GC3Duint index, Float32Arr ay*, GC3Dsizei expectedSize); 852 void vertexAttribfvImpl(const char* functionName, GC3Duint index, Float32Arr ay*, GC3Dsizei expectedSize);
827 void vertexAttribfvImpl(const char* functionName, GC3Duint index, GC3Dfloat* , GC3Dsizei, GC3Dsizei expectedSize); 853 void vertexAttribfvImpl(const char* functionName, GC3Duint index, GC3Dfloat* , GC3Dsizei, GC3Dsizei expectedSize);
828 854
829 // Helper function for delete* (deleteBuffer, deleteProgram, etc) functions. 855 // Helper function for delete* (deleteBuffer, deleteProgram, etc) functions.
830 // Return false if caller should return without further processing. 856 // Return false if caller should return without further processing.
831 bool deleteObject(WebGLObject*); 857 bool deleteContextObject(const char* functionName, WebGLContextObject*);
858 bool deleteSharedObject(const char* functionName, WebGLSharedObject*);
832 859
833 // Helper function for bind* (bindBuffer, bindTexture, etc) and useProgram. 860 // Helper function for bind* (bindBuffer, bindTexture, etc) and useProgram.
834 // If the object has already been deleted, set deleted to true upon return. 861 // If the object has already been deleted, set deleted to true upon return.
835 // Return false if caller should return without further processing. 862 // Return false if caller should return without further processing.
836 bool checkObjectToBeBound(const char* functionName, WebGLObject*, bool& dele ted); 863 bool checkContextObjectToBeBound(const char* functionName, WebGLContextObjec t*, bool& deleted);
864 bool checkSharedObjectToBeBound(const char* functionName, WebGLSharedObject* , bool& deleted, bool& boundSinceLastAcquire);
837 865
838 void dispatchContextLostEvent(Timer<WebGLRenderingContext>*); 866 void dispatchContextLostEvent(Timer<WebGLRenderingContext>*);
839 // Helper for restoration after context lost. 867 // Helper for restoration after context lost.
840 void maybeRestoreContext(Timer<WebGLRenderingContext>*); 868 void maybeRestoreContext(Timer<WebGLRenderingContext>*);
841 869
842 // Determine if we are running privileged code in the browser, for example, 870 // Determine if we are running privileged code in the browser, for example,
843 // a Safari or Chrome extension. 871 // a Safari or Chrome extension.
844 bool allowPrivilegedExtensions() const; 872 bool allowPrivilegedExtensions() const;
845 873
846 enum ConsoleDisplayPreference {
847 DisplayInConsole,
848 DontDisplayInConsole
849 };
850
851 // Wrapper for GraphicsContext3D::synthesizeGLError that sends a message
852 // to the JavaScript console.
853 void synthesizeGLError(GC3Denum, const char* functionName, const char* descr iption, ConsoleDisplayPreference = DisplayInConsole);
854
855 String ensureNotNull(const String&) const; 874 String ensureNotNull(const String&) const;
856 875
857 // Enable or disable stencil test based on user setting and 876 // Enable or disable stencil test based on user setting and
858 // whether the current FBO has a stencil buffer. 877 // whether the current FBO has a stencil buffer.
859 void applyStencilTest(); 878 void applyStencilTest();
860 879
861 // Helper for enabling or disabling a capability. 880 // Helper for enabling or disabling a capability.
862 void enableOrDisable(GC3Denum capability, bool enable); 881 void enableOrDisable(GC3Denum capability, bool enable);
863 882
864 // Clamp the width and height to GL_MAX_VIEWPORT_DIMS. 883 // Clamp the width and height to GL_MAX_VIEWPORT_DIMS.
(...skipping 22 matching lines...) Expand all
887 static void activateContext(WebGLRenderingContext*); 906 static void activateContext(WebGLRenderingContext*);
888 static void deactivateContext(WebGLRenderingContext*, bool addToInactiveList ); 907 static void deactivateContext(WebGLRenderingContext*, bool addToInactiveList );
889 static void willDestroyContext(WebGLRenderingContext*); 908 static void willDestroyContext(WebGLRenderingContext*);
890 static void forciblyLoseOldestContext(const String& reason); 909 static void forciblyLoseOldestContext(const String& reason);
891 static IntSize oldestContextSize(); 910 static IntSize oldestContextSize();
892 }; 911 };
893 912
894 } // namespace WebCore 913 } // namespace WebCore
895 914
896 #endif 915 #endif
OLDNEW
« 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