blob: e6665bb9daa1eb3d1ffa49f5dece794787708c75 [file] [log] [blame]
<!DOCTYPE html>
<html>
<script src="js/webgpu-functions.js"></script>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
const shaderCode = `
#include <metal_stdlib>
using namespace metal;
struct Vertex
{
float4 position [[position]];
};
vertex Vertex vertex_main(uint vid [[vertex_id]])
{
Vertex v;
switch (vid) {
case 0:
v.position = float4(-1, 1, 0, 1);
break;
case 1:
v.position = float4(-1, -1, 0, 1);
break;
case 2:
v.position = float4(1, 1, 0, 1);
break;
default:
v.position = float4(1, -1, 0, 1);
}
return v;
}
fragment float4 fragment_main(Vertex vertexIn [[stage_in]])
{
return float4(0.0, 1.0, 0.0, 1.0);
}
`
promise_test(() => {
return getBasicDevice().then(function(device) {
const shaderModule = device.createShaderModule({ code: shaderCode });
const layoutBinding = { binding: 0, visibility: GPUShaderStageBit.VERTEX, type: "storage-buffer" };
const bindGroupLayout = device.createBindGroupLayout({ bindings: [layoutBinding] });
const pipelineLayout = device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout] });
const pipeline = createBasicPipeline(shaderModule, device, null, pipelineLayout);
assert_true(pipeline instanceof GPURenderPipeline, "Successfully created GPURenderPipeline");
}, function() {
});
}, "Create basic GPURenderPipeline");
</script>
</html>