Changeset 207715 in webkit
- Timestamp:
- Oct 22, 2016 1:46:34 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r207714 r207715 1 2016-10-22 Chris Dumez <cdumez@apple.com> 2 3 WebGLRenderingContextBase.bufferData() should use a union instead of overloading 4 https://bugs.webkit.org/show_bug.cgi?id=163795 5 6 Reviewed by Darin Adler. 7 8 * runtime/ArrayBufferView.h: 9 (JSC::ArrayBufferView::data): 10 Add a data() method which aliases baseAddress() to align the API with 11 ArrayBuffer and reduce special handling at call sites. 12 13 * runtime/JSArrayBuffer.h: 14 (JSC::toArrayBuffer): 15 (JSC::JSArrayBuffer::toWrapped): 16 Add toWrapped() method similarly with WebCore wrapper types to 17 reduce special handling of JSArrayBuffer type. 18 19 * runtime/JSArrayBufferView.cpp: 20 (JSC::JSArrayBufferView::toWrapped): 21 * runtime/JSArrayBufferView.h: 22 Add toWrapped() method similarly with WebCore wrapper types to 23 reduce special handling of JSArrayBufferView type. 24 1 25 2016-10-21 Filip Pizlo <fpizlo@apple.com> 2 26 -
trunk/Source/JavaScriptCore/runtime/ArrayBufferView.h
r206525 r207715 63 63 } 64 64 65 void* data() const { return baseAddress(); } 66 65 67 unsigned byteOffset() const 66 68 { -
trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.h
r206525 r207715 47 47 48 48 static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype); 49 50 static ArrayBuffer* toWrapped(JSValue); 49 51 50 52 DECLARE_EXPORT_INFO; … … 68 70 JSArrayBuffer* wrapper = jsDynamicCast<JSArrayBuffer*>(value); 69 71 if (!wrapper) 70 return 0;72 return nullptr; 71 73 return wrapper->impl(); 72 74 } 73 75 76 inline ArrayBuffer* JSArrayBuffer::toWrapped(JSValue value) 77 { 78 return toArrayBuffer(value); 79 } 80 74 81 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSArrayBufferView.cpp
r205648 r207715 187 187 } 188 188 189 RefPtr<ArrayBufferView> JSArrayBufferView::toWrapped(JSValue value) 190 { 191 auto* wrapper = jsDynamicCast<JSArrayBufferView*>(value); 192 if (!wrapper) 193 return nullptr; 194 return wrapper->impl(); 195 } 196 189 197 } // namespace JSC 190 198 -
trunk/Source/JavaScriptCore/runtime/JSArrayBufferView.h
r206525 r207715 175 175 static ptrdiff_t offsetOfMode() { return OBJECT_OFFSETOF(JSArrayBufferView, m_mode); } 176 176 177 JS_EXPORT_PRIVATE static RefPtr<ArrayBufferView> toWrapped(JSValue); 178 177 179 private: 178 180 static void finalize(JSCell*); -
trunk/Source/WebCore/ChangeLog
r207712 r207715 1 2016-10-22 Chris Dumez <cdumez@apple.com> 2 3 WebGLRenderingContextBase.bufferData() should use a union instead of overloading 4 https://bugs.webkit.org/show_bug.cgi?id=163795 5 6 Reviewed by Darin Adler. 7 8 WebGLRenderingContextBase.bufferData() / bufferSubData() should use a union 9 instead of overloading: 10 - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14 11 12 No new tests, no web-exposed behavior change. 13 14 * bindings/js/JSDOMConvert.h: 15 (WebCore::Converter<IDLInterface<T>>::convert): 16 * bindings/scripts/CodeGeneratorJS.pm: 17 (GenerateHeader): 18 * bindings/scripts/test/JS/JSInterfaceName.h: 19 * bindings/scripts/test/JS/JSTestActiveDOMObject.h: 20 * bindings/scripts/test/JS/JSTestCEReactions.h: 21 * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h: 22 * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h: 23 * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h: 24 * bindings/scripts/test/JS/JSTestCustomNamedGetter.h: 25 * bindings/scripts/test/JS/JSTestEventConstructor.h: 26 * bindings/scripts/test/JS/JSTestEventTarget.h: 27 * bindings/scripts/test/JS/JSTestException.h: 28 * bindings/scripts/test/JS/JSTestGenerateIsReachable.h: 29 * bindings/scripts/test/JS/JSTestGlobalObject.h: 30 * bindings/scripts/test/JS/JSTestInterface.h: 31 * bindings/scripts/test/JS/JSTestIterable.h: 32 * bindings/scripts/test/JS/JSTestMediaQueryListListener.h: 33 * bindings/scripts/test/JS/JSTestNamedConstructor.h: 34 * bindings/scripts/test/JS/JSTestNode.h: 35 * bindings/scripts/test/JS/JSTestNondeterministic.h: 36 * bindings/scripts/test/JS/JSTestObj.h: 37 * bindings/scripts/test/JS/JSTestOverloadedConstructors.h: 38 * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h: 39 * bindings/scripts/test/JS/JSTestOverrideBuiltins.h: 40 * bindings/scripts/test/JS/JSTestSerialization.h: 41 * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h: 42 * bindings/scripts/test/JS/JSTestTypedefs.h: 43 * bindings/scripts/test/JS/JSattribute.h: 44 * bindings/scripts/test/JS/JSreadonly.h: 45 * html/canvas/WebGL2RenderingContext.cpp: 46 (WebCore::WebGL2RenderingContext::bufferData): 47 (WebCore::WebGL2RenderingContext::bufferSubData): 48 * html/canvas/WebGLRenderingContextBase.cpp: 49 (WebCore::WebGLRenderingContextBase::bufferData): 50 (WebCore::WebGLRenderingContextBase::bufferSubData): 51 * html/canvas/WebGLRenderingContextBase.h: 52 * html/canvas/WebGLRenderingContextBase.idl: 53 1 54 2016-10-22 Darin Adler <darin@apple.com> 2 55 -
trunk/Source/WebCore/bindings/js/JSDOMConvert.h
r207575 r207715 105 105 }; 106 106 107 // ArrayBuffer support. 108 template<> struct JSDOMWrapperConverterTraits<JSC::ArrayBuffer> { 109 using WrapperClass = JSC::JSArrayBuffer; 110 using ToWrappedReturnType = JSC::ArrayBuffer*; 111 }; 112 113 // ArrayBufferView support. 114 template<> struct JSDOMWrapperConverterTraits<JSC::ArrayBufferView> { 115 using WrapperClass = JSC::JSArrayBufferView; 116 using ToWrappedReturnType = RefPtr<ArrayBufferView>; 117 }; 118 107 119 // MARK: - 108 120 // MARK: Interface type 109 121 110 122 template<typename T> struct Converter<IDLInterface<T>> : DefaultConverter<IDLInterface<T>> { 111 using ReturnType = T*;123 using ReturnType = typename JSDOMWrapperConverterTraits<T>::ToWrappedReturnType; 112 124 using WrapperType = typename JSDOMWrapperConverterTraits<T>::WrapperClass; 113 125 114 static T*convert(JSC::ExecState& state, JSC::JSValue value)126 static ReturnType convert(JSC::ExecState& state, JSC::JSValue value) 115 127 { 116 128 JSC::VM& vm = state.vm(); 117 129 auto scope = DECLARE_THROW_SCOPE(vm); 118 T*object = WrapperType::toWrapped(value);130 ReturnType object = WrapperType::toWrapped(value); 119 131 if (!object) 120 132 throwTypeError(&state, scope); … … 122 134 } 123 135 }; 124 125 136 126 137 // Typed arrays support. … … 541 552 using WrapperType = typename JSDOMWrapperConverterTraits<ImplementationType>::WrapperClass; 542 553 543 auto *castedValue = WrapperType::toWrapped(value);554 auto castedValue = WrapperType::toWrapped(value); 544 555 if (!castedValue) 545 556 return; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r207711 r207715 1733 1733 push(@headerContent, "template<> struct JSDOMWrapperConverterTraits<${implType}> {\n"); 1734 1734 push(@headerContent, " using WrapperClass = ${className};\n"); 1735 push(@headerContent, " using ToWrappedReturnType = ${implType}*;\n"); 1735 1736 push(@headerContent, "};\n"); 1736 1737 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.h
r206723 r207715 88 88 template<> struct JSDOMWrapperConverterTraits<InterfaceName> { 89 89 using WrapperClass = JSInterfaceName; 90 using ToWrappedReturnType = InterfaceName*; 90 91 }; 91 92 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.h
r207192 r207715 87 87 template<> struct JSDOMWrapperConverterTraits<TestActiveDOMObject> { 88 88 using WrapperClass = JSTestActiveDOMObject; 89 using ToWrappedReturnType = TestActiveDOMObject*; 89 90 }; 90 91 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactions.h
r207192 r207715 85 85 template<> struct JSDOMWrapperConverterTraits<TestCEReactions> { 86 86 using WrapperClass = JSTestCEReactions; 87 using ToWrappedReturnType = TestCEReactions*; 87 88 }; 88 89 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactionsStringifier.h
r207192 r207715 85 85 template<> struct JSDOMWrapperConverterTraits<TestCEReactionsStringifier> { 86 86 using WrapperClass = JSTestCEReactionsStringifier; 87 using ToWrappedReturnType = TestCEReactionsStringifier*; 87 88 }; 88 89 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h
r206723 r207715 87 87 template<> struct JSDOMWrapperConverterTraits<TestClassWithJSBuiltinConstructor> { 88 88 using WrapperClass = JSTestClassWithJSBuiltinConstructor; 89 using ToWrappedReturnType = TestClassWithJSBuiltinConstructor*; 89 90 }; 90 91 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h
r206723 r207715 87 87 template<> struct JSDOMWrapperConverterTraits<TestCustomConstructorWithNoInterfaceObject> { 88 88 using WrapperClass = JSTestCustomConstructorWithNoInterfaceObject; 89 using ToWrappedReturnType = TestCustomConstructorWithNoInterfaceObject*; 89 90 }; 90 91 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.h
r206723 r207715 91 91 template<> struct JSDOMWrapperConverterTraits<TestCustomNamedGetter> { 92 92 using WrapperClass = JSTestCustomNamedGetter; 93 using ToWrappedReturnType = TestCustomNamedGetter*; 93 94 }; 94 95 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h
r207498 r207715 71 71 template<> struct JSDOMWrapperConverterTraits<TestEventConstructor> { 72 72 using WrapperClass = JSTestEventConstructor; 73 using ToWrappedReturnType = TestEventConstructor*; 73 74 }; 74 75 template<> TestEventConstructor::Init convertDictionary<TestEventConstructor::Init>(JSC::ExecState&, JSC::JSValue); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h
r206723 r207715 81 81 template<> struct JSDOMWrapperConverterTraits<TestEventTarget> { 82 82 using WrapperClass = JSTestEventTarget; 83 using ToWrappedReturnType = TestEventTarget*; 83 84 }; 84 85 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.h
r207192 r207715 88 88 template<> struct JSDOMWrapperConverterTraits<TestException> { 89 89 using WrapperClass = JSTestException; 90 using ToWrappedReturnType = TestException*; 90 91 }; 91 92 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.h
r206723 r207715 85 85 template<> struct JSDOMWrapperConverterTraits<TestGenerateIsReachable> { 86 86 using WrapperClass = JSTestGenerateIsReachable; 87 using ToWrappedReturnType = TestGenerateIsReachable*; 87 88 }; 88 89 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.h
r207192 r207715 115 115 template<> struct JSDOMWrapperConverterTraits<TestGlobalObject> { 116 116 using WrapperClass = JSTestGlobalObject; 117 using ToWrappedReturnType = TestGlobalObject*; 117 118 }; 118 119 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h
r207192 r207715 112 112 template<> struct JSDOMWrapperConverterTraits<TestInterface> { 113 113 using WrapperClass = JSTestInterface; 114 using ToWrappedReturnType = TestInterface*; 114 115 }; 115 116 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.h
r206723 r207715 85 85 template<> struct JSDOMWrapperConverterTraits<TestIterable> { 86 86 using WrapperClass = JSTestIterable; 87 using ToWrappedReturnType = TestIterable*; 87 88 }; 88 89 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h
r206723 r207715 85 85 template<> struct JSDOMWrapperConverterTraits<TestMediaQueryListListener> { 86 86 using WrapperClass = JSTestMediaQueryListListener; 87 using ToWrappedReturnType = TestMediaQueryListListener*; 87 88 }; 88 89 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.h
r206723 r207715 86 86 template<> struct JSDOMWrapperConverterTraits<TestNamedConstructor> { 87 87 using WrapperClass = JSTestNamedConstructor; 88 using ToWrappedReturnType = TestNamedConstructor*; 88 89 }; 89 90 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.h
r207192 r207715 72 72 template<> struct JSDOMWrapperConverterTraits<TestNode> { 73 73 using WrapperClass = JSTestNode; 74 using ToWrappedReturnType = TestNode*; 74 75 }; 75 76 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.h
r207192 r207715 85 85 template<> struct JSDOMWrapperConverterTraits<TestNondeterministic> { 86 86 using WrapperClass = JSTestNondeterministic; 87 using ToWrappedReturnType = TestNondeterministic*; 87 88 }; 88 89 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
r207498 r207715 105 105 template<> struct JSDOMWrapperConverterTraits<TestObj> { 106 106 using WrapperClass = JSTestObj; 107 using ToWrappedReturnType = TestObj*; 107 108 }; 108 109 JSC::JSString* jsStringWithCache(JSC::ExecState*, TestObj::EnumType); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.h
r206723 r207715 85 85 template<> struct JSDOMWrapperConverterTraits<TestOverloadedConstructors> { 86 86 using WrapperClass = JSTestOverloadedConstructors; 87 using ToWrappedReturnType = TestOverloadedConstructors*; 87 88 }; 88 89 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h
r206723 r207715 85 85 template<> struct JSDOMWrapperConverterTraits<TestOverloadedConstructorsWithSequence> { 86 86 using WrapperClass = JSTestOverloadedConstructorsWithSequence; 87 using ToWrappedReturnType = TestOverloadedConstructorsWithSequence*; 87 88 }; 88 89 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.h
r206723 r207715 92 92 template<> struct JSDOMWrapperConverterTraits<TestOverrideBuiltins> { 93 93 using WrapperClass = JSTestOverrideBuiltins; 94 using ToWrappedReturnType = TestOverrideBuiltins*; 94 95 }; 95 96 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h
r207378 r207715 85 85 template<> struct JSDOMWrapperConverterTraits<TestSerialization> { 86 86 using WrapperClass = JSTestSerialization; 87 using ToWrappedReturnType = TestSerialization*; 87 88 }; 88 89 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h
r207192 r207715 91 91 template<> struct JSDOMWrapperConverterTraits<TestSerializedScriptValueInterface> { 92 92 using WrapperClass = JSTestSerializedScriptValueInterface; 93 using ToWrappedReturnType = TestSerializedScriptValueInterface*; 93 94 }; 94 95 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.h
r207192 r207715 87 87 template<> struct JSDOMWrapperConverterTraits<TestTypedefs> { 88 88 using WrapperClass = JSTestTypedefs; 89 using ToWrappedReturnType = TestTypedefs*; 89 90 }; 90 91 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.h
r207192 r207715 88 88 template<> struct JSDOMWrapperConverterTraits<attribute> { 89 89 using WrapperClass = JSattribute; 90 using ToWrappedReturnType = attribute*; 90 91 }; 91 92 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.h
r206723 r207715 85 85 template<> struct JSDOMWrapperConverterTraits<readonly> { 86 86 using WrapperClass = JSreadonly; 87 using ToWrappedReturnType = readonly*; 87 88 }; 88 89 -
trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
r207685 r207715 100 100 return; 101 101 } 102 WebGLRenderingContextBase::bufferData(target, slice.get(), usage);102 WebGLRenderingContextBase::bufferData(target, BufferDataSource(slice.get()), usage); 103 103 } 104 104 … … 114 114 return; 115 115 } 116 WebGLRenderingContextBase::bufferSubData(target, offset, slice);116 WebGLRenderingContextBase::bufferSubData(target, offset, BufferDataSource(slice.get())); 117 117 } 118 118 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r207644 r207715 1076 1076 } 1077 1077 1078 void WebGLRenderingContextBase::bufferData(GC3Denum target, ArrayBuffer*data, GC3Denum usage)1078 void WebGLRenderingContextBase::bufferData(GC3Denum target, Optional<BufferDataSource>&& data, GC3Denum usage) 1079 1079 { 1080 1080 if (isContextLostOrPending()) … … 1087 1087 if (!buffer) 1088 1088 return; 1089 if (!isErrorGeneratedOnOutOfBoundsAccesses()) { 1090 if (!buffer->associateBufferData(data)) { 1091 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer"); 1092 return; 1093 } 1094 } 1095 1096 m_context->moveErrorsToSyntheticErrorList(); 1097 m_context->bufferData(target, data->byteLength(), data->data(), usage); 1098 if (m_context->moveErrorsToSyntheticErrorList()) { 1099 // The bufferData function failed. Tell the buffer it doesn't have the data it thinks it does. 1100 buffer->disassociateBufferData(); 1101 } 1102 } 1103 1104 void WebGLRenderingContextBase::bufferData(GC3Denum target, RefPtr<ArrayBufferView>&& data, GC3Denum usage) 1105 { 1106 if (isContextLostOrPending()) 1107 return; 1108 if (!data) { 1109 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "null data"); 1110 return; 1111 } 1112 WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage); 1113 if (!buffer) 1114 return; 1115 if (!isErrorGeneratedOnOutOfBoundsAccesses()) { 1116 if (!buffer->associateBufferData(data.get())) { 1117 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer"); 1118 return; 1119 } 1120 } 1121 1122 m_context->moveErrorsToSyntheticErrorList(); 1123 m_context->bufferData(target, data->byteLength(), data->baseAddress(), usage); 1124 if (m_context->moveErrorsToSyntheticErrorList()) { 1125 // The bufferData function failed. Tell the buffer it doesn't have the data it thinks it does. 1126 buffer->disassociateBufferData(); 1127 } 1128 } 1129 1130 void WebGLRenderingContextBase::bufferSubData(GC3Denum target, long long offset, ArrayBuffer* data) 1089 1090 WTF::visit([&](auto& data) { 1091 if (!this->isErrorGeneratedOnOutOfBoundsAccesses()) { 1092 if (!buffer->associateBufferData(data.get())) { 1093 this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer"); 1094 return; 1095 } 1096 } 1097 1098 m_context->moveErrorsToSyntheticErrorList(); 1099 m_context->bufferData(target, data->byteLength(), data->data(), usage); 1100 if (m_context->moveErrorsToSyntheticErrorList()) { 1101 // The bufferData function failed. Tell the buffer it doesn't have the data it thinks it does. 1102 buffer->disassociateBufferData(); 1103 } 1104 }, data.value()); 1105 } 1106 1107 void WebGLRenderingContextBase::bufferSubData(GC3Denum target, long long offset, Optional<BufferDataSource>&& data) 1131 1108 { 1132 1109 if (isContextLostOrPending()) … … 1141 1118 if (!data) 1142 1119 return; 1143 if (!isErrorGeneratedOnOutOfBoundsAccesses()) { 1144 if (!buffer->associateBufferSubData(static_cast<GC3Dintptr>(offset), data)) { 1145 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferSubData", "offset out of range"); 1146 return; 1147 } 1148 } 1149 1150 m_context->moveErrorsToSyntheticErrorList(); 1151 m_context->bufferSubData(target, static_cast<GC3Dintptr>(offset), data->byteLength(), data->data()); 1152 if (m_context->moveErrorsToSyntheticErrorList()) { 1153 // The bufferSubData function failed. Tell the buffer it doesn't have the data it thinks it does. 1154 buffer->disassociateBufferData(); 1155 } 1156 } 1157 1158 void WebGLRenderingContextBase::bufferSubData(GC3Denum target, long long offset, RefPtr<ArrayBufferView>&& data) 1159 { 1160 if (isContextLostOrPending()) 1161 return; 1162 WebGLBuffer* buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW); 1163 if (!buffer) 1164 return; 1165 if (offset < 0) { 1166 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferSubData", "offset < 0"); 1167 return; 1168 } 1169 if (!data) 1170 return; 1171 if (!isErrorGeneratedOnOutOfBoundsAccesses()) { 1172 if (!buffer->associateBufferSubData(static_cast<GC3Dintptr>(offset), data.get())) { 1173 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferSubData", "offset out of range"); 1174 return; 1175 } 1176 } 1177 1178 m_context->moveErrorsToSyntheticErrorList(); 1179 m_context->bufferSubData(target, static_cast<GC3Dintptr>(offset), data->byteLength(), data->baseAddress()); 1180 if (m_context->moveErrorsToSyntheticErrorList()) { 1181 // The bufferSubData function failed. Tell the buffer it doesn't have the data it thinks it does. 1182 buffer->disassociateBufferData(); 1183 } 1120 1121 WTF::visit([&](auto& data) { 1122 if (!this->isErrorGeneratedOnOutOfBoundsAccesses()) { 1123 if (!buffer->associateBufferSubData(static_cast<GC3Dintptr>(offset), data.get())) { 1124 this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferSubData", "offset out of range"); 1125 return; 1126 } 1127 } 1128 1129 m_context->moveErrorsToSyntheticErrorList(); 1130 m_context->bufferSubData(target, static_cast<GC3Dintptr>(offset), data->byteLength(), data->data()); 1131 if (m_context->moveErrorsToSyntheticErrorList()) { 1132 // The bufferSubData function failed. Tell the buffer it doesn't have the data it thinks it does. 1133 buffer->disassociateBufferData(); 1134 } 1135 }, data.value()); 1184 1136 } 1185 1137 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
r207644 r207715 38 38 #include <runtime/Float32Array.h> 39 39 #include <runtime/Int32Array.h> 40 #include <wtf/Variant.h> 40 41 #include <wtf/text/WTFString.h> 41 42 … … 139 140 void blendFuncSeparate(GC3Denum srcRGB, GC3Denum dstRGB, GC3Denum srcAlpha, GC3Denum dstAlpha); 140 141 142 using BufferDataSource = WTF::Variant<RefPtr<ArrayBuffer>, RefPtr<ArrayBufferView>>; 141 143 void bufferData(GC3Denum target, long long size, GC3Denum usage); 142 void bufferData(GC3Denum target, ArrayBuffer* data, GC3Denum usage); 143 void bufferData(GC3Denum target, RefPtr<ArrayBufferView>&& data, GC3Denum usage); 144 void bufferSubData(GC3Denum target, long long offset, ArrayBuffer* data); 145 void bufferSubData(GC3Denum target, long long offset, RefPtr<ArrayBufferView>&& data); 144 void bufferData(GC3Denum target, Optional<BufferDataSource>&&, GC3Denum usage); 145 void bufferSubData(GC3Denum target, long long offset, Optional<BufferDataSource>&&); 146 146 147 147 GC3Denum checkFramebufferStatus(GC3Denum target); -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl
r207644 r207715 38 38 typedef unrestricted float GLfloat; 39 39 typedef unrestricted float GLclampf; 40 typedef (ArrayBuffer or ArrayBufferView) BufferDataSource; 40 41 41 42 [ … … 485 486 void blendFunc(GLenum sfactor, GLenum dfactor); 486 487 void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); 487 void bufferData(GLenum target, ArrayBuffer? data, GLenum usage); 488 void bufferData(GLenum target, ArrayBufferView? data, GLenum usage); 488 void bufferData(GLenum target, BufferDataSource? data, GLenum usage); 489 489 void bufferData(GLenum target, GLsizeiptr size, GLenum usage); 490 void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer? data); 491 void bufferSubData(GLenum target, GLintptr offset, ArrayBufferView? data); 490 void bufferSubData(GLenum target, GLintptr offset, BufferDataSource? data); 492 491 493 492 GLenum checkFramebufferStatus(GLenum target);
Note: See TracChangeset
for help on using the changeset viewer.