Title: [291439] trunk/Source/WebGPU
Revision
291439
Author
[email protected]
Date
2022-03-17 13:56:17 -0700 (Thu, 17 Mar 2022)

Log Message

[WebGPU] Fix 32-bit build
https://bugs.webkit.org/show_bug.cgi?id=238046

Unreviewed.

* WebGPU/Buffer.h:
(WebGPU::Buffer::size const):
* WebGPU/Buffer.mm:
(WebGPU::Buffer::getMappedRange):
(WebGPU::Buffer::validateMapAsync const):
(WebGPU::Buffer::mapAsync):
* WebGPU/CommandEncoder.mm:
(WebGPU::CommandEncoder::clearBuffer):

Modified Paths

Diff

Modified: trunk/Source/WebGPU/ChangeLog (291438 => 291439)


--- trunk/Source/WebGPU/ChangeLog	2022-03-17 20:34:42 UTC (rev 291438)
+++ trunk/Source/WebGPU/ChangeLog	2022-03-17 20:56:17 UTC (rev 291439)
@@ -1,5 +1,21 @@
 2022-03-17  Myles C. Maxfield  <[email protected]>
 
+        [WebGPU] Fix 32-bit build
+        https://bugs.webkit.org/show_bug.cgi?id=238046
+
+        Unreviewed.
+
+        * WebGPU/Buffer.h:
+        (WebGPU::Buffer::size const):
+        * WebGPU/Buffer.mm:
+        (WebGPU::Buffer::getMappedRange):
+        (WebGPU::Buffer::validateMapAsync const):
+        (WebGPU::Buffer::mapAsync):
+        * WebGPU/CommandEncoder.mm:
+        (WebGPU::CommandEncoder::clearBuffer):
+
+2022-03-17  Myles C. Maxfield  <[email protected]>
+
         [WebGPU] Fix the 32-bit build
         https://bugs.webkit.org/show_bug.cgi?id=238031
 

Modified: trunk/Source/WebGPU/WebGPU/Buffer.h (291438 => 291439)


--- trunk/Source/WebGPU/WebGPU/Buffer.h	2022-03-17 20:34:42 UTC (rev 291438)
+++ trunk/Source/WebGPU/WebGPU/Buffer.h	2022-03-17 20:56:17 UTC (rev 291439)
@@ -71,7 +71,7 @@
     };
 
     id<MTLBuffer> buffer() const { return m_buffer; }
-    size_t size() const { return m_size; }
+    uint64_t size() const { return m_size; }
     WGPUBufferUsageFlags usage() const { return m_usage; }
 
 private:
@@ -85,7 +85,7 @@
 
     // https://gpuweb.github.io/gpuweb/#buffer-interface
     // "GPUBuffer has the following internal slots:"
-    const size_t m_size { 0 }; // "The length of the GPUBuffer allocation in bytes."
+    const uint64_t m_size { 0 }; // "The length of the GPUBuffer allocation in bytes."
     const WGPUBufferUsageFlags m_usage { 0 }; // "The allowed usages for this GPUBuffer."
     State m_state { State::Unmapped }; // "The current state of the GPUBuffer."
     // "[[mapping]] of type ArrayBuffer or Promise or null." This is unnecessary; we can just use m_device.contents.

Modified: trunk/Source/WebGPU/WebGPU/Buffer.mm (291438 => 291439)


--- trunk/Source/WebGPU/WebGPU/Buffer.mm	2022-03-17 20:34:42 UTC (rev 291438)
+++ trunk/Source/WebGPU/WebGPU/Buffer.mm	2022-03-17 20:56:17 UTC (rev 291439)
@@ -213,7 +213,7 @@
     // FIXME: Use checked arithmetic.
     auto rangeSize = size;
     if (size == WGPU_WHOLE_MAP_SIZE)
-        rangeSize = std::max(static_cast<size_t>(0), m_size - offset);
+        rangeSize = std::max(static_cast<uint64_t>(0), m_size - static_cast<uint64_t>(offset));
 
     // "If any of the following conditions are unsatisfied"
     if (!validateGetMappedRange(offset, rangeSize)) {
@@ -244,7 +244,7 @@
 
     // "offset + rangeSize is less or equal to this.[[size]]"
     // FIXME: Use checked arithmetic.
-    if (offset + rangeSize > m_size)
+    if (static_cast<uint64_t>(offset + rangeSize) > m_size)
         return false;
 
     // "this.[[state]] is unmapped"
@@ -275,7 +275,7 @@
     // FIXME: Use checked arithmetic.
     auto rangeSize = size;
     if (size == WGPU_WHOLE_MAP_SIZE)
-        rangeSize = std::max(static_cast<size_t>(0), m_size - offset);
+        rangeSize = std::max(static_cast<uint64_t>(0), static_cast<uint64_t>(m_size - offset));
 
     // "If any of the following conditions are unsatisfied:"
     if (!validateMapAsync(mode, offset, rangeSize)) {

Modified: trunk/Source/WebGPU/WebGPU/CommandEncoder.mm (291438 => 291439)


--- trunk/Source/WebGPU/WebGPU/CommandEncoder.mm	2022-03-17 20:34:42 UTC (rev 291438)
+++ trunk/Source/WebGPU/WebGPU/CommandEncoder.mm	2022-03-17 20:56:17 UTC (rev 291439)
@@ -218,7 +218,7 @@
 
     ensureBlitCommandEncoder();
 
-    [m_blitCommandEncoder fillBuffer:buffer.buffer() range:NSMakeRange(offset, size) value:0];
+    [m_blitCommandEncoder fillBuffer:buffer.buffer() range:NSMakeRange(static_cast<NSUInteger>(offset), static_cast<NSUInteger>(size)) value:0];
 }
 
 bool CommandEncoder::validateFinish() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to