Changeset 243658 in webkit
- Timestamp:
- Mar 29, 2019, 1:18:38 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 20 edited
-
ChangeLog (modified) (1 diff)
-
Modules/webgpu/WebGPUBuffer.cpp (modified) (1 diff)
-
Modules/webgpu/WebGPUBuffer.h (modified) (1 diff)
-
Modules/webgpu/WebGPUBufferBinding.h (modified) (1 diff)
-
Modules/webgpu/WebGPUCommandEncoder.cpp (modified) (1 diff)
-
Modules/webgpu/WebGPUCommandEncoder.h (modified) (1 diff)
-
Modules/webgpu/WebGPUCommandEncoder.idl (modified) (1 diff)
-
Modules/webgpu/WebGPURenderPassEncoder.cpp (modified) (1 diff)
-
Modules/webgpu/WebGPURenderPassEncoder.h (modified) (1 diff)
-
platform/graphics/gpu/GPUBindGroupLayout.h (modified) (1 diff)
-
platform/graphics/gpu/GPUBuffer.h (modified) (4 diffs)
-
platform/graphics/gpu/GPUBufferBinding.h (modified) (1 diff)
-
platform/graphics/gpu/GPUBufferDescriptor.h (modified) (1 diff)
-
platform/graphics/gpu/GPUCommandBuffer.h (modified) (2 diffs)
-
platform/graphics/gpu/GPURenderPassEncoder.h (modified) (1 diff)
-
platform/graphics/gpu/GPUVertexAttributeDescriptor.h (modified) (1 diff)
-
platform/graphics/gpu/GPUVertexInputDescriptor.h (modified) (1 diff)
-
platform/graphics/gpu/cocoa/GPUBufferMetal.mm (modified) (3 diffs)
-
platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm (modified) (2 diffs)
-
platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r243656 r243658 1 2019-03-29 Justin Fan <justin_fan@apple.com> 2 3 [Web GPU] Replace unsigned longs in WebGPU with uint64_t 4 https://bugs.webkit.org/show_bug.cgi?id=196401 5 6 Reviewed by Myles C. Maxfield. 7 8 Unsigned long is not guaranteed to be 64 bits on all platforms. In addition, rowPitch is updated 9 to u32 in the API and the implementation to match. 10 11 No new tests. No new behavior. 12 13 * Modules/webgpu/WebGPUBuffer.cpp: 14 (WebCore::WebGPUBuffer::setSubData): 15 * Modules/webgpu/WebGPUBuffer.h: 16 * Modules/webgpu/WebGPUBufferBinding.h: 17 * Modules/webgpu/WebGPUCommandEncoder.cpp: 18 (WebCore::WebGPUCommandEncoder::copyBufferToBuffer): 19 * Modules/webgpu/WebGPUCommandEncoder.h: 20 * Modules/webgpu/WebGPUCommandEncoder.idl: 21 * Modules/webgpu/WebGPURenderPassEncoder.cpp: 22 (WebCore::WebGPURenderPassEncoder::setVertexBuffers): 23 * Modules/webgpu/WebGPURenderPassEncoder.h: 24 * platform/graphics/gpu/GPUBindGroupLayout.h: 25 * platform/graphics/gpu/GPUBuffer.h: 26 (WebCore::GPUBuffer::byteLength const): 27 * platform/graphics/gpu/GPUBufferBinding.h: 28 * platform/graphics/gpu/GPUBufferDescriptor.h: 29 * platform/graphics/gpu/GPUCommandBuffer.h: 30 * platform/graphics/gpu/GPURenderPassEncoder.h: 31 * platform/graphics/gpu/GPUVertexAttributeDescriptor.h: 32 * platform/graphics/gpu/GPUVertexInputDescriptor.h: 33 * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: 34 (WebCore::GPUBuffer::GPUBuffer): 35 (WebCore::GPUBuffer::setSubData): 36 * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm: 37 (WebCore::GPUCommandBuffer::copyBufferToBuffer): 38 * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: 39 (WebCore::GPURenderPassEncoder::setVertexBuffers): 40 1 41 2019-03-29 Wenson Hsieh <wenson_hsieh@apple.com> 2 42 -
trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.cpp
r243636 r243658 43 43 } 44 44 45 void WebGPUBuffer::setSubData(u nsigned longoffset, const JSC::ArrayBuffer& data)45 void WebGPUBuffer::setSubData(uint64_t offset, const JSC::ArrayBuffer& data) 46 46 { 47 47 if (!m_buffer) -
trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.h
r243636 r243658 49 49 const GPUBuffer* buffer() const { return m_buffer.get(); } 50 50 51 void setSubData(u nsigned long, const JSC::ArrayBuffer&);51 void setSubData(uint64_t, const JSC::ArrayBuffer&); 52 52 using BufferMappingPromise = DOMPromiseDeferred<IDLInterface<JSC::ArrayBuffer>>; 53 53 void mapReadAsync(BufferMappingPromise&&); -
trunk/Source/WebCore/Modules/webgpu/WebGPUBufferBinding.h
r243636 r243658 35 35 struct WebGPUBufferBinding { 36 36 RefPtr<WebGPUBuffer> buffer; 37 u nsigned longoffset;38 u nsigned longsize;37 uint64_t offset; 38 uint64_t size; 39 39 }; 40 40 -
trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp
r243627 r243658 99 99 } 100 100 101 void WebGPUCommandEncoder::copyBufferToBuffer(WebGPUBuffer& src, u nsigned long srcOffset, WebGPUBuffer& dst, unsigned long dstOffset, unsigned longsize)101 void WebGPUCommandEncoder::copyBufferToBuffer(WebGPUBuffer& src, uint64_t srcOffset, WebGPUBuffer& dst, uint64_t dstOffset, uint64_t size) 102 102 { 103 103 if (!m_commandBuffer) { -
trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h
r243627 r243658 61 61 Ref<WebGPURenderPassEncoder> beginRenderPass(const WebGPURenderPassDescriptor&); 62 62 Ref<WebGPUComputePassEncoder> beginComputePass(); 63 void copyBufferToBuffer(WebGPUBuffer&, u nsigned long srcOffset, WebGPUBuffer&, unsigned long dstOffset, unsigned longsize);63 void copyBufferToBuffer(WebGPUBuffer&, uint64_t srcOffset, WebGPUBuffer&, uint64_t dstOffset, uint64_t size); 64 64 void copyBufferToTexture(const WebGPUBufferCopyView&, const WebGPUTextureCopyView&, const GPUExtent3D&); 65 65 void copyTextureToBuffer(const WebGPUTextureCopyView&, const WebGPUBufferCopyView&, const GPUExtent3D&); -
trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl
r243627 r243658 35 35 WebGPUBuffer buffer; 36 36 u64 offset; 37 u 64rowPitch;37 u32 rowPitch; 38 38 u32 imageHeight; 39 39 }; -
trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp
r243636 r243658 61 61 } 62 62 63 void WebGPURenderPassEncoder::setVertexBuffers(unsigned startSlot, Vector<RefPtr<WebGPUBuffer>>&& buffers, Vector<u nsigned long long>&& offsets)63 void WebGPURenderPassEncoder::setVertexBuffers(unsigned startSlot, Vector<RefPtr<WebGPUBuffer>>&& buffers, Vector<uint64_t>&& offsets) 64 64 { 65 65 #if !LOG_DISABLED -
trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h
r243636 r243658 44 44 45 45 void setPipeline(const WebGPURenderPipeline&); 46 void setVertexBuffers(unsigned, Vector<RefPtr<WebGPUBuffer>>&&, Vector<u nsigned long long>&&);46 void setVertexBuffers(unsigned, Vector<RefPtr<WebGPUBuffer>>&&, Vector<uint64_t>&&); 47 47 void draw(unsigned vertexCount, unsigned instanceCount, unsigned firstVertex, unsigned firstInstance); 48 48 -
trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h
r243636 r243658 48 48 static RefPtr<GPUBindGroupLayout> tryCreate(const GPUDevice&, const GPUBindGroupLayoutDescriptor&); 49 49 50 using BindingsMapType = HashMap<u nsigned long, GPUBindGroupLayoutBinding, WTF::IntHash<unsigned long>, WTF::UnsignedWithZeroKeyHashTraits<unsigned long>>;50 using BindingsMapType = HashMap<uint64_t, GPUBindGroupLayoutBinding, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>; 51 51 const BindingsMapType& bindingsMap() const { return m_bindingsMap; } 52 52 #if USE(METAL) -
trunk/Source/WebCore/platform/graphics/gpu/GPUBuffer.h
r243563 r243658 72 72 73 73 PlatformBuffer *platformBuffer() const { return m_platformBuffer.get(); } 74 u nsigned longbyteLength() const { return m_byteLength; }74 uint64_t byteLength() const { return m_byteLength; } 75 75 bool isTransferSource() const { return m_usage.contains(GPUBufferUsage::Flags::TransferSource); } 76 76 bool isTransferDestination() const { return m_usage.contains(GPUBufferUsage::Flags::TransferDestination); } … … 89 89 #endif 90 90 91 void setSubData(u nsigned long, const JSC::ArrayBuffer&);91 void setSubData(uint64_t, const JSC::ArrayBuffer&); 92 92 using MappingCallback = WTF::Function<void(JSC::ArrayBuffer*)>; 93 93 void registerMappingCallback(MappingCallback&&, bool); … … 110 110 static bool validateBufferUsage(const GPUDevice&, OptionSet<GPUBufferUsage::Flags>); 111 111 112 GPUBuffer(PlatformBufferSmartPtr&&, u nsigned long, OptionSet<GPUBufferUsage::Flags>, Ref<GPUDevice>&&);112 GPUBuffer(PlatformBufferSmartPtr&&, uint64_t, OptionSet<GPUBufferUsage::Flags>, Ref<GPUDevice>&&); 113 113 114 114 JSC::ArrayBuffer* stagingBufferForRead(); … … 132 132 DeferrableTask<Timer> m_mappingCallbackTask; 133 133 134 u nsigned longm_byteLength;134 uint64_t m_byteLength; 135 135 OptionSet<GPUBufferUsage::Flags> m_usage; 136 136 unsigned m_numScheduledCommandBuffers { 0 }; -
trunk/Source/WebCore/platform/graphics/gpu/GPUBufferBinding.h
r243636 r243658 35 35 struct GPUBufferBinding { 36 36 Ref<GPUBuffer> buffer; 37 u nsigned longoffset;38 u nsigned longsize;37 uint64_t offset; 38 uint64_t size; 39 39 }; 40 40 -
trunk/Source/WebCore/platform/graphics/gpu/GPUBufferDescriptor.h
r241328 r243658 33 33 34 34 struct GPUBufferDescriptor { 35 u nsigned longsize;35 uint64_t size; 36 36 GPUBufferUsageFlags usage; 37 37 }; -
trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h
r242974 r243658 49 49 50 50 struct GPUBufferCopyViewBase { 51 u nsigned longoffset;52 unsigned longrowPitch;51 uint64_t offset; 52 unsigned rowPitch; 53 53 unsigned imageHeight; 54 54 }; … … 95 95 #endif 96 96 97 void copyBufferToBuffer(Ref<GPUBuffer>&&, u nsigned long srcOffset, Ref<GPUBuffer>&&, unsigned long dstOffset, unsigned longsize);97 void copyBufferToBuffer(Ref<GPUBuffer>&&, uint64_t srcOffset, Ref<GPUBuffer>&&, uint64_t dstOffset, uint64_t size); 98 98 void copyBufferToTexture(GPUBufferCopyView&&, GPUTextureCopyView&&, const GPUExtent3D&); 99 99 void copyTextureToBuffer(GPUTextureCopyView&&, GPUBufferCopyView&&, const GPUExtent3D&); -
trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h
r243636 r243658 53 53 54 54 void setPipeline(Ref<const GPURenderPipeline>&&); 55 void setVertexBuffers(unsigned, Vector<Ref<GPUBuffer>>&&, Vector<u nsigned long long>&&);55 void setVertexBuffers(unsigned, Vector<Ref<GPUBuffer>>&&, Vector<uint64_t>&&); 56 56 void draw(unsigned vertexCount, unsigned instanceCount, unsigned firstVertex, unsigned firstInstance); 57 57 -
trunk/Source/WebCore/platform/graphics/gpu/GPUVertexAttributeDescriptor.h
r242972 r243658 42 42 unsigned shaderLocation; 43 43 unsigned inputSlot; 44 u nsigned longoffset;44 uint64_t offset; 45 45 GPUVertexFormat format; 46 46 }; -
trunk/Source/WebCore/platform/graphics/gpu/GPUVertexInputDescriptor.h
r242972 r243658 37 37 struct GPUVertexInputDescriptor { 38 38 unsigned inputSlot; 39 u nsigned longstride;39 uint64_t stride; 40 40 GPUInputStepMode stepMode; 41 41 }; -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBufferMetal.mm
r243563 r243658 92 92 } 93 93 94 GPUBuffer::GPUBuffer(RetainPtr<MTLBuffer>&& buffer, u nsigned longsize, OptionSet<GPUBufferUsage::Flags> usage, Ref<GPUDevice>&& device)94 GPUBuffer::GPUBuffer(RetainPtr<MTLBuffer>&& buffer, uint64_t size, OptionSet<GPUBufferUsage::Flags> usage, Ref<GPUDevice>&& device) 95 95 : m_platformBuffer(WTFMove(buffer)) 96 96 , m_device(WTFMove(device)) … … 120 120 } 121 121 122 void GPUBuffer::setSubData(u nsigned longoffset, const JSC::ArrayBuffer& data)122 void GPUBuffer::setSubData(uint64_t offset, const JSC::ArrayBuffer& data) 123 123 { 124 124 MTLCommandQueue *queue; … … 138 138 #endif 139 139 140 auto subDataLength = checkedSum<u nsigned long>(data.byteLength(), offset);140 auto subDataLength = checkedSum<uint64_t>(data.byteLength(), offset); 141 141 if (subDataLength.hasOverflowed() || subDataLength.unsafeGet() > m_byteLength) { 142 142 LOG(WebGPU, "GPUBuffer::setSubData(): Invalid offset or data size!"); -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm
r243563 r243658 94 94 } 95 95 96 void GPUCommandBuffer::copyBufferToBuffer(Ref<GPUBuffer>&& src, u nsigned long srcOffset, Ref<GPUBuffer>&& dst, unsigned long dstOffset, unsigned longsize)96 void GPUCommandBuffer::copyBufferToBuffer(Ref<GPUBuffer>&& src, uint64_t srcOffset, Ref<GPUBuffer>&& dst, uint64_t dstOffset, uint64_t size) 97 97 { 98 98 if (!src->isTransferSource() || !dst->isTransferDestination()) { … … 108 108 #endif 109 109 110 auto srcLength = checkedSum<u nsigned long>(size, srcOffset);111 auto dstLength = checkedSum<u nsigned long>(size, dstOffset);110 auto srcLength = checkedSum<uint64_t>(size, srcOffset); 111 auto dstLength = checkedSum<uint64_t>(size, dstOffset); 112 112 if (srcLength.hasOverflowed() || dstLength.hasOverflowed() 113 113 || srcLength.unsafeGet() > src->byteLength() || dstLength.unsafeGet() > dst->byteLength()) { -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm
r243636 r243658 205 205 } 206 206 207 void GPURenderPassEncoder::setVertexBuffers(unsigned index, Vector<Ref<GPUBuffer>>&& buffers, Vector<u nsigned long long>&& offsets)207 void GPURenderPassEncoder::setVertexBuffers(unsigned index, Vector<Ref<GPUBuffer>>&& buffers, Vector<uint64_t>&& offsets) 208 208 { 209 209 if (!m_platformRenderPassEncoder) {
Note:
See TracChangeset
for help on using the changeset viewer.