Diff
Modified: trunk/Source/WebCore/ChangeLog (267776 => 267777)
--- trunk/Source/WebCore/ChangeLog 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/ChangeLog 2020-09-30 01:59:34 UTC (rev 267777)
@@ -1,3 +1,35 @@
+2020-09-29 Don Olmstead <[email protected]>
+
+ [WebGPU] Add platform guards
+ https://bugs.webkit.org/show_bug.cgi?id=217095
+
+ Reviewed by Darin Adler.
+
+ Add platform guards around Apple specific implementations. The WebGPU implementation
+ on Apple platforms is guarded by USE(METAL). Additionally guard uses of the WHLSL
+ compiler.
+
+ No new tests. No change in behavior.
+
+ * Modules/webgpu/GPUCanvasContext.cpp:
+ (WebCore::GPUCanvasContext::platformLayer const):
+ * platform/graphics/gpu/GPUBindGroup.h:
+ * platform/graphics/gpu/GPUBindGroupAllocator.h:
+ * platform/graphics/gpu/GPUBindGroupLayout.h:
+ * platform/graphics/gpu/GPUBuffer.h:
+ * platform/graphics/gpu/GPUCommandBuffer.h:
+ * platform/graphics/gpu/GPUComputePassEncoder.h:
+ * platform/graphics/gpu/GPUComputePipeline.h:
+ * platform/graphics/gpu/GPUDevice.h:
+ * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
+ * platform/graphics/gpu/GPUQueue.h:
+ * platform/graphics/gpu/GPURenderPassEncoder.h:
+ * platform/graphics/gpu/GPURenderPipeline.h:
+ * platform/graphics/gpu/GPUSampler.h:
+ * platform/graphics/gpu/GPUShaderModule.h:
+ * platform/graphics/gpu/GPUSwapChain.h:
+ * platform/graphics/gpu/GPUTexture.h:
+
2020-09-29 Jer Noble <[email protected]>
Fullscreen mode on mlb.com shows white letterboxing when video aspect ratio does not match screen
Modified: trunk/Source/WebCore/Modules/webgpu/GPUCanvasContext.cpp (267776 => 267777)
--- trunk/Source/WebCore/Modules/webgpu/GPUCanvasContext.cpp 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/Modules/webgpu/GPUCanvasContext.cpp 2020-09-30 01:59:34 UTC (rev 267777)
@@ -75,7 +75,7 @@
return newSwapChain;
}
-CALayer* GPUCanvasContext::platformLayer() const
+PlatformLayer* GPUCanvasContext::platformLayer() const
{
if (m_swapChain && m_swapChain->swapChain())
return m_swapChain->swapChain()->platformLayer();
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroup.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroup.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroup.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -30,12 +30,15 @@
#include "GPUBindGroupAllocator.h"
#include "GPUBuffer.h"
#include "GPUTexture.h"
-#include <objc/NSObjCRuntime.h>
#include <utility>
#include <wtf/HashSet.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+
+#if USE(METAL)
+#include <objc/NSObjCRuntime.h>
#include <wtf/RetainPtr.h>
+#endif
#if USE(METAL)
OBJC_PROTOCOL(MTLBuffer);
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupAllocator.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupAllocator.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupAllocator.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -27,14 +27,19 @@
#if ENABLE(WEBGPU)
-#include <objc/NSObjCRuntime.h>
#include <wtf/Optional.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
+
+#if USE(METAL)
+#include <objc/NSObjCRuntime.h>
#include <wtf/RetainPtr.h>
+#endif
+#if USE(METAL)
OBJC_PROTOCOL(MTLArgumentEncoder);
OBJC_PROTOCOL(MTLBuffer);
+#endif
namespace WebCore {
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -31,10 +31,13 @@
#include <wtf/HashMap.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#include <wtf/RetainPtr.h>
#include <wtf/Variant.h>
#if USE(METAL)
+#include <wtf/RetainPtr.h>
+#endif
+
+#if USE(METAL)
OBJC_PROTOCOL(MTLArgumentEncoder);
OBJC_PROTOCOL(MTLBuffer);
#endif // USE(METAL)
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBuffer.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUBuffer.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBuffer.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -33,10 +33,13 @@
#include <wtf/OptionSet.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
-#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
#if USE(METAL)
+#include <wtf/RetainPtr.h>
+#endif
+
+#if USE(METAL)
OBJC_PROTOCOL(MTLBuffer);
OBJC_PROTOCOL(MTLCommandBuffer);
#endif
@@ -56,10 +59,8 @@
#if USE(METAL)
using PlatformBuffer = MTLBuffer;
-#else
-using PlatformBuffer = void;
+using PlatformBufferSmartPtr = RetainPtr<MTLBuffer>;
#endif
-using PlatformBufferSmartPtr = RetainPtr<PlatformBuffer>;
class GPUBuffer : public RefCounted<GPUBuffer> {
public:
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -33,10 +33,15 @@
#include <wtf/HashSet.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+
+#if USE(METAL)
#include <wtf/RetainPtr.h>
+#endif
+#if USE(METAL)
OBJC_PROTOCOL(MTLBlitCommandEncoder);
OBJC_PROTOCOL(MTLCommandBuffer);
+#endif
namespace WebCore {
@@ -44,8 +49,10 @@
struct GPUExtent3D;
+#if USE(METAL)
using PlatformCommandBuffer = MTLCommandBuffer;
using PlatformCommandBufferSmartPtr = RetainPtr<MTLCommandBuffer>;
+#endif
struct GPUBufferCopyViewBase {
uint64_t offset;
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUComputePassEncoder.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUComputePassEncoder.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUComputePassEncoder.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -31,14 +31,21 @@
#include "GPUProgrammablePassEncoder.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+
+#if USE(METAL)
#include <wtf/RetainPtr.h>
+#endif
+#if USE(METAL)
OBJC_PROTOCOL(MTLComputeCommandEncoder);
+#endif
namespace WebCore {
+#if USE(METAL)
using PlatformComputePassEncoder = MTLComputeCommandEncoder;
using PlatformComputePassEncoderSmartPtr = RetainPtr<MTLComputeCommandEncoder>;
+#endif
class GPUComputePassEncoder : public GPUProgrammablePassEncoder {
public:
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUComputePipeline.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUComputePipeline.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUComputePipeline.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -29,12 +29,20 @@
#include "GPUPipeline.h"
#include "GPUProgrammableStageDescriptor.h"
-#include "WHLSLPrepare.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+
+#if ENABLE(WHLSL_COMPILER)
+#include "WHLSLPrepare.h"
+#endif
+
+#if USE(METAL)
#include <wtf/RetainPtr.h>
+#endif
+#if USE(METAL)
OBJC_PROTOCOL(MTLComputePipelineState);
+#endif
namespace WebCore {
@@ -44,8 +52,10 @@
struct GPUComputePipelineDescriptor;
+#if USE(METAL)
using PlatformComputePipeline = MTLComputePipelineState;
using PlatformComputePipelineSmartPtr = RetainPtr<MTLComputePipelineState>;
+#endif
class GPUComputePipeline final : public GPUPipeline {
public:
@@ -59,13 +69,19 @@
const PlatformComputePipeline* platformComputePipeline() const { return m_platformComputePipeline.get(); }
+#if ENABLE(WHLSL_COMPILER)
WHLSL::ComputeDimensions computeDimensions() const { return m_computeDimensions; }
+#endif
private:
+#if ENABLE(WHLSL_COMPILER)
GPUComputePipeline(PlatformComputePipelineSmartPtr&&, WHLSL::ComputeDimensions, const RefPtr<GPUPipelineLayout>&);
+#endif
PlatformComputePipelineSmartPtr m_platformComputePipeline;
+#if ENABLE(WHLSL_COMPILER)
WHLSL::ComputeDimensions m_computeDimensions { 0, 0, 0 };
+#endif
// Preserved for Web Inspector recompilation.
RefPtr<GPUPipelineLayout> m_layout;
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -36,10 +36,15 @@
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#include <wtf/RetainPtr.h>
#include <wtf/WeakPtr.h>
+#if USE(METAL)
+#include <wtf/RetainPtr.h>
+#endif
+
+#if USE(METAL)
OBJC_PROTOCOL(MTLDevice);
+#endif
namespace WebCore {
@@ -69,8 +74,10 @@
enum class GPUBufferMappedOption;
+#if USE(METAL)
using PlatformDevice = MTLDevice;
using PlatformDeviceSmartPtr = RetainPtr<MTLDevice>;
+#endif
class GPUDevice : public RefCounted<GPUDevice>, public CanMakeWeakPtr<GPUDevice> {
public:
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -29,10 +29,13 @@
#include "GPUBindGroupBinding.h"
#include "GPUCommandBuffer.h"
-#include <objc/NSObjCRuntime.h>
#include <wtf/RefCounted.h>
#if USE(METAL)
+#include <objc/NSObjCRuntime.h>
+#endif
+
+#if USE(METAL)
OBJC_PROTOCOL(MTLBuffer);
OBJC_PROTOCOL(MTLCommandEncoder);
OBJC_PROTOCOL(MTLResource);
@@ -43,7 +46,9 @@
class GPUBindGroup;
class GPURenderPipeline;
+#if USE(METAL)
using PlatformProgrammablePassEncoder = MTLCommandEncoder;
+#endif
class GPUProgrammablePassEncoder : public RefCounted<GPUProgrammablePassEncoder> {
public:
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUQueue.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUQueue.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUQueue.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -30,16 +30,23 @@
#include "DeferrableTask.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
#include <wtf/WeakPtr.h>
+#if USE(METAL)
+#include <wtf/RetainPtr.h>
+#endif
+
+#if USE(METAL)
OBJC_PROTOCOL(MTLCommandQueue);
+#endif
namespace WebCore {
+#if USE(METAL)
using PlatformQueue = MTLCommandQueue;
using PlatformQueueSmartPtr = RetainPtr<MTLCommandQueue>;
+#endif
class GPUCommandBuffer;
class GPUDevice;
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -32,10 +32,15 @@
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
+#if USE(METAL)
+#include <wtf/RetainPtr.h>
+#endif
+
+#if USE(METAL)
OBJC_PROTOCOL(MTLRenderCommandEncoder);
+#endif
namespace WebCore {
@@ -45,8 +50,10 @@
struct GPUColor;
struct GPURenderPassDescriptor;
+#if USE(METAL)
using PlatformRenderPassEncoder = MTLRenderCommandEncoder;
using PlatformRenderPassEncoderSmartPtr = RetainPtr<MTLRenderCommandEncoder>;
+#endif
class GPURenderPassEncoder : public GPUProgrammablePassEncoder {
public:
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -33,12 +33,15 @@
#include <wtf/Optional.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+
+#if USE(METAL)
#include <wtf/RetainPtr.h>
+#endif
#if USE(METAL)
OBJC_PROTOCOL(MTLDepthStencilState);
OBJC_PROTOCOL(MTLRenderPipelineState);
-#endif // USE(METAL)
+#endif
namespace WebCore {
@@ -45,8 +48,10 @@
class GPUDevice;
class GPUErrorScopes;
+#if USE(METAL)
using PlatformRenderPipeline = MTLRenderPipelineState;
using PlatformRenderPipelineSmartPtr = RetainPtr<MTLRenderPipelineState>;
+#endif
class GPURenderPipeline final : public GPUPipeline {
public:
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUSampler.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUSampler.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUSampler.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -29,9 +29,14 @@
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+
+#if USE(METAL)
#include <wtf/RetainPtr.h>
+#endif
+#if USE(METAL)
OBJC_PROTOCOL(MTLSamplerState);
+#endif
namespace WebCore {
@@ -39,8 +44,10 @@
struct GPUSamplerDescriptor;
+#if USE(METAL)
using PlatformSampler = MTLSamplerState;
using PlatformSamplerSmartPtr = RetainPtr<MTLSamplerState>;
+#endif
class GPUSampler : public RefCounted<GPUSampler> {
public:
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUShaderModule.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUShaderModule.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUShaderModule.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -30,9 +30,14 @@
#include "WHLSLPrepare.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+
+#if USE(METAL)
#include <wtf/RetainPtr.h>
+#endif
+#if USE(METAL)
OBJC_PROTOCOL(MTLLibrary);
+#endif
namespace WebCore {
@@ -40,22 +45,30 @@
struct GPUShaderModuleDescriptor;
+#if USE(METAL)
using PlatformShaderModule = MTLLibrary;
using PlatformShaderModuleSmartPtr = RetainPtr<MTLLibrary>;
+#endif
class GPUShaderModule : public RefCounted<GPUShaderModule> {
public:
static RefPtr<GPUShaderModule> tryCreate(const GPUDevice&, const GPUShaderModuleDescriptor&);
+#if ENABLE(WHLSL_COMPILER)
PlatformShaderModule* platformShaderModule() const { return m_whlslModule ? nullptr : m_platformShaderModule.get(); }
const WHLSL::ShaderModule* whlslModule() const { return m_whlslModule.get(); }
+#endif
private:
GPUShaderModule(PlatformShaderModuleSmartPtr&&);
+#if ENABLE(WHLSL_COMPILER)
GPUShaderModule(UniqueRef<WHLSL::ShaderModule>&& whlslModule);
+#endif
PlatformShaderModuleSmartPtr m_platformShaderModule;
+#if ENABLE(WHLSL_COMPILER)
std::unique_ptr<WHLSL::ShaderModule> m_whlslModule;
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -28,13 +28,27 @@
#if ENABLE(WEBGPU)
#include "GPUTexture.h"
+#include "PlatformLayer.h"
#include <wtf/OptionSet.h>
#include <wtf/RefPtr.h>
+
+// PlatformLayer implementation needed otherwise compiling derived sources will fail.
+#if USE(NICOSIA)
+#include "NicosiaPlatformLayer.h"
+#elif USE(COORDINATED_GRAPHICS)
+#include "TextureMapperPlatformLayerProxyProvider.h"
+#elif USE(TEXTURE_MAPPER)
+#include "TextureMapperPlatformLayer.h"
+#endif
+
+#if USE(METAL)
#include <wtf/RetainPtr.h>
+#endif
-OBJC_CLASS CALayer;
+#if USE(METAL)
OBJC_CLASS CAMetalDrawable;
OBJC_CLASS WebGPULayer;
+#endif
namespace WebCore {
@@ -44,9 +58,10 @@
enum class GPUTextureFormat;
+#if USE(METAL)
using PlatformDrawableSmartPtr = RetainPtr<CAMetalDrawable>;
-using PlatformLayer = CALayer;
using PlatformSwapLayerSmartPtr = RetainPtr<WebGPULayer>;
+#endif
class GPUSwapChain : public RefCounted<GPUSwapChain> {
public:
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUTexture.h (267776 => 267777)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUTexture.h 2020-09-30 01:37:55 UTC (rev 267776)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUTexture.h 2020-09-30 01:59:34 UTC (rev 267777)
@@ -31,9 +31,14 @@
#include <wtf/OptionSet.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+
+#if USE(METAL)
#include <wtf/RetainPtr.h>
+#endif
+#if USE(METAL)
OBJC_PROTOCOL(MTLTexture);
+#endif
namespace WebCore {
@@ -42,8 +47,10 @@
struct GPUTextureDescriptor;
+#if USE(METAL)
using PlatformTexture = MTLTexture;
using PlatformTextureSmartPtr = RetainPtr<MTLTexture>;
+#endif
class GPUTexture : public RefCounted<GPUTexture> {
public: