Title: [242972] trunk/Source/WebCore
Revision
242972
Author
justin_...@apple.com
Date
2019-03-14 15:26:52 -0700 (Thu, 14 Mar 2019)

Log Message

[Web GPU] Enum cleanup
https://bugs.webkit.org/show_bug.cgi?id=195766

Reviewed by Myles C. Maxfield.

Clean up enum implementations in Web GPU. Enums referenced by only one class now share implementation files with that class to reduce clutter.

No change in behavior.

* DerivedSources.make:
* Modules/webgpu/GPUBindGroupLayoutBinding.h:
* Modules/webgpu/GPUBindGroupLayoutBinding.idl:
* Modules/webgpu/GPUInputStateDescriptor.idl:
* Modules/webgpu/GPURequestAdapterOptions.idl:
* Modules/webgpu/GPUSamplerDescriptor.idl:
* Modules/webgpu/GPUTextureDescriptor.idl:
* Modules/webgpu/GPUTextureDimension.idl: Removed.
* Modules/webgpu/GPUVertexAttributeDescriptor.idl:
* Modules/webgpu/GPUVertexInputDescriptor.idl:
* Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
(WebCore::validateBufferBindingType):
* Modules/webgpu/WebGPURenderPipelineDescriptor.h:
* Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/gpu/GPUInputStateDescriptor.h:
* platform/graphics/gpu/GPURequestAdapterOptions.h:
* platform/graphics/gpu/GPUSamplerDescriptor.h:
* platform/graphics/gpu/GPUTextureDescriptor.h:
* platform/graphics/gpu/GPUTextureDimension.h: Removed.
* platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
* platform/graphics/gpu/GPUVertexInputDescriptor.h:
* platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
(WebCore::MTLDataTypeForBindingType):
* platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:
(WebCore::GPUBindGroup::tryCreate):
* platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
(WebCore::GPUDevice::create):
* platform/graphics/gpu/cocoa/GPUSamplerMetal.mm:
(WebCore::mtlAddressModeForAddressMode):
(WebCore::mtlMinMagFilterForFilterMode):
(WebCore::mtlMipFilterForFilterMode):

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (242971 => 242972)


--- trunk/Source/WebCore/CMakeLists.txt	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/CMakeLists.txt	2019-03-14 22:26:52 UTC (rev 242972)
@@ -480,7 +480,6 @@
     Modules/webgpu/GPUShaderStageBit.idl
     Modules/webgpu/GPUStoreOp.idl
     Modules/webgpu/GPUTextureDescriptor.idl
-    Modules/webgpu/GPUTextureDimension.idl
     Modules/webgpu/GPUTextureFormat.idl
     Modules/webgpu/GPUTextureUsage.idl
     Modules/webgpu/GPUVertexAttributeDescriptor.idl

Modified: trunk/Source/WebCore/ChangeLog (242971 => 242972)


--- trunk/Source/WebCore/ChangeLog	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/ChangeLog	2019-03-14 22:26:52 UTC (rev 242972)
@@ -1,3 +1,48 @@
+2019-03-14  Justin Fan  <justin_...@apple.com>
+
+        [Web GPU] Enum cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=195766
+
+        Reviewed by Myles C. Maxfield.
+
+        Clean up enum implementations in Web GPU. Enums referenced by only one class now share implementation files with that class to reduce clutter.
+        
+        No change in behavior.
+
+        * DerivedSources.make:
+        * Modules/webgpu/GPUBindGroupLayoutBinding.h:
+        * Modules/webgpu/GPUBindGroupLayoutBinding.idl:
+        * Modules/webgpu/GPUInputStateDescriptor.idl:
+        * Modules/webgpu/GPURequestAdapterOptions.idl:
+        * Modules/webgpu/GPUSamplerDescriptor.idl:
+        * Modules/webgpu/GPUTextureDescriptor.idl:
+        * Modules/webgpu/GPUTextureDimension.idl: Removed.
+        * Modules/webgpu/GPUVertexAttributeDescriptor.idl:
+        * Modules/webgpu/GPUVertexInputDescriptor.idl:
+        * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
+        (WebCore::validateBufferBindingType):
+        * Modules/webgpu/WebGPURenderPipelineDescriptor.h:
+        * Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/gpu/GPUInputStateDescriptor.h:
+        * platform/graphics/gpu/GPURequestAdapterOptions.h:
+        * platform/graphics/gpu/GPUSamplerDescriptor.h:
+        * platform/graphics/gpu/GPUTextureDescriptor.h:
+        * platform/graphics/gpu/GPUTextureDimension.h: Removed.
+        * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
+        * platform/graphics/gpu/GPUVertexInputDescriptor.h:
+        * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
+        (WebCore::MTLDataTypeForBindingType):
+        * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:
+        (WebCore::GPUBindGroup::tryCreate):
+        * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
+        (WebCore::GPUDevice::create):
+        * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm:
+        (WebCore::mtlAddressModeForAddressMode):
+        (WebCore::mtlMinMagFilterForFilterMode):
+        (WebCore::mtlMipFilterForFilterMode):
+
 2019-03-14  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Use enum class for AnimationMode

Modified: trunk/Source/WebCore/DerivedSources.make (242971 => 242972)


--- trunk/Source/WebCore/DerivedSources.make	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/DerivedSources.make	2019-03-14 22:26:52 UTC (rev 242972)
@@ -390,7 +390,6 @@
     $(WebCore)/Modules/webgpu/GPUShaderStageBit.idl \
     $(WebCore)/Modules/webgpu/GPUStoreOp.idl \
     $(WebCore)/Modules/webgpu/GPUTextureDescriptor.idl \
-    $(WebCore)/Modules/webgpu/GPUTextureDimension.idl \
     $(WebCore)/Modules/webgpu/GPUTextureFormat.idl \
     $(WebCore)/Modules/webgpu/GPUTextureUsage.idl \
     $(WebCore)/Modules/webgpu/GPUVertexAttributeDescriptor.idl \

Modified: trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.h (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.h	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.h	2019-03-14 22:26:52 UTC (rev 242972)
@@ -31,19 +31,19 @@
 
 namespace WebCore {
 
+enum class GPUBindingType {
+    UniformBuffer,
+    DynamicUniformBuffer,
+    Sampler,
+    SampledTexture,
+    StorageBuffer,
+    DynamicStorageBuffer,
+};
+
 struct GPUBindGroupLayoutBinding {
-    enum class BindingType {
-        UniformBuffer,
-        DynamicUniformBuffer,
-        Sampler,
-        SampledTexture,
-        StorageBuffer,
-        DynamicStorageBuffer
-    };
-
     unsigned long binding;
     GPUShaderStageFlags visibility;
-    BindingType type;
+    GPUBindingType type;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.idl (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.idl	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.idl	2019-03-14 22:26:52 UTC (rev 242972)
@@ -28,8 +28,7 @@
 typedef u32 GPUShaderStageFlags;
 
 [
-    Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    ImplementedAs=GPUBindingType
 ] enum GPUBindingType {
     "uniform-buffer",
     "dynamic-uniform-buffer",

Modified: trunk/Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl	2019-03-14 22:26:52 UTC (rev 242972)
@@ -26,7 +26,9 @@
 
 typedef unsigned long u32;
 
-enum GPUIndexFormat {
+[
+    ImplementedAs=GPUIndexFormat
+] enum GPUIndexFormat {
     "uint16",
     "uint32"
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPURequestAdapterOptions.idl (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/GPURequestAdapterOptions.idl	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/GPURequestAdapterOptions.idl	2019-03-14 22:26:52 UTC (rev 242972)
@@ -24,7 +24,9 @@
  */
 // https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
 
-enum GPUPowerPreference {
+[
+    ImplementedAs=GPUPowerPreference
+] enum GPUPowerPreference {
     "low-power",
     "high-performance"
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUSamplerDescriptor.idl (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/GPUSamplerDescriptor.idl	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/GPUSamplerDescriptor.idl	2019-03-14 22:26:52 UTC (rev 242972)
@@ -26,13 +26,17 @@
 
 typedef unsigned long u32;
 
-enum GPUAddressMode {
+[
+    ImplementedAs=GPUAddressMode
+] enum GPUAddressMode {
     "clamp-to-edge",
     "repeat",
     "mirror-repeat"
 };
 
-enum GPUFilterMode {
+[
+    ImplementedAs=GPUFilterMode
+] enum GPUFilterMode {
     "nearest",
     "linear"
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUTextureDescriptor.idl (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/GPUTextureDescriptor.idl	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/GPUTextureDescriptor.idl	2019-03-14 22:26:52 UTC (rev 242972)
@@ -28,6 +28,14 @@
 typedef unsigned long GPUTextureUsageFlags;
 
 [
+    ImplementedAs=GPUTextureDimension
+] enum GPUTextureDimension {
+    "1d",
+    "2d",
+    "3d"
+};
+
+[
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUTextureDescriptor {

Deleted: trunk/Source/WebCore/Modules/webgpu/GPUTextureDimension.idl (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/GPUTextureDimension.idl	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/GPUTextureDimension.idl	2019-03-14 22:26:52 UTC (rev 242972)
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
-
-[
-    Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
-] enum GPUTextureDimension {
-    "1d",
-    "2d",
-    "3d"
-};

Modified: trunk/Source/WebCore/Modules/webgpu/GPUVertexAttributeDescriptor.idl (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/GPUVertexAttributeDescriptor.idl	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/GPUVertexAttributeDescriptor.idl	2019-03-14 22:26:52 UTC (rev 242972)
@@ -27,7 +27,9 @@
 typedef unsigned long u32;
 typedef unsigned long long u64;
 
-enum GPUVertexFormat {
+[
+    ImplementedAs=GPUVertexFormat
+] enum GPUVertexFormat {
     "float",
     "float2",
     "float3",

Modified: trunk/Source/WebCore/Modules/webgpu/GPUVertexInputDescriptor.idl (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/GPUVertexInputDescriptor.idl	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/GPUVertexInputDescriptor.idl	2019-03-14 22:26:52 UTC (rev 242972)
@@ -27,7 +27,9 @@
 typedef unsigned long u32;
 typedef unsigned long long u64;
 
-enum GPUInputStepMode {
+[
+    ImplementedAs=GPUInputStepMode
+] enum GPUInputStepMode {
     "vertex",
     "instance"
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.cpp (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.cpp	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.cpp	2019-03-14 22:26:52 UTC (rev 242972)
@@ -42,13 +42,13 @@
 #endif
 
     switch (binding.type) {
-    case GPUBindGroupLayoutBinding::BindingType::UniformBuffer:
+    case GPUBindingType::UniformBuffer:
         if (!buffer->isUniform()) {
             LOG(WebGPU, "%s: GPUBuffer resource for binding %lu does not have UNIFORM usage!", functionName, binding.binding);
             return false;
         }
         return true;
-    case GPUBindGroupLayoutBinding::BindingType::StorageBuffer:
+    case GPUBindingType::StorageBuffer:
         if (!buffer->isStorage()) {
             LOG(WebGPU, "%s: GPUBuffer resource for binding %lu does not have STORAGE usage!", functionName, binding.binding);
             return false;

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h	2019-03-14 22:26:52 UTC (rev 242972)
@@ -35,9 +35,6 @@
 namespace WebCore {
 
 struct WebGPURenderPipelineDescriptor : WebGPUPipelineDescriptorBase, GPURenderPipelineDescriptorBase {
-    using GPUPrimitiveTopology = GPUPrimitiveTopology;
-    using GPUColorStateDescriptor = GPUColorStateDescriptor;
-
     Optional<GPURenderPipelineDescriptor> tryCreateGPURenderPipelineDescriptor() const;
 
     WebGPUPipelineStageDescriptor vertexStage;

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl (242971 => 242972)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl	2019-03-14 22:26:52 UTC (rev 242972)
@@ -24,7 +24,9 @@
  */
 // https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
 
-enum GPUPrimitiveTopology {
+[
+    ImplementedAs=GPUPrimitiveTopology
+] enum GPUPrimitiveTopology {
     "point-list",
     "line-list",
     "line-strip",

Modified: trunk/Source/WebCore/Sources.txt (242971 => 242972)


--- trunk/Source/WebCore/Sources.txt	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/Sources.txt	2019-03-14 22:26:52 UTC (rev 242972)
@@ -2796,7 +2796,6 @@
 JSGPUShaderStageBit.cpp
 JSGPUStoreOp.cpp
 JSGPUTextureDescriptor.cpp
-JSGPUTextureDimension.cpp
 JSGPUTextureFormat.cpp
 JSGPUTextureUsage.cpp
 JSGPUVertexAttributeDescriptor.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (242971 => 242972)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-03-14 22:26:52 UTC (rev 242972)
@@ -14001,8 +14001,6 @@
 		D026F480220A2B7000AC5F49 /* GPUExtent3D.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUExtent3D.idl; sourceTree = "<group>"; };
 		D026F483220A472F00AC5F49 /* GPUTextureUsage.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUTextureUsage.idl; sourceTree = "<group>"; };
 		D026F485220A477200AC5F49 /* GPUTextureUsage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTextureUsage.h; sourceTree = "<group>"; };
-		D026F486220A505900AC5F49 /* GPUTextureDimension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTextureDimension.h; sourceTree = "<group>"; };
-		D026F489220A539800AC5F49 /* GPUTextureDimension.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUTextureDimension.idl; sourceTree = "<group>"; };
 		D026F48B220A5B0B00AC5F49 /* GPUTextureDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUTextureDescriptor.idl; sourceTree = "<group>"; };
 		D026F48C220A5BAD00AC5F49 /* GPUTextureDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTextureDescriptor.h; sourceTree = "<group>"; };
 		D02C26922181416D00D818E4 /* GPURequestAdapterOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPURequestAdapterOptions.idl; sourceTree = "<group>"; };
@@ -18547,7 +18545,6 @@
 				312FF8BA21A4C2EF00EB199D /* GPUSwapChain.h */,
 				312FF8C521A4C2F400EB199D /* GPUTexture.h */,
 				D026F48C220A5BAD00AC5F49 /* GPUTextureDescriptor.h */,
-				D026F486220A505900AC5F49 /* GPUTextureDimension.h */,
 				312FF8C321A4C2F300EB199D /* GPUTextureFormat.h */,
 				D026F485220A477200AC5F49 /* GPUTextureUsage.h */,
 				D06EF552220BA26A0018724E /* GPUUtils.h */,
@@ -26149,7 +26146,6 @@
 				D08AA031220D0CE60058C502 /* GPUStoreOp.idl */,
 				D0ADB27F2232F17300A22935 /* GPUSwapChainDescriptor.h */,
 				D026F48B220A5B0B00AC5F49 /* GPUTextureDescriptor.idl */,
-				D026F489220A539800AC5F49 /* GPUTextureDimension.idl */,
 				D0EACFAE219E30FD000FA75C /* GPUTextureFormat.idl */,
 				D026F483220A472F00AC5F49 /* GPUTextureUsage.idl */,
 				D0D8649621BA18F4003C983C /* GPUVertexAttributeDescriptor.idl */,

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUInputStateDescriptor.h (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUInputStateDescriptor.h	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUInputStateDescriptor.h	2019-03-14 22:26:52 UTC (rev 242972)
@@ -39,10 +39,8 @@
 };
 
 struct GPUInputStateDescriptor {
-    using IndexFormat = GPUIndexFormat;
+    GPUIndexFormat indexFormat;
 
-    IndexFormat indexFormat;
-
     Vector<GPUVertexAttributeDescriptor> attributes;
     Vector<GPUVertexInputDescriptor> inputs;
 };

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURequestAdapterOptions.h (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/GPURequestAdapterOptions.h	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURequestAdapterOptions.h	2019-03-14 22:26:52 UTC (rev 242972)
@@ -29,13 +29,13 @@
 
 namespace WebCore {
 
+enum class GPUPowerPreference {
+    LowPower,
+    HighPerformance
+};
+
 struct GPURequestAdapterOptions {
-    enum class PowerPreference {
-        LowPower,
-        HighPerformance
-    };
-    
-    PowerPreference powerPreference;
+    GPUPowerPreference powerPreference;
 };
     
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUSamplerDescriptor.h (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUSamplerDescriptor.h	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUSamplerDescriptor.h	2019-03-14 22:26:52 UTC (rev 242972)
@@ -31,24 +31,24 @@
 
 namespace WebCore {
 
-struct GPUSamplerDescriptor {
-    enum class AddressMode {
-        ClampToEdge,
-        Repeat,
-        MirrorRepeat,
-    };
+enum class GPUAddressMode {
+    ClampToEdge,
+    Repeat,
+    MirrorRepeat,
+};
 
-    enum class FilterMode {
-        Nearest,
-        Linear,
-    };
+enum class GPUFilterMode {
+    Nearest,
+    Linear,
+};
 
-    AddressMode addressModeU { AddressMode::ClampToEdge };
-    AddressMode addressModeV { AddressMode::ClampToEdge };
-    AddressMode addressModeW { AddressMode::ClampToEdge };
-    FilterMode magFilter { FilterMode::Nearest };
-    FilterMode minFilter { FilterMode::Nearest };
-    FilterMode mipmapFilter { FilterMode::Nearest };
+struct GPUSamplerDescriptor {
+    GPUAddressMode addressModeU { GPUAddressMode::ClampToEdge };
+    GPUAddressMode addressModeV { GPUAddressMode::ClampToEdge };
+    GPUAddressMode addressModeW { GPUAddressMode::ClampToEdge };
+    GPUFilterMode magFilter { GPUFilterMode::Nearest };
+    GPUFilterMode minFilter { GPUFilterMode::Nearest };
+    GPUFilterMode mipmapFilter { GPUFilterMode::Nearest };
     float lodMinClamp { 0 };
     float lodMaxClamp { 0xffffffff };
     unsigned maxAnisotropy { 1 };

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUTextureDescriptor.h (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUTextureDescriptor.h	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUTextureDescriptor.h	2019-03-14 22:26:52 UTC (rev 242972)
@@ -28,11 +28,16 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUExtent3D.h"
-#include "GPUTextureDimension.h"
 #include "GPUTextureFormat.h"
 #include "GPUTextureUsage.h"
 
 namespace WebCore {
+
+enum class GPUTextureDimension {
+    _1d,
+    _2d,
+    _3d
+};
     
 struct GPUTextureDescriptor {
     GPUExtent3D size;

Deleted: trunk/Source/WebCore/platform/graphics/gpu/GPUTextureDimension.h (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUTextureDimension.h	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUTextureDimension.h	2019-03-14 22:26:52 UTC (rev 242972)
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGPU)
-
-namespace WebCore {
-    
-enum class GPUTextureDimension {
-    _1d,
-    _2d,
-    _3d
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUVertexAttributeDescriptor.h (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUVertexAttributeDescriptor.h	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUVertexAttributeDescriptor.h	2019-03-14 22:26:52 UTC (rev 242972)
@@ -39,12 +39,10 @@
 };
 
 struct GPUVertexAttributeDescriptor {
-    using Format = GPUVertexFormat;
-
     unsigned shaderLocation;
     unsigned inputSlot;
     unsigned long offset;
-    Format format;
+    GPUVertexFormat format;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUVertexInputDescriptor.h (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUVertexInputDescriptor.h	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUVertexInputDescriptor.h	2019-03-14 22:26:52 UTC (rev 242972)
@@ -35,11 +35,9 @@
 };
 
 struct GPUVertexInputDescriptor {
-    using InputStepMode = GPUInputStepMode;
-
     unsigned inputSlot;
     unsigned long stride;
-    InputStepMode stepMode;
+    GPUInputStepMode stepMode;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm	2019-03-14 22:26:52 UTC (rev 242972)
@@ -37,17 +37,17 @@
 
 namespace WebCore {
 
-static MTLDataType MTLDataTypeForBindingType(GPUBindGroupLayoutBinding::BindingType type)
+static MTLDataType MTLDataTypeForBindingType(GPUBindingType type)
 {
     switch (type) {
-    case GPUBindGroupLayoutBinding::BindingType::Sampler:
+    case GPUBindingType::Sampler:
         return MTLDataTypeSampler;
-    case GPUBindGroupLayoutBinding::BindingType::SampledTexture:
+    case GPUBindingType::SampledTexture:
         return MTLDataTypeTexture;
-    case GPUBindGroupLayoutBinding::BindingType::UniformBuffer:
-    case GPUBindGroupLayoutBinding::BindingType::DynamicUniformBuffer:
-    case GPUBindGroupLayoutBinding::BindingType::StorageBuffer:
-    case GPUBindGroupLayoutBinding::BindingType::DynamicStorageBuffer:
+    case GPUBindingType::UniformBuffer:
+    case GPUBindingType::DynamicUniformBuffer:
+    case GPUBindingType::StorageBuffer:
+    case GPUBindingType::DynamicStorageBuffer:
         return MTLDataTypePointer;
     }
 }

Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm	2019-03-14 22:26:52 UTC (rev 242972)
@@ -172,8 +172,8 @@
         
         switch (layoutBinding.type) {
         // FIXME: Support more resource types.
-        case GPUBindGroupLayoutBinding::BindingType::UniformBuffer:
-        case GPUBindGroupLayoutBinding::BindingType::StorageBuffer: {
+        case GPUBindingType::UniformBuffer:
+        case GPUBindingType::StorageBuffer: {
             auto bufferResource = tryGetResourceAsBufferBinding(resourceBinding.resource, functionName);
             if (!bufferResource)
                 return nullptr;
@@ -184,7 +184,7 @@
             boundBuffers.append(bufferResource->buffer.copyRef());
             break;
         }
-        case GPUBindGroupLayoutBinding::BindingType::Sampler: {
+        case GPUBindingType::Sampler: {
             auto samplerResource = tryGetResourceAsSampler(resourceBinding.resource, functionName);
             if (!samplerResource)
                 return nullptr;
@@ -194,7 +194,7 @@
                 setSamplerOnEncoder(fragmentEncoder, samplerResource->platformSampler(), resourceBinding.binding);
             break;
         }
-        case GPUBindGroupLayoutBinding::BindingType::SampledTexture: {
+        case GPUBindingType::SampledTexture: {
             auto textureResource = tryGetResourceAsTexture(resourceBinding.resource, functionName);
             if (!textureResource)
                 return nullptr;

Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUDeviceMetal.mm (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUDeviceMetal.mm	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUDeviceMetal.mm	2019-03-14 22:26:52 UTC (rev 242972)
@@ -43,7 +43,7 @@
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     
 #if PLATFORM(MAC)
-    if (options && options->powerPreference == GPURequestAdapterOptions::PowerPreference::LowPower) {
+    if (options && options->powerPreference == GPUPowerPreference::LowPower) {
         auto devices = adoptNS(MTLCopyAllDevices());
         
         for (id <MTLDevice> device : devices.get()) {

Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUSamplerMetal.mm (242971 => 242972)


--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUSamplerMetal.mm	2019-03-14 22:18:35 UTC (rev 242971)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUSamplerMetal.mm	2019-03-14 22:26:52 UTC (rev 242972)
@@ -37,14 +37,14 @@
 
 namespace WebCore {
 
-static MTLSamplerAddressMode mtlAddressModeForAddressMode(GPUSamplerDescriptor::AddressMode mode)
+static MTLSamplerAddressMode mtlAddressModeForAddressMode(GPUAddressMode mode)
 {
     switch (mode) {
-    case GPUSamplerDescriptor::AddressMode::ClampToEdge:
+    case GPUAddressMode::ClampToEdge:
         return MTLSamplerAddressModeClampToEdge;
-    case GPUSamplerDescriptor::AddressMode::Repeat:
+    case GPUAddressMode::Repeat:
         return MTLSamplerAddressModeRepeat;
-    case GPUSamplerDescriptor::AddressMode::MirrorRepeat:
+    case GPUAddressMode::MirrorRepeat:
         return MTLSamplerAddressModeMirrorRepeat;
     }
 
@@ -51,12 +51,12 @@
     ASSERT_NOT_REACHED();
 }
 
-static MTLSamplerMinMagFilter mtlMinMagFilterForFilterMode(GPUSamplerDescriptor::FilterMode mode)
+static MTLSamplerMinMagFilter mtlMinMagFilterForFilterMode(GPUFilterMode mode)
 {
     switch (mode) {
-    case GPUSamplerDescriptor::FilterMode::Nearest:
+    case GPUFilterMode::Nearest:
         return MTLSamplerMinMagFilterNearest;
-    case GPUSamplerDescriptor::FilterMode::Linear:
+    case GPUFilterMode::Linear:
         return MTLSamplerMinMagFilterLinear;
     }
 
@@ -63,12 +63,12 @@
     ASSERT_NOT_REACHED();
 }
 
-static MTLSamplerMipFilter mtlMipFilterForFilterMode(GPUSamplerDescriptor::FilterMode mode)
+static MTLSamplerMipFilter mtlMipFilterForFilterMode(GPUFilterMode mode)
 {
     switch (mode) {
-    case GPUSamplerDescriptor::FilterMode::Nearest:
+    case GPUFilterMode::Nearest:
         return MTLSamplerMipFilterNearest;
-    case GPUSamplerDescriptor::FilterMode::Linear:
+    case GPUFilterMode::Linear:
         return MTLSamplerMipFilterLinear;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to