Web Inspector: REGRESSION (r238602): Elements: deleting the last child of a collapsed...
[WebKit-https.git] / LayoutTests / webgpu / textures-textureviews.html
1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] -->
2 <meta charset=utf-8>
3 <title>Basic GPUTexture Tests.</title>
4 <body>
5 <canvas width="400" height="400"></canvas>
6 <script src="js/webgpu-functions.js"></script>
7 <script src="../resources/testharness.js"></script>
8 <script src="../resources/testharnessreport.js"></script>
9 <script>
10 const canvas = document.querySelector("canvas");    
11 let device, context;
12
13 let texSize = {
14     width: canvas.width,
15     height: canvas.height,
16     depth: 1
17 };
18
19 let texDescriptor = {
20     size: texSize,
21     arrayLayerCount: 1,
22     mipLevelCount: 1,
23     sampleCount: 1,
24     dimension: "2d",
25     format: "depth32float-stencil8",
26     usage: GPUTextureUsage.OUTPUT_ATTACHMENT
27 };
28
29 promise_test(async () => {
30     device = await getBasicDevice();
31     swapChain = createBasicSwapChain(canvas, device);
32
33     const texture = swapChain.getCurrentTexture();
34     assert_true(texture instanceof WebGPUTexture, "Successfully acquired next texture.");
35
36     const textureView = texture.createDefaultView();
37     assert_true(textureView instanceof WebGPUTextureView, "Successfully created texture view from next texture.");
38 }, "Create texture view from swap chain.");
39
40 promise_test(async () => {
41     const depthTexture = device.createTexture(texDescriptor);
42     assert_true(depthTexture instanceof WebGPUTexture, "Successfully created depth texture.");
43 }, "Create basic depth texture from device.");
44
45 promise_test(async () => {
46     texDescriptor.sampleCount = 4;
47     texDescriptor.format = "rgba8unorm";
48     texDescriptor.usage = GPUTextureUsage.SAMPLED | GPUTextureUsage.TRANSFER_SRC
49
50     const multisampledTexture = device.createTexture(texDescriptor);
51     assert_true(multisampledTexture instanceof WebGPUTexture, "Successfully created multisampled texture.");
52 }, "Create basic 4x multisampled texture.");
53
54 promise_test(async () => {
55     texDescriptor.size.depth = 3;
56     texDescriptor.sampleCount = 1;
57     texDescriptor.dimension = "3d";
58
59     const texture3d = device.createTexture(texDescriptor);
60     assert_true(texture3d instanceof WebGPUTexture, "Successfully created basic 3D texture.");
61 }, "Create basic 3D texture from device.");
62
63 // FIXME: Add tests for 1D textures, textureArrays, and WebGPUTextureViews.
64 </script>
65 </body>
66 </html>