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

Open post process pipeline and support local mode #2401

Merged
merged 51 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ce07ccc
feat: refactor postprocess to component
zhuxudong Oct 23, 2024
ffb2d99
refactor: add uber Material as constructor
zhuxudong Oct 23, 2024
3a836b2
refactor: active logic
zhuxudong Oct 24, 2024
4bf5a8f
feat: add render pass event
zhuxudong Oct 25, 2024
1166cfb
perf: RT is created only when remainEffect > 1, and uber is only coun…
zhuxudong Oct 25, 2024
4e1b572
fix: swap RT after decrease remain effect
zhuxudong Oct 28, 2024
5550937
feat: support merge pp
zhuxudong Nov 18, 2024
5b39577
fix: resort pp after priority changed
zhuxudong Nov 19, 2024
278dcb1
feat: add destroy function
zhuxudong Nov 19, 2024
fbbb867
feat: reset default value
zhuxudong Nov 19, 2024
63afd4b
ci: add e2e case
zhuxudong Nov 19, 2024
7b25e57
refactor: perf code
zhuxudong Nov 20, 2024
664a1fd
fix: scene error
zhuxudong Nov 20, 2024
3fb0137
fix: pass destroy logic
zhuxudong Nov 20, 2024
d18e775
fix: refactor render pass
zhuxudong Nov 20, 2024
edaed82
fix: disable when pp destroyed
zhuxudong Nov 20, 2024
a5a58ba
fix: remove pass when multi scene
zhuxudong Nov 22, 2024
df76e8a
ci: add vitest
zhuxudong Nov 22, 2024
c6d2c5a
feat: blend enabled state of effect
zhuxudong Nov 22, 2024
19eeb18
ci: test
zhuxudong Nov 22, 2024
08e979a
fix: do not support post process schema of 1.3
zhuxudong Nov 25, 2024
b09bbad
Merge branch 'dev/1.4' into feat/open-post-process
zhuxudong Nov 25, 2024
9af2479
feat: support post parameter to auto mix
zhuxudong Dec 17, 2024
9389514
ci: add some tests
zhuxudong Dec 18, 2024
3a00ec4
fix: set pp invalid in blend/default effect
zhuxudong Dec 18, 2024
5bbbb87
Merge branch 'dev/1.4' into feat/open-post-process
zhuxudong Dec 18, 2024
f79fc38
ci: post process api change
zhuxudong Dec 18, 2024
e4ffbaf
feat: support local mode
zhuxudong Dec 18, 2024
d76183e
ci: add local mode test
zhuxudong Dec 18, 2024
0824a8a
ci: format code
zhuxudong Dec 18, 2024
76d267e
Merge branch 'dev/1.4' into feat/open-post-process
zhuxudong Dec 19, 2024
9064804
refactor: move pass to engine
zhuxudong Dec 19, 2024
39a8053
refactor: use enableInScene
zhuxudong Dec 19, 2024
b9eec71
refactor: delete onEnable function in effect
zhuxudong Dec 19, 2024
0283e02
refactor: change parameter api
zhuxudong Dec 19, 2024
6c6f9a6
refactor: format code
zhuxudong Dec 19, 2024
efdac74
refactor: perf blitter logic
zhuxudong Dec 19, 2024
86f3539
refactor: api change
zhuxudong Dec 19, 2024
e96778b
refactor: rename _isValid()
zhuxudong Dec 19, 2024
3547d98
refactor: opt code
GuoLei1990 Dec 20, 2024
b1b2531
refactor: add isValid in pp and ppp
zhuxudong Dec 20, 2024
59033ea
refactor: rename
zhuxudong Dec 20, 2024
59bb3b0
refactor: api change
zhuxudong Dec 20, 2024
d402074
refactor: api change
zhuxudong Dec 20, 2024
240332b
refactor: format code
zhuxudong Dec 20, 2024
0bd8f21
refactor: update dirty logic
zhuxudong Dec 20, 2024
65104bb
refactor: exclude child
zhuxudong Dec 20, 2024
82c1a4f
refactor: perf code
zhuxudong Dec 20, 2024
5d7d11d
refactor: add test
zhuxudong Dec 20, 2024
f68d245
refactor: rename
zhuxudong Dec 20, 2024
d58bcd0
refactor: delete constructor in effect
zhuxudong Dec 20, 2024
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
14 changes: 7 additions & 7 deletions e2e/case/postProcess-HDR-bloom-ACES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @title Bloom + HDR + ACES Tonemapping
* @category PostProcess
*/
import { Camera, TonemappingMode } from "@galacean/engine";
import { BloomEffect, Camera, PostProcess, TonemappingEffect, TonemappingMode } from "@galacean/engine";

