Title: [240945] trunk/Source/WebCore
Revision
240945
Author
justin_...@apple.com
Date
2019-02-04 15:12:44 -0800 (Mon, 04 Feb 2019)

Log Message

[Web GPU] Code clean-up for RenderPipeline backend
https://bugs.webkit.org/show_bug.cgi?id=194238

Reviewed by Dean Jackson.

Replace dot syntax setters with calls to setter methods, and remove unnecessary setter calls for
the input state's descriptor arrays.

Covered by existing tests; no change in behavior.

* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::tryCreateMtlDepthStencilState): Refactor to use implicit setters rather than dot syntax.
(WebCore::setInputStateForPipelineDescriptor): Ditto, and remove unnecessary setter calls on array objects.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240944 => 240945)


--- trunk/Source/WebCore/ChangeLog	2019-02-04 22:30:31 UTC (rev 240944)
+++ trunk/Source/WebCore/ChangeLog	2019-02-04 23:12:44 UTC (rev 240945)
@@ -1,3 +1,19 @@
+2019-02-04  Justin Fan  <justin_...@apple.com>
+
+        [Web GPU] Code clean-up for RenderPipeline backend
+        https://bugs.webkit.org/show_bug.cgi?id=194238
+
+        Reviewed by Dean Jackson.
+
+        Replace dot syntax setters with calls to setter methods, and remove unnecessary setter calls for 
+        the input state's descriptor arrays.
+
+        Covered by existing tests; no change in behavior.
+
+        * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
+        (WebCore::tryCreateMtlDepthStencilState): Refactor to use implicit setters rather than dot syntax.
+        (WebCore::setInputStateForPipelineDescriptor): Ditto, and remove unnecessary setter calls on array objects.
+
 2019-02-04  Benjamin Poulain  <benja...@webkit.org>
 
         Use deferrable timer to restart the Responsiveness Timer on each wheel event

Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm (240944 => 240945)


--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm	2019-02-04 22:30:31 UTC (rev 240944)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm	2019-02-04 23:12:44 UTC (rev 240945)
@@ -85,8 +85,8 @@
         return nullptr;
     }
 
-    mtlDescriptor.get().depthCompareFunction = *mtlDepthCompare;
-    mtlDescriptor.get().depthWriteEnabled = descriptor.depthWriteEnabled;
+    [mtlDescriptor setDepthCompareFunction:*mtlDepthCompare];
+    [mtlDescriptor setDepthWriteEnabled:descriptor.depthWriteEnabled];
 
     // FIXME: Implement back/frontFaceStencil.
 
@@ -210,10 +210,9 @@
         }
 
         auto mtlAttributeDesc = retainPtr([attributeArray objectAtIndexedSubscript:location]);
-        mtlAttributeDesc.get().format = *mtlFormat;
-        mtlAttributeDesc.get().offset = attributes[i].offset; // FIXME: After adding more vertex formats, ensure offset < buffer's stride + format's data size.
-        mtlAttributeDesc.get().bufferIndex = WHLSL::Metal::calculateVertexBufferIndex(attributes[i].inputSlot);
-        [mtlVertexDescriptor.get().attributes setObject:mtlAttributeDesc.get() atIndexedSubscript:location];
+        [mtlAttributeDesc setFormat:*mtlFormat];
+        [mtlAttributeDesc setOffset:attributes[i].offset]; // FIXME: After adding more vertex formats, ensure offset < buffer's stride + format's data size.
+        [mtlAttributeDesc setBufferIndex:WHLSL::Metal::calculateVertexBufferIndex(attributes[i].inputSlot)];
     }
 
     const auto& inputs = descriptor.inputState.inputs;
@@ -235,12 +234,11 @@
 
         auto convertedSlot = WHLSL::Metal::calculateVertexBufferIndex(slot);
         auto mtlLayoutDesc = retainPtr([layoutArray objectAtIndexedSubscript:convertedSlot]);
-        mtlLayoutDesc.get().stepFunction = *mtlStepFunction;
-        mtlLayoutDesc.get().stride = inputs[j].stride;
-        [mtlVertexDescriptor.get().layouts setObject:mtlLayoutDesc.get() atIndexedSubscript:convertedSlot];
+        [mtlLayoutDesc setStepFunction:*mtlStepFunction];
+        [mtlLayoutDesc setStride:inputs[j].stride];
     }
 
-    mtlDescriptor.vertexDescriptor = mtlVertexDescriptor.get();
+    [mtlDescriptor setVertexDescriptor:mtlVertexDescriptor.get()];
 
     return true;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to