⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243636 in webkit


Ignore:
Timestamp:
Mar 28, 2019, 7:19:37 PM (7 years ago)
Author:
Justin Fan
Message:

[Web GPU] Replace 'unsigned long' with 'unsigned' when implementing u32 variables
https://bugs.webkit.org/show_bug.cgi?id=194618
<rdar://problem/48055796>

Reviewed by Myles C. Maxfield.

WebIDL for "unsigned" on 64-bit is "unsigned long". Update Web GPU to match.

No new tests; no change in behavior.

  • Modules/webgpu/GPUBindGroupLayoutBinding.h:
  • Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.cpp:

(WebCore::WHLSL::Metal::calculateVertexBufferIndex):

  • Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.h:
  • Modules/webgpu/WebGPUBindGroupBinding.h:
  • Modules/webgpu/WebGPUBindGroupDescriptor.cpp:

(WebCore::validateBufferBindingType):
(WebCore::WebGPUBindGroupDescriptor::tryCreateGPUBindGroupDescriptor const):

  • Modules/webgpu/WebGPUBuffer.cpp:

(WebCore::WebGPUBuffer::setSubData):

  • Modules/webgpu/WebGPUBuffer.h:
  • Modules/webgpu/WebGPUBufferBinding.h:
  • Modules/webgpu/WebGPURenderPassEncoder.cpp:

(WebCore::WebGPURenderPassEncoder::setVertexBuffers):
(WebCore::WebGPURenderPassEncoder::draw):

  • Modules/webgpu/WebGPURenderPassEncoder.h:
  • platform/graphics/gpu/GPUBindGroupBinding.h:
  • platform/graphics/gpu/GPUBindGroupLayout.h:
  • platform/graphics/gpu/GPUBufferBinding.h:
  • platform/graphics/gpu/GPUExtent3D.h:
  • platform/graphics/gpu/GPULimits.h:
  • platform/graphics/gpu/GPURenderPassEncoder.h:
  • platform/graphics/gpu/GPUTextureDescriptor.h:
  • platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:

(WebCore::GPUBindGroupLayout::tryCreate):

  • platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:

(WebCore::GPUBindGroup::tryCreate):

  • platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:

(WebCore::GPURenderPassEncoder::setVertexBuffers):
(WebCore::GPURenderPassEncoder::draw):

  • platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:

(WebCore::trySetInputStateForPipelineDescriptor):

  • platform/graphics/gpu/cocoa/GPUTextureMetal.mm:

(WebCore::storageModeForPixelFormatAndSampleCount):