Check warning on line 5 in e2e/case/postProcess-HDR-bloom-ACES.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-HDR-bloom-ACES.ts#L5

Added line #L5 was not covered by tests
import { initPostProcessEnv } from "./.initPostProcessEnv";

initPostProcessEnv((camera: Camera, resArray) => {
Expand All @@ -11,15 +11,15 @@

camera.enablePostProcess = true;
camera.enableHDR = true;
// @ts-ignore
const bloomEffect = scene._postProcessManager._bloomEffect;
// @ts-ignore
const tonemappingEffect = scene._postProcessManager._tonemappingEffect;

bloomEffect.enabled = true;
tonemappingEffect.enabled = true;
const globalPostProcessEntity = scene.createRootEntity();
const postProcess = globalPostProcessEntity.addComponent(PostProcess);
const bloomEffect = postProcess.addEffect(BloomEffect);
const tonemappingEffect = postProcess.addEffect(TonemappingEffect);
tonemappingEffect.mode = TonemappingMode.ACES;

Check warning on line 19 in e2e/case/postProcess-HDR-bloom-ACES.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-HDR-bloom-ACES.ts#L15-L19

Added lines #L15 - L19 were not covered by tests

bloomEffect.threshold = 0.5;
bloomEffect.intensity = 1;

Check warning on line 22 in e2e/case/postProcess-HDR-bloom-ACES.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-HDR-bloom-ACES.ts#L22

Added line #L22 was not covered by tests
bloomEffect.dirtTexture = dirtTexture;
tonemappingEffect.mode = TonemappingMode.ACES;
});
14 changes: 7 additions & 7 deletions e2e/case/postProcess-HDR-bloom-neutral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @title Bloom + HDR + Neutral Tonemapping
* @category PostProcess
*/
import { Camera, TonemappingMode } from "@galacean/engine";
import { BloomEffect, Camera, PostProcess, TonemappingEffect, TonemappingMode } from "@galacean/engine";

Check warning on line 5 in e2e/case/postProcess-HDR-bloom-neutral.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-HDR-bloom-neutral.ts#L5

Added line #L5 was not covered by tests
import { initPostProcessEnv } from "./.initPostProcessEnv";

initPostProcessEnv((camera: Camera, resArray) => {
Expand All @@ -11,15 +11,15 @@

camera.enablePostProcess = true;
camera.enableHDR = true;
// @ts-ignore
const bloomEffect = scene._postProcessManager._bloomEffect;
// @ts-ignore
const tonemappingEffect = scene._postProcessManager._tonemappingEffect;

bloomEffect.enabled = true;
tonemappingEffect.enabled = true;
const globalPostProcessEntity = scene.createRootEntity();
const postProcess = globalPostProcessEntity.addComponent(PostProcess);
const bloomEffect = postProcess.addEffect(BloomEffect);
const tonemappingEffect = postProcess.addEffect(TonemappingEffect);
tonemappingEffect.mode = TonemappingMode.ACES;

Check warning on line 19 in e2e/case/postProcess-HDR-bloom-neutral.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-HDR-bloom-neutral.ts#L15-L19

Added lines #L15 - L19 were not covered by tests
zhuxudong marked this conversation as resolved.
Show resolved Hide resolved

bloomEffect.threshold = 0.5;
bloomEffect.intensity = 1;

Check warning on line 22 in e2e/case/postProcess-HDR-bloom-neutral.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-HDR-bloom-neutral.ts#L22

Added line #L22 was not covered by tests
bloomEffect.dirtTexture = dirtTexture;
tonemappingEffect.mode = TonemappingMode.Neutral;
});
14 changes: 7 additions & 7 deletions e2e/case/postProcess-LDR-bloom-neutral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @title Bloom + LDR + Neutral Tonemapping
* @category PostProcess
*/
import { Camera, TonemappingMode } from "@galacean/engine";
import { BloomEffect, Camera, PostProcess, TonemappingEffect, TonemappingMode } from "@galacean/engine";

Check warning on line 5 in e2e/case/postProcess-LDR-bloom-neutral.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-LDR-bloom-neutral.ts#L5

Added line #L5 was not covered by tests
import { initPostProcessEnv } from "./.initPostProcessEnv";

