Changeset 293706 in webkit


Ignore:
Timestamp:
May 2, 2022 5:59:22 PM (3 months ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Dan Glastonbury <djg@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

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r293631 r293706  
     12022-04-21  Dan Glastonbury  <djg@apple.com>
     2
     3        WebInspector: Improve rendering of GLbitfield in WebGL canvas recordings.
     4        https://bugs.webkit.org/show_bug.cgi?id=239589
     5
     6        Reviewed by Devin Rousso.
     7
     8        * UserInterface/Models/RecordingAction.js:
     9        (WI.RecordingAction.bitfieldNamesForParameter.test_and_clear_bit):
     10        (WI.RecordingAction.bitfieldNamesForParameter): Split known
     11        bitfields into an array of valid named representation for each
     12        bit. Unknown bits are returned as hexadecimal formatted string.
     13        * UserInterface/Views/RecordingActionTreeElement.js:
     14        (WI.RecordingActionTreeElement._generateDOM.createParameterElement):
     15        (WI.RecordingActionTreeElement._generateDOM): If param has a
     16        non-null, array of strings, render the array as
     17        `context.FIELD1|context.FIELD2`
     18
    1192022-04-29  Patrick Angle  <pangle@apple.com>
    220
  • trunk/Source/WebInspectorUI/UserInterface/Models/RecordingAction.js

    r293541 r293706  
    114114            return false;
    115115        return typeof propertyDescriptor.value === "function";
     116    }
     117
     118    static bitfieldNamesForParameter(type, name, value, index, count)
     119    {
     120        if (!value)
     121            return null;
     122
     123        let prototype = WI.RecordingAction._prototypeForType(type);
     124        if (!prototype)
     125            return null;
     126
     127        function testAndClearBit(name) {
     128            let bit = prototype[name];
     129            if (!bit)
     130                return;
     131
     132            if (value & bit)
     133                names.push(name);
     134
     135            value = value & ~bit;
     136        }
     137
     138        function hexString(value) {
     139            return "0x" + value.toString(16);
     140        }
     141
     142        let names = [];
     143
     144        if ((name === "clear" && index === 0 && (type === WI.Recording.Type.CanvasWebGL || type === WI.Recording.Type.CanvasWebGL2)) ||
     145            (name === "blitFramebuffer" && index === 8 && type === WI.Recording.Type.CanvasWebGL2)) {
     146            testAndClearBit("COLOR_BUFFER_BIT");
     147            testAndClearBit("DEPTH_BUFFER_BIT");
     148            testAndClearBit("STENCIL_BUFFER_BIT");
     149            if (value)
     150                names.push(hexString(value));
     151        }
     152
     153        if (name === "clientWaitSync" && index === 1 && type === WI.Recording.Type.CanvasWebGL2) {
     154            testAndClearBit("SYNC_FLUSH_COMMANDS_BIT");
     155            if (value)
     156                names.push(hexString(value));
     157        }
     158
     159        if (!names.length)
     160            return null;
     161
     162        return names;
    116163    }
    117164
  • trunk/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js

    r277547 r293706  
    5656            case WI.Recording.Swizzle.Number:
    5757                var constantNameForParameter = WI.RecordingAction.constantNameForParameter(recordingType, recordingAction.name, parameter, index, parameterCount);
     58                var bitfieldNamesForParameter = WI.RecordingAction.bitfieldNamesForParameter(recordingType, recordingAction.name, parameter, index, parameterCount);
    5859                if (constantNameForParameter) {
    5960                    parameterElement.classList.add("constant");
    6061                    parameterElement.textContent = "context." + constantNameForParameter;
     62                } else if (bitfieldNamesForParameter) {
     63                    parameterElement.classList.add("constant");
     64                    parameterElement.textContent = bitfieldNamesForParameter.map((p) => p.startsWith("0x") ? p : "context." + p).join(" | ");
    6165                } else
    6266                    parameterElement.textContent = parameter.maxDecimals(2);
Note: See TracChangeset for help on using the changeset viewer.