Skip to content

Commit

Permalink
fix: sampler for backbuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuki Shimada committed Mar 24, 2023
1 parent 64f39d7 commit 9c1a757
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/foundation/renderer/pipelines/ForwardRenderPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ModuleManager } from '../../system/ModuleManager';
import { ComponentType, HdriFormatEnum, PixelFormat } from '../../definitions';
import { MeshHelper, RenderPassHelper } from '../../helpers';
import { CameraComponent } from '../../components/Camera/CameraComponent';
import { Sampler } from '../../textures/Sampler';

type DrawFunc = (frame: Frame) => void;
type IBLCubeTextureParameter = {
Expand Down Expand Up @@ -93,6 +94,7 @@ export class ForwardRenderPipeline extends RnObject {
private __oDrawFunc: IOption<DrawFunc> = new None();
private __oDiffuseCubeTexture: IOption<CubeTexture> = new None();
private __oSpecularCubeTexture: IOption<CubeTexture> = new None();
private __oSamplerForBackBuffer: IOption<Sampler> = new None();

constructor() {
super();
Expand Down Expand Up @@ -121,6 +123,14 @@ export class ForwardRenderPipeline extends RnObject {
const sFrame = new Some(new Frame());
this.__oFrame = sFrame;

this.__oSamplerForBackBuffer = new Some(new Sampler({
wrapS: TextureParameter.Repeat,
wrapT: TextureParameter.Repeat,
minFilter: TextureParameter.LinearMipmapLinear,
magFilter: TextureParameter.Linear,
}));
this.__oSamplerForBackBuffer.unwrapForce().create();

// create Frame Buffers
const { framebufferMsaa, framebufferResolve, framebufferResolveForReference } =
this.__createRenderTargets(canvasWidth, canvasHeight);
Expand Down Expand Up @@ -528,7 +538,8 @@ export class ForwardRenderPipeline extends RnObject {
ShaderSemantics.BackBufferTexture,
this.__oFrameBufferResolveForReference
.unwrapForce()
.getColorAttachedRenderTargetTexture(0)!
.getColorAttachedRenderTargetTexture(0)!,
this.__oSamplerForBackBuffer.unwrapForce()
);
}
}
Expand Down

0 comments on commit 9c1a757

Please sign in to comment.