Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming of internal variable to backBufferFormat #5630

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/platform/graphics/graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ class GraphicsDevice extends EventHandler {
*/
backBufferSize = new Vec2();

/**
* The pixel format of the back buffer. Typically PIXELFORMAT_RGBA8, PIXELFORMAT_BGRA8 or
* PIXELFORMAT_RGB8.
*
* @ignore
*/
backBufferFormat;

/**
* True if the deviceType is WebGPU
*
Expand Down
2 changes: 1 addition & 1 deletion src/platform/graphics/webgl/webgl-graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ class WebglGraphicsDevice extends GraphicsDevice {

// pixel format of the framebuffer
const alphaBits = gl.getParameter(gl.ALPHA_BITS);
this.framebufferFormat = alphaBits ? PIXELFORMAT_RGBA8 : PIXELFORMAT_RGB8;
this.backBufferFormat = alphaBits ? PIXELFORMAT_RGBA8 : PIXELFORMAT_RGB8;

const isChrome = platform.browserName === 'chrome';
const isSafari = platform.browserName === 'safari';
Expand Down
2 changes: 1 addition & 1 deletion src/platform/graphics/webgl/webgl-render-target.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class WebglRenderTarget {
const buffer = gl.createRenderbuffer();
this._glMsaaColorBuffers.push(buffer);

const internalFormat = device.framebufferFormat === PIXELFORMAT_RGBA8 ? gl.RGBA8 : gl.RGB8;
const internalFormat = device.backBufferFormat === PIXELFORMAT_RGBA8 ? gl.RGBA8 : gl.RGB8;

gl.bindRenderbuffer(gl.RENDERBUFFER, buffer);
gl.renderbufferStorageMultisample(gl.RENDERBUFFER, target._samples, internalFormat, target.width, target.height);
Expand Down
2 changes: 1 addition & 1 deletion src/platform/graphics/webgpu/webgpu-graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class WebgpuGraphicsDevice extends GraphicsDevice {

// pixel format of the framebuffer is the most efficient one on the system
const preferredCanvasFormat = navigator.gpu.getPreferredCanvasFormat();
this.framebufferFormat = preferredCanvasFormat === 'rgba8unorm' ? PIXELFORMAT_RGBA8 : PIXELFORMAT_BGRA8;
this.backBufferFormat = preferredCanvasFormat === 'rgba8unorm' ? PIXELFORMAT_RGBA8 : PIXELFORMAT_BGRA8;

/**
* Configuration of the main colorframebuffer we obtain using getCurrentTexture
Expand Down
2 changes: 1 addition & 1 deletion src/scene/graphics/scene-grab.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class SceneGrab {
// texture format of the source texture the grab pass needs to copy
getSourceColorFormat(texture) {
// based on the RT the camera renders to, otherwise framebuffer
return texture?.format ?? this.device.framebufferFormat;
return texture?.format ?? this.device.backBufferFormat;
}

shouldReallocate(targetRT, sourceTexture, testFormat) {
Expand Down