@carbonenginejs/runtime 0.1.0-alpha.6 → 0.1.0-alpha.7
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.
Potentially problematic release.
This version of @carbonenginejs/runtime might be problematic. Click here for more details.
- package/dist/global/consts/effectPaths.js +4 -1
- package/dist/global/consts/effectPaths.js.map +1 -1
- package/dist/global/consts/index.js +1 -1
- package/dist/global/index.js +1 -1
- package/dist/index.js +3 -3
- package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js +19 -2
- package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
- package/dist/resource/format/index.js +1 -1
- package/dist/resource/formats/hlsl/core/carbonTypedViews.js +121 -65
- package/dist/resource/formats/hlsl/core/carbonTypedViews.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +10 -7
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/resource/formats/webgpu/core/effectBackendBodySet.js +3 -1
- package/dist/resource/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
- package/dist/resource/formats/webgpu/core/packageEffect.js +5 -0
- package/dist/resource/formats/webgpu/core/packageEffect.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/emitWgsl.js +20 -0
- package/dist/resource/formats/webgpu/core/wgsl/emitWgsl.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/emulatedAddressing.js +93 -4
- package/dist/resource/formats/webgpu/core/wgsl/emulatedAddressing.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js +74 -64
- package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/lowerFragmentProgram.js +16 -7
- package/dist/resource/formats/webgpu/core/wgsl/lowerFragmentProgram.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/wgslTypedViews.js +69 -27
- package/dist/resource/formats/webgpu/core/wgsl/wgslTypedViews.js.map +1 -1
- package/dist/resource/geometry/registerGeometryResources.js +10 -1
- package/dist/resource/geometry/registerGeometryResources.js.map +1 -1
- package/dist/sof/EveSOFDNA.js +4 -2
- package/dist/sof/EveSOFDNA.js.map +1 -1
- package/dist/sof/EveSOFDataMgr.js +83 -69
- package/dist/sof/EveSOFDataMgr.js.map +1 -1
- package/dist/trinity/core/Tr2Denoiser.js +6 -1
- package/dist/trinity/core/Tr2Denoiser.js.map +1 -1
- package/dist/trinity/core/Tr2ShadowMap.js +7 -2
- package/dist/trinity/core/Tr2ShadowMap.js.map +1 -1
- package/dist/trinity/core/context/Tr2RenderContext.js +43 -0
- package/dist/trinity/core/context/Tr2RenderContext.js.map +1 -1
- package/dist/trinity/core/device/Tr2GpuStructuredBuffer.js +134 -0
- package/dist/trinity/core/device/Tr2GpuStructuredBuffer.js.map +1 -0
- package/dist/trinity/core/index.js +1 -0
- package/dist/trinity/core/index.js.map +1 -1
- package/dist/trinity/core/lighting/Tr2LightManager.js +410 -124
- package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
- package/dist/trinity/eve/effect/lensflare/EveLensflare.js +303 -312
- package/dist/trinity/eve/effect/lensflare/EveLensflare.js.map +1 -1
- package/dist/trinity/eve/effect/lensflare/EveOccluder.js +117 -0
- package/dist/trinity/eve/effect/lensflare/EveOccluder.js.map +1 -0
- package/dist/trinity/eve/index.js +1 -0
- package/dist/trinity/eve/index.js.map +1 -1
- package/dist/trinity/eve/scene/EveSpaceScene.js +286 -6
- package/dist/trinity/eve/scene/EveSpaceScene.js.map +1 -1
- package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js +212 -32
- package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js.map +1 -1
- package/dist/trinity/generated/eve/effect/index.js +0 -1
- package/dist/trinity/generated/eve/effect/index.js.map +1 -1
- package/dist/trinity/generated/eve/index.js +0 -1
- package/dist/trinity/generated/eve/index.js.map +1 -1
- package/dist/trinity/generated/index.js +0 -2
- package/dist/trinity/generated/index.js.map +1 -1
- package/dist/trinity/generated/trinityCore/index.js +0 -1
- package/dist/trinity/generated/trinityCore/index.js.map +1 -1
- package/dist/trinity/index.js +2 -2
- package/dist/trinity/postProcess/Tr2PostProcessRenderer.js +4 -1
- package/dist/trinity/postProcess/Tr2PostProcessRenderer.js.map +1 -1
- package/dist/trinity/postProcess/Tr2SSAO.js +282 -21
- package/dist/trinity/postProcess/Tr2SSAO.js.map +1 -1
- package/dist/trinity/shader/parameter/Tr2RuntimeTextureParameter.js +71 -53
- package/dist/trinity/shader/parameter/Tr2RuntimeTextureParameter.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +81 -18
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js +46 -4
- package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js +32 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js +27 -0
- package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +29 -4
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js +32 -2
- package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js.map +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js +57 -5
- package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js.map +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js +111 -5
- package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js.map +1 -1
- package/docs/trinity/reference/classes/generated.md +20 -20
- package/docs/trinity/reference/classes/post-process.md +1 -1
- package/package.json +1 -1
- package/dist/trinity/generated/eve/effect/EveOccluder.js +0 -38
- package/dist/trinity/generated/eve/effect/EveOccluder.js.map +0 -1
- package/dist/trinity/generated/trinityCore/Tr2GpuStructuredBuffer.js +0 -48
- package/dist/trinity/generated/trinityCore/Tr2GpuStructuredBuffer.js.map +0 -1
|
@@ -44,5 +44,8 @@ const PostProcessEffectPaths = Object.freeze({
|
|
|
44
44
|
Blur: POST_PROCESS + "Blur.fx"
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
/** The light-list compute effect the light manager is created with (`EveSpaceScene.cpp:1380`). */
|
|
48
|
+
const COMPUTE_LIGHT_LISTS_EFFECT_PATH = "res:/graphics/effect/managed/space/system/computelightlists.fx";
|
|
49
|
+
|
|
50
|
+
export { BLIT_EFFECT_PATH, BLIT_FILTERED_EFFECT_PATH, COMPUTE_LIGHT_LISTS_EFFECT_PATH, OCCLUDER_MANAGEMENT_EFFECT_PATH, PostProcessEffectPaths };
|
|
48
51
|
//# sourceMappingURL=effectPaths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effectPaths.js","sources":["../../../../src/global/consts/effectPaths.js"],"sourcesContent":["// Source: trinity/trinity/Tr2Blitter.cpp (BLIT_EFFECT_PATH, BLIT_FILTERED_EFFECT_PATH)\n// Source: trinity/trinity/PostProcess/Tr2PostProcessRenderer.cpp (the constructor's paths)\n//\n// The effect paths Trinity's own classes create effects from, as Carbon spells\n// them. Shared from here so any layer - a host preloading them, a tool listing\n// what a frame needs, a test - names the same files the classes load.\n\n/** Carbon's two blit effect paths (`Tr2Blitter.cpp:11-12`). */\nexport const BLIT_EFFECT_PATH = \"res:/Graphics/Effect/Managed/space/system/Blit.fx\";\nexport const BLIT_FILTERED_EFFECT_PATH = \"res:/Graphics/Effect/Managed/space/system/BlitFiltered.fx\";\n\n/** The lens-flare occlusion buffer's compute effect (`EveOccluder.cpp:18`): Clear and CopyCounters. */\nexport const OCCLUDER_MANAGEMENT_EFFECT_PATH = \"res:/Graphics/Effect/Managed/Space/SpecialFX/Lensflares/OccluderManagement.fx\";\n\nconst POST_PROCESS = \"res:/Graphics/Effect/Managed/Space/PostProcess/\";\n\n/**\n * The effects `Tr2PostProcessRenderer`'s constructor and passes create\n * (`Tr2PostProcessRenderer.cpp:537-635, 1256-1259, 911-921`), keyed by file.\n */\nexport const PostProcessEffectPaths = Object.freeze({\n ToneMapping: POST_PROCESS + \"ToneMapping.fx\",\n ReactiveMask: POST_PROCESS + \"ReactiveMask.fx\",\n TransparencyMask: POST_PROCESS + \"TransparencyMask.fx\",\n HighPassFilter: POST_PROCESS + \"HighPassFilter.fx\",\n Downsample: POST_PROCESS + \"Downsample.fx\",\n Upsample: POST_PROCESS + \"Upsample.fx\",\n ExposureToTexture: POST_PROCESS + \"ExposureToTexture.fx\",\n CreateHistograms: POST_PROCESS + \"CreateHistograms.fx\",\n MergeHistograms: POST_PROCESS + \"MergeHistograms.fx\",\n MeasureExposure: POST_PROCESS + \"MeasureExposure.fx\",\n ExposureDebug: POST_PROCESS + \"ExposureDebug.fx\",\n CAS: POST_PROCESS + \"CAS.fx\",\n DownsampleDepth: POST_PROCESS + \"DownsampleDepth.fx\",\n EnvironmentFogColor: POST_PROCESS + \"EnvironmentFogColor.fx\",\n EnvironmentFogComposit: POST_PROCESS + \"EnvironmentFogComposit.fx\",\n Bokeh: POST_PROCESS + \"Bokeh.fx\",\n BokehTAA: POST_PROCESS + \"BokehTAA.fx\",\n CircleOfConfusion: POST_PROCESS + \"CircleOfConfusion.fx\",\n Godrays: POST_PROCESS + \"Godrays.fx\",\n SignalLoss: POST_PROCESS + \"SignalLoss.fx\",\n FilmGrain: POST_PROCESS + \"FilmGrain.fx\",\n TAA: POST_PROCESS + \"TAA.fx\",\n TAACopy: POST_PROCESS + \"TAACopy.fx\",\n Blur: POST_PROCESS + \"Blur.fx\"\n});\n"],"names":["BLIT_EFFECT_PATH","BLIT_FILTERED_EFFECT_PATH","OCCLUDER_MANAGEMENT_EFFECT_PATH","POST_PROCESS","PostProcessEffectPaths","Object","freeze","ToneMapping","ReactiveMask","TransparencyMask","HighPassFilter","Downsample","Upsample","ExposureToTexture","CreateHistograms","MergeHistograms","MeasureExposure","ExposureDebug","CAS","DownsampleDepth","EnvironmentFogColor","EnvironmentFogComposit","Bokeh","BokehTAA","CircleOfConfusion","Godrays","SignalLoss","FilmGrain","TAA","TAACopy","Blur"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACO,MAAMA,gBAAgB,GAAG;AACzB,MAAMC,yBAAyB,GAAG;;AAEzC;AACO,MAAMC,+BAA+B,GAAG;AAE/C,MAAMC,YAAY,GAAG,iDAAiD;;AAEtE;AACA;AACA;AACA;MACaC,sBAAsB,GAAGC,MAAM,CAACC,MAAM,CAAC;EAClDC,WAAW,EAAEJ,YAAY,GAAG,gBAAgB;EAC5CK,YAAY,EAAEL,YAAY,GAAG,iBAAiB;EAC9CM,gBAAgB,EAAEN,YAAY,GAAG,qBAAqB;EACtDO,cAAc,EAAEP,YAAY,GAAG,mBAAmB;EAClDQ,UAAU,EAAER,YAAY,GAAG,eAAe;EAC1CS,QAAQ,EAAET,YAAY,GAAG,aAAa;EACtCU,iBAAiB,EAAEV,YAAY,GAAG,sBAAsB;EACxDW,gBAAgB,EAAEX,YAAY,GAAG,qBAAqB;EACtDY,eAAe,EAAEZ,YAAY,GAAG,oBAAoB;EACpDa,eAAe,EAAEb,YAAY,GAAG,oBAAoB;EACpDc,aAAa,EAAEd,YAAY,GAAG,kBAAkB;EAChDe,GAAG,EAAEf,YAAY,GAAG,QAAQ;EAC5BgB,eAAe,EAAEhB,YAAY,GAAG,oBAAoB;EACpDiB,mBAAmB,EAAEjB,YAAY,GAAG,wBAAwB;EAC5DkB,sBAAsB,EAAElB,YAAY,GAAG,2BAA2B;EAClEmB,KAAK,EAAEnB,YAAY,GAAG,UAAU;EAChCoB,QAAQ,EAAEpB,YAAY,GAAG,aAAa;EACtCqB,iBAAiB,EAAErB,YAAY,GAAG,sBAAsB;EACxDsB,OAAO,EAAEtB,YAAY,GAAG,YAAY;EACpCuB,UAAU,EAAEvB,YAAY,GAAG,eAAe;EAC1CwB,SAAS,EAAExB,YAAY,GAAG,cAAc;EACxCyB,GAAG,EAAEzB,YAAY,GAAG,QAAQ;EAC5B0B,OAAO,EAAE1B,YAAY,GAAG,YAAY;EACpC2B,IAAI,EAAE3B,YAAY,GAAG;AACvB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"effectPaths.js","sources":["../../../../src/global/consts/effectPaths.js"],"sourcesContent":["// Source: trinity/trinity/Tr2Blitter.cpp (BLIT_EFFECT_PATH, BLIT_FILTERED_EFFECT_PATH)\n// Source: trinity/trinity/PostProcess/Tr2PostProcessRenderer.cpp (the constructor's paths)\n//\n// The effect paths Trinity's own classes create effects from, as Carbon spells\n// them. Shared from here so any layer - a host preloading them, a tool listing\n// what a frame needs, a test - names the same files the classes load.\n\n/** Carbon's two blit effect paths (`Tr2Blitter.cpp:11-12`). */\nexport const BLIT_EFFECT_PATH = \"res:/Graphics/Effect/Managed/space/system/Blit.fx\";\nexport const BLIT_FILTERED_EFFECT_PATH = \"res:/Graphics/Effect/Managed/space/system/BlitFiltered.fx\";\n\n/** The lens-flare occlusion buffer's compute effect (`EveOccluder.cpp:18`): Clear and CopyCounters. */\nexport const OCCLUDER_MANAGEMENT_EFFECT_PATH = \"res:/Graphics/Effect/Managed/Space/SpecialFX/Lensflares/OccluderManagement.fx\";\n\nconst POST_PROCESS = \"res:/Graphics/Effect/Managed/Space/PostProcess/\";\n\n/**\n * The effects `Tr2PostProcessRenderer`'s constructor and passes create\n * (`Tr2PostProcessRenderer.cpp:537-635, 1256-1259, 911-921`), keyed by file.\n */\nexport const PostProcessEffectPaths = Object.freeze({\n ToneMapping: POST_PROCESS + \"ToneMapping.fx\",\n ReactiveMask: POST_PROCESS + \"ReactiveMask.fx\",\n TransparencyMask: POST_PROCESS + \"TransparencyMask.fx\",\n HighPassFilter: POST_PROCESS + \"HighPassFilter.fx\",\n Downsample: POST_PROCESS + \"Downsample.fx\",\n Upsample: POST_PROCESS + \"Upsample.fx\",\n ExposureToTexture: POST_PROCESS + \"ExposureToTexture.fx\",\n CreateHistograms: POST_PROCESS + \"CreateHistograms.fx\",\n MergeHistograms: POST_PROCESS + \"MergeHistograms.fx\",\n MeasureExposure: POST_PROCESS + \"MeasureExposure.fx\",\n ExposureDebug: POST_PROCESS + \"ExposureDebug.fx\",\n CAS: POST_PROCESS + \"CAS.fx\",\n DownsampleDepth: POST_PROCESS + \"DownsampleDepth.fx\",\n EnvironmentFogColor: POST_PROCESS + \"EnvironmentFogColor.fx\",\n EnvironmentFogComposit: POST_PROCESS + \"EnvironmentFogComposit.fx\",\n Bokeh: POST_PROCESS + \"Bokeh.fx\",\n BokehTAA: POST_PROCESS + \"BokehTAA.fx\",\n CircleOfConfusion: POST_PROCESS + \"CircleOfConfusion.fx\",\n Godrays: POST_PROCESS + \"Godrays.fx\",\n SignalLoss: POST_PROCESS + \"SignalLoss.fx\",\n FilmGrain: POST_PROCESS + \"FilmGrain.fx\",\n TAA: POST_PROCESS + \"TAA.fx\",\n TAACopy: POST_PROCESS + \"TAACopy.fx\",\n Blur: POST_PROCESS + \"Blur.fx\"\n});\n\n/** The light-list compute effect the light manager is created with (`EveSpaceScene.cpp:1380`). */\nexport const COMPUTE_LIGHT_LISTS_EFFECT_PATH = \"res:/graphics/effect/managed/space/system/computelightlists.fx\";\n"],"names":["BLIT_EFFECT_PATH","BLIT_FILTERED_EFFECT_PATH","OCCLUDER_MANAGEMENT_EFFECT_PATH","POST_PROCESS","PostProcessEffectPaths","Object","freeze","ToneMapping","ReactiveMask","TransparencyMask","HighPassFilter","Downsample","Upsample","ExposureToTexture","CreateHistograms","MergeHistograms","MeasureExposure","ExposureDebug","CAS","DownsampleDepth","EnvironmentFogColor","EnvironmentFogComposit","Bokeh","BokehTAA","CircleOfConfusion","Godrays","SignalLoss","FilmGrain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EAAE1B,YAAY,GAAG,YAAY;EACpC2B,IAAI,EAAE3B,YAAY,GAAG;AACvB,CAAC;;AAED;AACO,MAAM4B,+BAA+B,GAAG;;;;"}
|
|
@@ -9,7 +9,7 @@ export { DxgiFormat, normalizeDxgiFormat } from './d3d/dxgiFormats.js';
|
|
|
9
9
|
export { D3dPrimitiveTopology } from './d3d/primitiveTopology.js';
|
|
10
10
|
export { BLUEERROR, BLUELISTEVENT } from './blue.js';
|
|
11
11
|
export { Tr2Lod } from './trinity.js';
|
|
12
|
-
export { BLIT_EFFECT_PATH, BLIT_FILTERED_EFFECT_PATH, OCCLUDER_MANAGEMENT_EFFECT_PATH, PostProcessEffectPaths } from './effectPaths.js';
|
|
12
|
+
export { BLIT_EFFECT_PATH, BLIT_FILTERED_EFFECT_PATH, COMPUTE_LIGHT_LISTS_EFFECT_PATH, OCCLUDER_MANAGEMENT_EFFECT_PATH, PostProcessEffectPaths } from './effectPaths.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Shared constant vocabularies: canonical string tokens (media and payload
|
package/dist/global/index.js
CHANGED
|
@@ -119,7 +119,7 @@ import * as tangent from './math/tangent.js';
|
|
|
119
119
|
export { tangent };
|
|
120
120
|
export { isResFileAddressFor, parseResFileAddress, resFileAddress } from './utils/resFile.js';
|
|
121
121
|
export { AudioChannelLayout, AudioSampleFormat, normalizeAudioSampleFormat } from './consts/audio/audioFormats.js';
|
|
122
|
-
export { BLIT_EFFECT_PATH, BLIT_FILTERED_EFFECT_PATH, OCCLUDER_MANAGEMENT_EFFECT_PATH, PostProcessEffectPaths } from './consts/effectPaths.js';
|
|
122
|
+
export { BLIT_EFFECT_PATH, BLIT_FILTERED_EFFECT_PATH, COMPUTE_LIGHT_LISTS_EFFECT_PATH, OCCLUDER_MANAGEMENT_EFFECT_PATH, PostProcessEffectPaths } from './consts/effectPaths.js';
|
|
123
123
|
export { BLUEERROR, BLUELISTEVENT } from './consts/blue.js';
|
|
124
124
|
export { CJS_OPERATION_CANCELLED, CjsCancellationError } from './utils/errors/CjsCancellationError.js';
|
|
125
125
|
export { CjsError } from './utils/errors/CjsError.js';
|
package/dist/index.js
CHANGED
|
@@ -479,6 +479,7 @@ export { IEveDistributionSpawner } from './trinity/eve/distribution/spawners/IEv
|
|
|
479
479
|
export { EveMultiEffect } from './trinity/eve/effect/multiEffect/EveMultiEffect.js';
|
|
480
480
|
export { EveMultiEffectParameter } from './trinity/eve/effect/multiEffect/EveMultiEffectParameter.js';
|
|
481
481
|
export { EveLensflare } from './trinity/eve/effect/lensflare/EveLensflare.js';
|
|
482
|
+
export { EveOccluder } from './trinity/eve/effect/lensflare/EveOccluder.js';
|
|
482
483
|
export { Tr2OcclusionBuffer } from './trinity/eve/effect/lensflare/Tr2OcclusionBuffer.js';
|
|
483
484
|
export { EveBoxVolume } from './trinity/eve/volume/EveBoxVolume.js';
|
|
484
485
|
export { EveEllipsoidVolume } from './trinity/eve/volume/EveEllipsoidVolume.js';
|
|
@@ -781,6 +782,7 @@ export { Tr2SwapChain } from './trinity/core/device/Tr2SwapChain.js';
|
|
|
781
782
|
export { Tr2DepthStencil } from './trinity/core/device/Tr2DepthStencil.js';
|
|
782
783
|
export { Tr2RenderTarget } from './trinity/core/device/Tr2RenderTarget.js';
|
|
783
784
|
export { Tr2GpuBuffer } from './trinity/core/device/Tr2GpuBuffer.js';
|
|
785
|
+
export { Tr2GpuStructuredBuffer } from './trinity/core/device/Tr2GpuStructuredBuffer.js';
|
|
784
786
|
export { Tr2RingBufferOffsets } from './trinity/core/device/Tr2RingBuffer/Tr2RingBufferOffsets.js';
|
|
785
787
|
export { Tr2RingBuffer } from './trinity/core/device/Tr2RingBuffer/Tr2RingBuffer.js';
|
|
786
788
|
export { Tr2RuntimeGpuBuffer } from './trinity/core/device/Tr2RuntimeGpuBuffer.js';
|
|
@@ -855,7 +857,6 @@ export { Tr2PresentParameters } from './trinity/ui/Tr2PresentParameters.js';
|
|
|
855
857
|
export { Tr2ProjectBoundingBoxBracket } from './trinity/ui/Tr2ProjectBoundingBoxBracket.js';
|
|
856
858
|
export { EveCloudEditableVolume } from './trinity/generated/eve/child/EveCloudEditableVolume.js';
|
|
857
859
|
export { MorphTargetAnimationFilter, Origin, PropagationType, RenderType, RotationalConstraints, Status, TriggerType, lineSetType } from './trinity/generated/eve/child/enums.js';
|
|
858
|
-
export { EveOccluder } from './trinity/generated/eve/effect/EveOccluder.js';
|
|
859
860
|
export { EveStarfield } from './trinity/generated/eve/effect/EveStarfield.js';
|
|
860
861
|
export { AmbientOcclusionQuality, AntiAliasingQuality, BackgroundRenderingReason, BoundingSphereQuery, EveVisualizeMethod, ParameterType, ReflectionQuality, ReflectionSetting, VisualizerType } from './trinity/generated/eve/enums.js';
|
|
861
862
|
export { PerLightShadowSetting } from './trinity/generated/eve/lights/enums.js';
|
|
@@ -889,7 +890,6 @@ export { Tr2TexturedSpriteObject } from './trinity/generated/sprite2d/Tr2Texture
|
|
|
889
890
|
export { CornerType, TextureRepeat, Tr2Sprite2dRenderEffect, Tr2Sprite2dTextureSettings, Tr2SpriteObjectBlendMode, Tr2SpriteObjectEffect, Tr2SpriteObjectPickState, Tr2SpriteTarget, Tr2StretchScaleBehavior } from './trinity/generated/sprite2d/enums.js';
|
|
890
891
|
export { Tr2AtlasTexture } from './trinity/generated/trinityCore/Tr2AtlasTexture.js';
|
|
891
892
|
export { Tr2GpuProfiler } from './trinity/generated/trinityCore/Tr2GpuProfiler.js';
|
|
892
|
-
export { Tr2GpuStructuredBuffer } from './trinity/generated/trinityCore/Tr2GpuStructuredBuffer.js';
|
|
893
893
|
export { Tr2GrannyPrimitiveSet } from './trinity/generated/trinityCore/Tr2GrannyPrimitiveSet.js';
|
|
894
894
|
export { Tr2HostBitmap } from './trinity/generated/trinityCore/Tr2HostBitmap.js';
|
|
895
895
|
export { Tr2ImpostorManager } from './trinity/generated/trinityCore/Tr2ImpostorManager.js';
|
|
@@ -1157,7 +1157,7 @@ export { Tr2VideoAdapter } from './core/platform/Tr2VideoAdapter.js';
|
|
|
1157
1157
|
export { Tr2VideoAdapters } from './core/platform/Tr2VideoAdapters.js';
|
|
1158
1158
|
export { Tr2VideoDriver } from './core/platform/Tr2VideoDriver.js';
|
|
1159
1159
|
export { AudioChannelLayout, AudioSampleFormat, normalizeAudioSampleFormat } from './global/consts/audio/audioFormats.js';
|
|
1160
|
-
export { BLIT_EFFECT_PATH, BLIT_FILTERED_EFFECT_PATH, OCCLUDER_MANAGEMENT_EFFECT_PATH, PostProcessEffectPaths } from './global/consts/effectPaths.js';
|
|
1160
|
+
export { BLIT_EFFECT_PATH, BLIT_FILTERED_EFFECT_PATH, COMPUTE_LIGHT_LISTS_EFFECT_PATH, OCCLUDER_MANAGEMENT_EFFECT_PATH, PostProcessEffectPaths } from './global/consts/effectPaths.js';
|
|
1161
1161
|
export { BLUEERROR, BLUELISTEVENT } from './global/consts/blue.js';
|
|
1162
1162
|
export { CJS_OPERATION_CANCELLED, CjsCancellationError } from './global/utils/errors/CjsCancellationError.js';
|
|
1163
1163
|
export { CjsError } from './global/utils/errors/CjsError.js';
|
|
@@ -68,7 +68,24 @@ const CARBON_BACKEND_RESOURCE_KIND = Object.freeze(["uniform-buffer", "sampled-r
|
|
|
68
68
|
* and it is stored because the WGSL type cannot carry it: `array<u32>` is
|
|
69
69
|
* both an R32_UINT view and a compute raw-word buffer.
|
|
70
70
|
*/
|
|
71
|
-
const CARBON_BACKEND_TYPED_VIEW = Object.freeze(["", "R32_FLOAT", "R32_UINT"]);
|
|
71
|
+
const CARBON_BACKEND_TYPED_VIEW = Object.freeze(["", "R32_FLOAT", "R32_UINT", "R8G8B8A8_SNORM"]);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The generated symbol of the emulated-addressing modes buffer, a uniform
|
|
75
|
+
* binding the translator adds (webgpu/core/wgsl/emulatedAddressing.js) and the
|
|
76
|
+
* backend fills itself from the bound sampler states. It travels as the
|
|
77
|
+
* binding's symbol, so it lives here, beside the rest of the wire.
|
|
78
|
+
*/
|
|
79
|
+
const CARBON_BACKEND_ADDRESS_MODES_SYMBOL = "cjsAddressModes";
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The prefix of a pixel shader's per-target UNORM override, `cjsUnormTarget<N>`
|
|
83
|
+
* for the output at location N. The backend sets it on a pipeline whose target
|
|
84
|
+
* N is a float stand-in for a 16-bit UNORM format, and the output is then
|
|
85
|
+
* stored as D3D stores to UNORM: clamped to [0, 1], NaN as 0. It travels in the
|
|
86
|
+
* WGSL, so it lives here, beside the rest of the wire.
|
|
87
|
+
*/
|
|
88
|
+
const CARBON_BACKEND_UNORM_TARGET_OVERRIDE = "cjsUnormTarget";
|
|
72
89
|
|
|
73
90
|
/**
|
|
74
91
|
* A texture binding's sample type, ordered so the wire value is stable. The
|
|
@@ -437,5 +454,5 @@ function readBackendBlock(bytes, options = {}) {
|
|
|
437
454
|
};
|
|
438
455
|
}
|
|
439
456
|
|
|
440
|
-
export { CARBON_BACKEND_RESOURCE_KIND, CARBON_BACKEND_TEXTURE_SAMPLE_TYPE, CARBON_BACKEND_TYPED_VIEW, CARBON_BACKEND_VISIBILITY, readBackendBlock, writeBackendBlock };
|
|
457
|
+
export { CARBON_BACKEND_ADDRESS_MODES_SYMBOL, CARBON_BACKEND_RESOURCE_KIND, CARBON_BACKEND_TEXTURE_SAMPLE_TYPE, CARBON_BACKEND_TYPED_VIEW, CARBON_BACKEND_UNORM_TARGET_OVERRIDE, CARBON_BACKEND_VISIBILITY, readBackendBlock, writeBackendBlock };
|
|
441
458
|
//# sourceMappingURL=carbonEffectBackendBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carbonEffectBackendBlock.js","sources":["../../../../../src/resource/format/carbonEffect/carbonEffectBackendBlock.js"],"sourcesContent":["import { CjsByteWriter } from \"../CjsByteWriter.js\";\nimport { CjsByteReader } from \"../CjsByteReader.js\";\nimport { CjsFormatReadError, CjsFormatWriteError } from \"../CjsFormatError.js\";\nimport {\n CARBON_BACKEND_ENGINE_ID,\n readBackendEngineId\n} from \"./backendEngineId.js\";\nimport {\n CARBON_BACKEND_TRANSFORM_FAMILY,\n DETAIL_MAP_ARRAY_DEFAULTS,\n readInlineString,\n readTransformSection,\n writeInlineString,\n writeTransformSection\n} from \"./carbonEffectResourceTransform.js\";\n\n/**\n * The WebGPU pass block: bind-group layouts plus the shared resource-transform\n * section.\n *\n * Neither is derivable from Carbon reflection. Carbon's `registers[]` is the D3D\n * binding model, while `(group, binding, visibility, generatedSymbol)` comes from\n * the *lowered IR's* bindings. So this is the port's only genuine invention, and\n * it is built entirely from Carbon's own techniques: count-prefixed fixed-width\n * records inside a blob referenced by `{u32 size, u32 offset}`, exactly like\n * program source.\n *\n * Both sections share **one** block rather than occupying two, because the\n * invariant worth keeping is \"the Carbon region is backend-invariant, with\n * exactly one optional trailing block\". They are also mutually required — a\n * transform needs a carrier binding in the same pass's layout and a transformed\n * binding needs a recipe — so one unit is the honest shape.\n *\n * ## Why the block is self-contained\n *\n * The block lives in the arena so that identical layouts dedupe across bodies the\n * way program source does; measured sharing is 30.5:1 at `(body, pass)`\n * granularity, 22 distinct blocks across 672 pairs.\n *\n * That forces one design consequence: **the block cannot contain arena offsets.**\n * An offset is only known after the arena's content sort, and the sort depends on\n * every blob's bytes — including this one. A block referencing the arena would\n * have to be interned before its own contents could be computed. Carbon never\n * meets this because no Carbon arena blob refers to the arena.\n *\n * So strings are inline here, length-prefixed, not interned. The cost is real but\n * small: a repeated `\"t11\"` inside 22 distinct blocks rather than one shared copy.\n * The block itself is what dedupes, and it dedupes 30x.\n */\n\n/**\n * The leading byte is the TARGET ENGINE IDENTIFIER, not a version.\n *\n * It was called CARBON_EFFECT_BACKEND_BLOCK_VERSION and emitted 1, while the\n * WebGL2 writer also emitted 1 meaning something unrelated - so the byte could\n * not do the one job it was there for. Renamed to what it is, and given a\n * distinct value per backend, it identifies the block.\n *\n * Carbon container version remains the only version. Nothing stores this block:\n * a consumer builds one and reads it back in the same process, so a block from\n * a different build is caught by the trailing-byte check at the end of the read.\n *\n * The identifier is shared with the WebGL2 block rather than duplicated, so the\n * two cannot drift into meaning the same number again.\n */\n\n/**\n * Resource kinds, ordered so the wire value is stable\n * (`buildWgslSet.js:117-122`).\n */\nexport const CARBON_BACKEND_RESOURCE_KIND = Object.freeze([\n \"uniform-buffer\",\n \"sampled-resource\",\n \"sampler\",\n \"storage-resource\"\n]);\n\n/**\n * The bound view format of a typed buffer or typed UAV texture, ordered so the\n * wire value is stable; the first means none. The format comes from where\n * Carbon creates the resource (`formats/hlsl/core/carbonTypedViews.js`),\n * and it is stored because the WGSL type cannot carry it: `array<u32>` is\n * both an R32_UINT view and a compute raw-word buffer.\n */\nexport const CARBON_BACKEND_TYPED_VIEW = Object.freeze([ \"\", \"R32_FLOAT\", \"R32_UINT\" ]);\n\n/**\n * A texture binding's sample type, ordered so the wire value is stable. The\n * first is the default and what every non-texture binding writes.\n */\nexport const CARBON_BACKEND_TEXTURE_SAMPLE_TYPE = Object.freeze([ \"float\", \"unfilterable-float\" ]);\n\n/** Shader stages, as a bit position in the visibility mask. */\nexport const CARBON_BACKEND_VISIBILITY = Object.freeze([ \"vertex\", \"fragment\", \"compute\" ]);\n\n// The transform section is shared with the GLSL block; both re-export the\n// family enum and defaults so a consumer of either codec sees them.\nexport { CARBON_BACKEND_TRANSFORM_FAMILY, DETAIL_MAP_ARRAY_DEFAULTS };\n\n/** Marks an absent optional `u32`. Carbon's null-reference value. */\nconst ABSENT = 0xffffffff;\n\n/**\n * Encodes a visibility list as a bit mask.\n *\n * @param {string[]} visibility Stage names.\n * @returns {number} Bit mask.\n */\nfunction packVisibility(visibility)\n{\n let mask = 0;\n for (const stage of visibility ?? [])\n {\n const bit = CARBON_BACKEND_VISIBILITY.indexOf(stage);\n if (bit < 0)\n {\n throw new CjsFormatWriteError(`Unknown binding visibility \"${stage}\"`, { stage });\n }\n mask |= 1 << bit;\n }\n return mask;\n}\n\n/**\n * Decodes a visibility bit mask, in the canonical stage order.\n *\n * @param {number} mask Bit mask.\n * @returns {string[]} Stage names.\n */\nfunction unpackVisibility(mask)\n{\n const stages = [];\n for (let bit = 0; bit < CARBON_BACKEND_VISIBILITY.length; bit += 1)\n {\n if (mask & (1 << bit)) stages.push(CARBON_BACKEND_VISIBILITY[bit]);\n }\n return stages;\n}\n\n/**\n * Rebuilds a binding's WebGPU descriptor from what the block does store.\n *\n * The descriptor — `buffer`, `texture` or `sampler` — is not on the wire because\n * it is a pure function of the WGSL type, the resource kind and the structure\n * stride, all three of which are. `lowerBindingLayout.js` derives it from the\n * same three inputs on the way out; this derives it back on the way in.\n *\n * The pairs that could collide do not. `array<u32>` reaches both a structured\n * buffer and a compute typed buffer, and the structure stride separates them:\n * structured always carries one, typed never does.\n *\n * One texture fact is not in the WGSL type and is stored: its sample type.\n * `texture_2d<f32>` is the same declaration whether the layout says `float` or\n * `unfilterable-float`, and only the lowering, which sees the instructions,\n * knows a texture is only ever loaded.\n *\n * @param {object} binding Decoded binding record.\n * @returns {object} The descriptor fragment, as one `{buffer|texture|sampler}` key.\n */\nfunction deriveBindingDescriptor(binding)\n{\n const stride = binding.structureStride;\n\n if (binding.resourceKind === \"sampler\")\n {\n return { sampler: { type: \"filtering\" } };\n }\n\n if (binding.resourceKind === \"uniform-buffer\")\n {\n const vec4Count = /^array<vec4<f32>, (\\d+)>$/u.exec(binding.type)?.[1];\n if (!vec4Count)\n {\n throw new CjsFormatReadError(\n `Backend block uniform binding has untranslatable type \"${binding.type}\"`,\n { type: binding.type }\n );\n }\n return {\n buffer: {\n type: \"uniform\",\n hasDynamicOffset: false,\n minBindingSize: Number(vec4Count) * 16\n }\n };\n }\n\n if (binding.resourceKind === \"sampled-resource\")\n {\n const texture = TEXTURE_DESCRIPTORS[binding.type];\n if (texture) return { texture: { ...texture, sampleType: binding.textureSampleType } };\n\n return {\n buffer: {\n type: \"read-only-storage\",\n hasDynamicOffset: false,\n minBindingSize: stride === undefined ? 4 : stride\n }\n };\n }\n\n // A storage texture's WGSL type names its dimension, format and access in\n // full (`lowerBindingLayout.js` storageTextureLayout), so nothing more is\n // stored for it.\n const storage = STORAGE_TEXTURE_TYPE.exec(binding.type);\n if (storage)\n {\n return {\n storageTexture: {\n access: STORAGE_TEXTURE_ACCESS[storage[3]],\n format: storage[2],\n viewDimension: storage[1].replace(\"_\", \"-\")\n }\n };\n }\n\n return {\n buffer: {\n type: \"storage\",\n hasDynamicOffset: false,\n minBindingSize: stride === undefined ? 4 : stride\n }\n };\n}\n\n/** `texture_storage_<dimension><<format>, <access>>`. */\nconst STORAGE_TEXTURE_TYPE = /^texture_storage_(2d|2d_array|3d)<(\\w+), (write|read|read_write)>$/u;\n\n/** WGSL storage-texture access to the WebGPU layout's `storageTexture.access`. */\nconst STORAGE_TEXTURE_ACCESS = Object.freeze({ write: \"write-only\", read: \"read-only\", read_write: \"read-write\" });\n\n/** Texture descriptors by WGSL type (`lowerBindingLayout.js:90-95`). */\nconst TEXTURE_DESCRIPTORS = Object.freeze({\n \"texture_2d<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"2d\", multisampled: false }),\n \"texture_cube<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"cube\", multisampled: false }),\n \"texture_3d<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"3d\", multisampled: false }),\n \"texture_2d_array<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"2d-array\", multisampled: false })\n});\n\n/**\n * Serialises one pass's backend block.\n *\n * @param {object} block Block contents.\n * @param {object[]} [block.bindGroups] Bind groups with their bindings.\n * @param {object[]} [block.transforms] Resource transforms.\n * @returns {Uint8Array} Self-contained block bytes.\n */\n/**\n * Refuses a binding whose derived fields disagree with what the reader rebuilds.\n *\n * `identity`, `scopeIdentity` and the per-binding `group` are not stored: the\n * reader recomputes them from the register triple, the visibility mask and the\n * enclosing group. A binding that carries a different value therefore does not\n * fail - it round-trips into a different binding, and the engine matches on\n * exactly these strings.\n *\n * `scopeIdentity` deserves the sharpest check, because the wire cannot preserve\n * what it is derived from. Visibility is stored as a **bitmask**, so it is a\n * set; `scopeIdentity` is built from `visibility[0]`, so it depends on an\n * order. A binding written as `[fragment, vertex]` reads back as\n * `[vertex, fragment]` and its scope silently moves from `@fragment` to\n * `@vertex`. Canonical order is the only order the format can represent, so a\n * producer must write it.\n *\n * @param {object} binding Binding record.\n * @param {object} group Enclosing bind group.\n */\nfunction assertDerivedBindingFieldsAgree(binding, group)\n{\n const identity = `${binding.resourceKind}:${binding.registerSpace}:${binding.registerIndex}`;\n const canonical = unpackVisibility(packVisibility(binding.visibility));\n const derived = [\n [ \"identity\", binding.identity, identity ],\n [ \"scopeIdentity\", binding.scopeIdentity, `${identity}@${canonical[0]}` ],\n [ \"group\", binding.group, group.group ]\n ];\n\n for (const [ field, actual, expected ] of derived)\n {\n if (actual === undefined || actual === null) continue;\n if (actual === expected) continue;\n\n throw new CjsFormatWriteError(\n `Binding ${identity} sets ${field} to ${JSON.stringify(actual)}, but the reader rebuilds`\n + ` ${JSON.stringify(expected)}. The value is not stored, so writing this would silently`\n + ` change the binding.`,\n { identity, field, actual, expected }\n );\n }\n}\n\n/**\n * Encode one canonical backend binding and transform block.\n * @param {object} block Backend block record.\n * @returns {Uint8Array} Encoded backend bytes.\n */\nexport function writeBackendBlock(block)\n{\n const bindGroups = block.bindGroups ?? [];\n const transforms = block.transforms ?? [];\n const writer = new CjsByteWriter(256);\n\n writer.u8(CARBON_BACKEND_ENGINE_ID.webgpu);\n\n writer.u8(bindGroups.length);\n for (const group of bindGroups)\n {\n writer.u8(group.group);\n writer.u8(group.bindings.length);\n for (const binding of group.bindings)\n {\n const kind = CARBON_BACKEND_RESOURCE_KIND.indexOf(binding.resourceKind);\n if (kind < 0)\n {\n throw new CjsFormatWriteError(`Unknown resource kind \"${binding.resourceKind}\"`, {\n resourceKind: binding.resourceKind\n });\n }\n assertDerivedBindingFieldsAgree(binding, group);\n writer.u8(kind);\n writer.u8(binding.registerSpace);\n writer.u8(binding.binding);\n writer.u8(packVisibility(binding.visibility));\n writer.u32(binding.registerIndex);\n writer.u32(binding.structureStride ?? ABSENT);\n writer.u8(binding.arrayLayerCount ?? 0);\n const sampleType = CARBON_BACKEND_TEXTURE_SAMPLE_TYPE.indexOf(binding.texture?.sampleType ?? \"float\");\n if (sampleType < 0)\n {\n throw new CjsFormatWriteError(`Unknown texture sample type \"${binding.texture.sampleType}\"`, {\n sampleType: binding.texture.sampleType\n });\n }\n writer.u8(sampleType);\n const typedView = CARBON_BACKEND_TYPED_VIEW.indexOf(binding.typedView ?? \"\");\n if (typedView < 0)\n {\n throw new CjsFormatWriteError(`Unknown typed view \"${binding.typedView}\"`, { typedView: binding.typedView });\n }\n writer.u8(typedView);\n writeInlineString(writer, binding.type);\n writeInlineString(writer, binding.generatedSymbol);\n // A binding either carries a transform id or it does not; an empty\n // string is not a legal id, so length zero encodes absence.\n writeInlineString(writer, binding.transformId ?? \"\");\n }\n }\n\n writeTransformSection(writer, transforms);\n\n return writer.toBytes();\n}\n\n/**\n * Parses one pass's backend block, restoring every derived field.\n *\n * @param {ArrayBuffer|ArrayBufferView|Uint8Array} bytes Block bytes.\n * @param {object} [options] Read options.\n * @param {string} [options.layoutKey] Enclosing pass key, restored onto records.\n * @param {string} [options.source] Source name for error details.\n * @returns {object} Block contents with derived fields restored.\n */\nexport function readBackendBlock(bytes, options = {})\n{\n const reader = new CjsByteReader(bytes, { source: options.source ?? \"backend block\" });\n const layoutKey = options.layoutKey ?? null;\n\n readBackendEngineId(reader, CARBON_BACKEND_ENGINE_ID.webgpu, options.source ?? \"backend block\");\n\n const bindGroups = [];\n const groupCount = reader.ReadUint8();\n for (let groupIndex = 0; groupIndex < groupCount; groupIndex += 1)\n {\n const group = reader.ReadUint8();\n const bindings = [];\n const bindingCount = reader.ReadUint8();\n for (let index = 0; index < bindingCount; index += 1)\n {\n const resourceKind = CARBON_BACKEND_RESOURCE_KIND[reader.ReadUint8()];\n const registerSpace = reader.ReadUint8();\n const binding = reader.ReadUint8();\n const visibility = unpackVisibility(reader.ReadUint8());\n const registerIndex = reader.ReadUint32();\n const structureStride = reader.ReadUint32();\n const arrayLayerCount = reader.ReadUint8();\n const textureSampleType = CARBON_BACKEND_TEXTURE_SAMPLE_TYPE[reader.ReadUint8()];\n if (!textureSampleType)\n {\n throw new CjsFormatReadError(\"Backend block binding has an unknown texture sample type\", {\n source: options.source ?? \"backend block\"\n });\n }\n const typedView = CARBON_BACKEND_TYPED_VIEW[reader.ReadUint8()];\n if (typedView === undefined)\n {\n throw new CjsFormatReadError(\"Backend block binding has an unknown typed view\", {\n source: options.source ?? \"backend block\"\n });\n }\n const type = readInlineString(reader);\n const generatedSymbol = readInlineString(reader);\n const transformId = readInlineString(reader);\n\n const identity = `${resourceKind}:${registerSpace}:${registerIndex}`;\n const record = {\n group,\n binding,\n resourceKind,\n registerSpace,\n registerIndex,\n visibility,\n type,\n generatedSymbol,\n identity,\n scopeIdentity: `${identity}@${visibility[0]}`,\n ...(structureStride === ABSENT ? {} : { structureStride }),\n ...(arrayLayerCount === 0 ? {} : { arrayLayerCount }),\n ...(typedView === \"\" ? {} : { typedView }),\n ...(transformId === \"\" ? {} : { transformId })\n };\n bindings.push({ ...record, ...deriveBindingDescriptor({ ...record, textureSampleType }) });\n }\n bindGroups.push({ group, bindings });\n }\n\n const transforms = readTransformSection(reader, layoutKey);\n\n // A sized record must land exactly on its declared end. Trailing bytes mean\n // the writer knew fields this reader does not, which with no version byte is\n // the ONLY signal that a block came from a different build - so this check is\n // load-bearing rather than defensive.\n // This is the only surviving form of a closed-schema check: under a record\n // layout a field either exists at its offset or the read fails, so there is\n // nothing per-field left to assert, but exhaustiveness is still checkable and\n // is exactly what a silently-discarded tail would violate.\n if (reader.remaining !== 0)\n {\n throw new CjsFormatReadError(\n `Backend block has ${reader.remaining} unparsed trailing byte(s); rebuild the effect package`,\n { source: options.source ?? \"backend block\", trailingBytes: reader.remaining }\n );\n }\n\n return {\n layoutKey,\n bindGroups,\n transforms,\n trailingBytes: 0\n };\n}\n"],"names":["CARBON_BACKEND_RESOURCE_KIND","Object","freeze","CARBON_BACKEND_TYPED_VIEW","CARBON_BACKEND_TEXTURE_SAMPLE_TYPE","CARBON_BACKEND_VISIBILITY","ABSENT","packVisibility","visibility","mask","stage","bit","indexOf","CjsFormatWriteError","unpackVisibility","stages","length","push","deriveBindingDescriptor","binding","stride","structureStride","resourceKind","sampler","type","vec4Count","exec","CjsFormatReadError","buffer","hasDynamicOffset","minBindingSize","Number","texture","TEXTURE_DESCRIPTORS","sampleType","textureSampleType","undefined","storage","STORAGE_TEXTURE_TYPE","storageTexture","access","STORAGE_TEXTURE_ACCESS","format","viewDimension","replace","write","read","read_write","multisampled","assertDerivedBindingFieldsAgree","group","identity","registerSpace","registerIndex","canonical","derived","scopeIdentity","field","actual","expected","JSON","stringify","writeBackendBlock","block","bindGroups","transforms","writer","CjsByteWriter","u8","CARBON_BACKEND_ENGINE_ID","webgpu","bindings","kind","u32","arrayLayerCount","typedView","writeInlineString","generatedSymbol","transformId","writeTransformSection","toBytes","readBackendBlock","bytes","options","reader","CjsByteReader","source","layoutKey","readBackendEngineId","groupCount","ReadUint8","groupIndex","bindingCount","index","ReadUint32","readInlineString","record","readTransformSection","remaining","trailingBytes"],"mappings":";;;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;MACaA,4BAA4B,GAAGC,MAAM,CAACC,MAAM,CAAC,CACtD,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,kBAAkB,CACrB;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,yBAAyB,GAAGF,MAA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L,EAAA;EAEA,OAAO;IACHX,SAAS;IACTvB,UAAU;IACVC,UAAU;AACVkC,IAAAA,aAAa,EAAE;GAClB;AACL;;;;"}
|
|
1
|
+
{"version":3,"file":"carbonEffectBackendBlock.js","sources":["../../../../../src/resource/format/carbonEffect/carbonEffectBackendBlock.js"],"sourcesContent":["import { CjsByteWriter } from \"../CjsByteWriter.js\";\nimport { CjsByteReader } from \"../CjsByteReader.js\";\nimport { CjsFormatReadError, CjsFormatWriteError } from \"../CjsFormatError.js\";\nimport {\n CARBON_BACKEND_ENGINE_ID,\n readBackendEngineId\n} from \"./backendEngineId.js\";\nimport {\n CARBON_BACKEND_TRANSFORM_FAMILY,\n DETAIL_MAP_ARRAY_DEFAULTS,\n readInlineString,\n readTransformSection,\n writeInlineString,\n writeTransformSection\n} from \"./carbonEffectResourceTransform.js\";\n\n/**\n * The WebGPU pass block: bind-group layouts plus the shared resource-transform\n * section.\n *\n * Neither is derivable from Carbon reflection. Carbon's `registers[]` is the D3D\n * binding model, while `(group, binding, visibility, generatedSymbol)` comes from\n * the *lowered IR's* bindings. So this is the port's only genuine invention, and\n * it is built entirely from Carbon's own techniques: count-prefixed fixed-width\n * records inside a blob referenced by `{u32 size, u32 offset}`, exactly like\n * program source.\n *\n * Both sections share **one** block rather than occupying two, because the\n * invariant worth keeping is \"the Carbon region is backend-invariant, with\n * exactly one optional trailing block\". They are also mutually required — a\n * transform needs a carrier binding in the same pass's layout and a transformed\n * binding needs a recipe — so one unit is the honest shape.\n *\n * ## Why the block is self-contained\n *\n * The block lives in the arena so that identical layouts dedupe across bodies the\n * way program source does; measured sharing is 30.5:1 at `(body, pass)`\n * granularity, 22 distinct blocks across 672 pairs.\n *\n * That forces one design consequence: **the block cannot contain arena offsets.**\n * An offset is only known after the arena's content sort, and the sort depends on\n * every blob's bytes — including this one. A block referencing the arena would\n * have to be interned before its own contents could be computed. Carbon never\n * meets this because no Carbon arena blob refers to the arena.\n *\n * So strings are inline here, length-prefixed, not interned. The cost is real but\n * small: a repeated `\"t11\"` inside 22 distinct blocks rather than one shared copy.\n * The block itself is what dedupes, and it dedupes 30x.\n */\n\n/**\n * The leading byte is the TARGET ENGINE IDENTIFIER, not a version.\n *\n * It was called CARBON_EFFECT_BACKEND_BLOCK_VERSION and emitted 1, while the\n * WebGL2 writer also emitted 1 meaning something unrelated - so the byte could\n * not do the one job it was there for. Renamed to what it is, and given a\n * distinct value per backend, it identifies the block.\n *\n * Carbon container version remains the only version. Nothing stores this block:\n * a consumer builds one and reads it back in the same process, so a block from\n * a different build is caught by the trailing-byte check at the end of the read.\n *\n * The identifier is shared with the WebGL2 block rather than duplicated, so the\n * two cannot drift into meaning the same number again.\n */\n\n/**\n * Resource kinds, ordered so the wire value is stable\n * (`buildWgslSet.js:117-122`).\n */\nexport const CARBON_BACKEND_RESOURCE_KIND = Object.freeze([\n \"uniform-buffer\",\n \"sampled-resource\",\n \"sampler\",\n \"storage-resource\"\n]);\n\n/**\n * The bound view format of a typed buffer or typed UAV texture, ordered so the\n * wire value is stable; the first means none. The format comes from where\n * Carbon creates the resource (`formats/hlsl/core/carbonTypedViews.js`),\n * and it is stored because the WGSL type cannot carry it: `array<u32>` is\n * both an R32_UINT view and a compute raw-word buffer.\n */\nexport const CARBON_BACKEND_TYPED_VIEW = Object.freeze([ \"\", \"R32_FLOAT\", \"R32_UINT\", \"R8G8B8A8_SNORM\" ]);\n\n/**\n * The generated symbol of the emulated-addressing modes buffer, a uniform\n * binding the translator adds (webgpu/core/wgsl/emulatedAddressing.js) and the\n * backend fills itself from the bound sampler states. It travels as the\n * binding's symbol, so it lives here, beside the rest of the wire.\n */\nexport const CARBON_BACKEND_ADDRESS_MODES_SYMBOL = \"cjsAddressModes\";\n\n/**\n * The prefix of a pixel shader's per-target UNORM override, `cjsUnormTarget<N>`\n * for the output at location N. The backend sets it on a pipeline whose target\n * N is a float stand-in for a 16-bit UNORM format, and the output is then\n * stored as D3D stores to UNORM: clamped to [0, 1], NaN as 0. It travels in the\n * WGSL, so it lives here, beside the rest of the wire.\n */\nexport const CARBON_BACKEND_UNORM_TARGET_OVERRIDE = \"cjsUnormTarget\";\n\n/**\n * A texture binding's sample type, ordered so the wire value is stable. The\n * first is the default and what every non-texture binding writes.\n */\nexport const CARBON_BACKEND_TEXTURE_SAMPLE_TYPE = Object.freeze([ \"float\", \"unfilterable-float\" ]);\n\n/** Shader stages, as a bit position in the visibility mask. */\nexport const CARBON_BACKEND_VISIBILITY = Object.freeze([ \"vertex\", \"fragment\", \"compute\" ]);\n\n// The transform section is shared with the GLSL block; both re-export the\n// family enum and defaults so a consumer of either codec sees them.\nexport { CARBON_BACKEND_TRANSFORM_FAMILY, DETAIL_MAP_ARRAY_DEFAULTS };\n\n/** Marks an absent optional `u32`. Carbon's null-reference value. */\nconst ABSENT = 0xffffffff;\n\n/**\n * Encodes a visibility list as a bit mask.\n *\n * @param {string[]} visibility Stage names.\n * @returns {number} Bit mask.\n */\nfunction packVisibility(visibility)\n{\n let mask = 0;\n for (const stage of visibility ?? [])\n {\n const bit = CARBON_BACKEND_VISIBILITY.indexOf(stage);\n if (bit < 0)\n {\n throw new CjsFormatWriteError(`Unknown binding visibility \"${stage}\"`, { stage });\n }\n mask |= 1 << bit;\n }\n return mask;\n}\n\n/**\n * Decodes a visibility bit mask, in the canonical stage order.\n *\n * @param {number} mask Bit mask.\n * @returns {string[]} Stage names.\n */\nfunction unpackVisibility(mask)\n{\n const stages = [];\n for (let bit = 0; bit < CARBON_BACKEND_VISIBILITY.length; bit += 1)\n {\n if (mask & (1 << bit)) stages.push(CARBON_BACKEND_VISIBILITY[bit]);\n }\n return stages;\n}\n\n/**\n * Rebuilds a binding's WebGPU descriptor from what the block does store.\n *\n * The descriptor — `buffer`, `texture` or `sampler` — is not on the wire because\n * it is a pure function of the WGSL type, the resource kind and the structure\n * stride, all three of which are. `lowerBindingLayout.js` derives it from the\n * same three inputs on the way out; this derives it back on the way in.\n *\n * The pairs that could collide do not. `array<u32>` reaches both a structured\n * buffer and a compute typed buffer, and the structure stride separates them:\n * structured always carries one, typed never does.\n *\n * One texture fact is not in the WGSL type and is stored: its sample type.\n * `texture_2d<f32>` is the same declaration whether the layout says `float` or\n * `unfilterable-float`, and only the lowering, which sees the instructions,\n * knows a texture is only ever loaded.\n *\n * @param {object} binding Decoded binding record.\n * @returns {object} The descriptor fragment, as one `{buffer|texture|sampler}` key.\n */\nfunction deriveBindingDescriptor(binding)\n{\n const stride = binding.structureStride;\n\n if (binding.resourceKind === \"sampler\")\n {\n return { sampler: { type: \"filtering\" } };\n }\n\n if (binding.resourceKind === \"uniform-buffer\")\n {\n const vec4Count = /^array<vec4<f32>, (\\d+)>$/u.exec(binding.type)?.[1];\n if (!vec4Count)\n {\n throw new CjsFormatReadError(\n `Backend block uniform binding has untranslatable type \"${binding.type}\"`,\n { type: binding.type }\n );\n }\n return {\n buffer: {\n type: \"uniform\",\n hasDynamicOffset: false,\n minBindingSize: Number(vec4Count) * 16\n }\n };\n }\n\n if (binding.resourceKind === \"sampled-resource\")\n {\n const texture = TEXTURE_DESCRIPTORS[binding.type];\n if (texture) return { texture: { ...texture, sampleType: binding.textureSampleType } };\n\n return {\n buffer: {\n type: \"read-only-storage\",\n hasDynamicOffset: false,\n minBindingSize: stride === undefined ? 4 : stride\n }\n };\n }\n\n // A storage texture's WGSL type names its dimension, format and access in\n // full (`lowerBindingLayout.js` storageTextureLayout), so nothing more is\n // stored for it.\n const storage = STORAGE_TEXTURE_TYPE.exec(binding.type);\n if (storage)\n {\n return {\n storageTexture: {\n access: STORAGE_TEXTURE_ACCESS[storage[3]],\n format: storage[2],\n viewDimension: storage[1].replace(\"_\", \"-\")\n }\n };\n }\n\n return {\n buffer: {\n type: \"storage\",\n hasDynamicOffset: false,\n minBindingSize: stride === undefined ? 4 : stride\n }\n };\n}\n\n/** `texture_storage_<dimension><<format>, <access>>`. */\nconst STORAGE_TEXTURE_TYPE = /^texture_storage_(2d|2d_array|3d)<(\\w+), (write|read|read_write)>$/u;\n\n/** WGSL storage-texture access to the WebGPU layout's `storageTexture.access`. */\nconst STORAGE_TEXTURE_ACCESS = Object.freeze({ write: \"write-only\", read: \"read-only\", read_write: \"read-write\" });\n\n/** Texture descriptors by WGSL type (`lowerBindingLayout.js:90-95`). */\nconst TEXTURE_DESCRIPTORS = Object.freeze({\n \"texture_2d<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"2d\", multisampled: false }),\n \"texture_cube<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"cube\", multisampled: false }),\n \"texture_3d<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"3d\", multisampled: false }),\n \"texture_2d_array<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"2d-array\", multisampled: false })\n});\n\n/**\n * Serialises one pass's backend block.\n *\n * @param {object} block Block contents.\n * @param {object[]} [block.bindGroups] Bind groups with their bindings.\n * @param {object[]} [block.transforms] Resource transforms.\n * @returns {Uint8Array} Self-contained block bytes.\n */\n/**\n * Refuses a binding whose derived fields disagree with what the reader rebuilds.\n *\n * `identity`, `scopeIdentity` and the per-binding `group` are not stored: the\n * reader recomputes them from the register triple, the visibility mask and the\n * enclosing group. A binding that carries a different value therefore does not\n * fail - it round-trips into a different binding, and the engine matches on\n * exactly these strings.\n *\n * `scopeIdentity` deserves the sharpest check, because the wire cannot preserve\n * what it is derived from. Visibility is stored as a **bitmask**, so it is a\n * set; `scopeIdentity` is built from `visibility[0]`, so it depends on an\n * order. A binding written as `[fragment, vertex]` reads back as\n * `[vertex, fragment]` and its scope silently moves from `@fragment` to\n * `@vertex`. Canonical order is the only order the format can represent, so a\n * producer must write it.\n *\n * @param {object} binding Binding record.\n * @param {object} group Enclosing bind group.\n */\nfunction assertDerivedBindingFieldsAgree(binding, group)\n{\n const identity = `${binding.resourceKind}:${binding.registerSpace}:${binding.registerIndex}`;\n const canonical = unpackVisibility(packVisibility(binding.visibility));\n const derived = [\n [ \"identity\", binding.identity, identity ],\n [ \"scopeIdentity\", binding.scopeIdentity, `${identity}@${canonical[0]}` ],\n [ \"group\", binding.group, group.group ]\n ];\n\n for (const [ field, actual, expected ] of derived)\n {\n if (actual === undefined || actual === null) continue;\n if (actual === expected) continue;\n\n throw new CjsFormatWriteError(\n `Binding ${identity} sets ${field} to ${JSON.stringify(actual)}, but the reader rebuilds`\n + ` ${JSON.stringify(expected)}. The value is not stored, so writing this would silently`\n + ` change the binding.`,\n { identity, field, actual, expected }\n );\n }\n}\n\n/**\n * Encode one canonical backend binding and transform block.\n * @param {object} block Backend block record.\n * @returns {Uint8Array} Encoded backend bytes.\n */\nexport function writeBackendBlock(block)\n{\n const bindGroups = block.bindGroups ?? [];\n const transforms = block.transforms ?? [];\n const writer = new CjsByteWriter(256);\n\n writer.u8(CARBON_BACKEND_ENGINE_ID.webgpu);\n\n writer.u8(bindGroups.length);\n for (const group of bindGroups)\n {\n writer.u8(group.group);\n writer.u8(group.bindings.length);\n for (const binding of group.bindings)\n {\n const kind = CARBON_BACKEND_RESOURCE_KIND.indexOf(binding.resourceKind);\n if (kind < 0)\n {\n throw new CjsFormatWriteError(`Unknown resource kind \"${binding.resourceKind}\"`, {\n resourceKind: binding.resourceKind\n });\n }\n assertDerivedBindingFieldsAgree(binding, group);\n writer.u8(kind);\n writer.u8(binding.registerSpace);\n writer.u8(binding.binding);\n writer.u8(packVisibility(binding.visibility));\n writer.u32(binding.registerIndex);\n writer.u32(binding.structureStride ?? ABSENT);\n writer.u8(binding.arrayLayerCount ?? 0);\n const sampleType = CARBON_BACKEND_TEXTURE_SAMPLE_TYPE.indexOf(binding.texture?.sampleType ?? \"float\");\n if (sampleType < 0)\n {\n throw new CjsFormatWriteError(`Unknown texture sample type \"${binding.texture.sampleType}\"`, {\n sampleType: binding.texture.sampleType\n });\n }\n writer.u8(sampleType);\n const typedView = CARBON_BACKEND_TYPED_VIEW.indexOf(binding.typedView ?? \"\");\n if (typedView < 0)\n {\n throw new CjsFormatWriteError(`Unknown typed view \"${binding.typedView}\"`, { typedView: binding.typedView });\n }\n writer.u8(typedView);\n writeInlineString(writer, binding.type);\n writeInlineString(writer, binding.generatedSymbol);\n // A binding either carries a transform id or it does not; an empty\n // string is not a legal id, so length zero encodes absence.\n writeInlineString(writer, binding.transformId ?? \"\");\n }\n }\n\n writeTransformSection(writer, transforms);\n\n return writer.toBytes();\n}\n\n/**\n * Parses one pass's backend block, restoring every derived field.\n *\n * @param {ArrayBuffer|ArrayBufferView|Uint8Array} bytes Block bytes.\n * @param {object} [options] Read options.\n * @param {string} [options.layoutKey] Enclosing pass key, restored onto records.\n * @param {string} [options.source] Source name for error details.\n * @returns {object} Block contents with derived fields restored.\n */\nexport function readBackendBlock(bytes, options = {})\n{\n const reader = new CjsByteReader(bytes, { source: options.source ?? \"backend block\" });\n const layoutKey = options.layoutKey ?? null;\n\n readBackendEngineId(reader, CARBON_BACKEND_ENGINE_ID.webgpu, options.source ?? \"backend block\");\n\n const bindGroups = [];\n const groupCount = reader.ReadUint8();\n for (let groupIndex = 0; groupIndex < groupCount; groupIndex += 1)\n {\n const group = reader.ReadUint8();\n const bindings = [];\n const bindingCount = reader.ReadUint8();\n for (let index = 0; index < bindingCount; index += 1)\n {\n const resourceKind = CARBON_BACKEND_RESOURCE_KIND[reader.ReadUint8()];\n const registerSpace = reader.ReadUint8();\n const binding = reader.ReadUint8();\n const visibility = unpackVisibility(reader.ReadUint8());\n const registerIndex = reader.ReadUint32();\n const structureStride = reader.ReadUint32();\n const arrayLayerCount = reader.ReadUint8();\n const textureSampleType = CARBON_BACKEND_TEXTURE_SAMPLE_TYPE[reader.ReadUint8()];\n if (!textureSampleType)\n {\n throw new CjsFormatReadError(\"Backend block binding has an unknown texture sample type\", {\n source: options.source ?? \"backend block\"\n });\n }\n const typedView = CARBON_BACKEND_TYPED_VIEW[reader.ReadUint8()];\n if (typedView === undefined)\n {\n throw new CjsFormatReadError(\"Backend block binding has an unknown typed view\", {\n source: options.source ?? \"backend block\"\n });\n }\n const type = readInlineString(reader);\n const generatedSymbol = readInlineString(reader);\n const transformId = readInlineString(reader);\n\n const identity = `${resourceKind}:${registerSpace}:${registerIndex}`;\n const record = {\n group,\n binding,\n resourceKind,\n registerSpace,\n registerIndex,\n visibility,\n type,\n generatedSymbol,\n identity,\n scopeIdentity: `${identity}@${visibility[0]}`,\n ...(structureStride === ABSENT ? {} : { structureStride }),\n ...(arrayLayerCount === 0 ? {} : { arrayLayerCount }),\n ...(typedView === \"\" ? {} : { typedView }),\n ...(transformId === \"\" ? {} : { transformId })\n };\n bindings.push({ ...record, ...deriveBindingDescriptor({ ...record, textureSampleType }) });\n }\n bindGroups.push({ group, bindings });\n }\n\n const transforms = readTransformSection(reader, layoutKey);\n\n // A sized record must land exactly on its declared end. Trailing bytes mean\n // the writer knew fields this reader does not, which with no version byte is\n // the ONLY signal that a block came from a different build - so this check is\n // load-bearing rather than defensive.\n // This is the only surviving form of a closed-schema check: under a record\n // layout a field either exists at its offset or the read fails, so there is\n // nothing per-field left to assert, but exhaustiveness is still checkable and\n // is exactly what a silently-discarded tail would violate.\n if (reader.remaining !== 0)\n {\n throw new CjsFormatReadError(\n `Backend block has ${reader.remaining} unparsed trailing byte(s); rebuild the effect package`,\n { source: options.source ?? \"backend block\", trailingBytes: reader.remaining }\n );\n }\n\n return {\n layoutKey,\n bindGroups,\n transforms,\n trailingBytes: 0\n };\n}\n"],"names":["CARBON_BACKEND_RESOURCE_KIND","Object","freeze","CARBON_BACKEND_TYPED_VIEW","CARBON_BACKEND_ADDRESS_MODES_SYMBOL","CARBON_BACKEND_UNORM_TARGET_OVERRIDE","CARBON_BACKEND_TEXTURE_SAMPLE_TYPE","CARBON_BACKEND_VISIBILITY","ABSENT","packVisibility","visibility","mask","stage","bit","indexOf","CjsFormatWriteError","unpackVisibility","stages","length","push","deriveBindingDescriptor","binding","stride","structureStride","resourceKind","sampler","type","vec4Count","exec","CjsFormatReadError","buffer","hasDynamicOffset","minBindingSize","Number","texture","TEXTURE_DESCRIPTORS","sampleType","textureSampleType","undefined","storage","STORAGE_TEXTURE_TYPE","storageTexture","access","STORAGE_TEXTURE_ACCESS","format","viewDimension","replace","write","read","read_write","multisampled","assertDerivedBindingFieldsAgree","group","identity","registerSpace","registerIndex","canonical","derived","scopeIdentity","field","actual","expected","JSON","stringify","writeBackendBlock","block","bindGroups","transforms","writer","CjsByteWriter","u8","CARBON_BACKEND_ENGINE_ID","webgpu","bindings","kind","u32","arrayLayerCount","typedView","writeInlineString","generatedSymbol","transformId","writeTransformSection","toBytes","readBackendBlock","bytes","options","reader","CjsByteReader","source","layoutKey","readBackendEngineId","groupCount","ReadUint8","groupIndex","bindingCount","index","ReadUint32","readInlineString","record","readTransformSection","remaining","trailingBytes"],"mappings":";;;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;MACaA,4BAA4B,GAAGC,MAAM,CAACC,MAAM,CAAC,CACtD,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,kBAAkB,CACrB;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;MACaC,yBAAyB,GAAGF,MAAM,CAACC,MAAM,CAAC,CAAE,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,CAAE;;AAExG;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,mCAAmC,GAAG;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,oCAAoC,GAAG;;AAEpD;AACA;AACA;AACA;AACO,MAAMC,kCAAkC,GAAGL,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,EAAE,oBAAoB,CAAE;;AAEjG;AACO,MAAMK,yBAAyB,GAAGN,MAAM,CAACC,MAAM,CAAC,CAAE,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ING_TABLE_NULL_REFERENCE, CjsStringTable, compareTableBlobs } from './CjsStringTable.js';
|
|
7
7
|
export { CARBON_ANNOTATION_TYPE, CARBON_EFFECT_COUNT_CAPS, CARBON_EFFECT_DATA_VERSION, CARBON_EFFECT_MIN_DATA_VERSION, CARBON_EFFECT_WRITE_VERSIONS, CARBON_SHADER_CONSTANTS_MAX, collectArena, compareAnnotationNames, internArena, passthroughArena, readEffectDescription, resolveWriteVersion, writeEffectDescription } from './carbonEffect/carbonEffectRecords.js';
|
|
8
|
-
export { CARBON_BACKEND_RESOURCE_KIND, CARBON_BACKEND_TEXTURE_SAMPLE_TYPE, CARBON_BACKEND_TYPED_VIEW, CARBON_BACKEND_VISIBILITY, readBackendBlock, writeBackendBlock } from './carbonEffect/carbonEffectBackendBlock.js';
|
|
8
|
+
export { CARBON_BACKEND_ADDRESS_MODES_SYMBOL, CARBON_BACKEND_RESOURCE_KIND, CARBON_BACKEND_TEXTURE_SAMPLE_TYPE, CARBON_BACKEND_TYPED_VIEW, CARBON_BACKEND_UNORM_TARGET_OVERRIDE, CARBON_BACKEND_VISIBILITY, readBackendBlock, writeBackendBlock } from './carbonEffect/carbonEffectBackendBlock.js';
|
|
9
9
|
export { CARBON_EFFECT_RECORD_BYTES, CARBON_EFFECT_SOURCE_HASH_BYTES, CjsCarbonEffectBodyReader, CjsCarbonEffectReader, looksLikeCarbonEffectContainer } from './carbonEffect/CjsCarbonEffectReader.js';
|
|
10
10
|
export { CjsCarbonEffectWriter, writeCarbonEffectFile } from './carbonEffect/CjsCarbonEffectWriter.js';
|
|
11
11
|
export { CjsFormat, CjsFormatOutputRole, CjsFormatReadMode } from './CjsFormat.js';
|
|
@@ -1,50 +1,96 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bound-view formats of the typed buffers and typed UAV textures Carbon's
|
|
3
|
-
* renderer creates and binds by effect parameter name.
|
|
4
|
-
*
|
|
5
|
-
* A DXBC typed resource or UAV declaration records only the component class a
|
|
6
|
-
* load returns, never the DXGI format the C++ binds, and Carbon's container
|
|
7
|
-
* keeps no more (`Tr2EffectResource`: name, type, array size, sRGB and
|
|
8
|
-
* auto-register flags; shipped DXBC carries no RDEF). So the format comes from
|
|
9
|
-
* where Carbon creates the resource. It is a fact about Carbon's resources, not
|
|
10
|
-
* about a shading language, so both translators read it from here, as they read
|
|
11
|
-
* the Detail-map family from `detailMapFamily.js`:
|
|
12
|
-
*
|
|
13
|
-
* - `Exposure` (and `ExposureBuffer` on the exposure-to-texture pass) is
|
|
14
|
-
* `Tr2PostProcessRenderer::GetExposureBuffer`, a `Tr2BufferDescriptionAL` of
|
|
15
|
-
* `PIXEL_FORMAT_R32_FLOAT` with 8 elements, SRV and UAV
|
|
16
|
-
* (trinity/PostProcess/Tr2PostProcessRenderer.cpp:1700-1705). It is bound
|
|
17
|
-
* under those names at :794 (tonemapping), :972 (bloom high-pass), :1028
|
|
18
|
-
* (bloom downsample), :1238 (measure exposure, as a UAV), :1262 (exposure
|
|
19
|
-
* debug), :1318 (exposure to texture), :1516 (TAA) and :1526 (TAA copy).
|
|
20
|
-
* - `Histogram` is `RenderDynamicExposure`'s 65-element `PIXEL_FORMAT_R32_UINT`
|
|
21
|
-
* buffer (Tr2PostProcessRenderer.cpp:1196-1198, returned at :1240), read by
|
|
22
|
-
* tonemapping (:795) and the exposure debug view (:1263).
|
|
23
|
-
* - `FlareOcclusionBuffer` is `Tr2OcclusionBuffer`'s `PIXEL_FORMAT_R32_UINT`
|
|
24
|
-
* buffer, registered as a global variable under that name
|
|
25
|
-
* (Eve/EveOccluder.cpp:21, created at :110).
|
|
26
|
-
* - `CooldownMap` is the "TAA Cooldown" texture, `PIXEL_FORMAT_R32_UINT` with
|
|
27
|
-
* UAV and SRV usage (Tr2PostProcessRenderer.cpp:1463-1469), bound to the TAA
|
|
28
|
-
* effect at :1514; the medium and high quality tiers read and write it from
|
|
29
|
-
* the pixel stage.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* Bound-view formats of the typed buffers and typed UAV textures Carbon's
|
|
3
|
+
* renderer creates and binds by effect parameter name.
|
|
4
|
+
*
|
|
5
|
+
* A DXBC typed resource or UAV declaration records only the component class a
|
|
6
|
+
* load returns, never the DXGI format the C++ binds, and Carbon's container
|
|
7
|
+
* keeps no more (`Tr2EffectResource`: name, type, array size, sRGB and
|
|
8
|
+
* auto-register flags; shipped DXBC carries no RDEF). So the format comes from
|
|
9
|
+
* where Carbon creates the resource. It is a fact about Carbon's resources, not
|
|
10
|
+
* about a shading language, so both translators read it from here, as they read
|
|
11
|
+
* the Detail-map family from `detailMapFamily.js`:
|
|
12
|
+
*
|
|
13
|
+
* - `Exposure` (and `ExposureBuffer` on the exposure-to-texture pass) is
|
|
14
|
+
* `Tr2PostProcessRenderer::GetExposureBuffer`, a `Tr2BufferDescriptionAL` of
|
|
15
|
+
* `PIXEL_FORMAT_R32_FLOAT` with 8 elements, SRV and UAV
|
|
16
|
+
* (trinity/PostProcess/Tr2PostProcessRenderer.cpp:1700-1705). It is bound
|
|
17
|
+
* under those names at :794 (tonemapping), :972 (bloom high-pass), :1028
|
|
18
|
+
* (bloom downsample), :1238 (measure exposure, as a UAV), :1262 (exposure
|
|
19
|
+
* debug), :1318 (exposure to texture), :1516 (TAA) and :1526 (TAA copy).
|
|
20
|
+
* - `Histogram` is `RenderDynamicExposure`'s 65-element `PIXEL_FORMAT_R32_UINT`
|
|
21
|
+
* buffer (Tr2PostProcessRenderer.cpp:1196-1198, returned at :1240), read by
|
|
22
|
+
* tonemapping (:795) and the exposure debug view (:1263).
|
|
23
|
+
* - `FlareOcclusionBuffer` is `Tr2OcclusionBuffer`'s `PIXEL_FORMAT_R32_UINT`
|
|
24
|
+
* buffer, registered as a global variable under that name
|
|
25
|
+
* (Eve/EveOccluder.cpp:21, created at :110).
|
|
26
|
+
* - `CooldownMap` is the "TAA Cooldown" texture, `PIXEL_FORMAT_R32_UINT` with
|
|
27
|
+
* UAV and SRV usage (Tr2PostProcessRenderer.cpp:1463-1469), bound to the TAA
|
|
28
|
+
* effect at :1514; the medium and high quality tiers read and write it from
|
|
29
|
+
* the pixel stage.
|
|
30
|
+
* - `PackedOutputBuffer0`..`7` are the mips of CORTAO's "cortao_packed"
|
|
31
|
+
* texture, `PIXEL_FORMAT_R32_FLOAT` with UAV and SRV usage
|
|
32
|
+
* (trinity/Tr2SSAO.cpp:557-558), bound at :661-665. 8..15 are never
|
|
33
|
+
* bound: see `CARBON_UNBOUND_UAVS`.
|
|
34
|
+
* - `OutputBuffer` (CORTAO's main pass) and `SSAOOutputBuffer` (its blur) are
|
|
35
|
+
* "cortao_output" and "cortao_blur", `PIXEL_FORMAT_R8G8B8A8_SNORM` with UAV
|
|
36
|
+
* and SRV usage while the bent normal is on, Carbon's default
|
|
37
|
+
* (Tr2SSAO.cpp:643-644, 686-687). With it off they are R8_UNORM, which this
|
|
38
|
+
* table cannot express: the format follows a shader option, not the name.
|
|
39
|
+
* - `LightIndexCount` is `Tr2LightManager`'s index counter, a one-element
|
|
40
|
+
* `PIXEL_FORMAT_R32_SINT` buffer, GPU-writable (Tr2LightManager.cpp:665),
|
|
41
|
+
* bound to computelightlists at :670; the tiling kernel allocates index
|
|
42
|
+
* ranges from it with an atomic add.
|
|
43
|
+
*
|
|
44
|
+
* A name missing here leaves the format unknown, and each backend decides what
|
|
45
|
+
* that means. A backend must also reject a declaration whose component class
|
|
46
|
+
* disagrees with the format, so a different effect reusing a name cannot be
|
|
47
|
+
* read with the wrong element type.
|
|
35
48
|
*/
|
|
36
49
|
const CARBON_TYPED_VIEWS = Object.freeze({
|
|
37
50
|
Exposure: "R32_FLOAT",
|
|
38
51
|
ExposureBuffer: "R32_FLOAT",
|
|
39
52
|
Histogram: "R32_UINT",
|
|
40
53
|
FlareOcclusionBuffer: "R32_UINT",
|
|
41
|
-
CooldownMap: "R32_UINT"
|
|
54
|
+
CooldownMap: "R32_UINT",
|
|
55
|
+
...Object.fromEntries(Array.from({
|
|
56
|
+
length: 8
|
|
57
|
+
}, (_unused, mip) => [`PackedOutputBuffer${mip}`, "R32_FLOAT"])),
|
|
58
|
+
OutputBuffer: "R8G8B8A8_SNORM",
|
|
59
|
+
SSAOOutputBuffer: "R8G8B8A8_SNORM",
|
|
60
|
+
LightIndexCount: "R32_SINT"
|
|
42
61
|
});
|
|
43
62
|
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
63
|
+
/**
|
|
64
|
+
* UAVs a shipped effect declares and Carbon's renderer never binds, so on
|
|
65
|
+
* D3D11 the slot is empty: a write to it is dropped.
|
|
66
|
+
*
|
|
67
|
+
* - `PackedOutputBuffer8`..`15`: CORTAO's Pack kernel declares sixteen packed
|
|
68
|
+
* mips, and Tr2SSAO binds eight (Tr2SSAO.cpp:659-665) because it makes at
|
|
69
|
+
* most eight (:547-555). The kernel writes a mip only below the mip count,
|
|
70
|
+
* so the unbound eight are never written either. Declared, they would need
|
|
71
|
+
* sixteen storage textures in one stage, twice WebGPU's common limit.
|
|
72
|
+
*
|
|
73
|
+
* A backend may leave these out of its binding layout, with their writes.
|
|
74
|
+
*/
|
|
75
|
+
const CARBON_UNBOUND_UAVS = Object.freeze(new Set(Array.from({
|
|
76
|
+
length: 8
|
|
77
|
+
}, (_unused, index) => `PackedOutputBuffer${index + 8}`)));
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The registers of one stage's never-bound UAVs (`CARBON_UNBOUND_UAVS`), in
|
|
81
|
+
* register space 0, ascending.
|
|
82
|
+
*
|
|
83
|
+
* @param {object[]} semanticBindings The stage's effect-description bindings.
|
|
84
|
+
* @returns {number[]} The UAV registers.
|
|
85
|
+
*/
|
|
86
|
+
function unboundUavRegistersFor(semanticBindings) {
|
|
87
|
+
return (semanticBindings || []).filter(binding => binding?.kind === "uav" && (binding.registerSpace ?? 0) === 0 && CARBON_UNBOUND_UAVS.has(binding.metadataName ?? binding.carbon?.name)).map(binding => binding.registerIndex).sort((left, right) => left - right);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The formats named above, in backend-neutral terms: the DXBC component class
|
|
92
|
+
* a declaration of them must carry, the channel count and the element size.
|
|
93
|
+
* D3D11 returns missing channels as 0 and a missing alpha as 1.
|
|
48
94
|
*/
|
|
49
95
|
const CARBON_VIEW_FORMATS = Object.freeze({
|
|
50
96
|
R32_FLOAT: Object.freeze({
|
|
@@ -56,37 +102,47 @@ const CARBON_VIEW_FORMATS = Object.freeze({
|
|
|
56
102
|
componentClass: "uint",
|
|
57
103
|
channels: 1,
|
|
58
104
|
bytesPerElement: 4
|
|
105
|
+
}),
|
|
106
|
+
R32_SINT: Object.freeze({
|
|
107
|
+
componentClass: "sint",
|
|
108
|
+
channels: 1,
|
|
109
|
+
bytesPerElement: 4
|
|
110
|
+
}),
|
|
111
|
+
R8G8B8A8_SNORM: Object.freeze({
|
|
112
|
+
componentClass: "float",
|
|
113
|
+
channels: 4,
|
|
114
|
+
bytesPerElement: 4
|
|
59
115
|
})
|
|
60
116
|
});
|
|
61
117
|
|
|
62
|
-
/**
|
|
63
|
-
* The effect-parameter annotation our containers carry the format in: a
|
|
64
|
-
* string annotation such as `CjsViewFormat = "R32_FLOAT"` on the parameter.
|
|
65
|
-
* Carbon's container already stores per-parameter annotations, so this adds a
|
|
66
|
-
* name, not a field, and any Carbon reader still parses the file. It is ours,
|
|
67
|
-
* hence the `Cjs` prefix; CCP's shipped effects never carry it, so for them
|
|
68
|
-
* the table above is the source.
|
|
118
|
+
/**
|
|
119
|
+
* The effect-parameter annotation our containers carry the format in: a
|
|
120
|
+
* string annotation such as `CjsViewFormat = "R32_FLOAT"` on the parameter.
|
|
121
|
+
* Carbon's container already stores per-parameter annotations, so this adds a
|
|
122
|
+
* name, not a field, and any Carbon reader still parses the file. It is ours,
|
|
123
|
+
* hence the `Cjs` prefix; CCP's shipped effects never carry it, so for them
|
|
124
|
+
* the table above is the source.
|
|
69
125
|
*/
|
|
70
126
|
const CARBON_VIEW_FORMAT_ANNOTATION = "CjsViewFormat";
|
|
71
127
|
const STRING_ANNOTATION = 3;
|
|
72
128
|
|
|
73
|
-
/**
|
|
74
|
-
* The view format a parameter's own annotation names, or null.
|
|
75
|
-
*
|
|
76
|
-
* @param {object[]} annotations The parameter's annotations (records or models).
|
|
77
|
-
* @returns {string|null} A known format, or null.
|
|
129
|
+
/**
|
|
130
|
+
* The view format a parameter's own annotation names, or null.
|
|
131
|
+
*
|
|
132
|
+
* @param {object[]} annotations The parameter's annotations (records or models).
|
|
133
|
+
* @returns {string|null} A known format, or null.
|
|
78
134
|
*/
|
|
79
135
|
function annotatedViewFormat(annotations) {
|
|
80
136
|
const entry = (annotations || []).find(annotation => annotation?.name === CARBON_VIEW_FORMAT_ANNOTATION && annotation.type === STRING_ANNOTATION);
|
|
81
137
|
return entry && CARBON_VIEW_FORMATS[entry.stringValue] ? entry.stringValue : null;
|
|
82
138
|
}
|
|
83
139
|
|
|
84
|
-
/**
|
|
85
|
-
* One parameter's view format: its own annotation, else the table.
|
|
86
|
-
*
|
|
87
|
-
* @param {string} name The Carbon parameter name.
|
|
88
|
-
* @param {object[]} [annotations] The parameter's annotations.
|
|
89
|
-
* @returns {string|null} The format, or null when unknown.
|
|
140
|
+
/**
|
|
141
|
+
* One parameter's view format: its own annotation, else the table.
|
|
142
|
+
*
|
|
143
|
+
* @param {string} name The Carbon parameter name.
|
|
144
|
+
* @param {object[]} [annotations] The parameter's annotations.
|
|
145
|
+
* @returns {string|null} The format, or null when unknown.
|
|
90
146
|
*/
|
|
91
147
|
function viewFormatForParameter(name, annotations) {
|
|
92
148
|
return annotatedViewFormat(annotations) ?? CARBON_TYPED_VIEWS[name] ?? null;
|
|
@@ -96,13 +152,13 @@ const SEMANTIC_KIND = Object.freeze({
|
|
|
96
152
|
uav: "storage-resource"
|
|
97
153
|
});
|
|
98
154
|
|
|
99
|
-
/**
|
|
100
|
-
* The typed-view formats for one stage: D3D identity to view format. A
|
|
101
|
-
* parameter's `CjsViewFormat` annotation wins; otherwise its Carbon name is
|
|
102
|
-
* looked up in the table.
|
|
103
|
-
*
|
|
104
|
-
* @param {object[]} semanticBindings The stage's effect-description bindings.
|
|
105
|
-
* @returns {Object<string, string>} `{ "sampled-resource:0:9": "R32_FLOAT" }`
|
|
155
|
+
/**
|
|
156
|
+
* The typed-view formats for one stage: D3D identity to view format. A
|
|
157
|
+
* parameter's `CjsViewFormat` annotation wins; otherwise its Carbon name is
|
|
158
|
+
* looked up in the table.
|
|
159
|
+
*
|
|
160
|
+
* @param {object[]} semanticBindings The stage's effect-description bindings.
|
|
161
|
+
* @returns {Object<string, string>} `{ "sampled-resource:0:9": "R32_FLOAT" }`
|
|
106
162
|
*/
|
|
107
163
|
function typedViewsFor(semanticBindings) {
|
|
108
164
|
const views = {};
|
|
@@ -116,5 +172,5 @@ function typedViewsFor(semanticBindings) {
|
|
|
116
172
|
return views;
|
|
117
173
|
}
|
|
118
174
|
|
|
119
|
-
export { CARBON_TYPED_VIEWS, CARBON_VIEW_FORMATS, CARBON_VIEW_FORMAT_ANNOTATION, annotatedViewFormat, typedViewsFor, viewFormatForParameter };
|
|
175
|
+
export { CARBON_TYPED_VIEWS, CARBON_UNBOUND_UAVS, CARBON_VIEW_FORMATS, CARBON_VIEW_FORMAT_ANNOTATION, annotatedViewFormat, typedViewsFor, unboundUavRegistersFor, viewFormatForParameter };
|
|
120
176
|
//# sourceMappingURL=carbonTypedViews.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carbonTypedViews.js","sources":["../../../../../../src/resource/formats/hlsl/core/carbonTypedViews.js"],"sourcesContent":["/**\n * Bound-view formats of the typed buffers and typed UAV textures Carbon's\n * renderer creates and binds by effect parameter name.\n *\n * A DXBC typed resource or UAV declaration records only the component class a\n * load returns, never the DXGI format the C++ binds, and Carbon's container\n * keeps no more (`Tr2EffectResource`: name, type, array size, sRGB and\n * auto-register flags; shipped DXBC carries no RDEF). So the format comes from\n * where Carbon creates the resource. It is a fact about Carbon's resources, not\n * about a shading language, so both translators read it from here, as they read\n * the Detail-map family from `detailMapFamily.js`:\n *\n * - `Exposure` (and `ExposureBuffer` on the exposure-to-texture pass) is\n * `Tr2PostProcessRenderer::GetExposureBuffer`, a `Tr2BufferDescriptionAL` of\n * `PIXEL_FORMAT_R32_FLOAT` with 8 elements, SRV and UAV\n * (trinity/PostProcess/Tr2PostProcessRenderer.cpp:1700-1705). It is bound\n * under those names at :794 (tonemapping), :972 (bloom high-pass), :1028\n * (bloom downsample), :1238 (measure exposure, as a UAV), :1262 (exposure\n * debug), :1318 (exposure to texture), :1516 (TAA) and :1526 (TAA copy).\n * - `Histogram` is `RenderDynamicExposure`'s 65-element `PIXEL_FORMAT_R32_UINT`\n * buffer (Tr2PostProcessRenderer.cpp:1196-1198, returned at :1240), read by\n * tonemapping (:795) and the exposure debug view (:1263).\n * - `FlareOcclusionBuffer` is `Tr2OcclusionBuffer`'s `PIXEL_FORMAT_R32_UINT`\n * buffer, registered as a global variable under that name\n * (Eve/EveOccluder.cpp:21, created at :110).\n * - `CooldownMap` is the \"TAA Cooldown\" texture, `PIXEL_FORMAT_R32_UINT` with\n * UAV and SRV usage (Tr2PostProcessRenderer.cpp:1463-1469), bound to the TAA\n * effect at :1514; the medium and high quality tiers read and write it from\n * the pixel stage.\n *\n * A name missing here leaves the format unknown, and each backend decides what\n * that means. A backend must also reject a declaration whose component class\n * disagrees with the format, so a different effect reusing a name cannot be\n * read with the wrong element type.\n */\nexport const CARBON_TYPED_VIEWS = Object.freeze({\n Exposure: \"R32_FLOAT\",\n ExposureBuffer: \"R32_FLOAT\",\n Histogram: \"R32_UINT\",\n FlareOcclusionBuffer: \"R32_UINT\",\n CooldownMap: \"R32_UINT\"\n});\n\n/**\n * The formats named above, in backend-neutral terms: the DXBC component class\n * a declaration of them must carry, the channel count and the element size.\n * D3D11 returns missing channels as 0 and a missing alpha as 1.\n */\nexport const CARBON_VIEW_FORMATS = Object.freeze({\n R32_FLOAT: Object.freeze({ componentClass: \"float\", channels: 1, bytesPerElement: 4 }),\n R32_UINT: Object.freeze({ componentClass: \"uint\", channels: 1, bytesPerElement: 4 })\n});\n\n/**\n * The effect-parameter annotation our containers carry the format in: a\n * string annotation such as `CjsViewFormat = \"R32_FLOAT\"` on the parameter.\n * Carbon's container already stores per-parameter annotations, so this adds a\n * name, not a field, and any Carbon reader still parses the file. It is ours,\n * hence the `Cjs` prefix; CCP's shipped effects never carry it, so for them\n * the table above is the source.\n */\nexport const CARBON_VIEW_FORMAT_ANNOTATION = \"CjsViewFormat\";\n\nconst STRING_ANNOTATION = 3;\n\n/**\n * The view format a parameter's own annotation names, or null.\n *\n * @param {object[]} annotations The parameter's annotations (records or models).\n * @returns {string|null} A known format, or null.\n */\nexport function annotatedViewFormat(annotations)\n{\n const entry = (annotations || []).find((annotation) =>\n annotation?.name === CARBON_VIEW_FORMAT_ANNOTATION && annotation.type === STRING_ANNOTATION);\n return entry && CARBON_VIEW_FORMATS[entry.stringValue] ? entry.stringValue : null;\n}\n\n/**\n * One parameter's view format: its own annotation, else the table.\n *\n * @param {string} name The Carbon parameter name.\n * @param {object[]} [annotations] The parameter's annotations.\n * @returns {string|null} The format, or null when unknown.\n */\nexport function viewFormatForParameter(name, annotations)\n{\n return annotatedViewFormat(annotations) ?? CARBON_TYPED_VIEWS[name] ?? null;\n}\n\nconst SEMANTIC_KIND = Object.freeze({\n resource: \"sampled-resource\",\n uav: \"storage-resource\"\n});\n\n/**\n * The typed-view formats for one stage: D3D identity to view format. A\n * parameter's `CjsViewFormat` annotation wins; otherwise its Carbon name is\n * looked up in the table.\n *\n * @param {object[]} semanticBindings The stage's effect-description bindings.\n * @returns {Object<string, string>} `{ \"sampled-resource:0:9\": \"R32_FLOAT\" }`\n */\nexport function typedViewsFor(semanticBindings)\n{\n const views = {};\n for (const binding of semanticBindings || [])\n {\n const kind = SEMANTIC_KIND[binding?.kind];\n const name = binding?.metadataName ?? binding?.carbon?.name;\n const format = kind && typeof name === \"string\"\n ? viewFormatForParameter(name, binding.annotations)\n : null;\n if (!format) continue;\n views[`${kind}:${binding.registerSpace ?? 0}:${binding.registerIndex}`] = format;\n }\n return views;\n}\n"],"names":["CARBON_TYPED_VIEWS","Object","freeze","Exposure","ExposureBuffer","Histogram","FlareOcclusionBuffer","CooldownMap","CARBON_VIEW_FORMATS","R32_FLOAT","componentClass","channels","bytesPerElement","R32_UINT","CARBON_VIEW_FORMAT_ANNOTATION","STRING_ANNOTATION","annotatedViewFormat","annotations","entry","find","annotation","name","type","stringValue","viewFormatForParameter","SEMANTIC_KIND","resource","uav","typedViewsFor","semanticBindings","views","binding","kind","metadataName","carbon","format","registerSpace","registerIndex"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACaA,kBAAkB,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC5CC,EAAAA,QAAQ,EAAE,WAAW;AACrBC,EAAAA,cAAc,EAAE,WAAW;AAC3BC,EAAAA,SAAS,EAAE,UAAU;AACrBC,EAAAA,oBAAoB,EAAE,UAAU;AAChCC,EAAAA,WAAW,EAAE;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;MACaC,mBAAmB,GAAGP,MAAM,CAACC,MAAM,CAAC;AAC7CO,EAAAA,SAAS,EAAER,MAAM,CAACC,MAAM,CAAC;AAAEQ,IAAAA,cAAc,EAAE,OAAO;AAAEC,IAAAA,QAAQ,EAAE,CAAC;AAAEC,IAAAA,eAAe,EAAE;AAAE,GAAC,CAAC;AACtFC,EAAAA,QAAQ,EAAEZ,MAAM,CAACC,MAAM,CAAC;AAAEQ,IAAAA,cAAc,EAAE,MAAM;AAAEC,IAAAA,QAAQ,EAAE,CAAC;AAAE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IAAI,EAAEU,OAAO,CAACd,WAAW,CAAC,GACjD,IAAI;IACV,IAAI,CAACkB,MAAM,EAAE;AACbL,IAAAA,KAAK,CAAC,CAAA,EAAGE,IAAI,CAAA,CAAA,EAAID,OAAO,CAACK,aAAa,IAAI,CAAC,CAAA,CAAA,EAAIL,OAAO,CAACM,aAAa,CAAA,CAAE,CAAC,GAAGF,MAAM;AACpF,EAAA;AACA,EAAA,OAAOL,KAAK;AAChB;;;;"}
|
|
1
|
+
{"version":3,"file":"carbonTypedViews.js","sources":["../../../../../../src/resource/formats/hlsl/core/carbonTypedViews.js"],"sourcesContent":["/**\r\n * Bound-view formats of the typed buffers and typed UAV textures Carbon's\r\n * renderer creates and binds by effect parameter name.\r\n *\r\n * A DXBC typed resource or UAV declaration records only the component class a\r\n * load returns, never the DXGI format the C++ binds, and Carbon's container\r\n * keeps no more (`Tr2EffectResource`: name, type, array size, sRGB and\r\n * auto-register flags; shipped DXBC carries no RDEF). So the format comes from\r\n * where Carbon creates the resource. It is a fact about Carbon's resources, not\r\n * about a shading language, so both translators read it from here, as they read\r\n * the Detail-map family from `detailMapFamily.js`:\r\n *\r\n * - `Exposure` (and `ExposureBuffer` on the exposure-to-texture pass) is\r\n * `Tr2PostProcessRenderer::GetExposureBuffer`, a `Tr2BufferDescriptionAL` of\r\n * `PIXEL_FORMAT_R32_FLOAT` with 8 elements, SRV and UAV\r\n * (trinity/PostProcess/Tr2PostProcessRenderer.cpp:1700-1705). It is bound\r\n * under those names at :794 (tonemapping), :972 (bloom high-pass), :1028\r\n * (bloom downsample), :1238 (measure exposure, as a UAV), :1262 (exposure\r\n * debug), :1318 (exposure to texture), :1516 (TAA) and :1526 (TAA copy).\r\n * - `Histogram` is `RenderDynamicExposure`'s 65-element `PIXEL_FORMAT_R32_UINT`\r\n * buffer (Tr2PostProcessRenderer.cpp:1196-1198, returned at :1240), read by\r\n * tonemapping (:795) and the exposure debug view (:1263).\r\n * - `FlareOcclusionBuffer` is `Tr2OcclusionBuffer`'s `PIXEL_FORMAT_R32_UINT`\r\n * buffer, registered as a global variable under that name\r\n * (Eve/EveOccluder.cpp:21, created at :110).\r\n * - `CooldownMap` is the \"TAA Cooldown\" texture, `PIXEL_FORMAT_R32_UINT` with\r\n * UAV and SRV usage (Tr2PostProcessRenderer.cpp:1463-1469), bound to the TAA\r\n * effect at :1514; the medium and high quality tiers read and write it from\r\n * the pixel stage.\r\n * - `PackedOutputBuffer0`..`7` are the mips of CORTAO's \"cortao_packed\"\r\n * texture, `PIXEL_FORMAT_R32_FLOAT` with UAV and SRV usage\r\n * (trinity/Tr2SSAO.cpp:557-558), bound at :661-665. 8..15 are never\r\n * bound: see `CARBON_UNBOUND_UAVS`.\r\n * - `OutputBuffer` (CORTAO's main pass) and `SSAOOutputBuffer` (its blur) are\r\n * \"cortao_output\" and \"cortao_blur\", `PIXEL_FORMAT_R8G8B8A8_SNORM` with UAV\r\n * and SRV usage while the bent normal is on, Carbon's default\r\n * (Tr2SSAO.cpp:643-644, 686-687). With it off they are R8_UNORM, which this\r\n * table cannot express: the format follows a shader option, not the name.\r\n * - `LightIndexCount` is `Tr2LightManager`'s index counter, a one-element\r\n * `PIXEL_FORMAT_R32_SINT` buffer, GPU-writable (Tr2LightManager.cpp:665),\r\n * bound to computelightlists at :670; the tiling kernel allocates index\r\n * ranges from it with an atomic add.\r\n *\r\n * A name missing here leaves the format unknown, and each backend decides what\r\n * that means. A backend must also reject a declaration whose component class\r\n * disagrees with the format, so a different effect reusing a name cannot be\r\n * read with the wrong element type.\r\n */\r\nexport const CARBON_TYPED_VIEWS = Object.freeze({\r\n Exposure: \"R32_FLOAT\",\r\n ExposureBuffer: \"R32_FLOAT\",\r\n Histogram: \"R32_UINT\",\r\n FlareOcclusionBuffer: \"R32_UINT\",\r\n CooldownMap: \"R32_UINT\",\r\n ...Object.fromEntries(Array.from({ length: 8 }, (_unused, mip) => [ `PackedOutputBuffer${mip}`, \"R32_FLOAT\" ])),\r\n OutputBuffer: \"R8G8B8A8_SNORM\",\r\n SSAOOutputBuffer: \"R8G8B8A8_SNORM\",\r\n LightIndexCount: \"R32_SINT\"\r\n});\r\n\r\n/**\r\n * UAVs a shipped effect declares and Carbon's renderer never binds, so on\r\n * D3D11 the slot is empty: a write to it is dropped.\r\n *\r\n * - `PackedOutputBuffer8`..`15`: CORTAO's Pack kernel declares sixteen packed\r\n * mips, and Tr2SSAO binds eight (Tr2SSAO.cpp:659-665) because it makes at\r\n * most eight (:547-555). The kernel writes a mip only below the mip count,\r\n * so the unbound eight are never written either. Declared, they would need\r\n * sixteen storage textures in one stage, twice WebGPU's common limit.\r\n *\r\n * A backend may leave these out of its binding layout, with their writes.\r\n */\r\nexport const CARBON_UNBOUND_UAVS = Object.freeze(new Set(\r\n Array.from({ length: 8 }, (_unused, index) => `PackedOutputBuffer${index + 8}`)\r\n));\r\n\r\n/**\r\n * The registers of one stage's never-bound UAVs (`CARBON_UNBOUND_UAVS`), in\r\n * register space 0, ascending.\r\n *\r\n * @param {object[]} semanticBindings The stage's effect-description bindings.\r\n * @returns {number[]} The UAV registers.\r\n */\r\nexport function unboundUavRegistersFor(semanticBindings)\r\n{\r\n return (semanticBindings || [])\r\n .filter((binding) => binding?.kind === \"uav\" && (binding.registerSpace ?? 0) === 0\r\n && CARBON_UNBOUND_UAVS.has(binding.metadataName ?? binding.carbon?.name))\r\n .map((binding) => binding.registerIndex)\r\n .sort((left, right) => left - right);\r\n}\r\n\r\n/**\r\n * The formats named above, in backend-neutral terms: the DXBC component class\r\n * a declaration of them must carry, the channel count and the element size.\r\n * D3D11 returns missing channels as 0 and a missing alpha as 1.\r\n */\r\nexport const CARBON_VIEW_FORMATS = Object.freeze({\r\n R32_FLOAT: Object.freeze({ componentClass: \"float\", channels: 1, bytesPerElement: 4 }),\r\n R32_UINT: Object.freeze({ componentClass: \"uint\", channels: 1, bytesPerElement: 4 }),\r\n R32_SINT: Object.freeze({ componentClass: \"sint\", channels: 1, bytesPerElement: 4 }),\r\n R8G8B8A8_SNORM: Object.freeze({ componentClass: \"float\", channels: 4, bytesPerElement: 4 })\r\n});\r\n\r\n/**\r\n * The effect-parameter annotation our containers carry the format in: a\r\n * string annotation such as `CjsViewFormat = \"R32_FLOAT\"` on the parameter.\r\n * Carbon's container already stores per-parameter annotations, so this adds a\r\n * name, not a field, and any Carbon reader still parses the file. It is ours,\r\n * hence the `Cjs` prefix; CCP's shipped effects never carry it, so for them\r\n * the table above is the source.\r\n */\r\nexport const CARBON_VIEW_FORMAT_ANNOTATION = \"CjsViewFormat\";\r\n\r\nconst STRING_ANNOTATION = 3;\r\n\r\n/**\r\n * The view format a parameter's own annotation names, or null.\r\n *\r\n * @param {object[]} annotations The parameter's annotations (records or models).\r\n * @returns {string|null} A known format, or null.\r\n */\r\nexport function annotatedViewFormat(annotations)\r\n{\r\n const entry = (annotations || []).find((annotation) =>\r\n annotation?.name === CARBON_VIEW_FORMAT_ANNOTATION && annotation.type === STRING_ANNOTATION);\r\n return entry && CARBON_VIEW_FORMATS[entry.stringValue] ? entry.stringValue : null;\r\n}\r\n\r\n/**\r\n * One parameter's view format: its own annotation, else the table.\r\n *\r\n * @param {string} name The Carbon parameter name.\r\n * @param {object[]} [annotations] The parameter's annotations.\r\n * @returns {string|null} The format, or null when unknown.\r\n */\r\nexport function viewFormatForParameter(name, annotations)\r\n{\r\n return annotatedViewFormat(annotations) ?? CARBON_TYPED_VIEWS[name] ?? null;\r\n}\r\n\r\nconst SEMANTIC_KIND = Object.freeze({\r\n resource: \"sampled-resource\",\r\n uav: \"storage-resource\"\r\n});\r\n\r\n/**\r\n * The typed-view formats for one stage: D3D identity to view format. A\r\n * parameter's `CjsViewFormat` annotation wins; otherwise its Carbon name is\r\n * looked up in the table.\r\n *\r\n * @param {object[]} semanticBindings The stage's effect-description bindings.\r\n * @returns {Object<string, string>} `{ \"sampled-resource:0:9\": \"R32_FLOAT\" }`\r\n */\r\nexport function typedViewsFor(semanticBindings)\r\n{\r\n const views = {};\r\n for (const binding of semanticBindings || [])\r\n {\r\n const kind = SEMANTIC_KIND[binding?.kind];\r\n const name = binding?.metadataName ?? binding?.carbon?.name;\r\n const format = kind && typeof name === \"string\"\r\n ? viewFormatForParameter(name, binding.annotations)\r\n : null;\r\n if (!format) continue;\r\n views[`${kind}:${binding.registerSpace ?? 0}:${binding.registerIndex}`] = format;\r\n }\r\n return views;\r\n}\r\n"],"names":["CARBON_TYPED_VIEWS","Object","freeze","Exposure","ExposureBuffer","Histogram","FlareOcclusionBuffer","CooldownMap","fromEntries","Array","from","length","_unused","mip","OutputBuffer","SSAOOutputBuffer","LightIndexCount","CARBON_UNBOUND_UAVS","Set","index","unboundUavRegistersFor","semanticBindings","filter","binding","kind","registerSpace","has","metadataName","carbon","name","map","registerIndex","sort","left","right","CARBON_VIEW_FORMATS","R32_FLOAT","componentClass","channels","bytesPerElement","R32_UINT","R32_SINT","R8G8B8A8_SNORM","CARBON_VIEW_FORMAT_ANNOTATION","STRING_ANNOTATION","annotatedViewFormat","annotations","entry","find","annotation","type","stringValue","viewFormatForParameter","SEMANTIC_KIND","resource","uav","typedViewsFor","views","format"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACaA,kBAAkB,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC5CC,EAAAA,QAAQ,EAAE,WAAW;AACrBC,EAAAA,cAAc,EAAE,WAAW;AAC3BC,EAAAA,SAAS,EAAE,UAAU;AACrBC,EAAAA,oBAAoB,EAAE,UAAU;AAChCC,EAAAA,WAAW,EAAE,UAAU;AACvB,EAAA,GAAGN,MAAM,CAACO,WAAW,CAACC,KAAK,CAACC,IAAI,CAAC;AAAEC,IAAAA,MAAM,EAAE;A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