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

Adapt post process to viewport in DefaultRenderingPipeline #14451

Merged
merged 2 commits into from Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Expand Up @@ -739,6 +739,8 @@ export class DefaultRenderingPipeline extends PostProcessRenderPipeline implemen
});
}

this._adaptPostProcessesToViewPort();

if (!this._enableMSAAOnFirstPostProcess(this.samples) && this.samples > 1) {
Logger.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0");
}
Expand Down
Expand Up @@ -233,6 +233,22 @@ export class PostProcessRenderPipeline {
return true;
}

/**
* Ensures that all post processes in the pipeline are the correct size according to the
* the viewport's required size
*/
protected _adaptPostProcessesToViewPort(): void {
const effectKeys = Object.keys(this._renderEffects);
for (const effectKey of effectKeys) {
const postProcesses = this._renderEffects[effectKey].getPostProcesses();
if (postProcesses) {
for (const postProcess of postProcesses) {
postProcess.adaptScaleToCurrentViewport = true;
}
}
}
}

/**
* Sets the required values to the prepass renderer.
* @param prePassRenderer defines the prepass renderer to setup.
Expand Down