Changeset 268766 in webkit
- Timestamp:
- Oct 20, 2020, 3:20:52 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/gpu/GPUBindGroup.h (modified) (2 diffs)
-
platform/graphics/gpu/GPUBindGroupAllocator.h (modified) (1 diff)
-
platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm (modified) (2 diffs)
-
platform/graphics/gpu/cocoa/GPUPlatformTypesMetal.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r268764 r268766 1 2020-10-20 Don Olmstead <don.olmstead@sony.com> 2 3 [WebGPU] Increase portability of GPUBindGroup 4 https://bugs.webkit.org/show_bug.cgi?id=217978 5 6 Reviewed by Myles C. Maxfield. 7 8 Remove more uses of USE(METAL) around the GPUBindGroup related constructs to increase 9 portability. Introduce a platform specific type for an offset into the GPU Buffer. 10 11 No new tests. No change in behavior. 12 13 * platform/graphics/gpu/GPUBindGroup.h: 14 (WebCore::GPUBindGroup::argumentBuffer const): 15 * platform/graphics/gpu/GPUBindGroupAllocator.h: 16 (WebCore::GPUBindGroupAllocator::argumentBuffer const): 17 * platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm: 18 * platform/graphics/gpu/cocoa/GPUPlatformTypesMetal.h: 19 1 20 2020-10-20 Don Olmstead <don.olmstead@sony.com> 2 21 -
trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroup.h
r268603 r268766 41 41 struct GPUBindGroupDescriptor; 42 42 43 #if USE(METAL) 44 using ArgumentBuffer = std::pair<const MTLBuffer *, const GPUBindGroupAllocator::ArgumentBufferOffsets&>; 45 #endif 43 using ArgumentBuffer = std::pair<const PlatformBuffer*, const GPUBindGroupAllocator::ArgumentBufferOffsets&>; 46 44 47 45 class GPUBindGroup : public RefCounted<GPUBindGroup> { … … 51 49 ~GPUBindGroup(); 52 50 53 #if USE(METAL)54 51 const ArgumentBuffer argumentBuffer() const { return { m_allocator->argumentBuffer(), m_argumentBufferOffsets }; } 55 #endif56 52 const HashSet<Ref<GPUBuffer>>& boundBuffers() const { return m_boundBuffers; } 57 53 const HashSet<Ref<GPUTexture>>& boundTextures() const { return m_boundTextures; } 58 54 59 55 private: 60 #if USE(METAL)61 56 GPUBindGroup(GPUBindGroupAllocator::ArgumentBufferOffsets&&, GPUBindGroupAllocator&, HashSet<Ref<GPUBuffer>>&&, HashSet<Ref<GPUTexture>>&&); 62 57 63 58 GPUBindGroupAllocator::ArgumentBufferOffsets m_argumentBufferOffsets; 64 59 Ref<GPUBindGroupAllocator> m_allocator; 65 #endif66 60 HashSet<Ref<GPUBuffer>> m_boundBuffers; 67 61 HashSet<Ref<GPUTexture>> m_boundTextures; -
trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupAllocator.h
r268603 r268766 42 42 static Ref<GPUBindGroupAllocator> create(GPUErrorScopes&); 43 43 44 #if USE(METAL)45 44 struct ArgumentBufferOffsets { 46 Optional< NSUInteger> vertex;47 Optional< NSUInteger> fragment;48 Optional< NSUInteger> compute;45 Optional<PlatformGPUBufferOffset> vertex; 46 Optional<PlatformGPUBufferOffset> fragment; 47 Optional<PlatformGPUBufferOffset> compute; 49 48 }; 50 49 50 #if USE(METAL) 51 51 Optional<ArgumentBufferOffsets> allocateAndSetEncoders(MTLArgumentEncoder *vertex, MTLArgumentEncoder *fragment, MTLArgumentEncoder *compute); 52 #endif 52 53 53 54 void tryReset(); 54 55 55 const MTLBuffer *argumentBuffer() const { return m_argumentBuffer.get(); } 56 #endif 56 const PlatformBuffer* argumentBuffer() const { return m_argumentBuffer.get(); } 57 57 58 58 private: 59 59 explicit GPUBindGroupAllocator(GPUErrorScopes&); 60 60 61 #if USE(METAL) 62 bool reallocate(NSUInteger); 61 bool reallocate(PlatformGPUBufferOffset); 63 62 64 RetainPtr<MTLBuffer> m_argumentBuffer; 65 NSUInteger m_lastOffset { 0 }; 66 #endif 63 PlatformBufferSmartPtr m_argumentBuffer; 64 PlatformGPUBufferOffset m_lastOffset { 0 }; 67 65 68 66 Ref<GPUErrorScopes> m_errorScopes; -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm
r264006 r268766 122 122 } 123 123 124 #endif // USE(METAL) 125 124 126 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=200657, https://bugs.webkit.org/show_bug.cgi?id=200658 Optimize reallocation and reset behavior. 125 127 bool GPUBindGroupAllocator::reallocate(NSUInteger newOffset) … … 165 167 } 166 168 167 #endif // USE(METAL)168 169 169 } // namespace WebCore 170 170 -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUPlatformTypesMetal.h
r268603 r268766 51 51 namespace WebCore { 52 52 53 using PlatformGPUBufferOffset = NSUInteger; 54 55 // Metal types 53 56 using PlatformBuffer = MTLBuffer; 54 57 using PlatformBufferSmartPtr = RetainPtr<PlatformBuffer>;
Note:
See TracChangeset
for help on using the changeset viewer.