RESOLVED FIXED Bug 138593
Web Inspector: add source view for WebGL shader programs
https://bugs.webkit.org/show_bug.cgi?id=138593
Summary Web Inspector: add source view for WebGL shader programs
Matt Baker
Reported 2014-11-10 18:52:21 PST
Selecting canvas shader programs from the resources sidebar should bring up side-by-side source code views displaying the vertex and fragment shader source. Live editing of shader source should be possible, with compilation errors displayed in the editor.
Attachments
Patch (91.19 KB, patch)
2017-07-31 17:16 PDT, Devin Rousso
no flags
[Image] After Patch is applied (568.22 KB, image/png)
2017-07-31 17:16 PDT, Devin Rousso
no flags
Patch (89.94 KB, patch)
2017-08-03 16:48 PDT, Devin Rousso
no flags
Patch (90.59 KB, patch)
2017-08-03 21:48 PDT, Devin Rousso
no flags
Archive of layout-test-results from ews116 for mac-elcapitan (1.83 MB, application/zip)
2017-08-03 23:13 PDT, Build Bot
no flags
Patch (92.36 KB, patch)
2017-08-03 23:20 PDT, Devin Rousso
no flags
Patch (93.42 KB, patch)
2017-08-04 12:14 PDT, Devin Rousso
no flags
Radar WebKit Bug Importer
Comment 1 2014-11-10 18:52:33 PST
Devin Rousso
Comment 2 2017-07-31 17:16:39 PDT
Devin Rousso
Comment 3 2017-07-31 17:16:54 PDT
Created attachment 316817 [details] [Image] After Patch is applied
Matt Baker
Comment 4 2017-08-01 12:21:34 PDT
This will need to be rebased once https://bugs.webkit.org/show_bug.cgi?id=172624 lands.
Devin Rousso
Comment 5 2017-08-03 16:48:25 PDT
Devin Rousso
Comment 6 2017-08-03 21:48:30 PDT
Build Bot
Comment 7 2017-08-03 23:13:56 PDT
Comment on attachment 317211 [details] Patch Attachment 317211 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/4250843 New failing tests: inspector/canvas/requestShaderSource.html
Build Bot
Comment 8 2017-08-03 23:13:58 PDT
Created attachment 317214 [details] Archive of layout-test-results from ews116 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Devin Rousso
Comment 9 2017-08-03 23:20:38 PDT
Matt Baker
Comment 10 2017-08-04 11:26:13 PDT
Comment on attachment 317217 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=317217&action=review r=me, with comments. > Source/WebInspectorUI/ChangeLog:7 > + Reviewed by NOBODY (OOPS!). Please add a short summary of the frontend bits. > Source/WebCore/inspector/InspectorShaderProgram.cpp:69 > + return nullptr; This should never happen so we should assert: else { ASSERT_NOT_REACHED(); return nullptr; } > Source/WebInspectorUI/UserInterface/Models/ShaderProgram.js:58 > + } Style: newline after. > Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.css:55 > + padding: 0.1em 0.5em; Nit: we usually use pixels for margin/padding. Our layout doesn't adapt to font size, and ems are convenient but more difficult to reason about. > Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.css:61 > + top: 1.5em; See above. > Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:48 > + Nit: remove space. > Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:51 > + break; Nit: space after. > Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:54 > + Ditto. > Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:66 > + Remove space. > Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:93 > + super.hidden(); In general calls to super should always be first, unless there is good reason. > Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:101 > + super.closed(); Ditto. > Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:124 > + get supportsSearch() Inline. > LayoutTests/inspector/canvas/requestShaderSource.html:61 > + // ------ Remove comment.
Devin Rousso
Comment 11 2017-08-04 11:48:07 PDT
Comment on attachment 317217 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=317217&action=review >> Source/WebCore/inspector/InspectorShaderProgram.cpp:69 >> + return nullptr; > > This should never happen so we should assert: > > else { > ASSERT_NOT_REACHED(); > return nullptr; > } I didn't do this because then one of the tests I wrote fails. I don't think it's necessary to have this assert. It's already possible for this to return a nullptr if no shaders have been attached, so I think that callers will already have to check for nullptr. >> Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:93 >> + super.hidden(); > > In general calls to super should always be first, unless there is good reason. I typically put hidden/closed super calls last in case they do something to the element that I don't expect. I follow a general->specific approach super.shown() this.shown() ... this.hidden() super.hidden() >> Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:124 >> + get supportsSearch() > > Inline. I thought we only did this for obvious getters/setters, such as ones that assign/return a variable of the same name? I'm fine either way though. >> LayoutTests/inspector/canvas/requestShaderSource.html:61 >> + // ------ > > Remove comment. I've done this in most of my tests to distinguish that the tests below the line are for error cases.
Matt Baker
Comment 12 2017-08-04 11:58:38 PDT
Comment on attachment 317217 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=317217&action=review >>> Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js:124 >>> + get supportsSearch() >> >> Inline. > > I thought we only did this for obvious getters/setters, such as ones that assign/return a variable of the same name? I'm fine either way though. Our criteria in the past has been whether the body of the getter is trivial/does work. It is subjective, but usually we consider getters that don't call class methods or methods on members trivial. >>> LayoutTests/inspector/canvas/requestShaderSource.html:61 >>> + // ------ >> >> Remove comment. > > I've done this in most of my tests to distinguish that the tests below the line are for error cases. I don't think it is needed, but if you feel strongly about it at least mention that in the comment. As is, this looks like it was included by accident.
Devin Rousso
Comment 13 2017-08-04 12:14:47 PDT
WebKit Commit Bot
Comment 14 2017-08-04 14:40:02 PDT
Comment on attachment 317265 [details] Patch Clearing flags on attachment: 317265 Committed r220294: <http://trac.webkit.org/changeset/220294>
WebKit Commit Bot
Comment 15 2017-08-04 14:40:06 PDT
All reviewed patches have been landed. Closing bug.
Joseph Pecoraro
Comment 16 2017-08-16 17:20:42 PDT
Comment on attachment 317265 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=317265&action=review Sweet! > Source/WebInspectorUI/Scripts/update-codemirror-resources.rb:44 > + mode/clike/clike.js Nice!! I didn't think anyone else knew about this script! =)
Ebrahim Byagowi
Comment 17 2017-12-11 12:23:38 PST
This looks just great. Thanks! Should it enabled by a build flag or something? I couldn't find the feature on the place depicted on the screenshot on Safari Technology Preview 45 on http://acko.net or https://ebraminio.github.io/extra/WebGL1.html so some help would be nice I guess
Ebrahim Byagowi
Comment 18 2018-01-10 21:57:39 PST
Guys, any pointer on how to see result of this? I still can't see result of this on "Release 47 (Safari 11.1, WebKit 13605.1.19.1)" maybe some build or runtime flag is needed?
Matt Baker
Comment 19 2018-02-07 16:50:03 PST
(In reply to Ebrahim Byagowi from comment #18) > Guys, any pointer on how to see result of this? I still can't see result of > this on "Release 47 (Safari 11.1, WebKit 13605.1.19.1)" maybe some build or > runtime flag is needed? Viewable shader programs were broken but are being brought back in <https://webkit.org/b/178744>. This should be available in the next Safari Technology Preview (release 50).
Ebrahim Byagowi
Comment 20 2018-02-10 13:53:58 PST
Tested this yesterday with `brew cask reinstall webkit-build-archive`, works flawlessly, even doesn't need page reload and works great. Thanks!
Note You need to log in before you can comment on or make changes to this bug.