Location:
trunk/Source/WebCore
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r243635 r243636  
     12019-03-28  Justin Fan  <justin_fan@apple.com>
     2
     3        [Web GPU] Replace 'unsigned long' with 'unsigned' when implementing u32 variables
     4        https://bugs.webkit.org/show_bug.cgi?id=194618
     5        <rdar://problem/48055796>
     6
     7        Reviewed by Myles C. Maxfield.
     8
     9        WebIDL for "unsigned" on 64-bit is "unsigned long". Update Web GPU to match.
     10
     11        No new tests; no change in behavior.
     12
     13        * Modules/webgpu/GPUBindGroupLayoutBinding.h:
     14        * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.cpp:
     15        (WebCore::WHLSL::Metal::calculateVertexBufferIndex):
     16        * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.h:
     17        * Modules/webgpu/WebGPUBindGroupBinding.h:
     18        * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
     19        (WebCore::validateBufferBindingType):
     20        (WebCore::WebGPUBindGroupDescriptor::tryCreateGPUBindGroupDescriptor const):
     21        * Modules/webgpu/WebGPUBuffer.cpp:
     22        (WebCore::WebGPUBuffer::setSubData):
     23        * Modules/webgpu/WebGPUBuffer.h:
     24        * Modules/webgpu/WebGPUBufferBinding.h:
     25        * Modules/webgpu/WebGPURenderPassEncoder.cpp:
     26        (WebCore::WebGPURenderPassEncoder::setVertexBuffers):
     27        (WebCore::WebGPURenderPassEncoder::draw):
     28        * Modules/webgpu/WebGPURenderPassEncoder.h:
     29        * platform/graphics/gpu/GPUBindGroupBinding.h:
     30        * platform/graphics/gpu/GPUBindGroupLayout.h:
     31        * platform/graphics/gpu/GPUBufferBinding.h:
     32        * platform/graphics/gpu/GPUExtent3D.h:
     33        * platform/graphics/gpu/GPULimits.h:
     34        * platform/graphics/gpu/GPURenderPassEncoder.h:
     35        * platform/graphics/gpu/GPUTextureDescriptor.h:
     36        * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
     37        (WebCore::GPUBindGroupLayout::tryCreate):
     38        * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:
     39        (WebCore::GPUBindGroup::tryCreate):
     40        * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
     41        (WebCore::GPURenderPassEncoder::setVertexBuffers):
     42        (WebCore::GPURenderPassEncoder::draw):
     43        * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
     44        (WebCore::trySetInputStateForPipelineDescriptor):
     45        * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
     46        (WebCore::storageModeForPixelFormatAndSampleCount):
     47
    1482019-03-28  Ryosuke Niwa  <rniwa@webkit.org>
    249
  • trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.h

    r242972 r243636  
    4242
    4343struct GPUBindGroupLayoutBinding {
    44     unsigned long binding;
     44    unsigned binding;
    4545    GPUShaderStageFlags visibility;
    4646    GPUBindingType type;
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.cpp

    r242571 r243636  
    3535namespace Metal {
    3636
    37 unsigned long calculateVertexBufferIndex(unsigned long index)
     37unsigned calculateVertexBufferIndex(unsigned index)
    3838{
    3939    // Reserve the first few MTLBuffer slots for argument buffers for GPUBindGroups.
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.h

    r242571 r243636  
    3434namespace Metal {
    3535
    36 unsigned long calculateVertexBufferIndex(unsigned long);
     36unsigned calculateVertexBufferIndex(unsigned);
    3737
    3838}
  • trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupBinding.h

    r242615 r243636  
    3838
    3939struct WebGPUBindGroupBinding {
    40     unsigned long binding;
     40    unsigned binding;
    4141    WebGPUBindingResource resource;
    4242};
  • trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.cpp

    r243563 r243636  
    4545    case GPUBindingType::UniformBuffer:
    4646        if (!buffer->isUniform()) {
    47             LOG(WebGPU, "%s: GPUBuffer resource for binding %lu does not have UNIFORM usage!", functionName, binding.binding);
     47            LOG(WebGPU, "%s: GPUBuffer resource for binding %u does not have UNIFORM usage!", functionName, binding.binding);
    4848            return false;
    4949        }
     
    5151    case GPUBindingType::StorageBuffer:
    5252        if (!buffer->isStorage()) {
    53             LOG(WebGPU, "%s: GPUBuffer resource for binding %lu does not have STORAGE usage!", functionName, binding.binding);
     53            LOG(WebGPU, "%s: GPUBuffer resource for binding %u does not have STORAGE usage!", functionName, binding.binding);
    5454            return false;
    5555        }
    5656        return true;
    5757    default:
    58         LOG(WebGPU, "%s: Layout binding %lu is not a buffer-type resource!", functionName, binding.binding);
     58        LOG(WebGPU, "%s: Layout binding %u is not a buffer-type resource!", functionName, binding.binding);
    5959        return false;
    6060    }
     
    8383        auto iterator = layoutMap.find(binding.binding);
    8484        if (iterator == layoutMap.end()) {
    85             LOG(WebGPU, "%s: GPUBindGroupLayoutBinding %lu not found in GPUBindGroupLayout!", functionName, binding.binding);
     85            LOG(WebGPU, "%s: GPUBindGroupLayoutBinding %u not found in GPUBindGroupLayout!", functionName, binding.binding);
    8686            return WTF::nullopt;
    8787        }
     
    120120        auto bindingResource = WTF::visit(bindingResourceVisitor, binding.resource);
    121121        if (!bindingResource) {
    122             LOG(WebGPU, "%s: Invalid resource for binding %lu!", functionName, layoutBinding.binding);
     122            LOG(WebGPU, "%s: Invalid resource for binding %u!", functionName, layoutBinding.binding);
    123123            return WTF::nullopt;
    124124        }
  • trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.cpp

    r242164 r243636  
    4343}
    4444
    45 void WebGPUBuffer::setSubData(unsigned long long offset, const JSC::ArrayBuffer& data)
     45void WebGPUBuffer::setSubData(unsigned long offset, const JSC::ArrayBuffer& data)
    4646{
    4747    if (!m_buffer)
  • trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.h

    r243563 r243636  
    4949    const GPUBuffer* buffer() const { return m_buffer.get(); }
    5050
    51     void setSubData(unsigned long long, const JSC::ArrayBuffer&);
     51    void setSubData(unsigned long, const JSC::ArrayBuffer&);
    5252    using BufferMappingPromise = DOMPromiseDeferred<IDLInterface<JSC::ArrayBuffer>>;
    5353    void mapReadAsync(BufferMappingPromise&&);
  • trunk/Source/WebCore/Modules/webgpu/WebGPUBufferBinding.h

    r242164 r243636  
    3535struct WebGPUBufferBinding {
    3636    RefPtr<WebGPUBuffer> buffer;
    37     unsigned long long offset;
    38     unsigned long long size;
     37    unsigned long offset;
     38    unsigned long size;
    3939};
    4040
  • trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp

    r243627 r243636  
    6161}
    6262
    63 void WebGPURenderPassEncoder::setVertexBuffers(unsigned long startSlot, Vector<RefPtr<WebGPUBuffer>>&& buffers, Vector<unsigned long long>&& offsets)
     63void WebGPURenderPassEncoder::setVertexBuffers(unsigned startSlot, Vector<RefPtr<WebGPUBuffer>>&& buffers, Vector<unsigned long long>&& offsets)
    6464{
    6565#if !LOG_DISABLED
     
    7575    }
    7676    if (startSlot + buffers.size() > maxVertexBuffers) {
    77         LOG(WebGPU, "%s: Invalid startSlot %lu for %lu buffers!", functionName, startSlot, buffers.size());
     77        LOG(WebGPU, "%s: Invalid startSlot %u for %lu buffers!", functionName, startSlot, buffers.size());
    7878        return;
    7979    }
     
    9999}
    100100
    101 void WebGPURenderPassEncoder::draw(unsigned long vertexCount, unsigned long instanceCount, unsigned long firstVertex, unsigned long firstInstance)
     101void WebGPURenderPassEncoder::draw(unsigned vertexCount, unsigned instanceCount, unsigned firstVertex, unsigned firstInstance)
    102102{
    103103    if (!m_passEncoder) {
  • trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h

    r243627 r243636  
    4444
    4545    void setPipeline(const WebGPURenderPipeline&);
    46     void setVertexBuffers(unsigned long, Vector<RefPtr<WebGPUBuffer>>&&, Vector<unsigned long long>&&);
    47     void draw(unsigned long vertexCount, unsigned long instanceCount, unsigned long firstVertex, unsigned long firstInstance);
     46    void setVertexBuffers(unsigned, Vector<RefPtr<WebGPUBuffer>>&&, Vector<unsigned long long>&&);
     47    void draw(unsigned vertexCount, unsigned instanceCount, unsigned firstVertex, unsigned firstInstance);
    4848
    4949private:
  • trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupBinding.h

    r243563 r243636  
    3838
    3939struct GPUBindGroupBinding {
    40     unsigned long binding;
     40    unsigned binding;
    4141    GPUBindingResource resource;
    4242};
  • trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h

    r242766 r243636  
    4848    static RefPtr<GPUBindGroupLayout> tryCreate(const GPUDevice&, const GPUBindGroupLayoutDescriptor&);
    4949
    50     using BindingsMapType = HashMap<unsigned long long, GPUBindGroupLayoutBinding, WTF::IntHash<unsigned long long>, WTF::UnsignedWithZeroKeyHashTraits<unsigned long long>>;
     50    using BindingsMapType = HashMap<unsigned long, GPUBindGroupLayoutBinding, WTF::IntHash<unsigned long>, WTF::UnsignedWithZeroKeyHashTraits<unsigned long>>;
    5151    const BindingsMapType& bindingsMap() const { return m_bindingsMap; }
    5252#if USE(METAL)
  • trunk/Source/WebCore/platform/graphics/gpu/GPUBufferBinding.h

    r242164 r243636  
    3535struct GPUBufferBinding {
    3636    Ref<GPUBuffer> buffer;
    37     unsigned long long offset;
    38     unsigned long long size;
     37    unsigned long offset;
     38    unsigned long size;
    3939};
    4040
  • trunk/Source/WebCore/platform/graphics/gpu/GPUExtent3D.h

    r241048 r243636  
    3131   
    3232struct GPUExtent3D {
    33     unsigned long width;
    34     unsigned long height;
    35     unsigned long depth;
     33    unsigned width;
     34    unsigned height;
     35    unsigned depth;
    3636};
    3737
  • trunk/Source/WebCore/platform/graphics/gpu/GPULimits.h

    r240898 r243636  
    3030namespace WebCore {
    3131
    32 const unsigned long maxVertexBuffers = 16;
     32const unsigned maxVertexBuffers = 16;
    3333
    3434} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h

    r243627 r243636  
    5353
    5454    void setPipeline(Ref<const GPURenderPipeline>&&);
    55     void setVertexBuffers(unsigned long, Vector<Ref<GPUBuffer>>&&, Vector<unsigned long long>&&);
    56     void draw(unsigned long vertexCount, unsigned long instanceCount, unsigned long firstVertex, unsigned long firstInstance);
     55    void setVertexBuffers(unsigned, Vector<Ref<GPUBuffer>>&&, Vector<unsigned long long>&&);
     56    void draw(unsigned vertexCount, unsigned instanceCount, unsigned firstVertex, unsigned firstInstance);
    5757
    5858private:
  • trunk/Source/WebCore/platform/graphics/gpu/GPUTextureDescriptor.h

    r242972 r243636  
    4242struct GPUTextureDescriptor {
    4343    GPUExtent3D size;
    44     unsigned long arrayLayerCount;
    45     unsigned long mipLevelCount;
    46     unsigned long sampleCount;
     44    unsigned arrayLayerCount;
     45    unsigned mipLevelCount;
     46    unsigned sampleCount;
    4747    GPUTextureDimension dimension;
    4848    GPUTextureFormat format;
  • trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm

    r242972 r243636  
    9090    for (const auto& binding : descriptor.bindings) {
    9191        if (!bindingsMap.add(binding.binding, binding)) {
    92             LOG(WebGPU, "GPUBindGroupLayout::tryCreate(): Duplicate binding %lu found in GPUBindGroupLayoutDescriptor!", binding.binding);
     92            LOG(WebGPU, "GPUBindGroupLayout::tryCreate(): Duplicate binding %u found in GPUBindGroupLayoutDescriptor!", binding.binding);
    9393            return nullptr;
    9494        }
     
    100100        END_BLOCK_OBJC_EXCEPTIONS;
    101101        if (!mtlArgument) {
    102             LOG(WebGPU, "GPUBindGroupLayout::tryCreate(): Unable to create MTLArgumentDescriptor for binding %lu!", binding.binding);
     102            LOG(WebGPU, "GPUBindGroupLayout::tryCreate(): Unable to create MTLArgumentDescriptor for binding %u!", binding.binding);
    103103            return nullptr;
    104104        }
  • trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm

    r243627 r243636  
    161161        auto layoutIterator = layoutBindingsMap.find(index);
    162162        if (layoutIterator == layoutBindingsMap.end()) {
    163             LOG(WebGPU, "%s: GPUBindGroupBinding %lu not found in GPUBindGroupLayout!", functionName, index);
     163            LOG(WebGPU, "%s: GPUBindGroupBinding %u not found in GPUBindGroupLayout!", functionName, index);
    164164            return nullptr;
    165165        }
     
    173173
    174174        if (isForVertex && !vertexEncoder) {
    175             LOG(WebGPU, "%s: No vertex argument encoder found for binding %lu!", functionName, index);
     175            LOG(WebGPU, "%s: No vertex argument encoder found for binding %u!", functionName, index);
    176176            return nullptr;
    177177        }
    178178        if (isForFragment && !fragmentEncoder) {
    179             LOG(WebGPU, "%s: No fragment argument encoder found for binding %lu!", functionName, index);
     179            LOG(WebGPU, "%s: No fragment argument encoder found for binding %u!", functionName, index);
    180180            return nullptr;
    181181        }
    182182        if (isForCompute && !computeEncoder) {
    183             LOG(WebGPU, "%s: No compute argument encoder found for binding %lu!", functionName, index);
     183            LOG(WebGPU, "%s: No compute argument encoder found for binding %u!", functionName, index);
    184184            return nullptr;
    185185        }
  • trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm

    r243627 r243636  
    205205}
    206206
    207 void GPURenderPassEncoder::setVertexBuffers(unsigned long index, Vector<Ref<GPUBuffer>>&& buffers, Vector<unsigned long long>&& offsets)
     207void GPURenderPassEncoder::setVertexBuffers(unsigned index, Vector<Ref<GPUBuffer>>&& buffers, Vector<unsigned long long>&& offsets)
    208208{
    209209    if (!m_platformRenderPassEncoder) {
     
    246246}
    247247
    248 void GPURenderPassEncoder::draw(unsigned long vertexCount, unsigned long instanceCount, unsigned long firstVertex, unsigned long firstInstance)
     248void GPURenderPassEncoder::draw(unsigned vertexCount, unsigned instanceCount, unsigned firstVertex, unsigned firstInstance)
    249249{
    250250    if (!m_platformRenderPassEncoder) {
  • trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm

    r243627 r243636  
    332332        // Maximum number of vertex attributes to be supported by Web GPU.
    333333        if (location >= 16) {
    334             LOG(WebGPU, "%s: Invalid shaderLocation %lu for vertex attribute!", functionName, location);
     334            LOG(WebGPU, "%s: Invalid shaderLocation %u for vertex attribute!", functionName, location);
    335335            return false;
    336336        }
    337337        if (attributes[i].inputSlot >= maxVertexBuffers) {
    338             LOG(WebGPU, "%s: Invalid inputSlot %lu for vertex attribute %lu!", functionName, attributes[i].inputSlot, location);
     338            LOG(WebGPU, "%s: Invalid inputSlot %u for vertex attribute %u!", functionName, attributes[i].inputSlot, location);
    339339            return false;
    340340        }
  • trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUTextureMetal.mm

    r242575 r243636  
    8484
    8585#if !PLATFORM(MAC)
    86 static MTLStorageMode storageModeForPixelFormatAndSampleCount(MTLPixelFormat format, unsigned long samples)
     86static MTLStorageMode storageModeForPixelFormatAndSampleCount(MTLPixelFormat format, unsigned samples)
    8787{
    8888    // Depth, Stencil, DepthStencil, and Multisample textures must be allocated with the MTLStorageModePrivate resource option.
Note: See TracChangeset for help on using the changeset viewer.