initPostProcessEnv((camera: Camera, resArray) => {
Expand All @@ -11,15 +11,15 @@

camera.enablePostProcess = true;
camera.enableHDR = false;
// @ts-ignore
const bloomEffect = scene._postProcessManager._bloomEffect;
// @ts-ignore
const tonemappingEffect = scene._postProcessManager._tonemappingEffect;

bloomEffect.enabled = true;
tonemappingEffect.enabled = true;
const globalPostProcessEntity = scene.createRootEntity();
const postProcess = globalPostProcessEntity.addComponent(PostProcess);
const bloomEffect = postProcess.addEffect(BloomEffect);
const tonemappingEffect = postProcess.addEffect(TonemappingEffect);
tonemappingEffect.mode = TonemappingMode.ACES;

Check warning on line 19 in e2e/case/postProcess-LDR-bloom-neutral.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-LDR-bloom-neutral.ts#L15-L19

Added lines #L15 - L19 were not covered by tests
zhuxudong marked this conversation as resolved.
Show resolved Hide resolved

bloomEffect.threshold = 0.5;
bloomEffect.intensity = 1;

Check warning on line 22 in e2e/case/postProcess-LDR-bloom-neutral.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-LDR-bloom-neutral.ts#L22

Added line #L22 was not covered by tests
bloomEffect.dirtTexture = dirtTexture;
tonemappingEffect.mode = TonemappingMode.Neutral;
});
89 changes: 89 additions & 0 deletions e2e/case/postProcess-customPass.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/**
* @title Custom post process pass
* @category PostProcess
*/
import {
Blitter,
BloomEffect,
Camera,
Engine,
Material,
PostProcess,
PostProcessPass,
PostProcessPassEvent,
RenderTarget,
Shader,
Texture2D,
TonemappingEffect,
TonemappingMode
} from "@galacean/engine";
import { initPostProcessEnv } from "./.initPostProcessEnv";

Check warning on line 20 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L19-L20

Added lines #L19 - L20 were not covered by tests

const customShader = Shader.create(
"Custom Post Process",
`

Check warning on line 24 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L22-L24

Added lines #L22 - L24 were not covered by tests
attribute vec4 POSITION_UV;
varying vec2 v_uv;

void main() {
gl_Position = vec4(POSITION_UV.xy, 0.0, 1.0);
v_uv = POSITION_UV.zw;
}
`,
`

Check warning on line 33 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L33

Added line #L33 was not covered by tests
varying vec2 v_uv;
uniform sampler2D renderer_BlitTexture;

void main(){
gl_FragColor = texture2D(renderer_BlitTexture, v_uv).rrra;
}
`
);

Check warning on line 41 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L41

Added line #L41 was not covered by tests

class CustomPass extends PostProcessPass {

Check warning on line 43 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L43

Added line #L43 was not covered by tests
private _blitMaterial: Material;

set intensity(value) {
this._blitMaterial.shaderData.setFloat("intensity", value);
}

Check warning on line 48 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L46-L48

Added lines #L46 - L48 were not covered by tests
zhuxudong marked this conversation as resolved.
Show resolved Hide resolved

constructor(engine: Engine) {
super(engine);
this.event = PostProcessPassEvent.AfterUber;
this._blitMaterial = new Material(this.engine, customShader);

Check warning on line 53 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L50-L53

Added lines #L50 - L53 were not covered by tests

const depthState = this._blitMaterial.renderState.depthState;

Check warning on line 55 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L55

Added line #L55 was not covered by tests

depthState.enabled = false;
depthState.writeEnabled = false;
}

Check warning on line 59 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L57-L59

Added lines #L57 - L59 were not covered by tests

onRender(_, srcTexture: Texture2D, dst: RenderTarget): void {
const engine = this.engine;
Blitter.blitTexture(engine, srcTexture, dst, undefined, undefined, this._blitMaterial, 0);
}
}

Check warning on line 65 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L61-L65

Added lines #L61 - L65 were not covered by tests

initPostProcessEnv((camera: Camera, resArray) => {
const [_, __, dirtTexture] = resArray;
const scene = camera.scene;
const engine = scene.engine;
const postProcessManager = scene.postProcessManager;

Check warning on line 71 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L67-L71

Added lines #L67 - L71 were not covered by tests

camera.enablePostProcess = true;
camera.enableHDR = true;

Check warning on line 74 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L73-L74

Added lines #L73 - L74 were not covered by tests

const globalPostProcessEntity = scene.createRootEntity();
const postProcess = globalPostProcessEntity.addComponent(PostProcess);
const bloomEffect = postProcess.addEffect(BloomEffect);
const tonemappingEffect = postProcess.addEffect(TonemappingEffect);
tonemappingEffect.mode = TonemappingMode.ACES;

Check warning on line 80 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L76-L80

Added lines #L76 - L80 were not covered by tests
zhuxudong marked this conversation as resolved.
Show resolved Hide resolved

bloomEffect.threshold = 0.5;
bloomEffect.intensity = 1;
bloomEffect.dirtTexture = dirtTexture;
tonemappingEffect.mode = TonemappingMode.Neutral;

Check warning on line 85 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L82-L85

Added lines #L82 - L85 were not covered by tests

const customPass = new CustomPass(engine);
postProcessManager.addPostProcessPass(customPass);
});

