| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../http/tests/inspector/resources/inspector-test.js"></script> |
| <script src="resources/shaderProgram-utilities-webgpu.js"></script> |
| <script> |
| function test() { |
| let suite = InspectorTest.createAsyncSuite("Canvas.requestShaderSource.WebGPU"); |
| |
| for (let programType of Object.values(WI.ShaderProgram.ProgramType)) { |
| for (let shaderType of Object.values(WI.ShaderProgram.ShaderType)) { |
| suite.addTestCase({ |
| name: `Canvas.requestShaderSource.WebGPU.Program.${programType}.Shader.${shaderType}`, |
| async test() { |
| let shaderProgram = InspectorTest.ShaderProgram.programForType(programType); |
| if (!shaderProgram) |
| throw "Missing shader program"; |
| |
| let logShader = async () => { |
| let {source} = await CanvasAgent.requestShaderSource(shaderProgram.identifier, shaderType); |
| InspectorTest.log(source); |
| }; |
| |
| let isComputeProgram = programType === WI.ShaderProgram.ProgramType.Compute; |
| let isComputeShader = shaderType === WI.ShaderProgram.ShaderType.Compute; |
| if (isComputeProgram !== isComputeShader) |
| await InspectorTest.expectException(logShader); |
| else |
| await logShader() |
| } |
| }); |
| } |
| } |
| |
| suite.runTestCasesAndFinish(); |
| } |
| </script> |
| </head> |
| <body onload="load()"> |
| <p>WebGPU tests for Canvas.requestShaderSource command.</p> |
| </body> |
| </html> |