Skip to content

Commit

Permalink
Increase dirtyId/dirtyFormat if Framebuffer.multisample is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
dev7355608 committed Apr 19, 2023
1 parent 94e25c4 commit a81da45
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions packages/core/src/framebuffer/Framebuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,7 @@ export class Framebuffer
/** Height of framebuffer in pixels. */
public height: number;

/**
* Desired number of samples for antialiasing. 0 means AA should not be used.
*
* Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.
* Antialiasing is the same as for main buffer with renderer `antialias: true` options.
* Seriously affects GPU memory consumption and GPU performance.
* @example
* import { MSAA_QUALITY } from 'pixi.js';
*
* renderTexture.framebuffer.multisample = MSAA_QUALITY.HIGH;
* // ...
* renderer.render(myContainer, { renderTexture });
* renderer.framebuffer.blit(); // Copies data from MSAA framebuffer to texture
* @default PIXI.MSAA_QUALITY.NONE
*/
public multisample: MSAA_QUALITY;
protected _multisample: MSAA_QUALITY;

stencil: boolean;
depth: boolean;
Expand Down Expand Up @@ -69,7 +54,7 @@ export class Framebuffer
this.glFramebuffers = {};

this.disposeRunner = new Runner('disposeFramebuffer');
this.multisample = MSAA_QUALITY.NONE;
this._multisample = MSAA_QUALITY.NONE;
}

/**
Expand All @@ -81,6 +66,38 @@ export class Framebuffer
return this.colorTextures[0];
}

/**
* Desired number of samples for antialiasing. 0 means AA should not be used.
*
* Allows to use antialiasing in individual renderTextures (WebGL2 only).
* Antialiasing is the same as for main buffer with renderer `antialias: true` options.
* Seriously affects GPU memory consumption and GPU performance.
* @example
* import { MSAA_QUALITY } from 'pixi.js';
*
* renderTexture.framebuffer.multisample = MSAA_QUALITY.HIGH;
* // ...
* renderer.render(myContainer, { renderTexture });
* renderer.framebuffer.blit(); // Copies data from MSAA framebuffer to texture
* @default PIXI.MSAA_QUALITY.NONE
*/
get multisample(): MSAA_QUALITY
{
return this._multisample;
}

set multisample(value: MSAA_QUALITY)
{
if (this._multisample === value)
{
return;
}

this._multisample = value;
this.dirtyId++;
this.dirtyFormat++;
}

/**
* Add texture to the colorTexture array.
* @param index - Index of the array to add the texture to
Expand Down

0 comments on commit a81da45

Please sign in to comment.