Check warning on line 89 in e2e/case/postProcess-customPass.ts

View check run for this annotation

Codecov / codecov/patch

e2e/case/postProcess-customPass.ts#L87-L89

Added lines #L87 - L89 were not covered by tests
5 changes: 5 additions & 0 deletions e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@
category: "PostProcess",
caseFileName: "postProcess-LDR-bloom-neutral",
threshold: 0.2
},
customPass: {
category: "PostProcess",
caseFileName: "postProcess-customPass",
threshold: 0.2

Check warning on line 218 in e2e/config.ts

View check run for this annotation

Codecov / codecov/patch

e2e/config.ts#L214-L218

Added lines #L214 - L218 were not covered by tests
}
},
Text: {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion packages/core/src/Camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ export class Camera extends Component {
*/
cullingMask: Layer = Layer.Everything;

/**
* Determines which PostProcess to use.
*/
postProcessMask: Layer = Layer.Everything;

/**
* Depth texture mode.
* If `DepthTextureMode.PrePass` is used, the depth texture can be accessed in the shader using `camera_DepthTexture`.
Expand Down Expand Up @@ -166,7 +171,7 @@ export class Camera extends Component {
* @remarks If true, the msaa in viewport can turn or off independently by `msaaSamples` property.
*/
get independentCanvasEnabled(): boolean {
if (this.enableHDR || (this.enablePostProcess && this.scene._postProcessManager.hasActiveEffect)) {
if (this.enableHDR || (this.enablePostProcess && this.scene.postProcessManager.hasActiveEffect)) {
return true;
}

Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ export class Component extends EngineObject {
@ignoreClone
protected _phasedActiveInScene: boolean = false;

/**
* @internal
*/
@ignoreClone
private _phasedActive: boolean = false;
_phasedActive: boolean = false;
GuoLei1990 marked this conversation as resolved.
Show resolved Hide resolved

@assignmentClone
private _enabled: boolean = true;

Expand Down
26 changes: 15 additions & 11 deletions packages/core/src/RenderPipeline/BasicRenderPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
TextureFormat,
TextureWrapMode
} from "../texture";
import { Blitter } from "./Blitter";
import { CullingResults } from "./CullingResults";
import { DepthOnlyPass } from "./DepthOnlyPass";
import { OpaqueTexturePass } from "./OpaqueTexturePass";
Expand Down Expand Up @@ -196,19 +197,22 @@

transparentQueue.render(context, PipelineStage.Forward);

const postProcessManager = scene._postProcessManager;
const postProcessManager = scene.postProcessManager;
const cameraRenderTarget = camera.renderTarget;
if (camera.enablePostProcess && postProcessManager.hasActiveEffect) {
postProcessManager._render(context, internalColorTarget, cameraRenderTarget);
} else if (internalColorTarget) {
internalColorTarget._blitRenderTarget();
PipelineUtils.blitTexture(
engine,
<Texture2D>internalColorTarget.getColorTexture(0),
cameraRenderTarget,
0,
camera.viewport
);
postProcessManager._render(camera, internalColorTarget, cameraRenderTarget);
} else {
postProcessManager._releaseSwapRenderTarget();
if (internalColorTarget) {
internalColorTarget._blitRenderTarget();
Blitter.blitTexture(
engine,
<Texture2D>internalColorTarget.getColorTexture(0),
cameraRenderTarget,

Check warning on line 211 in packages/core/src/RenderPipeline/BasicRenderPipeline.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/RenderPipeline/BasicRenderPipeline.ts#L210-L211

Added lines #L210 - L211 were not covered by tests
0,
camera.viewport
);
}

Check warning on line 215 in packages/core/src/RenderPipeline/BasicRenderPipeline.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/RenderPipeline/BasicRenderPipeline.ts#L214-L215

Added lines #L214 - L215 were not covered by tests
zhuxudong marked this conversation as resolved.
Show resolved Hide resolved
}

cameraRenderTarget?._blitRenderTarget();
Expand Down
81 changes: 81 additions & 0 deletions packages/core/src/RenderPipeline/Blitter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { Vector4 } from "@galacean/engine-math";
import { Engine } from "../Engine";
import { Material } from "../material";
import { ShaderProperty } from "../shader";
import { Shader } from "../shader/Shader";
import { ShaderData } from "../shader/ShaderData";
import { ShaderMacroCollection } from "../shader/ShaderMacroCollection";
import { ShaderDataGroup } from "../shader/enums/ShaderDataGroup";
import { RenderTarget, Texture2D } from "../texture";
import { PipelineUtils } from "./PipelineUtils";

export class Blitter {
GuoLei1990 marked this conversation as resolved.
Show resolved Hide resolved
private static _blitTextureProperty = ShaderProperty.getByName("renderer_BlitTexture");
private static _blitMipLevelProperty = ShaderProperty.getByName("renderer_BlitMipLevel");
private static _blitTexelSizeProperty = ShaderProperty.getByName("renderer_texelSize"); // x: 1/width, y: 1/height, z: width, w: height

private static _rendererShaderData = new ShaderData(ShaderDataGroup.Renderer);
private static _texelSize = new Vector4();
/**
* Blit texture to destination render target using a triangle.
* @param engine - Engine
* @param source - Source texture
* @param destination - Destination render target
* @param mipLevel - Mip level to blit
* @param viewport - Viewport
* @param material - The material to use when blit
* @param passIndex - Pass index to use of the provided material
*/
static blitTexture(
engine: Engine,
source: Texture2D,
destination: RenderTarget | null,
mipLevel: number = 0,
viewport: Vector4 = PipelineUtils.defaultViewport,
material: Material = null,
passIndex = 0
): void {
const basicResources = engine._basicResources;
const blitMesh = destination ? basicResources.flipYBlitMesh : basicResources.blitMesh;
const blitMaterial = material || basicResources.blitMaterial;
const rhi = engine._hardwareRenderer;
const context = engine._renderContext;

// We not use projection matrix when blit, but we must modify flipProjection to make front face correct
context.flipProjection = !!destination;

rhi.activeRenderTarget(destination, viewport, context.flipProjection, 0);

const rendererShaderData = Blitter._rendererShaderData;

rendererShaderData.setTexture(Blitter._blitTextureProperty, source);
rendererShaderData.setFloat(Blitter._blitMipLevelProperty, mipLevel);
Blitter._texelSize.set(1 / source.width, 1 / source.height, source.width, source.height);
rendererShaderData.setVector4(Blitter._blitTexelSizeProperty, Blitter._texelSize);
zhuxudong marked this conversation as resolved.
Show resolved Hide resolved

const pass = blitMaterial.shader.subShaders[0].passes[passIndex];
const compileMacros = Shader._compileMacros;

ShaderMacroCollection.unionCollection(
context.camera._globalShaderMacro,
blitMaterial.shaderData._macroCollection,
compileMacros
);
const program = pass._getShaderProgram(engine, compileMacros);

program.bind();
program.groupingOtherUniformBlock();
program.uploadAll(program.rendererUniformBlock, rendererShaderData);
program.uploadAll(program.materialUniformBlock, blitMaterial.shaderData);
program.uploadUnGroupTextures();

(pass._renderState || blitMaterial.renderState)._applyStates(
engine,
false,
pass._renderStateDataMap,
blitMaterial.shaderData
);

rhi.drawPrimitive(blitMesh._primitive, blitMesh.subMesh, program);
}

Check warning on line 80 in packages/core/src/RenderPipeline/Blitter.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/RenderPipeline/Blitter.ts#L30-L80

Added lines #L30 - L80 were not covered by tests
}
3 changes: 2 additions & 1 deletion packages/core/src/RenderPipeline/OpaqueTexturePass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { Texture, Texture2D, TextureFilterMode } from "../texture";
import { RenderTarget } from "../texture/RenderTarget";
import { TextureWrapMode } from "../texture/enums/TextureWrapMode";
import { Blitter } from "./Blitter";
import { PipelinePass } from "./PipelinePass";
import { PipelineUtils } from "./PipelineUtils";
import { RenderContext } from "./RenderContext";
Expand Down Expand Up @@ -46,7 +47,7 @@
}

override onRender(context: RenderContext): void {
PipelineUtils.blitTexture(this.engine, <Texture2D>this._cameraColorTexture, this._renderTarget);
Blitter.blitTexture(this.engine, <Texture2D>this._cameraColorTexture, this._renderTarget);

Check warning on line 50 in packages/core/src/RenderPipeline/OpaqueTexturePass.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/RenderPipeline/OpaqueTexturePass.ts#L50

Added line #L50 was not covered by tests
context.camera.shaderData.setTexture(Camera._cameraOpaqueTextureProperty, this._renderTarget.getColorTexture(0));
}
}
Loading
Loading