Changeset 220436 in webkit
- Timestamp:
- Aug 8, 2017 6:55:53 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r220428 r220436 1 2017-08-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Canvas: support editing WebGL shaders 4 https://bugs.webkit.org/show_bug.cgi?id=124211 5 <rdar://problem/15448958> 6 7 Reviewed by Matt Baker. 8 9 * inspector/canvas/updateShader-expected.txt: Added. 10 * inspector/canvas/updateShader.html: Added. 11 12 * platform/win/TestExpectations: 13 1 14 2017-08-08 Ryan Haddad <ryanhaddad@apple.com> 2 15 -
trunk/LayoutTests/platform/win/TestExpectations
r220294 r220436 1917 1917 inspector/canvas/shaderProgram-add-remove-webgl.html [ Skip ] 1918 1918 inspector/canvas/shaderProgram-add-remove-webgl2.html [ Skip ] 1919 inspector/canvas/updateShader.html [ Skip ] 1919 1920 ################################################################################ 1920 1921 ################# End WebGL Issues ####################### -
trunk/Source/JavaScriptCore/ChangeLog
r220432 r220436 1 2017-08-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Canvas: support editing WebGL shaders 4 https://bugs.webkit.org/show_bug.cgi?id=124211 5 <rdar://problem/15448958> 6 7 Reviewed by Matt Baker. 8 9 * inspector/protocol/Canvas.json: 10 Add `updateShader` command that will change the given shader's source to the provided string, 11 recompile, and relink it to its associated program. 12 Drive-by: add description to `requestShaderSource` command. 13 1 14 2017-08-08 Robin Morisset <rmorisset@apple.com> 2 15 -
trunk/Source/JavaScriptCore/inspector/protocol/Canvas.json
r220294 r220436 123 123 { 124 124 "name": "requestShaderSource", 125 "description": " ",125 "description": "Requests the source of the shader of the given type from the program with the given id.", 126 126 "parameters": [ 127 127 { "name": "programId", "$ref": "ProgramId" }, … … 130 130 "returns": [ 131 131 { "name": "content", "type": "string" } 132 ] 133 }, 134 { 135 "name": "updateShader", 136 "description": "Compiles and links the shader with identifier and type with the given source code.", 137 "parameters": [ 138 { "name": "programId", "$ref": "ProgramId" }, 139 { "name": "shaderType", "$ref": "ShaderType" }, 140 { "name": "source", "type": "string" } 132 141 ] 133 142 } -
trunk/Source/WebCore/ChangeLog
r220433 r220436 1 2017-08-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Canvas: support editing WebGL shaders 4 https://bugs.webkit.org/show_bug.cgi?id=124211 5 <rdar://problem/15448958> 6 7 Reviewed by Matt Baker. 8 9 Test: inspector/canvas/updateShader.html 10 11 * inspector/InspectorCanvasAgent.h: 12 * inspector/InspectorCanvasAgent.cpp: 13 (WebCore::InspectorCanvasAgent::updateShader): 14 15 * html/canvas/WebGLRenderingContextBase.h: 16 * html/canvas/WebGLRenderingContextBase.cpp: 17 (WebCore::WebGLRenderingContextBase::linkProgram): 18 (WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations): 19 Normally, when a program is linked, it invalidates any WebGLUniformLocation associated with 20 the program by incrementing its `linkCount`. In order to allow live editing of shaders, we 21 need to be able to compile and link a shader without invalidating these locations. This 22 patch moves the shader linking logic to its own function that is called by `linkProgram` so 23 that InspectorCanvasAgent can compile and link without invalidation. 24 1 25 2017-08-08 Sam Weinig <sam@webkit.org> 2 26 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r220281 r220436 2837 2837 void WebGLRenderingContextBase::linkProgram(WebGLProgram* program) 2838 2838 { 2839 if (!linkProgramWithoutInvalidatingAttribLocations(program)) 2840 return; 2841 2842 program->increaseLinkCount(); 2843 } 2844 2845 bool WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations(WebGLProgram* program) 2846 { 2839 2847 if (isContextLostOrPending() || !validateWebGLObject("linkProgram", program)) 2840 return; 2848 return false; 2849 2841 2850 WebGLShader* vertexShader = program->getAttachedShader(GraphicsContext3D::VERTEX_SHADER); 2842 2851 WebGLShader* fragmentShader = program->getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER); 2843 2852 if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid() || !m_context->precisionsMatch(objectOrZero(vertexShader), objectOrZero(fragmentShader)) || !m_context->checkVaryingsPacking(objectOrZero(vertexShader), objectOrZero(fragmentShader))) { 2844 2853 program->setLinkStatus(false); 2845 return ;2854 return false; 2846 2855 } 2847 2856 2848 2857 m_context->linkProgram(objectOrZero(program)); 2849 program->increaseLinkCount();2858 return true; 2850 2859 } 2851 2860 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
r219831 r220436 229 229 void lineWidth(GC3Dfloat); 230 230 void linkProgram(WebGLProgram*); 231 bool linkProgramWithoutInvalidatingAttribLocations(WebGLProgram*); 231 232 void pixelStorei(GC3Denum pname, GC3Dint param); 232 233 void polygonOffset(GC3Dfloat factor, GC3Dfloat units); -
trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp
r220294 r220436 294 294 } 295 295 296 void InspectorCanvasAgent::updateShader(ErrorString& errorString, const String& programId, const String& shaderType, const String& source) 297 { 298 #if ENABLE(WEBGL) 299 auto* inspectorProgram = assertInspectorProgram(errorString, programId); 300 if (!inspectorProgram) 301 return; 302 303 auto* shader = inspectorProgram->shaderForType(shaderType); 304 if (!shader) { 305 errorString = ASCIILiteral("No shader for given type."); 306 return; 307 } 308 309 WebGLRenderingContextBase* contextWebGL = inspectorProgram->context(); 310 contextWebGL->shaderSource(shader, source); 311 contextWebGL->compileShader(shader); 312 313 if (!shader->isValid()) { 314 errorString = ASCIILiteral("Shader compilation failed."); 315 return; 316 } 317 318 contextWebGL->linkProgramWithoutInvalidatingAttribLocations(&inspectorProgram->program()); 319 #else 320 UNUSED_PARAM(programId); 321 UNUSED_PARAM(shaderType); 322 UNUSED_PARAM(source); 323 errorString = ASCIILiteral("WebGL is not supported."); 324 #endif 325 } 326 296 327 void InspectorCanvasAgent::frameNavigated(Frame& frame) 297 328 { -
trunk/Source/WebCore/inspector/InspectorCanvasAgent.h
r220294 r220436 77 77 void cancelRecording(ErrorString&, const String& canvasId) override; 78 78 void requestShaderSource(ErrorString&, const String& programId, const String& shaderType, String*) override; 79 void updateShader(ErrorString&, const String& programId, const String& shaderType, const String& source) override; 79 80 80 81 // InspectorInstrumentation -
trunk/Source/WebInspectorUI/ChangeLog
r220370 r220436 1 2017-08-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Canvas: support editing WebGL shaders 4 https://bugs.webkit.org/show_bug.cgi?id=124211 5 <rdar://problem/15448958> 6 7 Reviewed by Matt Baker. 8 9 * UserInterface/Models/ShaderProgram.js: 10 (WI.ShaderProgram.prototype.updateVertexShader): 11 (WI.ShaderProgram.prototype.updateFragmentShader): 12 (WI.ShaderProgram.prototype._updateShader): 13 14 * UserInterface/Views/ShaderProgramContentView.js: 15 (WI.ShaderProgramContentView): 16 (WI.ShaderProgramContentView.prototype._contentDidChange): 17 1 18 2017-08-07 Devin Rousso <drousso@apple.com> 2 19 -
trunk/Source/WebInspectorUI/UserInterface/Models/ShaderProgram.js
r220294 r220436 58 58 } 59 59 60 updateVertexShader(source) 61 { 62 this._updateShader(CanvasAgent.ShaderType.Vertex, source); 63 } 64 65 updateFragmentShader(source) 66 { 67 this._updateShader(CanvasAgent.ShaderType.Fragment, source); 68 } 69 60 70 // Private 61 71 … … 71 81 }); 72 82 } 83 84 _updateShader(shaderType, source) 85 { 86 CanvasAgent.updateShader(this._identifier, shaderType, source, (error) => { 87 console.assert(!error, error); 88 }); 89 } 73 90 }; 74 91 -
trunk/Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js
r220294 r220436 36 36 let createEditor = (shaderType) => { 37 37 let textEditor = new WI.TextEditor; 38 textEditor.readOnly = false; 38 39 textEditor.addEventListener(WI.TextEditor.Event.Focused, this._editorFocused, this); 39 40 textEditor.addEventListener(WI.TextEditor.Event.NumberOfSearchResultsDidChange, this._numberOfSearchResultsDidChange, this); 41 textEditor.addEventListener(WI.TextEditor.Event.ContentDidChange, this.debounce(250)._contentDidChange, this); 40 42 textEditor.element.classList.add("shader"); 41 43 … … 195 197 this.dispatchEventToListeners(WI.ContentView.Event.NumberOfSearchResultsDidChange); 196 198 } 199 200 _contentDidChange(event) 201 { 202 if (event.target === this._vertexEditor) 203 this.representedObject.updateVertexShader(this._vertexEditor.string); 204 else if (event.target === this._fragmentEditor) 205 this.representedObject.updateFragmentShader(this._fragmentEditor.string); 206 } 197 207 };
Note: See TracChangeset
for help on using the changeset viewer.