diff options
author | Ben Murdoch <benm@google.com> | 2010-08-13 05:20:16 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-13 05:20:16 -0700 |
commit | f4958a7d95cd5fbc1c74905e229b02c95cd5ee78 (patch) | |
tree | 14a0f1b07a19948c2ed93d0d8547caa7fe10aa0e /WebCore/html/canvas/WebGLBuffer.h | |
parent | d074a7997da8ce379434eb6e208b97cde8a0841c (diff) | |
parent | f964bc1fd59a545a80a0cc2529ad8830be514871 (diff) | |
download | external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.zip external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.gz external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.bz2 |
Merge changes I60a96064,I6929172f,Idefd9bec,I8cf448f2,I8791737a,I992c56b0,Ibb4b089d,I779a8ec0,Ife412e30,I2da1ae98,Ibcf41849
* changes:
Merge WebKit at r65072 : Update WebKit revision number.
Merge WebKit at r65072 : Update test_expectations.
Merge WebKit at r65072 : Complete cherry-pick of WebKit change 43848 to add EmptyDeviceMotionClient
Merge WebKit at r65072 : Implement DeviceMotionClientAndroid
Merge WebKit at r65072: JSC build fix in InspectorController.h
Merge WebKit at r65072: Fix V8 code generator.
Merge WebKit at r65072 : Build fix for JSC, update ambiguous usage of JSLock.
Merge WebKit at r65072: String class has moved to the WTF namespace.
Merge Webkit at r65072 : Fix conflicts.
Merge Webkit at r65072 : Fix Makefiles.
Merge WebKit at r65072 : Initial merge by git.
Diffstat (limited to 'WebCore/html/canvas/WebGLBuffer.h')
-rw-r--r-- | WebCore/html/canvas/WebGLBuffer.h | 123 |
1 files changed, 64 insertions, 59 deletions
diff --git a/WebCore/html/canvas/WebGLBuffer.h b/WebCore/html/canvas/WebGLBuffer.h index 1280cf9..a7a25b9 100644 --- a/WebCore/html/canvas/WebGLBuffer.h +++ b/WebCore/html/canvas/WebGLBuffer.h @@ -26,72 +26,77 @@ #ifndef WebGLBuffer_h #define WebGLBuffer_h -#include "CanvasObject.h" #include "ArrayBuffer.h" +#include "WebGLObject.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> namespace WebCore { - - class WebGLBuffer : public CanvasObject { - public: - virtual ~WebGLBuffer() { deleteObject(); } - - static PassRefPtr<WebGLBuffer> create(WebGLRenderingContext*); - - bool associateBufferData(int size); - bool associateBufferData(ArrayBuffer* array); - bool associateBufferData(ArrayBufferView* array); - bool associateBufferSubData(long offset, ArrayBuffer* array); - bool associateBufferSubData(long offset, ArrayBufferView* array); - - unsigned byteLength() const; - const ArrayBuffer* elementArrayBuffer() const { return m_elementArrayBuffer.get(); } - - // Gets the cached max index for the given type. Returns -1 if - // none has been set. - long getCachedMaxIndex(unsigned long type); - // Sets the cached max index for the given type. - void setCachedMaxIndex(unsigned long type, long value); - - unsigned long getTarget() const { return m_target; } - void setTarget(unsigned long); - - protected: - WebGLBuffer(WebGLRenderingContext*); - - virtual void _deleteObject(Platform3DObject o); - - private: - virtual bool isBuffer() const { return true; } - - unsigned long m_target; - - RefPtr<ArrayBuffer> m_elementArrayBuffer; - unsigned m_byteLength; - - // Optimization for index validation. For each type of index - // (i.e., UNSIGNED_SHORT), cache the maximum index in the - // entire buffer. - // - // This is sufficient to eliminate a lot of work upon each - // draw call as long as all bound array buffers are at least - // that size. - struct MaxIndexCacheEntry { - unsigned long type; - long maxIndex; - }; - // OpenGL ES 2.0 only has two valid index types (UNSIGNED_BYTE - // and UNSIGNED_SHORT), but might as well leave open the - // possibility of adding others. - MaxIndexCacheEntry m_maxIndexCache[4]; - unsigned m_nextAvailableCacheEntry; - - // Clears all of the cached max indices. - void clearCachedMaxIndices(); + +class WebGLBuffer : public WebGLObject { +public: + virtual ~WebGLBuffer() { deleteObject(); } + + static PassRefPtr<WebGLBuffer> create(WebGLRenderingContext*); + + bool associateBufferData(int size); + bool associateBufferData(ArrayBuffer* array); + bool associateBufferData(ArrayBufferView* array); + bool associateBufferSubData(long offset, ArrayBuffer* array); + bool associateBufferSubData(long offset, ArrayBufferView* array); + + unsigned byteLength() const; + const ArrayBuffer* elementArrayBuffer() const { return m_elementArrayBuffer.get(); } + + // Gets the cached max index for the given type. Returns -1 if + // none has been set. + long getCachedMaxIndex(unsigned long type); + // Sets the cached max index for the given type. + void setCachedMaxIndex(unsigned long type, long value); + + unsigned long getTarget() const { return m_target; } + void setTarget(unsigned long); + +protected: + WebGLBuffer(WebGLRenderingContext*); + + virtual void deleteObjectImpl(Platform3DObject o); + +private: + virtual bool isBuffer() const { return true; } + + unsigned long m_target; + + RefPtr<ArrayBuffer> m_elementArrayBuffer; + unsigned m_byteLength; + + // Optimization for index validation. For each type of index + // (i.e., UNSIGNED_SHORT), cache the maximum index in the + // entire buffer. + // + // This is sufficient to eliminate a lot of work upon each + // draw call as long as all bound array buffers are at least + // that size. + struct MaxIndexCacheEntry { + unsigned long type; + long maxIndex; }; - + // OpenGL ES 2.0 only has two valid index types (UNSIGNED_BYTE + // and UNSIGNED_SHORT), but might as well leave open the + // possibility of adding others. + MaxIndexCacheEntry m_maxIndexCache[4]; + unsigned m_nextAvailableCacheEntry; + + // Clears all of the cached max indices. + void clearCachedMaxIndices(); + + // Helper function called by the three associateBufferData(). + bool associateBufferDataImpl(ArrayBuffer* array, unsigned byteOffset, unsigned byteLength); + // Helper function called by the two associateBufferSubData(). + bool associateBufferSubDataImpl(long offset, ArrayBuffer* array, unsigned arrayByteOffset, unsigned byteLength); +}; + } // namespace WebCore #endif // WebGLBuffer_h |