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

fixed fsr input/output size #15798

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions cocos/rendering/post-process/passes/fsr-pass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import { FSR } from '../components/fsr';
import { getSetting, SettingPass } from './setting-pass';
import { game } from '../../../game';

const tempVec4 = new Vec4();

export class FSRPass extends SettingPass {
get setting () { return getSetting(FSR); }

name = 'FSRPass'
name = 'FSRPass';
effectName = 'pipeline/post-process/fsr';
outputNames = ['FSRColor']
outputNames = ['FSRColor'];

checkEnable (camera: Camera) {
let enable = super.checkEnable(camera);
Expand All @@ -31,20 +33,16 @@ export class FSRPass extends SettingPass {
passContext.material = this.material;
passContext.clearBlack();

passContext.updatePassViewPort(1 / passContext.shadingScale);
passContext.updatePassViewPort(1 / passContext.shadingScale, 0);

const inputWidth = Math.floor(game.canvas!.width * passContext.shadingScale);
const inputHeight = Math.floor(game.canvas!.height * passContext.shadingScale);
const outWidth = Math.floor(game.canvas!.width);
const outHeight = Math.floor(game.canvas!.height);
const inputWidth = Math.floor(passContext.passViewport.width * passContext.shadingScale);
const inputHeight = Math.floor(passContext.passViewport.height * passContext.shadingScale);
const outWidth = Math.floor(passContext.passViewport.width);
const outHeight = Math.floor(passContext.passViewport.height);

const setting = this.setting;
this.material.setProperty('fsrParams', new Vec4(clamp(1.0 - setting.sharpness, 0.02, 0.98), 0, 0, 0));
this.material.setProperty('texSize',
new Vec4(
inputWidth, inputHeight,
outWidth, outHeight,
));
this.material.setProperty('fsrParams', tempVec4.set(clamp(1.0 - setting.sharpness, 0.02, 0.98), 0, 0, 0));
this.material.setProperty('texSize', tempVec4.set(inputWidth, inputHeight, outWidth, outHeight));

const input0 = this.lastPass!.slotName(camera, 0);
const easu = `FSR_EASU${cameraID}`;
Expand Down
Loading