Title: [293706] trunk/Source/WebInspectorUI
Revision
293706
Author
commit-qu...@webkit.org
Date
2022-05-02 17:59:22 -0700 (Mon, 02 May 2022)

Log Message

WebInspector: Improve rendering of GLbitfield in WebGL canvas recordings.
https://bugs.webkit.org/show_bug.cgi?id=239589

Patch by Dan Glastonbury <d...@apple.com> on 2022-05-02
Reviewed by Devin Rousso.

* UserInterface/Models/RecordingAction.js:
(WI.RecordingAction.bitfieldNamesForParameter.test_and_clear_bit):
(WI.RecordingAction.bitfieldNamesForParameter): Split known
bitfields into an array of valid named representation for each
bit. Unknown bits are returned as hexadecimal formatted string.
* UserInterface/Views/RecordingActionTreeElement.js:
(WI.RecordingActionTreeElement._generateDOM.createParameterElement):
(WI.RecordingActionTreeElement._generateDOM): If param has a
non-null, array of strings, render the array as
`context.FIELD1|context.FIELD2`

Canonical link: https://commits.webkit.org/250195@main

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (293705 => 293706)


--- trunk/Source/WebInspectorUI/ChangeLog	2022-05-03 00:55:03 UTC (rev 293705)
+++ trunk/Source/WebInspectorUI/ChangeLog	2022-05-03 00:59:22 UTC (rev 293706)
@@ -1,3 +1,21 @@
+2022-04-21  Dan Glastonbury  <d...@apple.com>
+
+        WebInspector: Improve rendering of GLbitfield in WebGL canvas recordings.
+        https://bugs.webkit.org/show_bug.cgi?id=239589
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Models/RecordingAction.js:
+        (WI.RecordingAction.bitfieldNamesForParameter.test_and_clear_bit):
+        (WI.RecordingAction.bitfieldNamesForParameter): Split known
+        bitfields into an array of valid named representation for each
+        bit. Unknown bits are returned as hexadecimal formatted string.
+        * UserInterface/Views/RecordingActionTreeElement.js:
+        (WI.RecordingActionTreeElement._generateDOM.createParameterElement):
+        (WI.RecordingActionTreeElement._generateDOM): If param has a
+        non-null, array of strings, render the array as
+        `context.FIELD1|context.FIELD2`
+
 2022-04-29  Patrick Angle  <pan...@apple.com>
 
         Web Inspector: Regression(r267038) Import a timeline does not render the timeline, only lists the events

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/RecordingAction.js (293705 => 293706)


--- trunk/Source/WebInspectorUI/UserInterface/Models/RecordingAction.js	2022-05-03 00:55:03 UTC (rev 293705)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/RecordingAction.js	2022-05-03 00:59:22 UTC (rev 293706)
@@ -115,6 +115,53 @@
         return typeof propertyDescriptor.value === "function";
     }
 
+    static bitfieldNamesForParameter(type, name, value, index, count)
+    {
+        if (!value)
+            return null;
+
+        let prototype = WI.RecordingAction._prototypeForType(type);
+        if (!prototype)
+            return null;
+
+        function testAndClearBit(name) {
+            let bit = prototype[name];
+            if (!bit)
+                return;
+
+            if (value & bit)
+                names.push(name);
+
+            value = value & ~bit;
+        }
+
+        function hexString(value) {
+            return "0x" + value.toString(16);
+        }
+
+        let names = [];
+
+        if ((name === "clear" && index === 0 && (type === WI.Recording.Type.CanvasWebGL || type === WI.Recording.Type.CanvasWebGL2)) ||
+            (name === "blitFramebuffer" && index === 8 && type === WI.Recording.Type.CanvasWebGL2)) {
+            testAndClearBit("COLOR_BUFFER_BIT");
+            testAndClearBit("DEPTH_BUFFER_BIT");
+            testAndClearBit("STENCIL_BUFFER_BIT");
+            if (value)
+                names.push(hexString(value));
+        }
+
+        if (name === "clientWaitSync" && index === 1 && type === WI.Recording.Type.CanvasWebGL2) {
+            testAndClearBit("SYNC_FLUSH_COMMANDS_BIT");
+            if (value)
+                names.push(hexString(value));
+        }
+
+        if (!names.length)
+            return null;
+
+        return names;
+    }
+
     static constantNameForParameter(type, name, value, index, count)
     {
         let indexesForType = WI.RecordingAction._constantIndexes[type];

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js (293705 => 293706)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js	2022-05-03 00:55:03 UTC (rev 293705)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js	2022-05-03 00:59:22 UTC (rev 293706)
@@ -55,9 +55,13 @@
             switch (swizzleType) {
             case WI.Recording.Swizzle.Number:
                 var constantNameForParameter = WI.RecordingAction.constantNameForParameter(recordingType, recordingAction.name, parameter, index, parameterCount);
+                var bitfieldNamesForParameter = WI.RecordingAction.bitfieldNamesForParameter(recordingType, recordingAction.name, parameter, index, parameterCount);
                 if (constantNameForParameter) {
                     parameterElement.classList.add("constant");
                     parameterElement.textContent = "context." + constantNameForParameter;
+                } else if (bitfieldNamesForParameter) {
+                    parameterElement.classList.add("constant");
+                    parameterElement.textContent = bitfieldNamesForParameter.map((p) => p.startsWith("0x") ? p : "context." + p).join(" | ");
                 } else
                     parameterElement.textContent = parameter.maxDecimals(2);
                 break;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to