Changeset 250874 in webkit
- Timestamp:
- Oct 8, 2019 4:15:59 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r250872 r250874 1 2019-10-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Canvas: modifications to shader modules can be shared between vertex/fragment shaders 4 https://bugs.webkit.org/show_bug.cgi?id=202031 5 6 Reviewed by Dean Jackson. 7 8 * inspector/canvas/updateShader-webgpu-sharedVertexFragment.html: Added. 9 * inspector/canvas/updateShader-webgpu-sharedVertexFragment-expected.txt: Added. 10 11 * platform/gtk/TestExpectations: 12 * platform/ios/TestExpectations: 13 * platform/mac-wk1/TestExpectations: 14 * platform/mac/TestExpectations: 15 * platform/win/TestExpectations: 16 * platform/wincairo/TestExpectations: 17 * platform/wpe/TestExpectations: 18 1 19 2019-10-08 Yury Semikhatsky <yurys@chromium.org> 2 20 -
trunk/LayoutTests/platform/gtk/TestExpectations
r250714 r250874 1154 1154 webkit.org/b/191005 inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ] 1155 1155 webkit.org/b/191005 inspector/canvas/updateShader-webgpu.html [ Skip ] 1156 webkit.org/b/191005 inspector/canvas/updateShader-webgpu-sharedVertexFragment.html [ Skip ] 1156 1157 1157 1158 # No support for resource load statistics yet -
trunk/LayoutTests/platform/ios/TestExpectations
r250714 r250874 50 50 inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ] 51 51 inspector/canvas/updateShader-webgpu.html [ Skip ] 52 inspector/canvas/updateShader-webgpu-sharedVertexFragment.html [ Skip ] 52 53 53 54 # Encrypted Media Extensions are not enabled -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r250824 r250874 55 55 inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ] 56 56 inspector/canvas/updateShader-webgpu.html [ Skip ] 57 inspector/canvas/updateShader-webgpu-sharedVertexFragment.html [ Skip ] 57 58 58 59 # Media Stream API testing is not supported for WK1 yet. -
trunk/LayoutTests/platform/mac/TestExpectations
r250781 r250874 1784 1784 webkit.org/b/199275 [ HighSierra ] inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ] 1785 1785 webkit.org/b/199275 [ HighSierra ] inspector/canvas/updateShader-webgpu.html [ Skip ] 1786 webkit.org/b/199275 [ HighSierra ] inspector/canvas/updateShader-webgpu-sharedVertexFragment.html [ Skip ] 1786 1787 1787 1788 webkit.org/b/189680 platform/mac/media/audio-session-category-video-paused.html [ Pass Timeout ] -
trunk/LayoutTests/platform/win/TestExpectations
r250786 r250874 4269 4269 inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ] 4270 4270 inspector/canvas/updateShader-webgpu.html [ Skip ] 4271 inspector/canvas/updateShader-webgpu-sharedVertexFragment.html [ Skip ] 4271 4272 4272 4273 webkit.org/b/191194 fast/block/basic/inline-content-with-floating-image.html [ Failure ] -
trunk/LayoutTests/platform/wincairo/TestExpectations
r250413 r250874 301 301 inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ] 302 302 inspector/canvas/updateShader-webgpu.html [ Skip ] 303 inspector/canvas/updateShader-webgpu-sharedVertexFragment.html [ Skip ] 303 304 304 305 # WIRELESS_PLAYBACK_TARGET is disabled -
trunk/LayoutTests/platform/wpe/TestExpectations
r250714 r250874 307 307 inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ] 308 308 inspector/canvas/updateShader-webgpu.html [ Skip ] 309 inspector/canvas/updateShader-webgpu-sharedVertexFragment.html [ Skip ] 309 310 310 311 # Skipped due to untestable DRM key system. ClearKey counterparts are tested instead. -
trunk/Source/JavaScriptCore/ChangeLog
r250860 r250874 1 2019-10-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Canvas: modifications to shader modules can be shared between vertex/fragment shaders 4 https://bugs.webkit.org/show_bug.cgi?id=202031 5 6 Reviewed by Dean Jackson. 7 8 * inspector/protocol/Canvas.json: 9 Create a distinct `ShaderProgram` type so that additional data can be bundled and sent to 10 the frontend as part of the `programCreated` event without having to worry about having too 11 many arguments. 12 1 13 2019-10-08 Alexey Shvayka <shvaikalesh@gmail.com> 2 14 -
trunk/Source/JavaScriptCore/inspector/protocol/Canvas.json
r250258 r250874 58 58 { "name": "backtrace", "type": "array", "items": { "$ref": "Console.CallFrame" }, "optional": true, "description": "Backtrace that was captured when this canvas context was created." } 59 59 ] 60 }, 61 { 62 "id": "ShaderProgram", 63 "type": "object", 64 "description": "Information about a WebGL/WebGL2 shader program or WebGPU shader pipeline.", 65 "properties": [ 66 { "name": "programId", "$ref": "ProgramId" }, 67 { "name": "programType", "$ref": "ProgramType" }, 68 { "name": "canvasId", "$ref": "CanvasId"} , 69 { "name": "sharesVertexFragmentShader", "type": "boolean", "optional": true, "description": "Indicates whether the vertex and fragment shader modules are the same object for a render shader pipleine for a WebGPU device." } 70 ] 60 71 } 61 72 ], … … 228 239 "name": "programCreated", 229 240 "parameters": [ 230 { "name": "canvasId", "$ref": "CanvasId"} , 231 { "name": "programId", "$ref": "ProgramId" }, 232 { "name": "programType", "$ref": "ProgramType" } 241 { "name": "shaderProgram", "$ref": "ShaderProgram" } 233 242 ] 234 243 }, -
trunk/Source/WebCore/ChangeLog
r250863 r250874 1 2019-10-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Canvas: modifications to shader modules can be shared between vertex/fragment shaders 4 https://bugs.webkit.org/show_bug.cgi?id=202031 5 6 Reviewed by Dean Jackson. 7 8 Test: inspector/canvas/updateShader-webgpu-sharedVertexFragment.html 9 10 * Modules/webgpu/WebGPUPipeline.h: 11 * Modules/webgpu/WebGPUComputePipeline.cpp: 12 (WebCore::WebGPUComputePipeline::cloneShaderModules): Added. 13 (WebCore::WebGPUComputePipeline::recompile): 14 * Modules/webgpu/WebGPURenderPipeline.cpp: 15 (WebCore::WebGPURenderPipeline::cloneShaderModules): Added. 16 (WebCore::WebGPURenderPipeline::recompile): 17 Recreate the vertex/fragment/compute shader module(s) when recompiling so that modifications 18 to it via this pipeline don't affect other pipelines that also use the same shader module. 19 20 * inspector/InspectorShaderProgram.h: 21 * inspector/InspectorShaderProgram.cpp: 22 (WebCore::InspectorShaderProgram::updateShader): 23 (WebCore::InspectorShaderProgram::buildObjectForShaderProgram): Added. 24 * inspector/agents/InspectorCanvasAgent.cpp: 25 (WebCore::InspectorCanvasAgent::didCreateWebGLProgram): 26 (WebCore::InspectorCanvasAgent::didCreateWebGPUPipeline): 27 Include as part of the `Canvas.event.programCreated` payload a flag indicating whether the 28 vertex shader module and fragment shader module are the same for `WebGPURenderPipeline`s. 29 1 30 2019-10-08 Timothy Hatcher <timothy@apple.com> 2 31 -
trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.cpp
r250258 r250874 33 33 #include "GPUPipeline.h" 34 34 #include "GPUProgrammableStageDescriptor.h" 35 #include "GPUShaderModule.h" 36 #include "GPUShaderModuleDescriptor.h" 35 37 #include "WebGPUDevice.h" 38 #include "WebGPUShaderModule.h" 36 39 #include <wtf/Optional.h> 37 40 #include <wtf/Ref.h> … … 53 56 WebGPUComputePipeline::~WebGPUComputePipeline() = default; 54 57 58 bool WebGPUComputePipeline::cloneShaderModules(const WebGPUDevice& device) 59 { 60 if (m_computeShader) { 61 if (auto& webGPUComputeShaderModule = m_computeShader.value().module) { 62 const auto& computeSource = webGPUComputeShaderModule->source(); 63 webGPUComputeShaderModule = WebGPUShaderModule::create(GPUShaderModule::tryCreate(device.device(), { computeSource }), computeSource); 64 return true; 65 } 66 } 67 return false; 68 } 69 55 70 bool WebGPUComputePipeline::recompile(const WebGPUDevice& device) 56 71 { 57 72 if (m_computePipeline && m_computeShader) { 58 73 if (auto& webGPUComputeShaderModule = m_computeShader.value().module) { 74 // Recreate the shader module so that modifications to it via this pipeline don't affect 75 // other pipelines that also use the same shader module. 76 59 77 if (auto* gpuComputeShaderModule = webGPUComputeShaderModule->module()) { 60 78 GPUProgrammableStageDescriptor computeStage(makeRef(*gpuComputeShaderModule), { m_computeShader.value().entryPoint }); -
trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.h
r250258 r250874 50 50 Optional<WebGPUPipeline::ShaderData> computeShader() const { return m_computeShader; } 51 51 52 bool cloneShaderModules(const WebGPUDevice&); 52 53 bool recompile(const WebGPUDevice&); 53 54 -
trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.h
r250824 r250874 57 57 }; 58 58 59 virtual bool cloneShaderModules(const WebGPUDevice&) = 0; 59 60 virtual bool recompile(const WebGPUDevice&) = 0; 60 61 -
trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.cpp
r250258 r250874 33 33 #include "GPUProgrammableStageDescriptor.h" 34 34 #include "GPURenderPipeline.h" 35 #include "GPUShaderModule.h" 36 #include "GPUShaderModuleDescriptor.h" 35 37 #include "WebGPUDevice.h" 38 #include "WebGPUShaderModule.h" 36 39 #include <wtf/Optional.h> 37 40 #include <wtf/Ref.h> … … 53 56 54 57 WebGPURenderPipeline::~WebGPURenderPipeline() = default; 58 59 bool WebGPURenderPipeline::cloneShaderModules(const WebGPUDevice& device) 60 { 61 if (m_vertexShader) { 62 if (auto& webGPUVertexShaderModule = m_vertexShader.value().module) { 63 bool sharesVertexFragmentShaderModule = m_fragmentShader && m_fragmentShader.value().module == webGPUVertexShaderModule; 64 65 const auto& vertexSource = webGPUVertexShaderModule->source(); 66 webGPUVertexShaderModule = WebGPUShaderModule::create(GPUShaderModule::tryCreate(device.device(), { vertexSource }), vertexSource); 67 68 if (!m_fragmentShader) 69 return true; 70 71 if (auto& webGPUFragmentShaderModule = m_fragmentShader.value().module) { 72 if (sharesVertexFragmentShaderModule) 73 webGPUFragmentShaderModule = webGPUVertexShaderModule; 74 else { 75 const auto& fragmentSource = webGPUFragmentShaderModule->source(); 76 webGPUFragmentShaderModule = WebGPUShaderModule::create(GPUShaderModule::tryCreate(device.device(), { fragmentSource }), fragmentSource); 77 } 78 return true; 79 } 80 } 81 } 82 return false; 83 } 55 84 56 85 bool WebGPURenderPipeline::recompile(const WebGPUDevice& device) -
trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.h
r250258 r250874 51 51 Optional<WebGPUPipeline::ShaderData> fragmentShader() const { return m_fragmentShader; } 52 52 53 bool cloneShaderModules(const WebGPUDevice&); 53 54 bool recompile(const WebGPUDevice&); 54 55 -
trunk/Source/WebCore/inspector/InspectorShaderProgram.cpp
r250258 r250874 216 216 auto& pipeline = pipelineWrapper.get(); 217 217 if (auto* device = m_canvas.deviceContext()) { 218 if (auto shaderData = shaderForType(pipeline, shaderType)) { 219 if (auto module = shaderData.value().module) { 220 module->update(*device, source); 221 if (pipeline.recompile(*device)) 222 return true; 218 if (pipeline.cloneShaderModules(*device)) { 219 if (auto shaderData = shaderForType(pipeline, shaderType)) { 220 if (auto module = shaderData.value().module) { 221 module->update(*device, source); 222 if (pipeline.recompile(*device)) 223 return true; 224 } 223 225 } 224 226 } … … 236 238 } 237 239 240 Ref<Inspector::Protocol::Canvas::ShaderProgram> InspectorShaderProgram::buildObjectForShaderProgram() 241 { 242 bool sharesVertexFragmentShader = false; 243 244 using ProgramTypeType = Optional<Inspector::Protocol::Canvas::ProgramType>; 245 auto programType = WTF::switchOn(m_program, 246 #if ENABLE(WEBGL) 247 [&] (std::reference_wrapper<WebGLProgram>) -> ProgramTypeType { 248 return Inspector::Protocol::Canvas::ProgramType::Render; 249 }, 250 #endif 251 #if ENABLE(WEBGPU) 252 [&] (std::reference_wrapper<WebGPUPipeline> pipelineWrapper) -> ProgramTypeType { 253 auto& pipeline = pipelineWrapper.get(); 254 if (is<WebGPUComputePipeline>(pipeline)) 255 return Inspector::Protocol::Canvas::ProgramType::Compute; 256 if (is<WebGPURenderPipeline>(pipeline)) { 257 auto& renderPipeline = downcast<WebGPURenderPipeline>(pipeline); 258 auto vertexShader = renderPipeline.vertexShader(); 259 auto fragmentShader = renderPipeline.fragmentShader(); 260 if (vertexShader && fragmentShader && vertexShader.value().module == fragmentShader.value().module) 261 sharesVertexFragmentShader = true; 262 return Inspector::Protocol::Canvas::ProgramType::Render; 263 } 264 return WTF::nullopt; 265 }, 266 #endif 267 [&] (Monostate) -> ProgramTypeType { 268 #if ENABLE(WEBGL) || ENABLE(WEBGPU) 269 ASSERT_NOT_REACHED(); 270 #endif 271 return WTF::nullopt; 272 } 273 ); 274 if (!programType) { 275 ASSERT_NOT_REACHED(); 276 programType = Inspector::Protocol::Canvas::ProgramType::Render; 277 } 278 279 auto payload = Inspector::Protocol::Canvas::ShaderProgram::create() 280 .setProgramId(m_identifier) 281 .setProgramType(programType.value()) 282 .setCanvasId(m_canvas.identifier()) 283 .release(); 284 if (sharesVertexFragmentShader) 285 payload->setSharesVertexFragmentShader(true); 286 return payload; 287 } 288 238 289 } // namespace WebCore -
trunk/Source/WebCore/inspector/InspectorShaderProgram.h
r250463 r250874 72 72 void setHighlighted(bool value) { m_highlighted = value; } 73 73 74 Ref<Inspector::Protocol::Canvas::ShaderProgram> buildObjectForShaderProgram(); 75 74 76 private: 75 77 #if ENABLE(WEBGL) -
trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
r250839 r250874 569 569 return; 570 570 571 auto inspectorProgram = InspectorShaderProgram::create(program, *inspectorCanvas);572 String programIdentifier = inspectorProgram->identifier();573 m_identifierToInspectorProgram.set( programIdentifier, WTFMove(inspectorProgram));574 m_frontendDispatcher->programCreated(inspector Canvas->identifier(), programIdentifier, Inspector::Protocol::Canvas::ProgramType::Render);571 auto inspectorProgramRef = InspectorShaderProgram::create(program, *inspectorCanvas); 572 auto& inspectorProgram = inspectorProgramRef.get(); 573 m_identifierToInspectorProgram.set(inspectorProgram.identifier(), WTFMove(inspectorProgramRef)); 574 m_frontendDispatcher->programCreated(inspectorProgram.buildObjectForShaderProgram()); 575 575 } 576 576 … … 652 652 ASSERT(pipeline.isValid()); 653 653 654 auto inspectorProgram = InspectorShaderProgram::create(pipeline, *inspectorCanvas); 655 String programIdentifier = inspectorProgram->identifier(); 656 m_identifierToInspectorProgram.set(programIdentifier, WTFMove(inspectorProgram)); 657 658 Optional<Inspector::Protocol::Canvas::ProgramType> programType; 659 if (is<WebGPUComputePipeline>(pipeline)) 660 programType = Inspector::Protocol::Canvas::ProgramType::Compute; 661 else if (is<WebGPURenderPipeline>(pipeline)) 662 programType = Inspector::Protocol::Canvas::ProgramType::Render; 663 ASSERT(programType); 664 665 m_frontendDispatcher->programCreated(inspectorCanvas->identifier(), programIdentifier, programType.value()); 654 auto inspectorProgramRef = InspectorShaderProgram::create(pipeline, *inspectorCanvas); 655 auto& inspectorProgram = inspectorProgramRef.get(); 656 m_identifierToInspectorProgram.set(inspectorProgram.identifier(), WTFMove(inspectorProgramRef)); 657 m_frontendDispatcher->programCreated(inspectorProgram.buildObjectForShaderProgram()); 666 658 } 667 659 -
trunk/Source/WebInspectorUI/ChangeLog
r250859 r250874 1 2019-10-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Canvas: modifications to shader modules can be shared between vertex/fragment shaders 4 https://bugs.webkit.org/show_bug.cgi?id=202031 5 6 Reviewed by Dean Jackson. 7 8 If the vertex and fragment shaders share the same source module for a WebGPU shader pipeline, 9 only display a single editable content view for that shader pipeline in the Canvas Tab. 10 11 * UserInterface/Models/ShaderProgram.js: 12 (WI.ShaderProgram): 13 (WI.ShaderProgram.prototype.get sharesVertexFragmentShader): Added. 14 * UserInterface/Controllers/CanvasManager.js: 15 (WI.CanvasManager.prototype.programCreated): 16 * UserInterface/Protocol/CanvasObserver.js: 17 (WI.CanvasObserver.prototype.programCreated): 18 19 * UserInterface/Views/ShaderProgramContentView.js: 20 (WI.ShaderProgramContentView): 21 (WI.ShaderProgramContentView.prototype.shown): 22 (WI.ShaderProgramContentView.prototype.hidden): 23 (WI.ShaderProgramContentView.prototype._refreshContent): 24 * UserInterface/Views/ShaderProgramContentView.css: 25 (.content-view.shader-program > .shader.compute, .content-view.shader-program > .shader.vertex.shares-vertex-fragment-shader): Added. 26 (body[dir=ltr] .content-view.shader-program > .shader.vertex:not(.shares-vertex-fragment-shader), body[dir=rtl] .content-view.shader-program > .shader.fragment): Added. 27 (body[dir=ltr] .content-view.shader-program > .shader.fragment, body[dir=rtl] .content-view.shader-program > .shader.vertex:not(.shares-vertex-fragment-shader)): Added. 28 (.content-view.shader-program > .shader.compute): Deleted. 29 (body[dir=ltr] .content-view.shader-program > .shader.vertex, body[dir=rtl] .content-view.shader-program > .shader.fragment): Deleted. 30 (body[dir=ltr] .content-view.shader-program > .shader.fragment, body[dir=rtl] .content-view.shader-program > .shader.vertex): Deleted. 31 32 * UserInterface/Views/CodeMirrorAdditions.js: 33 Replace the vertex/fragment specific MIME types with a more general "render" MIME type. 34 35 * Localizations/en.lproj/localizedStrings.js: 36 1 37 2019-10-08 Devin Rousso <drousso@apple.com> 2 38 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r250814 r250874 1232 1232 localizedStrings["Vertex"] = "Vertex"; 1233 1233 localizedStrings["Vertex Shader"] = "Vertex Shader"; 1234 localizedStrings["Vertex/Fragment Shader"] = "Vertex/Fragment Shader"; 1234 1235 localizedStrings["Very High"] = "Very High"; 1235 1236 localizedStrings["View Image"] = "View Image"; -
trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
r250258 r250874 235 235 } 236 236 237 programCreated(canvasIdentifier, programIdentifier, programType) 238 { 239 let canvas = this._canvasIdentifierMap.get(canvasIdentifier); 240 console.assert(canvas); 241 if (!canvas) 242 return; 243 244 console.assert(!this._shaderProgramIdentifierMap.has(programIdentifier), `ShaderProgram already exists with id ${programIdentifier}.`); 245 246 // COMPATIBILITY (iOS 13): `programType` did not exist yet. 237 programCreated(shaderProgramPayload) 238 { 239 let canvas = this._canvasIdentifierMap.get(shaderProgramPayload.canvasId); 240 console.assert(canvas); 241 if (!canvas) 242 return; 243 244 let programId = shaderProgramPayload.programId; 245 console.assert(!this._shaderProgramIdentifierMap.has(programId), `ShaderProgram already exists with id ${programId}.`); 246 247 // COMPATIBILITY (iOS 13.0): `Canvas.ShaderProgram.programType` did not exist yet. 248 let programType = shaderProgramPayload.programType; 247 249 if (!programType) 248 250 programType = WI.ShaderProgram.ProgramType.Render; 249 251 250 let program = new WI.ShaderProgram(programIdentifier, programType, canvas); 252 let options = {}; 253 254 // COMPATIBILITY (iOS 13.0): `Canvas.ShaderProgram.sharesVertexFragmentShader` did not exist yet. 255 if (shaderProgramPayload.sharesVertexFragmentShader) 256 options.sharesVertexFragmentShader = true; 257 258 let program = new WI.ShaderProgram(programId, programType, canvas, options); 251 259 this._shaderProgramIdentifierMap.set(program.identifier, program); 252 260 -
trunk/Source/WebInspectorUI/UserInterface/Models/ShaderProgram.js
r250258 r250874 26 26 WI.ShaderProgram = class ShaderProgram extends WI.Object 27 27 { 28 constructor(identifier, programType, canvas )28 constructor(identifier, programType, canvas, {sharesVertexFragmentShader} = {}) 29 29 { 30 30 console.assert(identifier); … … 38 38 this._programType = programType; 39 39 this._canvas = canvas; 40 41 this._sharesVertexFragmentShader = !!sharesVertexFragmentShader; 42 console.assert(!this._sharesVertexFragmentShader || (this._canvas.contextType === WI.Canvas.ContextType.WebGPU && this._programType === ShaderProgram.ProgramType.Render)); 43 40 44 this._disabled = false; 41 45 } … … 79 83 get programType() { return this._programType; } 80 84 get canvas() { return this._canvas; } 85 get sharesVertexFragmentShader() { return this._sharesVertexFragmentShader; } 81 86 82 87 get displayName() -
trunk/Source/WebInspectorUI/UserInterface/Protocol/CanvasObserver.js
r250258 r250874 68 68 } 69 69 70 programCreated( canvasId, programId, programType)70 programCreated(shaderProgram) 71 71 { 72 WI.canvasManager.programCreated(canvasId, programId, programType); 72 // COMPATIBILITY (iOS 13.0): `shaderProgram` replaced `canvasId` and `programId`. 73 if (arguments.length === 2) { 74 shaderProgram = { 75 canvasId: arguments[0], 76 programId: arguments[1], 77 }; 78 } 79 WI.canvasManager.programCreated(shaderProgram); 73 80 } 74 81 -
trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js
r250277 r250874 686 686 // FIXME: Add WHLSL specific modes. 687 687 CodeMirror.defineMIME("x-pipeline/x-compute", CodeMirror.resolveMode("x-shader/x-vertex")); 688 CodeMirror.defineMIME("x-pipeline/x-fragment", CodeMirror.resolveMode("x-shader/x-fragment")); 689 CodeMirror.defineMIME("x-pipeline/x-vertex", CodeMirror.resolveMode("x-shader/x-vertex")); 688 CodeMirror.defineMIME("x-pipeline/x-render", CodeMirror.resolveMode("x-shader/x-vertex")); 690 689 })(); 691 690 -
trunk/Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.css
r250533 r250874 32 32 } 33 33 34 .content-view.shader-program > .shader.compute { 34 .content-view.shader-program > .shader.compute, 35 .content-view.shader-program > .shader.vertex.shares-vertex-fragment-shader { 35 36 right: 0; 36 37 left: 0; 37 38 } 38 39 39 body[dir=ltr] .content-view.shader-program > .shader.vertex ,40 body[dir=ltr] .content-view.shader-program > .shader.vertex:not(.shares-vertex-fragment-shader), 40 41 body[dir=rtl] .content-view.shader-program > .shader.fragment { 41 42 width: calc(50% - 1px); … … 44 45 45 46 body[dir=ltr] .content-view.shader-program > .shader.fragment, 46 body[dir=rtl] .content-view.shader-program > .shader.vertex {47 body[dir=rtl] .content-view.shader-program > .shader.vertex:not(.shares-vertex-fragment-shader) { 47 48 width: calc(50% + 1px); 48 49 right: 0; -
trunk/Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js
r250277 r250874 33 33 34 34 let isWebGPU = this.representedObject.canvas.contextType === WI.Canvas.ContextType.WebGPU; 35 let sharesVertexFragmentShader = isWebGPU && this.representedObject.sharesVertexFragmentShader; 35 36 36 37 this._refreshButtonNavigationItem = new WI.ButtonNavigationItem("refresh", WI.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13); … … 68 69 case WI.ShaderProgram.ShaderType.Fragment: 69 70 shaderTypeContainer.textContent = WI.UIString("Fragment Shader"); 70 textEditor.mimeType = isWebGPU ? "x-pipeline/x- fragment" : "x-shader/x-fragment";71 textEditor.mimeType = isWebGPU ? "x-pipeline/x-render" : "x-shader/x-fragment"; 71 72 break; 72 73 73 74 case WI.ShaderProgram.ShaderType.Vertex: 74 shaderTypeContainer.textContent = WI.UIString("Vertex Shader"); 75 textEditor.mimeType = isWebGPU ? "x-pipeline/x-vertex" : "x-shader/x-vertex"; 75 if (sharesVertexFragmentShader) 76 shaderTypeContainer.textContent = WI.UIString("Vertex/Fragment Shader"); 77 else 78 shaderTypeContainer.textContent = WI.UIString("Vertex Shader"); 79 textEditor.mimeType = isWebGPU ? "x-pipeline/x-render" : "x-shader/x-vertex"; 76 80 break; 77 81 } … … 80 84 container.appendChild(textEditor.element); 81 85 container.classList.add("shader", shaderType); 86 container.classList.toggle("shares-vertex-fragment-shader", sharesVertexFragmentShader); 82 87 83 88 return {container, textEditor}; … … 99 104 this._vertexEditor = vertexEditor.textEditor; 100 105 101 let fragmentEditor = createEditor(WI.ShaderProgram.ShaderType.Fragment); 102 this._fragmentContainer = fragmentEditor.container; 103 this._fragmentEditor = fragmentEditor.textEditor; 106 if (!sharesVertexFragmentShader) { 107 let fragmentEditor = createEditor(WI.ShaderProgram.ShaderType.Fragment); 108 this._fragmentContainer = fragmentEditor.container; 109 this._fragmentEditor = fragmentEditor.textEditor; 110 } 104 111 105 112 this._lastActiveEditor = this._vertexEditor; … … 129 136 case WI.ShaderProgram.ProgramType.Render: 130 137 this._vertexEditor.shown(); 131 this._fragmentEditor.shown(); 138 if (!this.representedObject.sharesVertexFragmentShader) 139 this._fragmentEditor.shown(); 132 140 break; 133 141 } … … 145 153 case WI.ShaderProgram.ProgramType.Render: 146 154 this._vertexEditor.hidden(); 147 this._fragmentEditor.hidden(); 155 if (!this.representedObject.sharesVertexFragmentShader) 156 this._fragmentEditor.hidden(); 148 157 break; 149 158 } … … 277 286 case WI.ShaderProgram.ProgramType.Render: 278 287 this.representedObject.requestShaderSource(WI.ShaderProgram.ShaderType.Vertex, createCallback(this._vertexContainer, this._vertexEditor)); 279 this.representedObject.requestShaderSource(WI.ShaderProgram.ShaderType.Fragment, createCallback(this._fragmentContainer, this._fragmentEditor)); 288 if (!this.representedObject.sharesVertexFragmentShader) 289 this.representedObject.requestShaderSource(WI.ShaderProgram.ShaderType.Fragment, createCallback(this._fragmentContainer, this._fragmentEditor)); 280 290 return; 281 291 }
Note: See TracChangeset
for help on using the changeset viewer.