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

V3.8.2 pipeline #16244

Merged
merged 132 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
ba60761
fgd rebuild & depth stencil view (#154)
hana-alice Jul 27, 2023
095b083
loading subresource as needed & all metal shader delayed compile (#155)
hana-alice Jul 31, 2023
7d1b349
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 2, 2023
9a87d4d
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
star-e Aug 2, 2023
00f5a5a
Complete Scene Culling (#156)
GengineJS Aug 2, 2023
869075b
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 3, 2023
132e2b1
[Optimize] Executor and sceneCulling (#158)
GengineJS Aug 8, 2023
89b1aa0
fix lint
star-e Aug 8, 2023
04d5623
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
star-e Aug 8, 2023
ace2185
[Update] mempool logic
GengineJS Aug 9, 2023
5c701fc
subresource move (#157)
hana-alice Aug 9, 2023
003f4f9
add constants
star-e Aug 9, 2023
d08205c
Merge branch 'v3.8.1' into v3.8.1-pipeline-resolve
star-e Aug 9, 2023
7c1ddf6
Merge branch 'v3.8.1-pipeline' into v3.8.1-pipeline-resolve
star-e Aug 9, 2023
a31e5a9
fix lint
star-e Aug 9, 2023
8f676b6
type update (#160)
hana-alice Aug 9, 2023
0385078
fix addTexture default plane
star-e Aug 9, 2023
ed75fb8
change default planeID to 0
star-e Aug 9, 2023
ddad5a1
remove [nodiscard] string literal (#161)
hana-alice Aug 10, 2023
fd659f3
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 10, 2023
22eca7f
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
star-e Aug 10, 2023
60a89e2
fix naming
star-e Aug 10, 2023
94e21dd
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 10, 2023
e5faac9
[Fixed]Clean up redundant code and fix an issue where adjusting the c…
GengineJS Aug 10, 2023
7dcf1a3
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
GengineJS Aug 10, 2023
bf9866e
Update eslint
GengineJS Aug 10, 2023
7cb9fb3
Merge pull request #162 from GengineJS/v3.8.1-pipeline-0809
star-e Aug 10, 2023
9600900
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 11, 2023
f901860
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
star-e Aug 11, 2023
479e67a
[Fixed] Fix the issue of ghosting in the gizmo when moving the editor.
GengineJS Aug 11, 2023
67209ba
Merge pull request #163 from GengineJS/v3.8.1-pipeline-0811
star-e Aug 11, 2023
5eaff55
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 11, 2023
1c9ecc4
add object pool
star-e Aug 11, 2023
378ed5f
skip index reset
star-e Aug 11, 2023
628bb91
Merge pull request #164 from star-e/v3.8.1-pipeline-memory
star-e Aug 14, 2023
a24e954
add reset
star-e Aug 14, 2023
4d4c992
remove unnecessary reset
star-e Aug 14, 2023
0814256
adding object pool
star-e Aug 14, 2023
ae06698
adding object pool
star-e Aug 14, 2023
a98ad1d
change default batch size
star-e Aug 14, 2023
6d26cd6
reset added
star-e Aug 14, 2023
6bd4c74
Merge pull request #159 from GengineJS/v3.8.1-pipeline-0808
star-e Aug 14, 2023
94889a2
add pool creation
star-e Aug 16, 2023
34c75e8
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
star-e Aug 16, 2023
a8bf3d5
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 16, 2023
f95ab81
fix reset bug
star-e Aug 16, 2023
8b077f7
[Modify]Adjusting the logic of Reflection Probes
GengineJS Aug 16, 2023
f5f63c5
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
GengineJS Aug 16, 2023
603a050
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 17, 2023
b4f3ebc
[Completed] the logic adjustment for reflection probes
GengineJS Aug 17, 2023
bc87d44
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
GengineJS Aug 17, 2023
4af68a8
[Update]
GengineJS Aug 17, 2023
f556cbb
Merge pull request #166 from GengineJS/v3.8.1-pipeline-0814
star-e Aug 17, 2023
6d5125a
remove view type from subresource view
star-e Aug 17, 2023
b1b3535
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 17, 2023
230f04b
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 23, 2023
0c3e594
add reflection probe
star-e Aug 23, 2023
2a1931a
[Modify] Native reflectionProbe
GengineJS Aug 25, 2023
766f549
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
GengineJS Aug 25, 2023
1ce2d37
add builtin reflection probe pass builder
star-e Aug 25, 2023
9c7a443
Update
GengineJS Aug 25, 2023
b73fcd6
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
GengineJS Aug 25, 2023
cee296c
remove render queue
star-e Aug 25, 2023
81e555c
Merge branch 'v3.8.1-pipeline' of https://github.com/star-e/cocos-eng…
GengineJS Aug 28, 2023
72522b0
Complete reflection probes for the native new pipeline
GengineJS Aug 29, 2023
f444e0b
Fixed lint
GengineJS Aug 29, 2023
749bc15
Update
GengineJS Aug 29, 2023
f565651
Merge pull request #167 from GengineJS/v3.8.1-pipeline-0820
star-e Aug 30, 2023
ec12686
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 30, 2023
fa34683
add generated code
star-e Aug 30, 2023
df20a52
remove width and height
star-e Aug 30, 2023
a6465b7
fix missing header
star-e Aug 30, 2023
94dd7be
add missing web change
star-e Aug 30, 2023
24d124d
add missing change
star-e Aug 30, 2023
b5c272a
Replace old pipeline (#168)
GengineJS Aug 31, 2023
518e3d5
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Aug 31, 2023
bcf72ba
Revert "Replace old pipeline (#168)"
star-e Aug 31, 2023
fd7368d
[Fixed] the problem that the wireframe is not displayed (#170)
GengineJS Sep 1, 2023
1c8ae59
adding builtin lights
star-e Sep 1, 2023
dfe3d9f
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Sep 1, 2023
81e82bc
adding culling
star-e Sep 1, 2023
2df4429
Merge branch 'v3.8.1' into v3.8.1-pipeline
star-e Sep 6, 2023
94b7468
Merge branch 'v3.8.2' into v3.8.2-pipeline
star-e Sep 6, 2023
93b1895
Update (#169)
GengineJS Sep 6, 2023
cd5d238
Merge branch 'v3.8.1-pipeline' into v3.8.2-pipeline
star-e Sep 6, 2023
481d270
enhance cullingID type safety
star-e Sep 7, 2023
4cb1940
enhance safety
star-e Sep 7, 2023
8ededf4
adding light bounds culling
star-e Sep 7, 2023
d6162a8
renderQueueIndex renamed
star-e Sep 7, 2023
5651057
light bounds culling added
star-e Sep 8, 2023
ab5b169
csm updated
star-e Sep 8, 2023
454fec5
Merge branch 'v3.8.1' into v3.8.2-merge
star-e Sep 11, 2023
76b9a04
Merge branch 'v3.8.2-merge' into v3.8.2-pipeline
star-e Sep 11, 2023
a8375b7
fix compile error
star-e Sep 11, 2023
684a710
Merge branch 'v3.8.2' into v3.8.2-pipeline
star-e Sep 11, 2023
3a24a36
Merge branch 'v3.8.2' into v3.8.2-pipeline
star-e Sep 12, 2023
7bb1c99
addScene simplified
star-e Sep 12, 2023
7559379
onGlobalPipelineStateChanged added
star-e Sep 12, 2023
36a8efb
revert optional to null
star-e Sep 12, 2023
ed1652b
[Update] RecyclePool (#176)
GengineJS Sep 18, 2023
1f57f3b
multi light added
star-e Sep 19, 2023
935443b
revert change
star-e Sep 19, 2023
53037ae
Merge branch 'v3.8.2-pipeline' of https://github.com/star-e/cocos-eng…
star-e Sep 19, 2023
b5bec6a
Merge branch 'v3.8.1' into v3.8.2-pipeline
star-e Sep 20, 2023
79b6d86
Merge branch 'v3.8.2' into v3.8.2-pipeline
star-e Sep 20, 2023
92be044
lint
star-e Sep 20, 2023
4d9d392
add profile marker
star-e Sep 20, 2023
f27a99c
add debug object pool
star-e Sep 20, 2023
5b44fcd
add object pool tracking
star-e Sep 20, 2023
658933e
Merge branch 'v3.8.2' into v3.8.2-pipeline
star-e Sep 20, 2023
1f9ef76
add create debug
star-e Sep 20, 2023
a398222
remove debug
star-e Sep 21, 2023
3da6495
revert version
star-e Sep 21, 2023
04a782d
Complete the webpipeline pool (#177)
GengineJS Sep 21, 2023
7cf8f5b
Merge branch 'v3.8.2-pipeline' of https://github.com/star-e/cocos-eng…
star-e Sep 21, 2023
6822e20
[Added] new pipeline setter's light interface (#175)
GengineJS Sep 21, 2023
760f2a6
[Fixed] sampler synchronization issues with compute view texture (#178)
GengineJS Sep 22, 2023
6f18470
punctual light ubo added
star-e Sep 22, 2023
47e4794
Merge branch 'v3.8.2-pipeline' of https://github.com/star-e/cocos-eng…
star-e Sep 22, 2023
6fdba8a
spot light shadow map added
star-e Sep 22, 2023
4dd3c8d
Merge branch 'v3.8.2' into v3.8.2-pipeline
star-e Sep 22, 2023
2d35ba9
Merge branch 'v3.8.2' into v3.8.2-pipeline
star-e Oct 9, 2023
08c66e4
Merge branch 'v3.8.2' into v3.8.2-pipeline
star-e Oct 9, 2023
57f2f8d
add guard to buildLightBuffer
star-e Oct 10, 2023
9dca300
[Complete] multi-light source adjustment logic (#179)
GengineJS Oct 13, 2023
2a93479
Fix multiple light sources (#180)
GengineJS Oct 23, 2023
a2784da
[Add] lightbounds pool (#181)
GengineJS Oct 30, 2023
2021d78
Solve the problem that only one light source is effective in the case…
GengineJS Oct 31, 2023
f39b7e8
Merge branch 'v3.8.2' into v3.8.2-pipeline
star-e Nov 1, 2023
06e472e
Merge branch 'v3.8.2-pipeline' of https://github.com/star-e/cocos-eng…
star-e Nov 1, 2023
8f632f2
Update instancing (#183)
GengineJS Nov 2, 2023
9475df9
Fix shadowmap flickering problem with multiple light sources (#184)
GengineJS Nov 6, 2023
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
4 changes: 3 additions & 1 deletion cocos/asset/assets/effect-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ export class EffectAsset extends Asset {
public onLoaded (): void {
if (cclegacy.rendering && cclegacy.rendering.enableEffectImport) {
addEffectDefaultProperties(this);
(cclegacy.rendering.programLib as ProgramLibrary).addEffect(this);
const programLib = cclegacy.rendering.programLib;
programLib.addEffect(this);
programLib.init(deviceManager.gfxDevice);
} else {
programLib.register(this);
}
Expand Down
20 changes: 20 additions & 0 deletions cocos/gfx/base/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,15 @@ export class Viewport {
this.maxDepth = info.maxDepth;
return this;
}

public reset (): void {
this.left = 0;
this.top = 0;
this.width = 0;
this.height = 0;
this.minDepth = 0;
this.maxDepth = 1;
}
}

export class Color {
Expand Down Expand Up @@ -1007,6 +1016,13 @@ export class Color {
this.w = w;
return this;
}

public reset (): void {
this.x = 0;
this.y = 0;
this.z = 0;
this.w = 0;
}
}

export class BindingMappingInfo {
Expand Down Expand Up @@ -1757,6 +1773,10 @@ export class DescriptorSetLayoutInfo {
deepCopy(this.bindings, info.bindings, DescriptorSetLayoutBinding);
return this;
}

reset (): void {
this.bindings.length = 0;
}
}

export class DescriptorSetInfo {
Expand Down
4 changes: 4 additions & 0 deletions cocos/gfx/base/shader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export abstract class Shader extends GFXObject {
return this._samplers;
}

get stages (): ShaderStage[] {
return this._stages;
}

protected _name = '';
protected _stages: ShaderStage[] = [];
protected _attributes: Attribute[] = [];
Expand Down
7 changes: 5 additions & 2 deletions cocos/gfx/webgl/webgl-command-buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
this._cmdAllocator.clearCmds(this.cmdPackage);
}

public begin (renderPass?: RenderPass, subpass = 0, frameBuffer?: Framebuffer): void {

Check failure on line 77 in cocos/gfx/webgl/webgl-command-buffer.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Default parameters should be last
this._cmdAllocator.clearCmds(this.cmdPackage);
this._curGPUPipelineState = null;
this._curGPUInputAssembler = null;
Expand Down Expand Up @@ -295,7 +295,7 @@
}
}
} else {
console.error('Command \'draw\' must be recorded inside a render pass.');

Check failure on line 298 in cocos/gfx/webgl/webgl-command-buffer.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected console statement
}
}

Expand Down Expand Up @@ -331,7 +331,7 @@
this.cmdPackage.cmds.push(WebGLCmd.UPDATE_BUFFER);
}
} else {
console.error('Command \'updateBuffer\' must be recorded outside a render pass.');

Check failure on line 334 in cocos/gfx/webgl/webgl-command-buffer.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected console statement
}
}

Expand All @@ -353,7 +353,7 @@
}
}
} else {
console.error('Command \'copyBufferToTexture\' must be recorded outside a render pass.');

Check failure on line 356 in cocos/gfx/webgl/webgl-command-buffer.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected console statement
}
}

Expand Down Expand Up @@ -405,10 +405,13 @@
}
}

public pipelineBarrier (GeneralBarrier: Readonly<GeneralBarrier>, bufferBarriers?: Readonly<BufferBarrier[]>,
public pipelineBarrier (
GeneralBarrier: Readonly<GeneralBarrier>,
bufferBarriers?: Readonly<BufferBarrier[]>,
buffers?: Readonly<Buffer[]>,
textureBarriers?: Readonly<TextureBarrier[]>,
textures?: Readonly<Texture[]>): void {}
textures?: Readonly<Texture[]>,
): void {}

Check failure on line 414 in cocos/gfx/webgl/webgl-command-buffer.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected empty method 'pipelineBarrier'

protected bindStates (): void {
const bindStatesCmd = this._cmdAllocator.bindStatesCmdPool.alloc(WebGLCmdBindStates);
Expand Down
166 changes: 152 additions & 14 deletions cocos/rendering/custom/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@

import { EDITOR } from 'internal:constants';
import { BufferInfo, Buffer, BufferUsageBit, ClearFlagBit, Color, DescriptorSet, LoadOp,
Format, Rect, Sampler, StoreOp, Texture, Viewport, MemoryUsageBit, Filter, Address } from '../../gfx';
Format, Rect, Sampler, StoreOp, Texture, Viewport, MemoryUsageBit, Filter, Address, DescriptorSetLayoutInfo, DescriptorSetLayoutBinding } from '../../gfx';

Check warning on line 27 in cocos/rendering/custom/define.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 159. Maximum allowed is 150
import { ProbeType, ReflectionProbe } from '../../render-scene/scene/reflection-probe';
import { Camera, SKYBOX_FLAG } from '../../render-scene/scene/camera';
import { CSMLevel, ShadowType } from '../../render-scene/scene/shadows';
import { CSMLevel, ShadowType, Shadows } from '../../render-scene/scene/shadows';
import { Light, LightType } from '../../render-scene/scene/light';
import { DirectionalLight } from '../../render-scene/scene/directional-light';
import { RangedDirectionalLight } from '../../render-scene/scene/ranged-directional-light';
import { PointLight } from '../../render-scene/scene/point-light';
import { SphereLight } from '../../render-scene/scene/sphere-light';
import { SpotLight } from '../../render-scene/scene/spot-light';
import { supportsR32FloatTexture, supportsRGBA16HalfFloatTexture } from '../define';
import { UBOForwardLight, supportsR32FloatTexture, supportsRGBA16HalfFloatTexture } from '../define';
import { BasicPipeline, Pipeline } from './pipeline';
import {
AccessType, AttachmentType, CopyPair, LightInfo,
Expand All @@ -46,7 +46,7 @@
import { RenderWindow } from '../../render-scene/core/render-window';
import { RenderData, RenderGraph } from './render-graph';
import { WebComputePassBuilder, WebPipeline } from './web-pipeline';
import { DescriptorSetData, LayoutGraph, LayoutGraphData } from './layout-graph';
import { DescriptorSetData, DescriptorSetLayoutData, LayoutGraph, LayoutGraphData } from './layout-graph';
import { AABB } from '../../core/geometry';
import { DebugViewCompositeType, DebugViewSingleType } from '../debug-view';
import { ReflectionProbeManager } from '../../3d/reflection-probe/reflection-probe-manager';
Expand Down Expand Up @@ -682,11 +682,10 @@
);
}
const queue = shadowPass.addQueue(QueueHint.RENDER_OPAQUE, 'shadow-caster');
queue.addSceneOfCamera(
queue.addScene(
camera,
new LightInfo(light, level),
SceneFlags.SHADOW_CASTER | SceneFlags.OPAQUE_OBJECT | SceneFlags.TRANSPARENT_OBJECT,
);
SceneFlags.SHADOW_CASTER | SceneFlags.OPAQUE_OBJECT | SceneFlags.MASK,
).useLightFrustum(light, light.type !== LightType.DIRECTIONAL ? 0 : level);
queue.setViewport(new Viewport(area.x, area.y, area.width, area.height));
}

Expand Down Expand Up @@ -755,8 +754,10 @@
probeCamera.clearStencil,
probeCamera.clearFlag,
);
const passBuilder = probePass.addQueue(QueueHint.RENDER_OPAQUE);
passBuilder.addSceneOfCamera(camera, new LightInfo(), SceneFlags.REFLECTION_PROBE);
const passBuilder = probePass.addQueue(QueueHint.RENDER_OPAQUE, 'reflect-map');
const lightInfo = new LightInfo();
lightInfo.probe = probe;
passBuilder.addSceneOfCamera(camera, lightInfo, SceneFlags.REFLECTION_PROBE | SceneFlags.OPAQUE_OBJECT);
updateCameraUBO(passBuilder as unknown as any, probeCamera, ppl);
}

Expand Down Expand Up @@ -2481,6 +2482,140 @@
return !!val;
}

export function AlignUp (value: number, alignment: number): number {
return (value + (alignment - 1)) & ~(alignment - 1);
}
const kLightMeterScale = 10000;
export function SetLightUBO (
light: Light | null,
bHDR: boolean,
exposure: number,
shadowInfo: Shadows | null,
buffer: Float32Array,
offset: number,
elemSize: number,
): void {
const vec4Array = new Float32Array(4);
let size = 0.0;
let range = 0.0;
let luminanceHDR = 0.0;
let luminanceLDR = 0.0;

if (light && light.type === LightType.SPHERE) {
const sphereLight = light as SphereLight;
vec4Array[0] = sphereLight.position.x;
vec4Array[1] = sphereLight.position.y;
vec4Array[2] = sphereLight.position.z;
vec4Array[3] = LightType.SPHERE;
size = sphereLight.size;
range = sphereLight.range;
luminanceHDR = sphereLight.luminanceHDR;
luminanceLDR = sphereLight.luminanceLDR;
} else if (light && light.type === LightType.SPOT) {
const spotLight = light as SpotLight;
vec4Array[0] = spotLight.position.x;
vec4Array[1] = spotLight.position.y;
vec4Array[2] = spotLight.position.z;
vec4Array[3] = LightType.SPOT;
size = spotLight.size;
range = spotLight.range;
luminanceHDR = spotLight.luminanceHDR;
luminanceLDR = spotLight.luminanceLDR;
} else if (light && light.type === LightType.POINT) {
const pointLight = light as PointLight;
vec4Array[0] = pointLight.position.x;
vec4Array[1] = pointLight.position.y;
vec4Array[2] = pointLight.position.z;
vec4Array[3] = LightType.POINT;
size = 0.0;
range = pointLight.range;
luminanceHDR = pointLight.luminanceHDR;
luminanceLDR = pointLight.luminanceLDR;
} else if (light && light.type === LightType.RANGED_DIRECTIONAL) {
const rangedDirLight = light as RangedDirectionalLight;
vec4Array[0] = rangedDirLight.position.x;
vec4Array[1] = rangedDirLight.position.y;
vec4Array[2] = rangedDirLight.position.z;
vec4Array[3] = LightType.RANGED_DIRECTIONAL;
size = 0.0;
range = 0.0;
luminanceHDR = rangedDirLight.illuminanceHDR;
luminanceLDR = rangedDirLight.illuminanceLDR;
}

let index = offset + UBOForwardLight.LIGHT_POS_OFFSET;
buffer.set(vec4Array, index);

index = offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET;
vec4Array.set([size, range, 0, 0]);
buffer.set(vec4Array, index);

index = offset + UBOForwardLight.LIGHT_COLOR_OFFSET;
const color = light ? light.color : new Color();
if (light && light.useColorTemperature) {
const tempRGB = light.colorTemperatureRGB;
buffer[index++] = color.x * tempRGB.x;
buffer[index++] = color.y * tempRGB.y;
buffer[index++] = color.z * tempRGB.z;
} else {
buffer[index++] = color.x;
buffer[index++] = color.y;
buffer[index++] = color.z;
}

if (bHDR) {
buffer[index] = luminanceHDR * exposure * kLightMeterScale;
} else {
buffer[index] = luminanceLDR;
}

switch (light ? light.type : LightType.UNKNOWN) {
case LightType.SPHERE:
buffer[offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 2] = 0;
buffer[offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 3] = 0;
break;
case LightType.SPOT: {
const spotLight = light as SpotLight;
buffer[offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 2] = spotLight.spotAngle;
buffer[offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 3] = (shadowInfo && shadowInfo.enabled
&& spotLight.shadowEnabled
&& shadowInfo.type === ShadowType.ShadowMap) ? 1.0 : 0.0;

index = offset + UBOForwardLight.LIGHT_DIR_OFFSET;
const direction = spotLight.direction;
buffer[index++] = direction.x;
buffer[index++] = direction.y;
buffer[index] = direction.z;
} break;
case LightType.POINT:
buffer[offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 2] = 0;
buffer[offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 3] = 0;
break;
case LightType.RANGED_DIRECTIONAL: {
const rangedDirLight = light as RangedDirectionalLight;
const right = rangedDirLight.right;
buffer[offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 0] = right.x;
buffer[offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 1] = right.y;
buffer[offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 2] = right.z;
buffer[offset + UBOForwardLight.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 3] = 0;

const direction = rangedDirLight.direction;
buffer[offset + UBOForwardLight.LIGHT_DIR_OFFSET + 0] = direction.x;
buffer[offset + UBOForwardLight.LIGHT_DIR_OFFSET + 1] = direction.y;
buffer[offset + UBOForwardLight.LIGHT_DIR_OFFSET + 2] = direction.z;
buffer[offset + UBOForwardLight.LIGHT_DIR_OFFSET + 3] = 0;

const scale = rangedDirLight.scale;
buffer[offset + UBOForwardLight.LIGHT_BOUNDING_SIZE_VS_OFFSET + 0] = scale.x * 0.5;
buffer[offset + UBOForwardLight.LIGHT_BOUNDING_SIZE_VS_OFFSET + 1] = scale.y * 0.5;
buffer[offset + UBOForwardLight.LIGHT_BOUNDING_SIZE_VS_OFFSET + 2] = scale.z * 0.5;
buffer[offset + UBOForwardLight.LIGHT_BOUNDING_SIZE_VS_OFFSET + 3] = 0;
} break;
default:
break;
}
}

export function getSubpassOrPassID (sceneId: number, rg: RenderGraph, lg: LayoutGraphData): number {
const queueId = rg.getParent(sceneId);
assert(queueId !== 0xFFFFFFFF);
Expand All @@ -2500,10 +2635,13 @@
assert(passLayoutId !== lg.nullVertex());

const subpassLayoutName: string = rg.getLayout(subpassOrPassID);
assert(!!subpassLayoutName);
const subpassLayoutId = lg.locateChild(passLayoutId, subpassLayoutName);
assert(subpassLayoutId !== lg.nullVertex());
layoutId = subpassLayoutId;
if (subpassLayoutName.length === 0) {
layoutId = passLayoutId;
} else {
const subpassLayoutId = lg.locateChild(passLayoutId, subpassLayoutName);
assert(subpassLayoutId !== lg.nullVertex());
layoutId = subpassLayoutId;
}
}
assert(layoutId !== lg.nullVertex());
return layoutId;
Expand Down
Loading
Loading