This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="../resources/js-test-pre.js"></script> | |
<script src="js/set-up-webgpu-contexts.js"></script> | |
<script id="library" type="x-shader/x-metal"> | |
#include <metal_stdlib> | |
using namespace metal; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] --> | |
<meta charset=utf-8> | |
<title>Create WebGPUBindGroupLayout.</title> | |
<body> | |
<script src="js/webgpu-functions.js"></script> | |
<script src="../resources/testharness.js"></script> | |
<script src="../resources/testharnessreport.js"></script> | |
<script> | |
function createBindGroupLayoutBinding() { | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function render() { | |
if (mappedBuffers.empty()) { | |
buffer, ab = device.createMappedBuffer(); | |
bg = device.createBindGroup(buffer); | |
buffer.bindGroup = bg; | |
buffer.arrayBuffer = ab; | |
} else { | |
buffer = mappedBuffers.pop(); | |
bg = buffer.bindGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buffer.mapWriteAsync().then(arrayBuffer => { | |
fillArrayBuffer(arrayBuffer); // Is this pointer into memory still valid, or is this an error? | |
buffer.unmap(); // This is an error? | |
}); | |
// Is buffer 'mapped' now, or is it not 'mapped' until callback is called? | |
buffer.destroy() // or buffer.unmap()? | |
/* Due to Promise/event loop, execution order is 1, 6, 2, 3 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function helloTriangle() { | |
if (!window.gpu) { | |
document.body.className = 'error'; | |
return; | |
} | |
const adapter = await window.gpu.requestAdapter(); | |
const device = await adapter.requestDevice(); | |
/*** Shader Setup ***/ |