blob: 4bd05adc98c50b8743623a3a820c272cfac8ab58 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../js/webgpu-functions.js"></script>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
const vertexShaderSource = `
vertex float4 vertexShader(float4 position : attribute(0)) : SV_Position {
return position;
}`;
const fragmentShaderSource = `
float saturate(float x) {
return 0;
}
fragment float4 fragmentShader(float4 position : SV_Position) : SV_Target 0 {
return float4(1, 1, 1, 1);
}
`;
async function start(device) {
const vertexShaderModule = device.createShaderModule({code: vertexShaderSource});
const fragmentShaderModule = device.createShaderModule({code: fragmentShaderSource});
const vertexStage = {module: vertexShaderModule, entryPoint: "vertexShader"};
const fragmentStage = {module: fragmentShaderModule, entryPoint: "fragmentShader"};
const primitiveTopology = "triangle-strip";
const rasterizationState = {frontFace: "cw", cullMode: "none"};
const alphaBlend = {};
const colorBlend = {};
const colorStates = [{format: "rgba8unorm", alphaBlend, colorBlend, writeMask: 15}]; // GPUColorWrite.ALL
const depthStencilState = null;
const attribute = {shaderLocation: 0, format: "float4"};
const input = {stride: 16, attributeSet: [attribute]};
const inputs = [input];
const vertexInput = {vertexBuffers: inputs};
const pipelineLayoutDescriptor = {bindGroupLayouts: []};
const pipelineLayout = device.createPipelineLayout(pipelineLayoutDescriptor);
device.pushErrorScope("validation");
const renderPipelineDescriptor = {vertexStage, fragmentStage, primitiveTopology, rasterizationState, colorStates, depthStencilState, vertexInput, sampleCount: 1, layout: pipelineLayout};
const renderPipeline = device.createRenderPipeline(renderPipelineDescriptor);
return device.popErrorScope();
}
window.jsTestIsAsync = true;
getBasicDevice().then(function(device) {
start(device).then(function(x) {
if (x)
testPassed("");
else
testFailed("");
finishJSTest();
}, function() {
testFailed("");
finishJSTest();
});
}, function() {
testPassed();
finishJSTest();
});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>