blob: 4262e11cb661f2e4d77241020e825dc2cf64f0b2 [file] [log] [blame]
sbarati@apple.combf41af12019-07-10 00:23:19 +00001<!DOCTYPE html>
justin_fan@apple.com272b7152018-11-02 07:09:09 +00002<html>
justin_fan@apple.com4583cd02019-03-12 00:46:41 +00003<meta charset=utf-8>
4<title>Test shader validation.</title>
5<script src="js/webgpu-functions.js"></script>
6<script src="../resources/testharness.js"></script>
7<script src="../resources/testharnessreport.js"></script>
justin_fan@apple.com272b7152018-11-02 07:09:09 +00008<script>
justin_fan@apple.com4583cd02019-03-12 00:46:41 +00009const shaders = `
justin_fan@apple.com4583cd02019-03-12 00:46:41 +000010struct Vertex
11{
mmaxfield@apple.com882a29d2019-08-27 04:58:11 +000012 float4 position : SV_Position;
13 float4 attributePosition : attribute(0);
justin_fan@apple.com4583cd02019-03-12 00:46:41 +000014};
15
16vertex Vertex vertex_main()
17{
mmaxfield@apple.com882a29d2019-08-27 04:58:11 +000018 Vertex result;
19 result.position = float4(0, 0, 0, 1);
20 result.attributePosition = result.position;
21 return result;
justin_fan@apple.com272b7152018-11-02 07:09:09 +000022}
23
mmaxfield@apple.com882a29d2019-08-27 04:58:11 +000024fragment float4 fragment_main(float4 position : attribute(0)) : SV_Target 0
justin_fan@apple.com4583cd02019-03-12 00:46:41 +000025{
mmaxfield@apple.com882a29d2019-08-27 04:58:11 +000026 return position;
justin_fan@apple.com4583cd02019-03-12 00:46:41 +000027}
28`
justin_fan@apple.com272b7152018-11-02 07:09:09 +000029
mmaxfield@apple.come7ba53b2019-06-26 19:35:26 +000030promise_test(() => {
31 return getBasicDevice().then(function(device) {
32 let shaderModule = device.createShaderModule({ code: shaders });
33 assert_true(shaderModule instanceof GPUShaderModule, "Shader module created successfully.");
34 }, function() {
35 });
justin_fan@apple.com4583cd02019-03-12 00:46:41 +000036}, "Test shader code validation when creating modules.");
justin_fan@apple.com272b7152018-11-02 07:09:09 +000037</script>
mmaxfield@apple.come7ba53b2019-06-26 19:35:26 +000038</html>