@forgeax/engine-render 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/assembly/factory.d.ts +16 -5
- package/dist/assembly/factory.d.ts.map +1 -1
- package/dist/{chunk-RJRUS55L.mjs → chunk-4XINDLAY.mjs} +267 -186
- package/dist/chunk-4XINDLAY.mjs.map +1 -0
- package/dist/{chunk-YTQ5C7YQ.mjs → chunk-CDTWTHZR.mjs} +176 -8
- package/dist/chunk-CDTWTHZR.mjs.map +1 -0
- package/dist/{chunk-IPXCABEP.mjs → chunk-M2MP4ZOU.mjs} +2 -2
- package/dist/chunk-M2MP4ZOU.mjs.map +1 -0
- package/dist/{chunk-LOSO4CTV.mjs → chunk-TBQJOK2L.mjs} +67 -3
- package/dist/chunk-TBQJOK2L.mjs.map +1 -0
- package/dist/components/light-helpers.d.ts.map +1 -1
- package/dist/components/spot-light.d.ts +12 -0
- package/dist/components/spot-light.d.ts.map +1 -1
- package/dist/construct-renderer.mjs +2281 -164
- package/dist/construct-renderer.mjs.map +1 -1
- package/dist/device/gpu-residency.d.ts +19 -2
- package/dist/device/gpu-residency.d.ts.map +1 -1
- package/dist/errors/render.d.ts +69 -1
- package/dist/errors/render.d.ts.map +1 -1
- package/dist/gpu-usage.d.ts +2 -0
- package/dist/gpu-usage.d.ts.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal.mjs +1 -1
- package/dist/light-buffer-layout.d.ts +20 -12
- package/dist/light-buffer-layout.d.ts.map +1 -1
- package/dist/pbr-pipeline.d.ts +6 -3
- package/dist/pbr-pipeline.d.ts.map +1 -1
- package/dist/pipeline/standard-forward-lane.d.ts.map +1 -1
- package/dist/pipeline/standard-pipeline.d.ts.map +1 -1
- package/dist/pipeline/standard-profile.d.ts +13 -0
- package/dist/pipeline/standard-profile.d.ts.map +1 -1
- package/dist/record/frame-lighting.d.ts +2 -0
- package/dist/record/frame-lighting.d.ts.map +1 -1
- package/dist/record/frame-snapshot.d.ts +37 -1
- package/dist/record/frame-snapshot.d.ts.map +1 -1
- package/dist/record/frame-targets.d.ts.map +1 -1
- package/dist/record/frame.d.ts +3 -2
- package/dist/record/frame.d.ts.map +1 -1
- package/dist/record/gpu-timing.d.ts +32 -0
- package/dist/record/gpu-timing.d.ts.map +1 -0
- package/dist/record/main-pass-material.d.ts +1 -1
- package/dist/record/main-pass-material.d.ts.map +1 -1
- package/dist/record/render-context.d.ts +5 -1
- package/dist/record/render-context.d.ts.map +1 -1
- package/dist/record/shadow-pass.d.ts.map +1 -1
- package/dist/record/typed-frame-graph.d.ts +11 -3
- package/dist/record/typed-frame-graph.d.ts.map +1 -1
- package/dist/render-contract.d.ts +66 -1
- package/dist/render-contract.d.ts.map +1 -1
- package/dist/render-data.d.ts +10 -6
- package/dist/render-data.d.ts.map +1 -1
- package/dist/render-pipeline.d.ts +36 -0
- package/dist/render-pipeline.d.ts.map +1 -1
- package/dist/render-system-extract.d.ts +55 -3
- package/dist/render-system-extract.d.ts.map +1 -1
- package/dist/render-system.d.ts +7 -1
- package/dist/render-system.d.ts.map +1 -1
- package/dist/renderer-inspect.d.ts +29 -0
- package/dist/renderer-inspect.d.ts.map +1 -0
- package/dist/scene/render-scene.d.ts.map +1 -1
- package/dist/temporal/frame.d.ts +44 -0
- package/dist/temporal/frame.d.ts.map +1 -0
- package/dist/temporal/index.mjs +3 -3
- package/dist/typed-render-graph-primitives.d.ts +6 -1
- package/dist/typed-render-graph-primitives.d.ts.map +1 -1
- package/dist/typed-shadow-atlas.d.ts +10 -0
- package/dist/typed-shadow-atlas.d.ts.map +1 -0
- package/dist/typed-shadow-passes.d.ts.map +1 -1
- package/dist/volume/capability.d.ts +57 -0
- package/dist/volume/capability.d.ts.map +1 -0
- package/dist/volume/component.d.ts +61 -0
- package/dist/volume/component.d.ts.map +1 -0
- package/dist/volume/extract.d.ts +11 -0
- package/dist/volume/extract.d.ts.map +1 -0
- package/dist/volume/inspection.d.ts +38 -0
- package/dist/volume/inspection.d.ts.map +1 -0
- package/dist/volume/passes.d.ts +38 -0
- package/dist/volume/passes.d.ts.map +1 -0
- package/dist/volume/recovery.d.ts +38 -0
- package/dist/volume/recovery.d.ts.map +1 -0
- package/dist/volume/resources.d.ts +57 -0
- package/dist/volume/resources.d.ts.map +1 -0
- package/dist/volume/temporal.d.ts +35 -0
- package/dist/volume/temporal.d.ts.map +1 -0
- package/package.json +20 -20
- package/src/__tests__/ktx2-basis-gpu-consumer.dawn.test.ts +14 -14
- package/src/__tests__/mesh-buffer-usage-surface.unit.test.ts +1 -1
- package/src/__tests__/render-error-code-owner.test-d.ts +5 -0
- package/src/__tests__/renderer-factory-material-contract.unit.test.ts +28 -0
- package/src/__tests__/renderer-frame-transaction.integration.test.ts +1 -1
- package/src/__tests__/skinned-shadow-caster.test.ts +21 -0
- package/src/__tests__/standard-profile-oracle.unit.test.ts +7 -5
- package/src/__tests__/volume-optics-oracle.unit.test.ts +85 -0
- package/src/__tests__/volumetric-fog-budget-recovery.integration.test.ts +655 -0
- package/src/__tests__/volumetric-fog-component.unit.test.ts +71 -0
- package/src/__tests__/volumetric-fog-composite-stage-readback.dawn.test.ts +376 -0
- package/src/__tests__/volumetric-fog-errors.unit.test.ts +51 -0
- package/src/__tests__/volumetric-fog-inspection.unit.test.ts +77 -0
- package/src/__tests__/volumetric-fog-light-capability.unit.test.ts +19 -0
- package/src/__tests__/volumetric-fog-light-consumers.integration.test.ts +18 -0
- package/src/__tests__/volumetric-fog-light-errors.unit.test.ts +17 -0
- package/src/__tests__/volumetric-fog-light-topology.unit.test.ts +21 -0
- package/src/__tests__/volumetric-fog-light-transaction.integration.test.ts +53 -0
- package/src/__tests__/volumetric-fog-m9-watcher.integration.test.ts +27 -0
- package/src/__tests__/volumetric-fog-point-light-owner.integration.test.ts +44 -0
- package/src/__tests__/volumetric-fog-point-spot-accumulation.integration.test.ts +49 -0
- package/src/__tests__/volumetric-fog-point-spot-contract.unit.test.ts +28 -0
- package/src/__tests__/volumetric-fog-point-spot-lkg.integration.test.ts +65 -0
- package/src/__tests__/volumetric-fog-point-spot-selection.integration.test.ts +49 -0
- package/src/__tests__/volumetric-fog-point-spot-temporal.unit.test.ts +55 -0
- package/src/__tests__/volumetric-fog-projector-contract.unit.test.ts +22 -0
- package/src/__tests__/volumetric-fog-projector-inspection.unit.test.ts +12 -0
- package/src/__tests__/volumetric-fog-projector-surface-volume.integration.test.ts +11 -0
- package/src/__tests__/volumetric-fog-projector-transaction.integration.test.ts +26 -0
- package/src/__tests__/volumetric-fog-recovery.integration.test.ts +47 -0
- package/src/__tests__/volumetric-fog-selected-light-resolution.integration.test.ts +63 -0
- package/src/__tests__/volumetric-fog-spot-closure.integration.test.ts +26 -0
- package/src/__tests__/volumetric-fog-spot-contract.test-d.ts +21 -0
- package/src/__tests__/volumetric-fog-spot-contract.unit.test.ts +27 -0
- package/src/__tests__/volumetric-fog-spot-frame-optics.integration.test.ts +14 -0
- package/src/__tests__/volumetric-fog-spot-optics.integration.test.ts +29 -0
- package/src/__tests__/volumetric-fog-stage-readback.dawn.test.ts +550 -0
- package/src/__tests__/volumetric-fog-temporal-selected-light.unit.test.ts +33 -0
- package/src/__tests__/volumetric-fog-temporal.unit.test.ts +45 -0
- package/src/__tests__/volumetric-fog-topology.unit.test.ts +237 -0
- package/src/__tests__/volumetric-fog-transparent.integration.test.ts +27 -0
- package/src/assembly/factory.ts +271 -15
- package/src/components/light-helpers.ts +4 -0
- package/src/components/spot-light.ts +22 -3
- package/src/device/gpu-residency.ts +168 -58
- package/src/errors/render.ts +119 -1
- package/src/gpu-usage.ts +2 -0
- package/src/index.ts +38 -1
- package/src/light-buffer-layout.ts +59 -26
- package/src/pbr-pipeline.ts +33 -10
- package/src/pipeline/standard-forward-lane.ts +20 -0
- package/src/pipeline/standard-pipeline.ts +20 -0
- package/src/pipeline/standard-profile.ts +23 -0
- package/src/record/frame-lighting.ts +103 -89
- package/src/record/frame-snapshot.ts +41 -1
- package/src/record/frame-targets.ts +6 -2
- package/src/record/frame.ts +908 -5
- package/src/record/gpu-timing.ts +224 -0
- package/src/record/main-pass-material.ts +6 -2
- package/src/record/render-context.ts +5 -0
- package/src/record/shadow-pass.ts +87 -38
- package/src/record/typed-frame-graph.ts +143 -8
- package/src/render-contract.ts +72 -0
- package/src/render-data.ts +50 -22
- package/src/render-pipeline.ts +44 -0
- package/src/render-system-extract.ts +329 -3
- package/src/render-system.ts +79 -0
- package/src/renderer-inspect.ts +66 -0
- package/src/scene/render-scene.ts +2 -0
- package/src/temporal/frame.ts +128 -0
- package/src/transmission/__tests__/standard-transmission.dawn.test.ts +2 -3
- package/src/typed-render-graph-primitives.ts +32 -2
- package/src/typed-shadow-atlas.ts +17 -0
- package/src/typed-shadow-passes.ts +6 -5
- package/src/volume/capability.ts +173 -0
- package/src/volume/component.ts +110 -0
- package/src/volume/extract.ts +21 -0
- package/src/volume/inspection.ts +78 -0
- package/src/volume/passes.ts +680 -0
- package/src/volume/recovery.ts +86 -0
- package/src/volume/resources.ts +236 -0
- package/src/volume/temporal.ts +89 -0
- package/dist/chunk-IPXCABEP.mjs.map +0 -1
- package/dist/chunk-LOSO4CTV.mjs.map +0 -1
- package/dist/chunk-RJRUS55L.mjs.map +0 -1
- package/dist/chunk-YTQ5C7YQ.mjs.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { TRANSPARENT_SORT_MODE_LAYER_Z, TRANSPARENT_SORT_MODE_LAYER_Y } from './chunk-RXZ3RGOU.mjs';
|
|
2
|
-
import { DEFAULT_CLUSTER_GRID, CLUSTER_GRID_STRIDE_U32, LIGHT_INDEX_LIST_CAPACITY, EquirectProjectionFailedError, PointShadowAtlasUninitializedError, PointShadowAtlasBoundsViolationError, HdrpLightBudgetExceededError, STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, MAX_LIGHTS, HdrpIndexListOverflowError, VideoUploadUnsupportedError, VertexColorVariantConflictError } from './chunk-
|
|
2
|
+
import { DEFAULT_CLUSTER_GRID, CLUSTER_GRID_STRIDE_U32, LIGHT_INDEX_LIST_CAPACITY, EquirectProjectionFailedError, PointShadowAtlasUninitializedError, PointShadowAtlasBoundsViolationError, HdrpLightBudgetExceededError, STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, MAX_LIGHTS, HdrpIndexListOverflowError, VideoUploadUnsupportedError, VertexColorVariantConflictError } from './chunk-TBQJOK2L.mjs';
|
|
3
3
|
import { SPRITE_PREMULTIPLIED_ALPHA_BLEND } from './chunk-VFPLTKCU.mjs';
|
|
4
|
-
import { clampPcfKernelSize, worldEntityKey } from './chunk-
|
|
5
|
-
import { ok, err as err$1, toShared, ASSET_ERROR_HINTS,
|
|
4
|
+
import { clampPcfKernelSize, worldEntityKey } from './chunk-M2MP4ZOU.mjs';
|
|
5
|
+
import { ok, derive, err as err$1, toShared, ASSET_ERROR_HINTS, deriveTextureLayout, KNOWN_PASS_KINDS, resolveMaterialTextureCoordinates, handleSlot } from '@forgeax/engine-types';
|
|
6
6
|
import { ok as ok$1, err, RhiError, cubeArrayDepthDescriptor, comparisonSamplerDescriptor, cubeArrayDepthFaceView } from '@forgeax/engine-rhi';
|
|
7
7
|
import { vec3, mat3, mat4 } from '@forgeax/engine-math';
|
|
8
8
|
import { deriveVertexLayoutProjection, deriveVertexBufferLayout } from '@forgeax/engine-geometry';
|
|
9
9
|
import { DEFAULT_STANDARD_PBR_PARAM_SCHEMA, DEFAULT_MSDF_TEXT_PARAM_SCHEMA, DEFAULT_SPRITE_PARAM_SCHEMA, DEFAULT_UNLIT_PARAM_SCHEMA } from '@forgeax/engine-shader';
|
|
10
|
-
import { resolveAssetHandle
|
|
10
|
+
import { resolveAssetHandle } from '@forgeax/engine-assets-runtime';
|
|
11
11
|
import { probeVideoHighPerfUpload, VIDEO_ELEMENT_PROVIDER_KEY } from '@forgeax/engine-graphics-extras';
|
|
12
|
-
import {
|
|
12
|
+
import { isCompressedFormat, bytesPerRow, blockParamsForFormat } from '@forgeax/engine-codec';
|
|
13
13
|
|
|
14
14
|
// src/gpu-texture-usage.ts
|
|
15
15
|
var GPU_TEXTURE_USAGE_COPY_SRC = 1;
|
|
@@ -478,6 +478,8 @@ var GPU_BUFFER_USAGE_COPY_SRC = 4;
|
|
|
478
478
|
var GPU_BUFFER_USAGE_UNIFORM = 64;
|
|
479
479
|
var GPU_BUFFER_USAGE_STORAGE = 128;
|
|
480
480
|
var GPU_BUFFER_USAGE_INDIRECT = 256;
|
|
481
|
+
var GPU_BUFFER_USAGE_MAP_READ = 1;
|
|
482
|
+
var GPU_BUFFER_USAGE_QUERY_RESOLVE = 512;
|
|
481
483
|
var BYTES_PER_LIGHT_SLOT = 64;
|
|
482
484
|
var LightSlotKind = {
|
|
483
485
|
POINT: 0,
|
|
@@ -485,8 +487,9 @@ var LightSlotKind = {
|
|
|
485
487
|
};
|
|
486
488
|
var STORAGE_BUFFER_MIN_REQUIRED = 4;
|
|
487
489
|
var POINT_LIGHT_STD430_BYTES = 32;
|
|
488
|
-
var SPOT_LIGHT_STD430_BYTES =
|
|
490
|
+
var SPOT_LIGHT_STD430_BYTES = 80;
|
|
489
491
|
var SPOT_LIGHT_SHADOW_TILE_SENTINEL = -1;
|
|
492
|
+
var SPOT_LIGHT_PROJECTOR_ONLY_SENTINEL = -2;
|
|
490
493
|
var LIGHT_ARRAY_HEADER_BYTES = 16;
|
|
491
494
|
var LIGHT_ARRAY_MAX_SLOTS = 4;
|
|
492
495
|
var POINT_LIGHT_SHADOW_LAYER_SENTINEL = -1;
|
|
@@ -504,7 +507,7 @@ function packPointLight(snap) {
|
|
|
504
507
|
return out;
|
|
505
508
|
}
|
|
506
509
|
function packSpotLight(snap) {
|
|
507
|
-
const out = new Float32Array(
|
|
510
|
+
const out = new Float32Array(20);
|
|
508
511
|
out[0] = snap.position[0] ?? 0;
|
|
509
512
|
out[1] = snap.position[1] ?? 0;
|
|
510
513
|
out[2] = snap.position[2] ?? 0;
|
|
@@ -517,8 +520,12 @@ function packSpotLight(snap) {
|
|
|
517
520
|
out[9] = snap.direction[1] ?? 0;
|
|
518
521
|
out[10] = snap.direction[2] ?? 0;
|
|
519
522
|
out[11] = snap.cosOuter;
|
|
523
|
+
out[12] = snap.depthBias ?? 5e-3;
|
|
524
|
+
out[13] = snap.normalBias ?? 0.05;
|
|
525
|
+
out[14] = snap.pcfKernelSize ?? 3;
|
|
520
526
|
const i32 = new Int32Array(out.buffer);
|
|
521
|
-
i32[15] = snap.shadowAtlasTile
|
|
527
|
+
i32[15] = snap.shadowAtlasTile >= 0 ? snap.shadowAtlasTile : snap.projectorAsset !== void 0 && snap.lightViewProj !== void 0 ? SPOT_LIGHT_PROJECTOR_ONLY_SENTINEL : SPOT_LIGHT_SHADOW_TILE_SENTINEL;
|
|
528
|
+
out[16] = snap.shadowIntensity ?? 1;
|
|
522
529
|
return out;
|
|
523
530
|
}
|
|
524
531
|
function packLightArrayHeader(count) {
|
|
@@ -549,7 +556,9 @@ function packLightSlot(snap, shadow) {
|
|
|
549
556
|
out[14] = shadow.near;
|
|
550
557
|
out[15] = shadow.far;
|
|
551
558
|
} else if (snap.kind === "spot") {
|
|
552
|
-
i32[13] = snap.shadowAtlasTile;
|
|
559
|
+
i32[13] = snap.shadowAtlasTile >= 0 ? snap.shadowAtlasTile : snap.projectorAsset !== void 0 && snap.lightViewProj !== void 0 ? SPOT_LIGHT_PROJECTOR_ONLY_SENTINEL : SPOT_LIGHT_SHADOW_TILE_SENTINEL;
|
|
560
|
+
out[14] = snap.shadowIntensity ?? 1;
|
|
561
|
+
out[15] = snap.pcfKernelSize ?? 3;
|
|
553
562
|
} else {
|
|
554
563
|
i32[13] = POINT_LIGHT_SHADOW_LAYER_SENTINEL;
|
|
555
564
|
}
|
|
@@ -593,7 +602,7 @@ function buildPbrMaterialUserRegionEntries(paramSchema = DEFAULT_STANDARD_PBR_PA
|
|
|
593
602
|
})
|
|
594
603
|
);
|
|
595
604
|
const ubo = entries[0];
|
|
596
|
-
if (ubo !== void 0 && ubo.binding === 0 && ubo.buffer
|
|
605
|
+
if (ubo !== void 0 && ubo.binding === 0 && ubo.buffer?.type === "uniform") {
|
|
597
606
|
entries[0] = {
|
|
598
607
|
binding: 0,
|
|
599
608
|
visibility: GPU_SHADER_STAGE_VERTEX | GPU_SHADER_STAGE_FRAGMENT,
|
|
@@ -705,7 +714,7 @@ function appendInjection(bgl, kind) {
|
|
|
705
714
|
}
|
|
706
715
|
function buildPbrViewBglEntries(caps) {
|
|
707
716
|
const lightBufType = caps.storageBuffer ? "read-only-storage" : "uniform";
|
|
708
|
-
|
|
717
|
+
const entries = [
|
|
709
718
|
{
|
|
710
719
|
binding: 0,
|
|
711
720
|
visibility: GPU_SHADER_STAGE_VERTEX | GPU_SHADER_STAGE_FRAGMENT,
|
|
@@ -797,13 +806,28 @@ function buildPbrViewBglEntries(caps) {
|
|
|
797
806
|
binding: 8,
|
|
798
807
|
visibility: GPU_SHADER_STAGE_FRAGMENT,
|
|
799
808
|
texture: { sampleType: "depth", viewDimension: "2d" }
|
|
800
|
-
},
|
|
801
|
-
{
|
|
802
|
-
binding: 10,
|
|
803
|
-
visibility: GPU_SHADER_STAGE_VERTEX,
|
|
804
|
-
buffer: { type: "uniform", hasDynamicOffset: true }
|
|
805
809
|
}
|
|
806
810
|
];
|
|
811
|
+
if (caps.projectorAvailable !== false) {
|
|
812
|
+
entries.push(
|
|
813
|
+
{
|
|
814
|
+
binding: 11,
|
|
815
|
+
visibility: GPU_SHADER_STAGE_FRAGMENT,
|
|
816
|
+
texture: { sampleType: "float", viewDimension: "2d" }
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
binding: 12,
|
|
820
|
+
visibility: GPU_SHADER_STAGE_FRAGMENT,
|
|
821
|
+
sampler: { type: "filtering" }
|
|
822
|
+
}
|
|
823
|
+
);
|
|
824
|
+
}
|
|
825
|
+
entries.push({
|
|
826
|
+
binding: 10,
|
|
827
|
+
visibility: GPU_SHADER_STAGE_VERTEX,
|
|
828
|
+
buffer: { type: "uniform", hasDynamicOffset: true }
|
|
829
|
+
});
|
|
830
|
+
return entries;
|
|
807
831
|
}
|
|
808
832
|
function buildPbrPipelineLayouts(device, caps) {
|
|
809
833
|
const viewBglRes = device.createBindGroupLayout(
|
|
@@ -2990,6 +3014,9 @@ function buildPerFrameBindGroups(internals, frameState, pipelineState, hasValida
|
|
|
2990
3014
|
const b5View = atlasViewMaybe !== null ? atlasViewMaybe : pipelineState.shadowAtlasFallbackTextureView;
|
|
2991
3015
|
const graphSpotShadowView = graphTargets?.spotShadow;
|
|
2992
3016
|
const b8View = graphSpotShadowView !== void 0 ? graphSpotShadowView : pipelineState.shadowFallbackTextureView;
|
|
3017
|
+
const projectorAvailable = pipelineState.projectorAvailable !== false;
|
|
3018
|
+
const b11View = graphTargets?.projector ?? pipelineState.defaultWhiteTextureView;
|
|
3019
|
+
const b12Sampler = graphTargets?.projectorSampler ?? pipelineState.defaultSampler;
|
|
2993
3020
|
viewBindGroup = getOrCreateFromChain(
|
|
2994
3021
|
frameState.viewBindGroupCache,
|
|
2995
3022
|
[
|
|
@@ -3001,110 +3028,116 @@ function buildPerFrameBindGroups(internals, frameState, pipelineState, hasValida
|
|
|
3001
3028
|
b5View,
|
|
3002
3029
|
pipelineState.shadowParamsBuffer,
|
|
3003
3030
|
b8View,
|
|
3031
|
+
...projectorAvailable ? [b11View, b12Sampler] : [],
|
|
3004
3032
|
pipelineState.pointsLinesViewBuffer ?? pipelineState.viewUniformBuffer
|
|
3005
3033
|
],
|
|
3006
3034
|
"view-main",
|
|
3007
3035
|
() => {
|
|
3036
|
+
const entries = [
|
|
3037
|
+
{
|
|
3038
|
+
binding: 0,
|
|
3039
|
+
resource: {
|
|
3040
|
+
kind: "buffer",
|
|
3041
|
+
value: { buffer: pipelineState.viewUniformBuffer, size: VIEW_UNIFORM_BYTES }
|
|
3042
|
+
}
|
|
3043
|
+
},
|
|
3044
|
+
{
|
|
3045
|
+
binding: 1,
|
|
3046
|
+
resource: {
|
|
3047
|
+
kind: "buffer",
|
|
3048
|
+
value: { buffer: pipelineState.pointLightsBuffer }
|
|
3049
|
+
}
|
|
3050
|
+
},
|
|
3051
|
+
{
|
|
3052
|
+
binding: 2,
|
|
3053
|
+
resource: {
|
|
3054
|
+
kind: "buffer",
|
|
3055
|
+
value: { buffer: pipelineState.spotLightsBuffer }
|
|
3056
|
+
}
|
|
3057
|
+
},
|
|
3058
|
+
{
|
|
3059
|
+
binding: 3,
|
|
3060
|
+
resource: {
|
|
3061
|
+
kind: "textureView",
|
|
3062
|
+
value: b3View
|
|
3063
|
+
}
|
|
3064
|
+
},
|
|
3065
|
+
{
|
|
3066
|
+
binding: 4,
|
|
3067
|
+
resource: {
|
|
3068
|
+
kind: "sampler",
|
|
3069
|
+
value: shadowSampler
|
|
3070
|
+
}
|
|
3071
|
+
},
|
|
3072
|
+
// feat-20260612-point-light-shadows-urp-hdrp Round-2 F-1:
|
|
3073
|
+
// cube_array shadow atlas view (real ShadowAtlas when point
|
|
3074
|
+
// shadows are active; else 1x1x6 fallback).
|
|
3075
|
+
{
|
|
3076
|
+
binding: 5,
|
|
3077
|
+
resource: {
|
|
3078
|
+
kind: "textureView",
|
|
3079
|
+
value: b5View
|
|
3080
|
+
}
|
|
3081
|
+
},
|
|
3082
|
+
// feat-20260612-point-light-shadows-urp-hdrp Round-2 F-1:
|
|
3083
|
+
// shadowParams UBO (`array<vec4<f32>, 4>` = 64 B). Lane N
|
|
3084
|
+
// stores `(near, far, 1/(far-near), 0)` for the point light
|
|
3085
|
+
// with shadowAtlasLayer === N. Updated per frame from
|
|
3086
|
+
// `pointShadowSnapshots` below.
|
|
3087
|
+
{
|
|
3088
|
+
binding: 6,
|
|
3089
|
+
resource: {
|
|
3090
|
+
kind: "buffer",
|
|
3091
|
+
value: { buffer: pipelineState.shadowParamsBuffer }
|
|
3092
|
+
}
|
|
3093
|
+
},
|
|
3094
|
+
// feat-20260613-csm-cascaded-shadow-maps M5 / w28 (rebased to
|
|
3095
|
+
// binding 7 on 2026-06-13 to make room for point-shadow 5/6):
|
|
3096
|
+
// forward shaders declare binding 7 in common.wgsl (shared
|
|
3097
|
+
// view BGL) but never reference it; only shadow_caster.wgsl
|
|
3098
|
+
// reads it. Host writes a stable singleton buffer so every
|
|
3099
|
+
// forward bind group entry stays populated.
|
|
3100
|
+
{
|
|
3101
|
+
binding: 7,
|
|
3102
|
+
resource: {
|
|
3103
|
+
kind: "buffer",
|
|
3104
|
+
value: { buffer: pipelineState.shadowCasterCascadeBuffer }
|
|
3105
|
+
}
|
|
3106
|
+
},
|
|
3107
|
+
// feat-20260625-spot-light-shadow-mapping M3 / w21 (D-5):
|
|
3108
|
+
// spot shadow 2D atlas (real spotShadowDepth view when spot
|
|
3109
|
+
// shadows run this frame, else the 1x1 depth fallback). Always-on.
|
|
3110
|
+
{
|
|
3111
|
+
binding: 8,
|
|
3112
|
+
resource: {
|
|
3113
|
+
kind: "textureView",
|
|
3114
|
+
value: b8View
|
|
3115
|
+
}
|
|
3116
|
+
},
|
|
3117
|
+
{
|
|
3118
|
+
binding: 10,
|
|
3119
|
+
resource: {
|
|
3120
|
+
kind: "buffer",
|
|
3121
|
+
value: {
|
|
3122
|
+
buffer: pipelineState.pointsLinesViewBuffer ?? pipelineState.viewUniformBuffer,
|
|
3123
|
+
size: POINTS_LINES_VIEW_BYTES
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
},
|
|
3127
|
+
...projectorAvailable ? [
|
|
3128
|
+
{ binding: 11, resource: { kind: "textureView", value: b11View } },
|
|
3129
|
+
{ binding: 12, resource: { kind: "sampler", value: b12Sampler } }
|
|
3130
|
+
] : []
|
|
3131
|
+
// feat-20260625-spot-light-shadow-mapping w25: the per-spot
|
|
3132
|
+
// fragment-read lightViewProj matrices fold into the View UBO
|
|
3133
|
+
// (binding 0, `view.spotLightViewProj`) — no standalone binding 9
|
|
3134
|
+
// (WebGL2 fragment uniform-buffer budget). binding 10 is the
|
|
3135
|
+
// dedicated vertex-only Points/Lines viewport UBO.
|
|
3136
|
+
];
|
|
3008
3137
|
const viewBindGroupResult = internals.device.createBindGroup({
|
|
3009
3138
|
label: "pbr-view-bg",
|
|
3010
3139
|
layout: pipelineState.viewBindGroupLayout,
|
|
3011
|
-
entries
|
|
3012
|
-
{
|
|
3013
|
-
binding: 0,
|
|
3014
|
-
resource: {
|
|
3015
|
-
kind: "buffer",
|
|
3016
|
-
value: { buffer: pipelineState.viewUniformBuffer, size: VIEW_UNIFORM_BYTES }
|
|
3017
|
-
}
|
|
3018
|
-
},
|
|
3019
|
-
{
|
|
3020
|
-
binding: 1,
|
|
3021
|
-
resource: {
|
|
3022
|
-
kind: "buffer",
|
|
3023
|
-
value: { buffer: pipelineState.pointLightsBuffer }
|
|
3024
|
-
}
|
|
3025
|
-
},
|
|
3026
|
-
{
|
|
3027
|
-
binding: 2,
|
|
3028
|
-
resource: {
|
|
3029
|
-
kind: "buffer",
|
|
3030
|
-
value: { buffer: pipelineState.spotLightsBuffer }
|
|
3031
|
-
}
|
|
3032
|
-
},
|
|
3033
|
-
{
|
|
3034
|
-
binding: 3,
|
|
3035
|
-
resource: {
|
|
3036
|
-
kind: "textureView",
|
|
3037
|
-
value: b3View
|
|
3038
|
-
}
|
|
3039
|
-
},
|
|
3040
|
-
{
|
|
3041
|
-
binding: 4,
|
|
3042
|
-
resource: {
|
|
3043
|
-
kind: "sampler",
|
|
3044
|
-
value: shadowSampler
|
|
3045
|
-
}
|
|
3046
|
-
},
|
|
3047
|
-
// feat-20260612-point-light-shadows-urp-hdrp Round-2 F-1:
|
|
3048
|
-
// cube_array shadow atlas view (real ShadowAtlas when point
|
|
3049
|
-
// shadows are active; else 1x1x6 fallback).
|
|
3050
|
-
{
|
|
3051
|
-
binding: 5,
|
|
3052
|
-
resource: {
|
|
3053
|
-
kind: "textureView",
|
|
3054
|
-
value: b5View
|
|
3055
|
-
}
|
|
3056
|
-
},
|
|
3057
|
-
// feat-20260612-point-light-shadows-urp-hdrp Round-2 F-1:
|
|
3058
|
-
// shadowParams UBO (`array<vec4<f32>, 4>` = 64 B). Lane N
|
|
3059
|
-
// stores `(near, far, 1/(far-near), 0)` for the point light
|
|
3060
|
-
// with shadowAtlasLayer === N. Updated per frame from
|
|
3061
|
-
// `pointShadowSnapshots` below.
|
|
3062
|
-
{
|
|
3063
|
-
binding: 6,
|
|
3064
|
-
resource: {
|
|
3065
|
-
kind: "buffer",
|
|
3066
|
-
value: { buffer: pipelineState.shadowParamsBuffer }
|
|
3067
|
-
}
|
|
3068
|
-
},
|
|
3069
|
-
// feat-20260613-csm-cascaded-shadow-maps M5 / w28 (rebased to
|
|
3070
|
-
// binding 7 on 2026-06-13 to make room for point-shadow 5/6):
|
|
3071
|
-
// forward shaders declare binding 7 in common.wgsl (shared
|
|
3072
|
-
// view BGL) but never reference it; only shadow_caster.wgsl
|
|
3073
|
-
// reads it. Host writes a stable singleton buffer so every
|
|
3074
|
-
// forward bind group entry stays populated.
|
|
3075
|
-
{
|
|
3076
|
-
binding: 7,
|
|
3077
|
-
resource: {
|
|
3078
|
-
kind: "buffer",
|
|
3079
|
-
value: { buffer: pipelineState.shadowCasterCascadeBuffer }
|
|
3080
|
-
}
|
|
3081
|
-
},
|
|
3082
|
-
// feat-20260625-spot-light-shadow-mapping M3 / w21 (D-5):
|
|
3083
|
-
// spot shadow 2D atlas (real spotShadowDepth view when spot
|
|
3084
|
-
// shadows run this frame, else the 1x1 depth fallback). Always-on.
|
|
3085
|
-
{
|
|
3086
|
-
binding: 8,
|
|
3087
|
-
resource: {
|
|
3088
|
-
kind: "textureView",
|
|
3089
|
-
value: b8View
|
|
3090
|
-
}
|
|
3091
|
-
},
|
|
3092
|
-
{
|
|
3093
|
-
binding: 10,
|
|
3094
|
-
resource: {
|
|
3095
|
-
kind: "buffer",
|
|
3096
|
-
value: {
|
|
3097
|
-
buffer: pipelineState.pointsLinesViewBuffer ?? pipelineState.viewUniformBuffer,
|
|
3098
|
-
size: POINTS_LINES_VIEW_BYTES
|
|
3099
|
-
}
|
|
3100
|
-
}
|
|
3101
|
-
}
|
|
3102
|
-
// feat-20260625-spot-light-shadow-mapping w25: the per-spot
|
|
3103
|
-
// fragment-read lightViewProj matrices fold into the View UBO
|
|
3104
|
-
// (binding 0, `view.spotLightViewProj`) — no standalone binding 9
|
|
3105
|
-
// (WebGL2 fragment uniform-buffer budget). binding 10 is the
|
|
3106
|
-
// dedicated vertex-only Points/Lines viewport UBO.
|
|
3107
|
-
]
|
|
3140
|
+
entries
|
|
3108
3141
|
});
|
|
3109
3142
|
if (!viewBindGroupResult.ok) throw viewBindGroupResult.error;
|
|
3110
3143
|
return viewBindGroupResult.value;
|
|
@@ -4643,35 +4676,6 @@ function deriveTextureExtent(format, width, height) {
|
|
|
4643
4676
|
uvScale: [width / physicalWidth, height / physicalHeight]
|
|
4644
4677
|
};
|
|
4645
4678
|
}
|
|
4646
|
-
function deriveMipUploadLayout(format, baseWidth, baseHeight, mipLevelCount) {
|
|
4647
|
-
const params = blockParamsForFormat(format);
|
|
4648
|
-
if (params === null) return [];
|
|
4649
|
-
const levels = [];
|
|
4650
|
-
let byteOffset = 0;
|
|
4651
|
-
for (let level = 0; level < mipLevelCount; level++) {
|
|
4652
|
-
const width = Math.max(1, baseWidth >> level);
|
|
4653
|
-
const height = Math.max(1, baseHeight >> level);
|
|
4654
|
-
const blockCols = Math.ceil(width / params.blockW);
|
|
4655
|
-
const blockRows = Math.ceil(height / params.blockH);
|
|
4656
|
-
const rowBytes = blockCols * params.bytesPerBlock;
|
|
4657
|
-
const byteLength = rowBytes * blockRows;
|
|
4658
|
-
levels.push({
|
|
4659
|
-
level,
|
|
4660
|
-
width,
|
|
4661
|
-
height,
|
|
4662
|
-
physicalWidth: blockCols * params.blockW,
|
|
4663
|
-
physicalHeight: blockRows * params.blockH,
|
|
4664
|
-
copyWidth: blockCols * params.blockW,
|
|
4665
|
-
copyHeight: blockRows * params.blockH,
|
|
4666
|
-
bytesPerRow: rowBytes,
|
|
4667
|
-
rowsPerImage: blockRows,
|
|
4668
|
-
byteOffset,
|
|
4669
|
-
byteLength
|
|
4670
|
-
});
|
|
4671
|
-
byteOffset += byteLength;
|
|
4672
|
-
}
|
|
4673
|
-
return levels;
|
|
4674
|
-
}
|
|
4675
4679
|
function deriveRenderDataMesh(mesh) {
|
|
4676
4680
|
const indices = mesh.indices;
|
|
4677
4681
|
const indexBytesUnpadded = indices === void 0 ? 0 : indices.byteLength;
|
|
@@ -4689,6 +4693,8 @@ function deriveRenderDataMesh(mesh) {
|
|
|
4689
4693
|
});
|
|
4690
4694
|
}
|
|
4691
4695
|
function deriveRenderDataTexture(tex) {
|
|
4696
|
+
const width = tex.shape.extent.width;
|
|
4697
|
+
const height = tex.shape.extent.height;
|
|
4692
4698
|
const isSrgbFormat = tex.format.endsWith("-srgb");
|
|
4693
4699
|
const expectedColorSpace = isSrgbFormat ? "srgb" : "linear";
|
|
4694
4700
|
if (tex.colorSpace !== expectedColorSpace) {
|
|
@@ -4701,8 +4707,17 @@ function deriveRenderDataTexture(tex) {
|
|
|
4701
4707
|
);
|
|
4702
4708
|
}
|
|
4703
4709
|
const compressed = isCompressedFormat(tex.format);
|
|
4704
|
-
const
|
|
4705
|
-
if (
|
|
4710
|
+
const layout = deriveTextureLayout({ shape: tex.shape, format: tex.format, mips: tex.mips });
|
|
4711
|
+
if (!layout.ok) {
|
|
4712
|
+
return err(
|
|
4713
|
+
projectionError({
|
|
4714
|
+
code: "invalid-source-format",
|
|
4715
|
+
expected: layout.error.expected,
|
|
4716
|
+
hint: layout.error.hint
|
|
4717
|
+
})
|
|
4718
|
+
);
|
|
4719
|
+
}
|
|
4720
|
+
if (compressed && tex.mips.kind === "generate") {
|
|
4706
4721
|
return err(
|
|
4707
4722
|
projectionError({
|
|
4708
4723
|
code: "mipgen-unsupported-compressed-format",
|
|
@@ -4711,9 +4726,18 @@ function deriveRenderDataTexture(tex) {
|
|
|
4711
4726
|
})
|
|
4712
4727
|
);
|
|
4713
4728
|
}
|
|
4714
|
-
const mipLevelCount =
|
|
4715
|
-
const
|
|
4716
|
-
if (
|
|
4729
|
+
const mipLevelCount = layout.value.levels.length;
|
|
4730
|
+
const baseLevel = layout.value.levels[0];
|
|
4731
|
+
if (baseLevel === void 0) {
|
|
4732
|
+
return err(
|
|
4733
|
+
projectionError({
|
|
4734
|
+
code: "invalid-source-format",
|
|
4735
|
+
expected: "texture layout contains a base mip level",
|
|
4736
|
+
hint: ASSET_ERROR_HINTS["invalid-source-format"]
|
|
4737
|
+
})
|
|
4738
|
+
);
|
|
4739
|
+
}
|
|
4740
|
+
if (!compressed && tex.data.byteLength < baseLevel.byteLength) {
|
|
4717
4741
|
return err(
|
|
4718
4742
|
projectionError({
|
|
4719
4743
|
code: "invalid-source-format",
|
|
@@ -4722,12 +4746,14 @@ function deriveRenderDataTexture(tex) {
|
|
|
4722
4746
|
})
|
|
4723
4747
|
);
|
|
4724
4748
|
}
|
|
4725
|
-
const bytesPerRow$1 = compressed ? bytesPerRow(tex.format,
|
|
4749
|
+
const bytesPerRow$1 = compressed ? bytesPerRow(tex.format, width) ?? baseLevel.bytesPerRow : baseLevel.bytesPerRow;
|
|
4726
4750
|
const usage = compressed ? GPU_TEXTURE_USAGE_TEXTURE_BINDING | GPU_TEXTURE_USAGE_COPY_DST | GPU_TEXTURE_USAGE_COPY_SRC : GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING | GPU_TEXTURE_USAGE_COPY_DST | GPU_TEXTURE_USAGE_COPY_SRC;
|
|
4727
4751
|
return ok$1({
|
|
4728
|
-
width
|
|
4729
|
-
height
|
|
4730
|
-
|
|
4752
|
+
width,
|
|
4753
|
+
height,
|
|
4754
|
+
shape: tex.shape,
|
|
4755
|
+
depthOrArrayLayers: tex.shape.viewDimension === "2d" ? 1 : tex.shape.viewDimension === "2d-array" ? tex.shape.extent.layers : tex.shape.extent.depth,
|
|
4756
|
+
...deriveTextureExtent(tex.format, width, height),
|
|
4731
4757
|
format: tex.format,
|
|
4732
4758
|
mipLevelCount,
|
|
4733
4759
|
usage,
|
|
@@ -4746,8 +4772,9 @@ function deriveRenderDataCubemap(source) {
|
|
|
4746
4772
|
})
|
|
4747
4773
|
);
|
|
4748
4774
|
}
|
|
4775
|
+
const sourceHeight = source.shape.viewDimension === "2d" ? source.shape.extent.height : 0;
|
|
4749
4776
|
return ok$1({
|
|
4750
|
-
cubeFaceSize:
|
|
4777
|
+
cubeFaceSize: sourceHeight,
|
|
4751
4778
|
outputFormat: "rgba16float",
|
|
4752
4779
|
needsHalfConversion: source.format === "rgba32float",
|
|
4753
4780
|
cubeUsage: GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING | GPU_TEXTURE_USAGE_COPY_DST | GPU_TEXTURE_USAGE_COPY_SRC
|
|
@@ -5081,7 +5108,11 @@ var DEFAULT_STANDARD_TEXTURE_COORDINATES = new Float32Array([
|
|
|
5081
5108
|
]);
|
|
5082
5109
|
function materialTextureUvScale(texture) {
|
|
5083
5110
|
if (texture === void 0) return [1, 1];
|
|
5084
|
-
return deriveTextureExtent(
|
|
5111
|
+
return deriveTextureExtent(
|
|
5112
|
+
texture.format,
|
|
5113
|
+
texture.shape.extent.width,
|
|
5114
|
+
texture.shape.extent.height
|
|
5115
|
+
).uvScale;
|
|
5085
5116
|
}
|
|
5086
5117
|
function materialTextureForField(material, field) {
|
|
5087
5118
|
if (field === "emissiveTexture") return material.emissiveTexture;
|
|
@@ -6725,6 +6756,7 @@ function ensureTypedShadowViewBg(c, viewOffset, cascadeOffset, variant) {
|
|
|
6725
6756
|
const { runtime, frameState, pipelineState } = c;
|
|
6726
6757
|
const shadowSampler = pipelineState.perPassResources.shadowSampler;
|
|
6727
6758
|
if (shadowSampler === null) return null;
|
|
6759
|
+
const projectorAvailable = pipelineState.projectorAvailable !== false;
|
|
6728
6760
|
try {
|
|
6729
6761
|
return getOrCreateFromChain(
|
|
6730
6762
|
frameState.viewBindGroupCache,
|
|
@@ -6738,6 +6770,7 @@ function ensureTypedShadowViewBg(c, viewOffset, cascadeOffset, variant) {
|
|
|
6738
6770
|
pipelineState.shadowParamsBuffer,
|
|
6739
6771
|
pipelineState.shadowCasterCascadeBuffer,
|
|
6740
6772
|
pipelineState.shadowFallbackTextureView,
|
|
6773
|
+
...projectorAvailable ? [pipelineState.defaultWhiteTextureView, pipelineState.defaultSampler] : [],
|
|
6741
6774
|
pipelineState.pointsLinesViewBuffer ?? pipelineState.viewUniformBuffer
|
|
6742
6775
|
],
|
|
6743
6776
|
variant,
|
|
@@ -6808,7 +6841,20 @@ function ensureTypedShadowViewBg(c, viewOffset, cascadeOffset, variant) {
|
|
|
6808
6841
|
size: 80
|
|
6809
6842
|
}
|
|
6810
6843
|
}
|
|
6811
|
-
}
|
|
6844
|
+
},
|
|
6845
|
+
...projectorAvailable ? [
|
|
6846
|
+
{
|
|
6847
|
+
binding: 11,
|
|
6848
|
+
resource: {
|
|
6849
|
+
kind: "textureView",
|
|
6850
|
+
value: pipelineState.defaultWhiteTextureView
|
|
6851
|
+
}
|
|
6852
|
+
},
|
|
6853
|
+
{
|
|
6854
|
+
binding: 12,
|
|
6855
|
+
resource: { kind: "sampler", value: pipelineState.defaultSampler }
|
|
6856
|
+
}
|
|
6857
|
+
] : []
|
|
6812
6858
|
]
|
|
6813
6859
|
});
|
|
6814
6860
|
if (!created.ok) throw created.error;
|
|
@@ -6828,7 +6874,15 @@ function shadowShaderMap(c) {
|
|
|
6828
6874
|
const shaders = /* @__PURE__ */ new Map();
|
|
6829
6875
|
for (const entry of c.dispatch) {
|
|
6830
6876
|
if (entry.tags.LightMode === "ShadowCaster" && entry.materialShaderId !== void 0) {
|
|
6831
|
-
shaders.
|
|
6877
|
+
let byMaterial = shaders.get(entry.renderableIndex);
|
|
6878
|
+
if (byMaterial === void 0) {
|
|
6879
|
+
byMaterial = /* @__PURE__ */ new Map();
|
|
6880
|
+
shaders.set(entry.renderableIndex, byMaterial);
|
|
6881
|
+
}
|
|
6882
|
+
byMaterial.set(entry.materialHandle, {
|
|
6883
|
+
materialShaderId: entry.materialShaderId,
|
|
6884
|
+
renderState: entry.renderState
|
|
6885
|
+
});
|
|
6832
6886
|
}
|
|
6833
6887
|
}
|
|
6834
6888
|
return shaders;
|
|
@@ -7026,7 +7080,7 @@ function buildMatchedMaterialHandlesByRenderable(dispatch, selector) {
|
|
|
7026
7080
|
}
|
|
7027
7081
|
return handlesByRenderable;
|
|
7028
7082
|
}
|
|
7029
|
-
function recordShadowCasterDraws(c, shadowPass, shadowPipeline2, shadowMeshBindGroup, matchedIndices,
|
|
7083
|
+
function recordShadowCasterDraws(c, shadowPass, shadowPipeline2, shadowMeshBindGroup, matchedIndices, shadowDispatchByRenderableIdx) {
|
|
7030
7084
|
const { runtime, pipelineState, validatedOrdered } = c;
|
|
7031
7085
|
let shadowLastVertexBuffer = null;
|
|
7032
7086
|
let shadowLastIndexBuffer = null;
|
|
@@ -7035,32 +7089,13 @@ function recordShadowCasterDraws(c, shadowPass, shadowPipeline2, shadowMeshBindG
|
|
|
7035
7089
|
const entry = validatedOrdered[i];
|
|
7036
7090
|
if (entry === void 0) continue;
|
|
7037
7091
|
if (matchedIndices !== null && !matchedIndices.has(entry.renderableIndex)) continue;
|
|
7038
|
-
const entryShadowShaderId = shadowShaderByRenderableIdx.get(entry.renderableIndex);
|
|
7039
|
-
let entryShadowPipeline = shadowPipeline2;
|
|
7040
7092
|
if (entry.source.skin !== void 0) {
|
|
7041
7093
|
const skinPipeline = skinnedShadowPipeline(c, entry);
|
|
7042
7094
|
if (skinPipeline === null) continue;
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
false,
|
|
7048
|
-
// isHdr — shadow depth pass is always LDR
|
|
7049
|
-
void 0,
|
|
7050
|
-
// renderState
|
|
7051
|
-
"triangle-list",
|
|
7052
|
-
// topology — shadow PSO targets triangle-list
|
|
7053
|
-
void 0,
|
|
7054
|
-
// indexFormat
|
|
7055
|
-
void 0,
|
|
7056
|
-
// variantSet — shadow caster has no variant axes
|
|
7057
|
-
"shadow-caster"
|
|
7058
|
-
// passKind
|
|
7059
|
-
) ?? shadowPipeline2;
|
|
7060
|
-
}
|
|
7061
|
-
if (entryShadowPipeline !== shadowLastPipeline && entryShadowPipeline !== null) {
|
|
7062
|
-
shadowPass.setPipeline(entryShadowPipeline);
|
|
7063
|
-
shadowLastPipeline = entryShadowPipeline;
|
|
7095
|
+
if (skinPipeline !== shadowLastPipeline) {
|
|
7096
|
+
shadowPass.setPipeline(skinPipeline);
|
|
7097
|
+
shadowLastPipeline = skinPipeline;
|
|
7098
|
+
}
|
|
7064
7099
|
}
|
|
7065
7100
|
const shadowSubmeshes = entry.mesh.submeshes;
|
|
7066
7101
|
const hasAnyShadowSubmesh = shadowSubmeshes.some(
|
|
@@ -7176,6 +7211,31 @@ function recordShadowCasterDraws(c, shadowPass, shadowPipeline2, shadowMeshBindG
|
|
|
7176
7211
|
if (sm.topology !== "triangle-list" && sm.topology !== "triangle-strip") {
|
|
7177
7212
|
continue;
|
|
7178
7213
|
}
|
|
7214
|
+
const submeshMaterial = entry.source.materials[sm.materialSlot] ?? entry.source.material;
|
|
7215
|
+
const shadowDispatch = shadowDispatchByRenderableIdx.get(entry.renderableIndex)?.get(submeshMaterial.materialHandle ?? 0);
|
|
7216
|
+
const entryShadowShaderId = shadowDispatch?.materialShaderId;
|
|
7217
|
+
const entryShadowRenderState = shadowDispatch?.renderState;
|
|
7218
|
+
let entryShadowPipeline = entry.source.skin !== void 0 ? shadowLastPipeline : shadowPipeline2;
|
|
7219
|
+
if (entry.source.skin === void 0 && entryShadowShaderId !== void 0 && (entryShadowShaderId !== "forgeax::default-shadow-caster" || entryShadowRenderState !== void 0)) {
|
|
7220
|
+
entryShadowPipeline = runtime.getMaterialShaderPipeline?.(
|
|
7221
|
+
entryShadowShaderId,
|
|
7222
|
+
false,
|
|
7223
|
+
// isHdr — shadow depth pass is always LDR
|
|
7224
|
+
entryShadowRenderState,
|
|
7225
|
+
"triangle-list",
|
|
7226
|
+
// topology — shadow PSO targets triangle-list
|
|
7227
|
+
void 0,
|
|
7228
|
+
// indexFormat
|
|
7229
|
+
void 0,
|
|
7230
|
+
// variantSet — shadow caster has no variant axes
|
|
7231
|
+
"shadow-caster"
|
|
7232
|
+
// passKind
|
|
7233
|
+
) ?? shadowPipeline2;
|
|
7234
|
+
}
|
|
7235
|
+
if (entryShadowPipeline !== shadowLastPipeline && entryShadowPipeline !== null) {
|
|
7236
|
+
shadowPass.setPipeline(entryShadowPipeline);
|
|
7237
|
+
shadowLastPipeline = entryShadowPipeline;
|
|
7238
|
+
}
|
|
7179
7239
|
if (entry.mesh.indexed) {
|
|
7180
7240
|
shadowPass.drawIndexed(sm.indexCount, shadowInstanceCount, sm.indexOffset, 0, 0);
|
|
7181
7241
|
} else {
|
|
@@ -8847,7 +8907,12 @@ function addTypedScenePass(graph, options) {
|
|
|
8847
8907
|
internal.pipelineState,
|
|
8848
8908
|
internal.validated.length > 0 || options.gpuDriven !== void 0,
|
|
8849
8909
|
internal.bindGroupCounts,
|
|
8850
|
-
{
|
|
8910
|
+
{
|
|
8911
|
+
directionalShadow,
|
|
8912
|
+
spotShadow,
|
|
8913
|
+
projector: internal.spotLightProjector?.view ?? internal.volumetricFog?.projectorView,
|
|
8914
|
+
projectorSampler: internal.spotLightProjector?.sampler ?? internal.volumetricFog?.projectorSampler
|
|
8915
|
+
}
|
|
8851
8916
|
);
|
|
8852
8917
|
if (groups.viewBindGroup !== null) {
|
|
8853
8918
|
options.gpuDriven?.encode(groups.viewBindGroup, pass, resources);
|
|
@@ -9169,7 +9234,10 @@ function addTypedFullscreenPass(graph, options) {
|
|
|
9169
9234
|
}),
|
|
9170
9235
|
outputFormat: options.output.format,
|
|
9171
9236
|
...options.depth === void 0 ? {} : { depthView: resolvedDepthView(frame, resources, options.depth) },
|
|
9172
|
-
...options.rawSwapchainOutput === void 0 ? {} : { rawSwapchainOutput: options.rawSwapchainOutput }
|
|
9237
|
+
...options.rawSwapchainOutput === void 0 ? {} : { rawSwapchainOutput: options.rawSwapchainOutput },
|
|
9238
|
+
...options.paramsTransform === void 0 ? {} : {
|
|
9239
|
+
paramsOverride: options.paramsTransform(frame.postProcessParams.get(options.shader))
|
|
9240
|
+
}
|
|
9173
9241
|
});
|
|
9174
9242
|
}
|
|
9175
9243
|
});
|
|
@@ -9220,14 +9288,27 @@ function addTypedCompositePostEffects(graph, effects, input, output, depth, size
|
|
|
9220
9288
|
}
|
|
9221
9289
|
return ok(void 0);
|
|
9222
9290
|
}
|
|
9223
|
-
function addTypedOutputTransformPass(graph, input, output,
|
|
9291
|
+
function addTypedOutputTransformPass(graph, input, output, options = {}) {
|
|
9292
|
+
const outputOnly = options.outputOnly ?? false;
|
|
9224
9293
|
return addTypedFullscreenPass(graph, {
|
|
9225
9294
|
name: outputOnly ? "present" : "output-transform",
|
|
9226
9295
|
shader: STANDARD_OUTPUT_TRANSFORM_FEATURE_ID,
|
|
9227
9296
|
input,
|
|
9228
9297
|
output,
|
|
9229
9298
|
outputOnly,
|
|
9230
|
-
rawSwapchainOutput: outputOnly
|
|
9299
|
+
rawSwapchainOutput: outputOnly,
|
|
9300
|
+
...options.outputTransform === true ? {
|
|
9301
|
+
paramsTransform: (params) => {
|
|
9302
|
+
if (params === void 0 || params.byteLength !== 16) return params;
|
|
9303
|
+
const transformed = params.slice();
|
|
9304
|
+
new DataView(
|
|
9305
|
+
transformed.buffer,
|
|
9306
|
+
transformed.byteOffset,
|
|
9307
|
+
transformed.byteLength
|
|
9308
|
+
).setFloat32(12, 1, true);
|
|
9309
|
+
return transformed;
|
|
9310
|
+
}
|
|
9311
|
+
} : {}
|
|
9231
9312
|
});
|
|
9232
9313
|
}
|
|
9233
9314
|
|
|
@@ -9318,6 +9399,6 @@ function addTaaResolvePass(graph, current, currentTemporal, previousColor, previ
|
|
|
9318
9399
|
});
|
|
9319
9400
|
}
|
|
9320
9401
|
|
|
9321
|
-
export { CAPTURE_VIEW_PROJS, CUBEMAP_FACE_VERTICES, DEFERRED_COLOR_FORMATS, DEPTH_MIN_PARAMS_BYTE_SIZE, FALLBACK_BYTES_PER_ROW, GPU_BUFFER_USAGE_COPY_DST, GPU_BUFFER_USAGE_COPY_SRC, GPU_BUFFER_USAGE_INDEX, GPU_BUFFER_USAGE_INDIRECT, GPU_BUFFER_USAGE_STORAGE, GPU_BUFFER_USAGE_UNIFORM, GPU_BUFFER_USAGE_VERTEX, GPU_SHADER_STAGE_FRAGMENT, GPU_SHADER_STAGE_VERTEX, GPU_TEXTURE_USAGE_COPY_DST, GPU_TEXTURE_USAGE_COPY_SRC, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING, GPU_TEXTURE_USAGE_TEXTURE_BINDING, GpuBuffer, GpuTexture, LIGHT_ARRAY_HEADER_BYTES, LIGHT_ARRAY_MAX_SLOTS, MATERIAL_PER_ENTITY_STRIDE, POINTS_LINES_MATERIAL_SHADER_ID, POINTS_LINES_VIEW_BUFFER_SIZE, POINT_LIGHT_STD430_BYTES, PREFILTER_MIP_LEVELS, PREFILTER_SIZE, PipelineSpecError, PostProcessError, SHADOW_CASTER_BUFFER_SIZE, SKIN_MATERIAL_SHADER_ID, SPOT_LIGHT_STD430_BYTES, TYPED_BLOOM_PASS_NAMES, VIEW_UNIFORM_BUFFER_SIZE, abortTemporalGpuSubmit, addStandardSceneDataPass, addTaaResolvePass, addTypedBloomPasses, addTypedCompositePostEffects, addTypedFrameObservationPass, addTypedFullscreenPass, addTypedOutputTransformPass, addTypedScenePass, addTypedSkyboxPass, addTypedSsaoPasses, addTypedTemporalResolvePass, aggregateTemporalDemand, applyParamSnapshotToUbo, assembleMaterialWithSkylightEntries, assertStorageBufferCap, buildBindGroupLayoutDescriptor, buildFoldDispatchPlan, buildFullscreenPostProcessPass, buildLinearLdrMaterialSpecTable, buildPbrPipelineLayouts, buildPbrSkinLayouts, buildPerFrameBindGroups, buildSpecConstTable, cacheKeyOf, cleanPerEntityCache, colorFormatsForPassKind, commitTemporalGpuSubmit, computeProjectionMatrix, computeSplitLdrSprite, computeViewMatrix, configureSurface, createClusterBinScratch, createFullscreenBindGroup, createHdrpBindGroupLayoutDescriptor, createHdrpClusterMembershipBindGroupLayoutDescriptor, createIblPipelines, createPointsLinesLaneAdapter, createPointsLinesLaneContract, createRenderPipelineTarget, createSkylightFallback, createStandardSceneDataTarget,
|
|
9322
|
-
//# sourceMappingURL=chunk-
|
|
9323
|
-
//# sourceMappingURL=chunk-
|
|
9402
|
+
export { CAPTURE_VIEW_PROJS, CUBEMAP_FACE_VERTICES, DEFERRED_COLOR_FORMATS, DEPTH_MIN_PARAMS_BYTE_SIZE, FALLBACK_BYTES_PER_ROW, GPU_BUFFER_USAGE_COPY_DST, GPU_BUFFER_USAGE_COPY_SRC, GPU_BUFFER_USAGE_INDEX, GPU_BUFFER_USAGE_INDIRECT, GPU_BUFFER_USAGE_MAP_READ, GPU_BUFFER_USAGE_QUERY_RESOLVE, GPU_BUFFER_USAGE_STORAGE, GPU_BUFFER_USAGE_UNIFORM, GPU_BUFFER_USAGE_VERTEX, GPU_SHADER_STAGE_FRAGMENT, GPU_SHADER_STAGE_VERTEX, GPU_TEXTURE_USAGE_COPY_DST, GPU_TEXTURE_USAGE_COPY_SRC, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING, GPU_TEXTURE_USAGE_TEXTURE_BINDING, GpuBuffer, GpuTexture, LIGHT_ARRAY_HEADER_BYTES, LIGHT_ARRAY_MAX_SLOTS, MATERIAL_PER_ENTITY_STRIDE, POINTS_LINES_MATERIAL_SHADER_ID, POINTS_LINES_VIEW_BUFFER_SIZE, POINT_LIGHT_STD430_BYTES, PREFILTER_MIP_LEVELS, PREFILTER_SIZE, PipelineSpecError, PostProcessError, SHADOW_CASTER_BUFFER_SIZE, SKIN_MATERIAL_SHADER_ID, SPOT_LIGHT_STD430_BYTES, TYPED_BLOOM_PASS_NAMES, VIEW_UNIFORM_BUFFER_SIZE, VIEW_UNIFORM_BYTES, abortTemporalGpuSubmit, addStandardSceneDataPass, addTaaResolvePass, addTypedBloomPasses, addTypedCompositePostEffects, addTypedFrameObservationPass, addTypedFullscreenPass, addTypedOutputTransformPass, addTypedScenePass, addTypedSkyboxPass, addTypedSsaoPasses, addTypedTemporalResolvePass, aggregateTemporalDemand, applyParamSnapshotToUbo, assembleMaterialWithSkylightEntries, assertStorageBufferCap, buildBindGroupLayoutDescriptor, buildFoldDispatchPlan, buildFullscreenPostProcessPass, buildLinearLdrMaterialSpecTable, buildPbrMaterialUserRegionEntries, buildPbrPipelineLayouts, buildPbrSkinLayouts, buildPerFrameBindGroups, buildSpecConstTable, cacheKeyOf, cleanPerEntityCache, colorFormatsForPassKind, commitTemporalGpuSubmit, computeProjectionMatrix, computeSplitLdrSprite, computeViewMatrix, configureSurface, createClusterBinScratch, createFullscreenBindGroup, createHdrpBindGroupLayoutDescriptor, createHdrpClusterMembershipBindGroupLayoutDescriptor, createIblPipelines, createPointsLinesLaneAdapter, createPointsLinesLaneContract, createRenderPipelineTarget, createSkylightFallback, createStandardSceneDataTarget, deriveRenderDataCubemap, deriveRenderDataMesh, deriveRenderDataTexture, describeTemporalDemand, driveLazyEquirectProjection, encodeDirectionalShadowPass, encodePointShadowPass, encodeSpotShadowPass, ensureMeshSsboCapacity, entryHasDepthRead, evaluateFoldBucketUniformCap, foldDispatchBuckets, geometryRenderStateForTopology, getOrBuildPipeline, getOrCreateHdrpBuffers, getTemporalGpuState, hasPendingTemporalGpuSubmit, importRenderPipelineSurface, incrementFoldedDrawsMetric, isSkinnedShadowCasterVariant, isStandardPbrMaterialShader, isTemporalFullscreenBinding, prepareFrameLighting, residentTextureView, resolveSkyboxActive, resolveSsaoParameters, resolveSurfaceFormatPair, resolveSurfaceProfile, retireTemporalGpuState, retireTemporalGpuStateAfterFence, runIblPrecompute, selectLazyEquirectHandle, selectPasses, selectSwapChainFormat, setIblComposedShaders, standardTemporalLaneAdmission, standardTemporalPostOrder, temporalReadIndex, temporalWriteIndex, typedFrameClearColor, uploadMeshSsboBatch, variantSetFromDefines, warnMultiSkybox, warnMultiSkylight, warnZeroLightStandard, writeHdrpClusterAndSsaoBuffers, writePointSpotLightBuffers, writePointsLinesViewUbo, writeShadowCasterUniforms, writeShadowParamsBuffer, writeViewUbo };
|
|
9403
|
+
//# sourceMappingURL=chunk-4XINDLAY.mjs.map
|
|
9404
|
+
//# sourceMappingURL=chunk-4XINDLAY.mjs.map
|