diff --git a/examples/webgpu_xr_rollercoaster.html b/examples/webgpu_xr_rollercoaster.html
index 62ca09da18ca1c..0d4ce8910ba317 100644
--- a/examples/webgpu_xr_rollercoaster.html
+++ b/examples/webgpu_xr_rollercoaster.html
@@ -32,7 +32,7 @@
let mesh, material, geometry;
- const renderer = new THREE.WebGPURenderer( { antialias: true, forceWebGL: true, colorBufferType: THREE.UnsignedByteType, multiview: false } );
+ const renderer = new THREE.WebGPURenderer( { antialias: true, forceWebGL: true, outputBufferType: THREE.UnsignedByteType, multiview: false } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setAnimationLoop( animate );
diff --git a/src/nodes/display/PassNode.js b/src/nodes/display/PassNode.js
index 1f1f6c70d68297..af65c3eac03ed7 100644
--- a/src/nodes/display/PassNode.js
+++ b/src/nodes/display/PassNode.js
@@ -736,7 +736,7 @@ class PassNode extends TempNode {
this.renderTarget.samples = this.options.samples === undefined ? renderer.samples : this.options.samples;
- this.renderTarget.texture.type = renderer.getColorBufferType();
+ this.renderTarget.texture.type = renderer.getOutputBufferType();
return this.scope === PassNode.COLOR ? this.getTextureNode() : this.getLinearDepthNode();
diff --git a/src/renderers/common/Renderer.js b/src/renderers/common/Renderer.js
index 510c95a1955d49..32cba9e5c12c59 100644
--- a/src/renderers/common/Renderer.js
+++ b/src/renderers/common/Renderer.js
@@ -64,7 +64,7 @@ class Renderer {
* @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0
* to overwrite the default.
* @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
- * @property {number} [colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
+ * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best
* quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
* @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported.
*/
@@ -97,7 +97,7 @@ class Renderer {
antialias = false,
samples = 0,
getFallback = null,
- colorBufferType = HalfFloatType,
+ outputBufferType = HalfFloatType,
multiview = false
} = parameters;
@@ -584,7 +584,7 @@ class Renderer {
this.onDeviceLost = this._onDeviceLost;
/**
- * Defines the type of color buffers. The default `HalfFloatType` is recommend for
+ * Defines the type of output buffers. The default `HalfFloatType` is recommend for
* best quality. To save memory and bandwidth, `UnsignedByteType` might be used.
* This will reduce rendering quality though.
*
@@ -592,7 +592,7 @@ class Renderer {
* @type {number}
* @default HalfFloatType
*/
- this._colorBufferType = colorBufferType;
+ this._outputBufferType = outputBufferType;
/**
* A cache for shadow nodes per material
@@ -1084,13 +1084,27 @@ class Renderer {
}
/**
- * Returns the color buffer type.
+ * Returns the output buffer type.
*
- * @return {number} The color buffer type.
+ * @return {number} The output buffer type.
*/
- getColorBufferType() {
+ getOutputBufferType() {
- return this._colorBufferType;
+ return this._outputBufferType;
+
+ }
+
+ /**
+ * Returns the output buffer type.
+ *
+ * @deprecated since r182. Use `.getOutputBufferType()` instead.
+ * @return {number} The output buffer type.
+ */
+ getColorBufferType() { // @deprecated, r182
+
+ warnOnce( 'Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".' );
+
+ return this.getOutputBufferType();
}
@@ -1266,7 +1280,7 @@ class Renderer {
frameBufferTarget = new RenderTarget( width, height, {
depthBuffer: depth,
stencilBuffer: stencil,
- type: this._colorBufferType,
+ type: this._outputBufferType,
format: RGBAFormat,
colorSpace: ColorManagement.workingColorSpace,
generateMipmaps: false,
diff --git a/src/renderers/webgpu/WebGPURenderer.js b/src/renderers/webgpu/WebGPURenderer.js
index 0b7756305e10b4..1e3ce9a2ec6e6e 100644
--- a/src/renderers/webgpu/WebGPURenderer.js
+++ b/src/renderers/webgpu/WebGPURenderer.js
@@ -40,7 +40,7 @@ class WebGPURenderer extends Renderer {
* @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not.
* @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported.
* @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead.
- * @property {number} [colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
+ * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best
* quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
*/
diff --git a/src/renderers/webgpu/utils/WebGPUUtils.js b/src/renderers/webgpu/utils/WebGPUUtils.js
index de4b4f28a52349..0dc26c7b82a777 100644
--- a/src/renderers/webgpu/utils/WebGPUUtils.js
+++ b/src/renderers/webgpu/utils/WebGPUUtils.js
@@ -220,23 +220,31 @@ class WebGPUUtils {
*/
getPreferredCanvasFormat() {
- const outputType = this.backend.parameters.outputType;
+ const parameters = this.backend.parameters;
- if ( outputType === undefined ) {
+ let bufferType = parameters.outputBufferType;
+
+ if ( bufferType === undefined ) {
+
+ bufferType = parameters.outputType;
+
+ }
+
+ if ( bufferType === undefined ) {
return navigator.gpu.getPreferredCanvasFormat();
- } else if ( outputType === UnsignedByteType ) {
+ } else if ( bufferType === UnsignedByteType ) {
return GPUTextureFormat.BGRA8Unorm;
- } else if ( outputType === HalfFloatType ) {
+ } else if ( bufferType === HalfFloatType ) {
return GPUTextureFormat.RGBA16Float;
} else {
- throw new Error( 'Unsupported outputType' );
+ throw new Error( 'Unsupported output buffer type.' );
}