Renderer: Rename .getColorBufferType() -> .getOutputBufferType()#32501
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
| let bufferType = parameters.outputBufferType; | ||
|
|
||
| if ( bufferType === undefined ) { | ||
|
|
||
| bufferType = parameters.outputType; | ||
|
|
||
| } |
There was a problem hiding this comment.
Hm, I think we're going to create problems having outputBufferType override outputType. It must be possible to specify a higher-precision format for the frame buffer used before tone mapping, without necessarily having a higher-precision canvas format / drawing buffer.
I am a bit worried by how similar the "output" names are, too, but I'll put that comment in #32461.
There was a problem hiding this comment.
outputType would not be essential for defining the output buffer; if the user does not define outputBufferType, it will use the most appropriate one for output rendering. I think this is still consistent with the observation above.
Possible scenarios:
// canvas buffer 16bpc + 16bpc screen output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.HalfFloatType,
outputBufferType: THREE.HalfFloatType
} );
// canvas buffer 16bpc + 8bpc screen output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.UnsignedByteType,
outputBufferType: THREE.HalfFloatType
} );
// canvas buffer 8bpc + 16bpc screen output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.HalfFloatType,
outputBufferType: THREE.UnsignedByteType
} );
// canvas buffer 8bpc + 8bpc screen output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.UnsignedByteType,
outputBufferType: THREE.UnsignedByteType
} );
// reason for this conditional, most appropriate selection if not defined outputBufferType
// canvas buffer 16bpc + 16bpc output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.HalfFloatType
} );
// canvas buffer 8bpc + 8bpc output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.UnsignedByteType,
} );There was a problem hiding this comment.
This is the case I was thinking of:
// working buffer 16bpc + 8bpc screen output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.UnsignedByteType,
outputBufferType: THREE.HalfFloatType
} );From a glance at the code it looks like outputType would be overridden by outputBufferType to HalfFloatType when configuring the WebGPU canvas context. I haven't tested this locally yet, though, and will try to do that.
EDIT: Tested and confirmed the issue.
There was a problem hiding this comment.
How about reverting the changes to getPreferredCanvasFormat() until there is an agreement on how to proceed?
I must also say the naming outputType and outputBufferType is a bit confusing to me. When outputType is mainly about the canvas, maybe canvasType is more clear?
|
@Mugen87 @sunag Please see the comment at #32501 (comment). The renaming part of the PR is OK with me, but overriding the canvas format to For example I've tested in |
|
I don't see anything different in that. As you can see, the canvas texture is 8bpc. Perhaps you are confusing it with? #27880
|
|
I'm setting a breakpoint here ... three.js/src/renderers/webgpu/WebGPUBackend.js Lines 262 to 270 in e49cd3f ... and seeing the canvas context configured to |
|
Apparently we have a related but different problem. The internals |
Cleanup after mrdoob#32501

Related issue: #32461 (comment)
Description
Rename
.getColorBufferType()->.getOutputBufferType().I also made the update related to canvas buffer setup #31893 (comment)