| <!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] --> |
| <html> |
| <meta charset=utf-8> |
| <title>Test shader validation.</title> |
| <script src="js/webgpu-functions.js"></script> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script> |
| const shaders = ` |
| #include <metal_stdlib> |
| |
| using namespace metal; |
| |
| struct Vertex |
| { |
| float4 position [[position]]; |
| }; |
| |
| vertex Vertex vertex_main() |
| { |
| return Vertex { float4(0, 0, 0, 1) }; |
| } |
| |
| fragment float4 fragment_main(Vertex vertexIn [[stage_in]]) |
| { |
| return vertexIn.position; |
| } |
| ` |
| |
| promise_test(async () => { |
| const device = await getBasicDevice(); |
| |
| let shaderModule = device.createShaderModule({ code: shaders }); |
| assert_true(shaderModule instanceof GPUShaderModule, "Shader module created successfully."); |
| }, "Test shader code validation when creating modules."); |
| </script> |
| </html> |