blob: 4948b6e432563f2850e01c9e87c493a98d722d6c [file] [log] [blame]
<!DOCTYPE html>
<meta charset=utf-8>
<title>Get the GPUDevice and ask for the GPUQueue</title>
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="js/webgpu-functions.js"></script>
<script>
const shaders = `
struct Vertex
{
float4 position : SV_Position;
float4 attributePosition : attribute(0);
};
vertex Vertex vertex_main()
{
Vertex result;
result.position = float4(0, 0, 0, 1);
result.attributePosition = result.position;
return result;
}
fragment float4 fragment_main(float4 position : attribute(0)) : SV_Target 0
{
return position;
}
`
promise_test(() => {
return getBasicDevice().then(function(device) {
const canvas = document.createElement("canvas");
const swapChain = createBasicSwapChain(canvas, device);
const shaderModule = device.createShaderModule({ code: shaders });
const pipeline = createBasicPipeline(shaderModule, device);
const commandEncoder = device.createCommandEncoder();
assert_true(commandEncoder instanceof GPUCommandEncoder, "createCommandEncoder returned a GPUCommandEncoder");
const encoder = beginBasicRenderPass(swapChain, commandEncoder);
assert_true(encoder instanceof GPURenderPassEncoder, "beginRenderPass() returned a GPURenderPassEncoder");
encoder.setPipeline(pipeline);
encoder.endPass();
}, function() {
});
}, "GPURenderPassEncoder created and successfully ended");
</script>
</body>