Bug 31175

Summary: Update API of WebGLArray and friends
Product: WebKit Reporter: Chris Marrin <cmarrin>
Component: WebGLAssignee: Kenneth Russell <kbr>
Status: RESOLVED FIXED    
Severity: Normal CC: brettw, dglazkov, fishd, kbr, oliver, petersont, rlp
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
Proposed patch oliver: review+

Description Chris Marrin 2009-11-05 10:53:13 PST
The current implementation of CanvasArray has sizeInBytes and alignedSizeInBytes. The former has been moved to CanvasRenderingContextWebGL and the latter has been removed. Attributes buffer, byteOffset and byteLength need to be added. Also need to add slice() method.

All the subclasses need an added copy constructor, and two set() methods, one of which takes another object of the same type and one which takes a JS array.
Comment 1 Kenneth Russell 2009-11-13 18:20:17 PST
Created attachment 43219 [details]
Proposed patch

Implementation updates to match spec:
 - Renamed WebGL<T>Array.sizeInBytes() to byteLength.
 - Removed WebGLArray.alignedSizeInBytes().
 - Added WebGLArray.buffer, byteOffset, and slice().
 - Added explicit get() and set() methods to WebGL<T>Array.

Added positive and negative test cases for copy constructors, get() / set(), byteOffset, byteLength, and slice().

Fixed crash in JSWebGLArrayCustom.cpp, toJS(), when WebGLArray was NULL. Fixed various bugs in V8 bindings resulting in test failures.

Reformatted WebGLArray classes to match WebKit coding convention, specifically removing indentation within namespaces. Cleaned up a few places from the recent Canvas -> WebGL renaming.

As discussed in https://bugs.webkit.org/show_bug.cgi?id=29343 , updated copyright notices on WebGLArray classes.

Built and tested both WebKit and Chromium on Mac OS X.
Comment 2 Oliver Hunt 2009-11-13 18:30:24 PST
Comment on attachment 43219 [details]
Proposed patch

r=me, this all looks sane to me.
Comment 3 Chris Marrin 2009-11-16 13:30:42 PST
Sending        LayoutTests/ChangeLog
Sending        LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt
Sending        LayoutTests/fast/canvas/webgl/array-unit-tests.html
Sending        WebCore/ChangeLog
Sending        WebCore/bindings/js/JSWebGLArrayCustom.cpp
Sending        WebCore/bindings/js/JSWebGLByteArrayCustom.cpp
Sending        WebCore/bindings/js/JSWebGLFloatArrayCustom.cpp
Sending        WebCore/bindings/js/JSWebGLIntArrayCustom.cpp
Sending        WebCore/bindings/js/JSWebGLShortArrayCustom.cpp
Sending        WebCore/bindings/js/JSWebGLUnsignedByteArrayCustom.cpp
Sending        WebCore/bindings/js/JSWebGLUnsignedIntArrayCustom.cpp
Sending        WebCore/bindings/js/JSWebGLUnsignedShortArrayCustom.cpp
Sending        WebCore/bindings/scripts/CodeGeneratorV8.pm
Sending        WebCore/bindings/v8/V8DOMWrapper.cpp
Sending        WebCore/bindings/v8/custom/V8CustomBinding.h
Sending        WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
Sending        WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
Sending        WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
Sending        WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
Sending        WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
Sending        WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
Sending        WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
Sending        WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
Sending        WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
Sending        WebCore/html/canvas/WebGLArray.cpp
Sending        WebCore/html/canvas/WebGLArray.h
Sending        WebCore/html/canvas/WebGLArray.idl
Sending        WebCore/html/canvas/WebGLArrayBuffer.cpp
Sending        WebCore/html/canvas/WebGLArrayBuffer.h
Sending        WebCore/html/canvas/WebGLByteArray.cpp
Sending        WebCore/html/canvas/WebGLByteArray.h
Sending        WebCore/html/canvas/WebGLByteArray.idl
Sending        WebCore/html/canvas/WebGLFloatArray.cpp
Sending        WebCore/html/canvas/WebGLFloatArray.h
Sending        WebCore/html/canvas/WebGLFloatArray.idl
Sending        WebCore/html/canvas/WebGLIntArray.cpp
Sending        WebCore/html/canvas/WebGLIntArray.h
Sending        WebCore/html/canvas/WebGLIntArray.idl
Sending        WebCore/html/canvas/WebGLShortArray.cpp
Sending        WebCore/html/canvas/WebGLShortArray.h
Sending        WebCore/html/canvas/WebGLShortArray.idl
Sending        WebCore/html/canvas/WebGLUnsignedByteArray.cpp
Sending        WebCore/html/canvas/WebGLUnsignedByteArray.h
Sending        WebCore/html/canvas/WebGLUnsignedByteArray.idl
Sending        WebCore/html/canvas/WebGLUnsignedIntArray.cpp
Sending        WebCore/html/canvas/WebGLUnsignedIntArray.h
Sending        WebCore/html/canvas/WebGLUnsignedIntArray.idl
Sending        WebCore/html/canvas/WebGLUnsignedShortArray.cpp
Sending        WebCore/html/canvas/WebGLUnsignedShortArray.h
Sending        WebCore/html/canvas/WebGLUnsignedShortArray.idl
Sending        WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
Sending        WebKit/chromium/ChangeLog
Sending        WebKit/chromium/src/GraphicsContext3D.cpp
Transmitting file data .....................................................
Committed revision 51049.
Comment 4 Mark Rowe (bdash) 2009-11-16 13:42:55 PST
(In reply to comment #1)
> Created an attachment (id=43219) [details]
> Proposed patch
> 
> Implementation updates to match spec:
>  - Renamed WebGL<T>Array.sizeInBytes() to byteLength.
>  - Removed WebGLArray.alignedSizeInBytes().
>  - Added WebGLArray.buffer, byteOffset, and slice().
>  - Added explicit get() and set() methods to WebGL<T>Array.
> 
> Added positive and negative test cases for copy constructors, get() / set(),
> byteOffset, byteLength, and slice().
> 
> Fixed crash in JSWebGLArrayCustom.cpp, toJS(), when WebGLArray was NULL. Fixed
> various bugs in V8 bindings resulting in test failures.
> 
> Reformatted WebGLArray classes to match WebKit coding convention, specifically
> removing indentation within namespaces. Cleaned up a few places from the recent
> Canvas -> WebGL renaming.

This is the sort of information that should be included in the ChangeLog entry.  Linking to a bug with no description of the changes is not sufficient.
Comment 5 Mark Rowe (bdash) 2009-11-16 13:52:27 PST
r51049 did not include WebCore/bindings/js/JSWebGLArrayHelper.h.  I landed it in r51051.