Skip to content

Commit 127272e

Browse files
committed
StorageTexture: Adds support for other formats.
1 parent 55b9b14 commit 127272e

File tree

2 files changed

+157
-154
lines changed

2 files changed

+157
-154
lines changed

examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { getVectorLength, getStrideLength } from '../../common/BufferUtils.js';
1111

1212
import { NodeBuilder, CodeNode, NodeMaterial } from '../../../nodes/Nodes.js';
1313

14+
import { getFormat } from '../utils/WebGPUTextureUtils.js';
15+
1416
import WGSLNodeParser from './WGSLNodeParser.js';
1517

1618
const gpuShaderStageLib = {
@@ -659,8 +661,9 @@ class WGSLNodeBuilder extends NodeBuilder {
659661

660662
} else if ( uniform.node.isStoreTextureNode === true ) {
661663

662-
// @TODO: Add support for other formats
663-
textureType = 'texture_storage_2d<rgba8unorm, write>';
664+
const format = getFormat( texture );
665+
666+
textureType = 'texture_storage_2d<' + format + ', write>';
664667

665668
} else {
666669

0 commit comments

Comments
 (0)