Web Inspector: provide way for ShaderPrograms to be enabled/disabled
authorwebkit@devinrousso.com <webkit@devinrousso.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Aug 2017 18:08:50 +0000 (18:08 +0000)
committerwebkit@devinrousso.com <webkit@devinrousso.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Aug 2017 18:08:50 +0000 (18:08 +0000)
commitc8620bef222d6097ef05a68d6afdc0b72c5bc53b
tree64228b4decd36c655a1e28411f04ea77b931c394
parent672d7b5be655e29e9cc1b9b97602c1043c00e6f3
Web Inspector: provide way for ShaderPrograms to be enabled/disabled
https://bugs.webkit.org/show_bug.cgi?id=175400

Reviewed by Matt Baker.

Source/JavaScriptCore:

* inspector/protocol/Canvas.json:
Add `setShaderProgramDisabled` command that sets the `disabled` flag on the given shader
program to the supplied boolean value. If this value is true, calls to `drawArrays` and
`drawElements` when that program is in use will have no effect.

Source/WebCore:

Test: inspector/canvas/setShaderProgramDisabled.html

* inspector/InspectorShaderProgram.h:
(WebCore::InspectorShaderProgram::disabled):
(WebCore::InspectorShaderProgram::setDisabled):

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::drawArrays):
(WebCore::WebGLRenderingContextBase::drawElements):
If the current program is disabled, return early. This will prevent the current shader
program from drawing anything to the canvas.

* inspector/InspectorCanvasAgent.h:
* inspector/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::setShaderProgramDisabled):
(WebCore::InspectorCanvasAgent::isShaderProgramDisabled):
* inspector/InspectorInstrumentation.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::isShaderProgramDisabled):
(WebCore::InspectorInstrumentation::isShaderProgramDisabledImpl):

Source/WebInspectorUI:

Adds a status element to ShaderProgramTreeElement that, when clicked, will toggle the
disabled state of the corresponding ShaderProgram. Disabled shader programs will not draw
anything to the context.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Main.html:

* UserInterface/Models/ShaderProgram.js:
(WI.ShaderProgram):
(WI.ShaderProgram.prototype.get disabled):
(WI.ShaderProgram.prototype.toggleDisabled):

* UserInterface/Views/ShaderProgramTreeElement.js:
(WI.ShaderProgramTreeElement):
(WI.ShaderProgramTreeElement.prototype.selectOnMouseDown):
(WI.ShaderProgramTreeElement.prototype._disabledImageElementClicked):
* UserInterface/Views/ShaderProgramTreeElement.css: Added.
(.item.shader-program .status > img):
(.item.shader-program:not(:hover, .selected, .disabled) .status > img):
(.tree-outline:matches(:focus, .force-focus) .item.shader-program.selected .status > img):
(.item.shader-program.disabled > *):

LayoutTests:

* inspector/canvas/setShaderProgramDisabled-expected.txt: Added.
* inspector/canvas/setShaderProgramDisabled.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221025 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/canvas/setShaderProgramDisabled-expected.txt [new file with mode: 0644]
LayoutTests/inspector/canvas/setShaderProgramDisabled.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Canvas.json
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Source/WebCore/inspector/InspectorCanvasAgent.cpp
Source/WebCore/inspector/InspectorCanvasAgent.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorShaderProgram.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Main.html
Source/WebInspectorUI/UserInterface/Models/ShaderProgram.js
Source/WebInspectorUI/UserInterface/Views/ShaderProgramTreeElement.css [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Views/ShaderProgramTreeElement.js