Skip to content

Commit bac5903

Browse files
committed
add support of device.framebuffer(width, height)
1 parent 677efd2 commit bac5903

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/reshader.gl/src/webgpu/GraphicsDevice.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { isNumber } from "../common/Util";
12
import Geometry from "../Geometry";
23
import DynamicBufferPool from "./DynamicBufferPool";
34
import GraphicsFramebuffer from "./GraphicsFramebuffer";
@@ -106,8 +107,16 @@ export default class GraphicsDevice {
106107
}
107108

108109
// implementation of regl.framebuffer
109-
framebuffer(reglFBODescriptor) {
110-
// reglDesciprtor => gpu renderPassEncoder
110+
framebuffer(width, height) {
111+
let reglFBODescriptor;
112+
if (!isNumber(width)) {
113+
reglFBODescriptor = width;
114+
} else {
115+
if (height === undefined) {
116+
height = width;
117+
}
118+
reglFBODescriptor = { color: true, depthStencil: true, width, height };
119+
}
111120
return new GraphicsFramebuffer(this, reglFBODescriptor);
112121
}
113122

0 commit comments

Comments
 (0)