File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
src/renderers/webgpu/utils Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -267,12 +267,12 @@ class WebGPUPipelineUtils {
267267 const { utils, device } = backend ;
268268
269269 const depthStencilFormat = utils . getCurrentDepthStencilFormat ( renderContext ) ;
270- const colorFormat = utils . getCurrentColorFormat ( renderContext ) ;
270+ const colorFormats = utils . getCurrentColorFormats ( renderContext ) ;
271271 const sampleCount = this . _getSampleCount ( renderContext ) ;
272272
273273 const descriptor = {
274- label : label ,
275- colorFormats : [ colorFormat ] ,
274+ label,
275+ colorFormats,
276276 depthStencilFormat,
277277 sampleCount
278278 } ;
Original file line number Diff line number Diff line change @@ -124,6 +124,26 @@ class WebGPUUtils {
124124
125125 }
126126
127+ /**
128+ * Returns the GPU formats of all color attachments of the current render context.
129+ *
130+ * @param {RenderContext } renderContext - The render context.
131+ * @return {Array<string> } The GPU texture formats of all color attachments.
132+ */
133+ getCurrentColorFormats ( renderContext ) {
134+
135+ if ( renderContext . textures !== null ) {
136+
137+ return renderContext . textures . map ( t => this . getTextureFormatGPU ( t ) ) ;
138+
139+ } else {
140+
141+ return [ this . getPreferredCanvasFormat ( ) ] ; // default context format
142+
143+ }
144+
145+ }
146+
127147 /**
128148 * Returns the output color space of the current render context.
129149 *
You can’t perform that action at this time.
0 commit comments