Diff
Modified: trunk/Source/WebCore/ChangeLog (243657 => 243658)
--- trunk/Source/WebCore/ChangeLog 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/ChangeLog 2019-03-29 20:18:38 UTC (rev 243658)
@@ -1,3 +1,43 @@
+2019-03-29 Justin Fan <justin_...@apple.com>
+
+ [Web GPU] Replace unsigned longs in WebGPU with uint64_t
+ https://bugs.webkit.org/show_bug.cgi?id=196401
+
+ Reviewed by Myles C. Maxfield.
+
+ Unsigned long is not guaranteed to be 64 bits on all platforms. In addition, rowPitch is updated
+ to u32 in the API and the implementation to match.
+
+ No new tests. No new behavior.
+
+ * Modules/webgpu/WebGPUBuffer.cpp:
+ (WebCore::WebGPUBuffer::setSubData):
+ * Modules/webgpu/WebGPUBuffer.h:
+ * Modules/webgpu/WebGPUBufferBinding.h:
+ * Modules/webgpu/WebGPUCommandEncoder.cpp:
+ (WebCore::WebGPUCommandEncoder::copyBufferToBuffer):
+ * Modules/webgpu/WebGPUCommandEncoder.h:
+ * Modules/webgpu/WebGPUCommandEncoder.idl:
+ * Modules/webgpu/WebGPURenderPassEncoder.cpp:
+ (WebCore::WebGPURenderPassEncoder::setVertexBuffers):
+ * Modules/webgpu/WebGPURenderPassEncoder.h:
+ * platform/graphics/gpu/GPUBindGroupLayout.h:
+ * platform/graphics/gpu/GPUBuffer.h:
+ (WebCore::GPUBuffer::byteLength const):
+ * platform/graphics/gpu/GPUBufferBinding.h:
+ * platform/graphics/gpu/GPUBufferDescriptor.h:
+ * platform/graphics/gpu/GPUCommandBuffer.h:
+ * platform/graphics/gpu/GPURenderPassEncoder.h:
+ * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
+ * platform/graphics/gpu/GPUVertexInputDescriptor.h:
+ * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
+ (WebCore::GPUBuffer::GPUBuffer):
+ (WebCore::GPUBuffer::setSubData):
+ * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
+ (WebCore::GPUCommandBuffer::copyBufferToBuffer):
+ * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
+ (WebCore::GPURenderPassEncoder::setVertexBuffers):
+
2019-03-29 Wenson Hsieh <wenson_hs...@apple.com>
REGRESSION (r243250): Text interactions are no longer suppressed when editing in some websites
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.cpp (243657 => 243658)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.cpp 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.cpp 2019-03-29 20:18:38 UTC (rev 243658)
@@ -42,7 +42,7 @@
{
}
-void WebGPUBuffer::setSubData(unsigned long offset, const JSC::ArrayBuffer& data)
+void WebGPUBuffer::setSubData(uint64_t offset, const JSC::ArrayBuffer& data)
{
if (!m_buffer)
LOG(WebGPU, "GPUBuffer::setSubData(): Invalid operation!");
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.h (243657 => 243658)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -48,7 +48,7 @@
GPUBuffer* buffer() { return m_buffer.get(); }
const GPUBuffer* buffer() const { return m_buffer.get(); }
- void setSubData(unsigned long, const JSC::ArrayBuffer&);
+ void setSubData(uint64_t, const JSC::ArrayBuffer&);
using BufferMappingPromise = DOMPromiseDeferred<IDLInterface<JSC::ArrayBuffer>>;
void mapReadAsync(BufferMappingPromise&&);
void mapWriteAsync(BufferMappingPromise&&);
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUBufferBinding.h (243657 => 243658)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUBufferBinding.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBufferBinding.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -34,8 +34,8 @@
struct WebGPUBufferBinding {
RefPtr<WebGPUBuffer> buffer;
- unsigned long offset;
- unsigned long size;
+ uint64_t offset;
+ uint64_t size;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp (243657 => 243658)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp 2019-03-29 20:18:38 UTC (rev 243658)
@@ -98,7 +98,7 @@
return WebGPUComputePassEncoder::create(WTFMove(encoder));
}
-void WebGPUCommandEncoder::copyBufferToBuffer(WebGPUBuffer& src, unsigned long srcOffset, WebGPUBuffer& dst, unsigned long dstOffset, unsigned long size)
+void WebGPUCommandEncoder::copyBufferToBuffer(WebGPUBuffer& src, uint64_t srcOffset, WebGPUBuffer& dst, uint64_t dstOffset, uint64_t size)
{
if (!m_commandBuffer) {
LOG(WebGPU, "WebGPUCommandEncoder::copyBufferToBuffer(): Invalid operation!");
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h (243657 => 243658)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -60,7 +60,7 @@
Ref<WebGPURenderPassEncoder> beginRenderPass(const WebGPURenderPassDescriptor&);
Ref<WebGPUComputePassEncoder> beginComputePass();
- void copyBufferToBuffer(WebGPUBuffer&, unsigned long srcOffset, WebGPUBuffer&, unsigned long dstOffset, unsigned long size);
+ void copyBufferToBuffer(WebGPUBuffer&, uint64_t srcOffset, WebGPUBuffer&, uint64_t dstOffset, uint64_t size);
void copyBufferToTexture(const WebGPUBufferCopyView&, const WebGPUTextureCopyView&, const GPUExtent3D&);
void copyTextureToBuffer(const WebGPUTextureCopyView&, const WebGPUBufferCopyView&, const GPUExtent3D&);
void copyTextureToTexture(const WebGPUTextureCopyView&, const WebGPUTextureCopyView&, const GPUExtent3D&);
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl (243657 => 243658)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl 2019-03-29 20:18:38 UTC (rev 243658)
@@ -34,7 +34,7 @@
] dictionary GPUBufferCopyView {
WebGPUBuffer buffer;
u64 offset;
- u64 rowPitch;
+ u32 rowPitch;
u32 imageHeight;
};
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp (243657 => 243658)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp 2019-03-29 20:18:38 UTC (rev 243658)
@@ -60,7 +60,7 @@
m_passEncoder->setPipeline(makeRef(*pipeline.renderPipeline()));
}
-void WebGPURenderPassEncoder::setVertexBuffers(unsigned startSlot, Vector<RefPtr<WebGPUBuffer>>&& buffers, Vector<unsigned long long>&& offsets)
+void WebGPURenderPassEncoder::setVertexBuffers(unsigned startSlot, Vector<RefPtr<WebGPUBuffer>>&& buffers, Vector<uint64_t>&& offsets)
{
#if !LOG_DISABLED
const char* const functionName = "GPURenderPassEncoder::setVertexBuffers()";
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h (243657 => 243658)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -43,7 +43,7 @@
static Ref<WebGPURenderPassEncoder> create(RefPtr<GPURenderPassEncoder>&&);
void setPipeline(const WebGPURenderPipeline&);
- void setVertexBuffers(unsigned, Vector<RefPtr<WebGPUBuffer>>&&, Vector<unsigned long long>&&);
+ void setVertexBuffers(unsigned, Vector<RefPtr<WebGPUBuffer>>&&, Vector<uint64_t>&&);
void draw(unsigned vertexCount, unsigned instanceCount, unsigned firstVertex, unsigned firstInstance);
private:
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -47,7 +47,7 @@
public:
static RefPtr<GPUBindGroupLayout> tryCreate(const GPUDevice&, const GPUBindGroupLayoutDescriptor&);
- using BindingsMapType = HashMap<unsigned long, GPUBindGroupLayoutBinding, WTF::IntHash<unsigned long>, WTF::UnsignedWithZeroKeyHashTraits<unsigned long>>;
+ using BindingsMapType = HashMap<uint64_t, GPUBindGroupLayoutBinding, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>;
const BindingsMapType& bindingsMap() const { return m_bindingsMap; }
#if USE(METAL)
MTLArgumentEncoder *vertexEncoder() const { return m_vertexEncoder.get(); }
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBuffer.h (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUBuffer.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBuffer.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -71,7 +71,7 @@
static RefPtr<GPUBuffer> tryCreate(Ref<GPUDevice>&&, const GPUBufferDescriptor&);
PlatformBuffer *platformBuffer() const { return m_platformBuffer.get(); }
- unsigned long byteLength() const { return m_byteLength; }
+ uint64_t byteLength() const { return m_byteLength; }
bool isTransferSource() const { return m_usage.contains(GPUBufferUsage::Flags::TransferSource); }
bool isTransferDestination() const { return m_usage.contains(GPUBufferUsage::Flags::TransferDestination); }
bool isVertex() const { return m_usage.contains(GPUBufferUsage::Flags::Vertex); }
@@ -88,7 +88,7 @@
void reuseSubDataBuffer(RetainPtr<MTLBuffer>&&);
#endif
- void setSubData(unsigned long, const JSC::ArrayBuffer&);
+ void setSubData(uint64_t, const JSC::ArrayBuffer&);
using MappingCallback = WTF::Function<void(JSC::ArrayBuffer*)>;
void registerMappingCallback(MappingCallback&&, bool);
void unmap();
@@ -109,7 +109,7 @@
static bool validateBufferUsage(const GPUDevice&, OptionSet<GPUBufferUsage::Flags>);
- GPUBuffer(PlatformBufferSmartPtr&&, unsigned long, OptionSet<GPUBufferUsage::Flags>, Ref<GPUDevice>&&);
+ GPUBuffer(PlatformBufferSmartPtr&&, uint64_t, OptionSet<GPUBufferUsage::Flags>, Ref<GPUDevice>&&);
JSC::ArrayBuffer* stagingBufferForRead();
JSC::ArrayBuffer* stagingBufferForWrite();
@@ -131,7 +131,7 @@
RefPtr<PendingMappingCallback> m_mappingCallback;
DeferrableTask<Timer> m_mappingCallbackTask;
- unsigned long m_byteLength;
+ uint64_t m_byteLength;
OptionSet<GPUBufferUsage::Flags> m_usage;
unsigned m_numScheduledCommandBuffers { 0 };
};
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBufferBinding.h (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUBufferBinding.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBufferBinding.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -34,8 +34,8 @@
struct GPUBufferBinding {
Ref<GPUBuffer> buffer;
- unsigned long offset;
- unsigned long size;
+ uint64_t offset;
+ uint64_t size;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBufferDescriptor.h (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUBufferDescriptor.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBufferDescriptor.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -32,7 +32,7 @@
namespace WebCore {
struct GPUBufferDescriptor {
- unsigned long size;
+ uint64_t size;
GPUBufferUsageFlags usage;
};
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -48,8 +48,8 @@
using PlatformCommandBufferSmartPtr = RetainPtr<MTLCommandBuffer>;
struct GPUBufferCopyViewBase {
- unsigned long offset;
- unsigned long rowPitch;
+ uint64_t offset;
+ unsigned rowPitch;
unsigned imageHeight;
};
@@ -94,7 +94,7 @@
void endBlitEncoding();
#endif
- void copyBufferToBuffer(Ref<GPUBuffer>&&, unsigned long srcOffset, Ref<GPUBuffer>&&, unsigned long dstOffset, unsigned long size);
+ void copyBufferToBuffer(Ref<GPUBuffer>&&, uint64_t srcOffset, Ref<GPUBuffer>&&, uint64_t dstOffset, uint64_t size);
void copyBufferToTexture(GPUBufferCopyView&&, GPUTextureCopyView&&, const GPUExtent3D&);
void copyTextureToBuffer(GPUTextureCopyView&&, GPUBufferCopyView&&, const GPUExtent3D&);
void copyTextureToTexture(GPUTextureCopyView&&, GPUTextureCopyView&&, const GPUExtent3D&);
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -52,7 +52,7 @@
static RefPtr<GPURenderPassEncoder> tryCreate(Ref<GPUCommandBuffer>&&, GPURenderPassDescriptor&&);
void setPipeline(Ref<const GPURenderPipeline>&&);
- void setVertexBuffers(unsigned, Vector<Ref<GPUBuffer>>&&, Vector<unsigned long long>&&);
+ void setVertexBuffers(unsigned, Vector<Ref<GPUBuffer>>&&, Vector<uint64_t>&&);
void draw(unsigned vertexCount, unsigned instanceCount, unsigned firstVertex, unsigned firstInstance);
private:
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUVertexAttributeDescriptor.h (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUVertexAttributeDescriptor.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUVertexAttributeDescriptor.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -41,7 +41,7 @@
struct GPUVertexAttributeDescriptor {
unsigned shaderLocation;
unsigned inputSlot;
- unsigned long offset;
+ uint64_t offset;
GPUVertexFormat format;
};
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUVertexInputDescriptor.h (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUVertexInputDescriptor.h 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUVertexInputDescriptor.h 2019-03-29 20:18:38 UTC (rev 243658)
@@ -36,7 +36,7 @@
struct GPUVertexInputDescriptor {
unsigned inputSlot;
- unsigned long stride;
+ uint64_t stride;
GPUInputStepMode stepMode;
};
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBufferMetal.mm (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBufferMetal.mm 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBufferMetal.mm 2019-03-29 20:18:38 UTC (rev 243658)
@@ -91,7 +91,7 @@
return adoptRef(*new GPUBuffer(WTFMove(mtlBuffer), descriptor.size, usage, WTFMove(device)));
}
-GPUBuffer::GPUBuffer(RetainPtr<MTLBuffer>&& buffer, unsigned long size, OptionSet<GPUBufferUsage::Flags> usage, Ref<GPUDevice>&& device)
+GPUBuffer::GPUBuffer(RetainPtr<MTLBuffer>&& buffer, uint64_t size, OptionSet<GPUBufferUsage::Flags> usage, Ref<GPUDevice>&& device)
: m_platformBuffer(WTFMove(buffer))
, m_device(WTFMove(device))
, m_byteLength(size)
@@ -119,7 +119,7 @@
return State::Unmapped;
}
-void GPUBuffer::setSubData(unsigned long offset, const JSC::ArrayBuffer& data)
+void GPUBuffer::setSubData(uint64_t offset, const JSC::ArrayBuffer& data)
{
MTLCommandQueue *queue;
if (!m_device->tryGetQueue() || !(queue = m_device->tryGetQueue()->platformQueue()))
@@ -137,7 +137,7 @@
}
#endif
- auto subDataLength = checkedSum<unsigned long>(data.byteLength(), offset);
+ auto subDataLength = checkedSum<uint64_t>(data.byteLength(), offset);
if (subDataLength.hasOverflowed() || subDataLength.unsafeGet() > m_byteLength) {
LOG(WebGPU, "GPUBuffer::setSubData(): Invalid offset or data size!");
return;
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm 2019-03-29 20:18:38 UTC (rev 243658)
@@ -93,7 +93,7 @@
m_blitEncoder = nullptr;
}
-void GPUCommandBuffer::copyBufferToBuffer(Ref<GPUBuffer>&& src, unsigned long srcOffset, Ref<GPUBuffer>&& dst, unsigned long dstOffset, unsigned long size)
+void GPUCommandBuffer::copyBufferToBuffer(Ref<GPUBuffer>&& src, uint64_t srcOffset, Ref<GPUBuffer>&& dst, uint64_t dstOffset, uint64_t size)
{
if (!src->isTransferSource() || !dst->isTransferDestination()) {
LOG(WebGPU, "GPUCommandBuffer::copyBufferToBuffer(): Invalid operation!");
@@ -107,8 +107,8 @@
}
#endif
- auto srcLength = checkedSum<unsigned long>(size, srcOffset);
- auto dstLength = checkedSum<unsigned long>(size, dstOffset);
+ auto srcLength = checkedSum<uint64_t>(size, srcOffset);
+ auto dstLength = checkedSum<uint64_t>(size, dstOffset);
if (srcLength.hasOverflowed() || dstLength.hasOverflowed()
|| srcLength.unsafeGet() > src->byteLength() || dstLength.unsafeGet() > dst->byteLength()) {
LOG(WebGPU, "GPUCommandBuffer::copyBufferToBuffer(): Invalid offset or copy size!");
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm (243657 => 243658)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm 2019-03-29 20:11:54 UTC (rev 243657)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm 2019-03-29 20:18:38 UTC (rev 243658)
@@ -204,7 +204,7 @@
m_pipeline = WTFMove(pipeline);
}
-void GPURenderPassEncoder::setVertexBuffers(unsigned index, Vector<Ref<GPUBuffer>>&& buffers, Vector<unsigned long long>&& offsets)
+void GPURenderPassEncoder::setVertexBuffers(unsigned index, Vector<Ref<GPUBuffer>>&& buffers, Vector<uint64_t>&& offsets)
{
if (!m_platformRenderPassEncoder) {
LOG(WebGPU, "GPURenderPassEncoder::setVertexBuffers(): Invalid operation: Encoding is ended!");