-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
46 lines (31 loc) · 1.06 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
title: "GPUTexture: format property"
short-title: format
slug: Web/API/GPUTexture/format
page-type: web-api-instance-property
status:
- experimental
browser-compat: api.GPUTexture.format
---
{{APIRef("WebGPU API")}}{{SeeCompatTable}}{{SecureContext_Header}}
The **`format`** read-only property of the
{{domxref("GPUTexture")}} interface represents the format of the `GPUTexture`.
This is set via the `format` property in the descriptor object passed into the originating {{domxref("GPUDevice.createTexture()")}} call.
## Value
An enumerated value. See the [Texture formats](https://gpuweb.github.io/gpuweb/#enumdef-gputextureformat) section of the specification for all the possible values.
## Examples
```js
// ...
const depthTexture = device.createTexture({
size: [canvas.width, canvas.height],
format: "depth24plus",
usage: GPUTextureUsage.RENDER_ATTACHMENT,
});
console.log(depthTexture.format); // "depth24plus"
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- The [WebGPU API](/en-US/docs/Web/API/WebGPU_API)