Generalize generated mesh draw signature
This commit is contained in:
parent
b9b9dcbe46
commit
e11edf0f4c
3 changed files with 17 additions and 13 deletions
|
|
@ -42,8 +42,8 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
private const int MaxTubeFieldVertices = MaxTubeFieldSegments * 4;
|
||||
private const int MaxTubeFieldIndices = MaxTubeFieldSegments * 6;
|
||||
private const int MaxTubeFieldDrawBatches = 4_096;
|
||||
private const int TubeFieldDrawArgumentUIntCount = 5;
|
||||
private const int TubeFieldDrawArgumentBytes = TubeFieldDrawArgumentUIntCount * sizeof(uint);
|
||||
private const int GeneratedMeshDrawArgumentUIntCount = 5;
|
||||
private const int GeneratedMeshDrawArgumentBytes = GeneratedMeshDrawArgumentUIntCount * sizeof(uint);
|
||||
private const float SurfaceTransparentMinZ = -1.85f;
|
||||
private const float SurfaceTransparentMaxZ = 0.45f;
|
||||
private const int BloomLevelCount = 3;
|
||||
|
|
@ -143,7 +143,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
private readonly ID3D12RootSignature fractalReservoirRootSignature;
|
||||
private readonly ID3D12RootSignature tubeFieldRootSignature;
|
||||
private readonly ID3D12RootSignature tubeFieldRenderRootSignature;
|
||||
private readonly ID3D12CommandSignature tubeFieldDrawCommandSignature;
|
||||
private readonly ID3D12CommandSignature generatedMeshDrawCommandSignature;
|
||||
private readonly D3D12BlueNoiseTexture blueNoiseTexture;
|
||||
private D3D12FieldTexture2D? tubeFieldFallbackRampTexture;
|
||||
private ID3D12PipelineState? heightFieldBasePipelineState;
|
||||
|
|
@ -371,7 +371,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
tubeFieldVertexBuffer = new D3D12StructuredBuffer(device, MaxTubeFieldVertices, Marshal.SizeOf<D3D12TubeFieldVertex>(), "Aquarium D3D12 TubeField Vertex Buffer", allowUnorderedAccess: true);
|
||||
tubeFieldIndexBuffer = new D3D12StructuredBuffer(device, MaxTubeFieldIndices, Marshal.SizeOf<uint>(), "Aquarium D3D12 TubeField Index Buffer", allowUnorderedAccess: true);
|
||||
tubeFieldStatsBuffer = new D3D12StructuredBuffer(device, 4, Marshal.SizeOf<uint>(), "Aquarium D3D12 TubeField Stats Buffer", allowUnorderedAccess: true);
|
||||
tubeFieldDrawArgumentBuffer = new D3D12StructuredBuffer(device, MaxTubeFieldDrawBatches * TubeFieldDrawArgumentUIntCount, Marshal.SizeOf<uint>(), "Aquarium D3D12 TubeField Indirect Draw Arguments", allowUnorderedAccess: true);
|
||||
tubeFieldDrawArgumentBuffer = new D3D12StructuredBuffer(device, MaxTubeFieldDrawBatches * GeneratedMeshDrawArgumentUIntCount, Marshal.SizeOf<uint>(), "Aquarium D3D12 TubeField Indirect Draw Arguments", allowUnorderedAccess: true);
|
||||
resourceRegistry.Add("sdf-light-buffer", sdfLightBuffer);
|
||||
resourceRegistry.Add("sdf-object-buffer", sdfObjectBuffer);
|
||||
resourceRegistry.Add("gpu-sensor-camera-buffer", gpuSensorCameraBuffer);
|
||||
|
|
@ -409,8 +409,8 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
tubeFieldRootSignature.Name = "Aquarium D3D12 TubeField Root Signature";
|
||||
tubeFieldRenderRootSignature = CreateTubeFieldRenderRootSignature();
|
||||
tubeFieldRenderRootSignature.Name = "Aquarium D3D12 TubeField Render Root Signature";
|
||||
tubeFieldDrawCommandSignature = CreateTubeFieldDrawCommandSignature();
|
||||
tubeFieldDrawCommandSignature.Name = "Aquarium D3D12 TubeField Draw Command Signature";
|
||||
generatedMeshDrawCommandSignature = CreateGeneratedMeshDrawCommandSignature();
|
||||
generatedMeshDrawCommandSignature.Name = "Aquarium D3D12 Generated Mesh Draw Command Signature";
|
||||
CaptureShaderWriteTimes();
|
||||
StartPipelineBuild("initial");
|
||||
viewport = new Viewport(0.0f, 0.0f, width, height);
|
||||
|
|
@ -985,7 +985,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
fractalReservoirRootSignature.Dispose();
|
||||
tubeFieldRootSignature.Dispose();
|
||||
tubeFieldRenderRootSignature.Dispose();
|
||||
tubeFieldDrawCommandSignature.Dispose();
|
||||
generatedMeshDrawCommandSignature.Dispose();
|
||||
blueNoiseTexture.Dispose();
|
||||
tubeFieldFallbackRampTexture?.Dispose();
|
||||
studioIrradianceTexture.Dispose();
|
||||
|
|
@ -1893,7 +1893,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
int drawArgumentOffsetBytes)
|
||||
{
|
||||
activeCommandList.ExecuteIndirect(
|
||||
tubeFieldDrawCommandSignature,
|
||||
generatedMeshDrawCommandSignature,
|
||||
1,
|
||||
generatedMesh.DrawArguments.Resource,
|
||||
(ulong)drawArgumentOffsetBytes,
|
||||
|
|
@ -2382,7 +2382,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
new Vector4(normalized.AmplitudePower, normalized.AmplitudeScale, normalized.NormalizeMin, normalized.NormalizeMax),
|
||||
new Vector4(normalized.BaseRadius, normalized.RadiusScale, normalized.Alpha, normalized.Feather),
|
||||
new Vector4(normalized.EmissionScale, normalized.CatmullRomSubdivisions, segmentBase, dispatchSegments),
|
||||
new Vector4(tubeFieldDrawBatches.Count * TubeFieldDrawArgumentUIntCount, startIndex, 0.0f, 0.0f),
|
||||
new Vector4(tubeFieldDrawBatches.Count * GeneratedMeshDrawArgumentUIntCount, startIndex, 0.0f, 0.0f),
|
||||
normalized.Origin,
|
||||
0.0f,
|
||||
normalized.AxisStep,
|
||||
|
|
@ -2417,7 +2417,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
sourceBuffer,
|
||||
constantsUpload.GpuVirtualAddress,
|
||||
normalized.RampResourceKey,
|
||||
tubeFieldDrawBatches.Count * TubeFieldDrawArgumentBytes));
|
||||
tubeFieldDrawBatches.Count * GeneratedMeshDrawArgumentBytes));
|
||||
}
|
||||
|
||||
activeTubeFieldDrawIndexCount = activeTubeFieldDispatchedSegments * 6;
|
||||
|
|
@ -3641,7 +3641,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
return device.CreateRootSignature(0, in description, RootSignatureVersion.Version1);
|
||||
}
|
||||
|
||||
private ID3D12CommandSignature CreateTubeFieldDrawCommandSignature()
|
||||
private ID3D12CommandSignature CreateGeneratedMeshDrawCommandSignature()
|
||||
{
|
||||
var arguments = new[]
|
||||
{
|
||||
|
|
@ -3652,7 +3652,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
};
|
||||
var description = new CommandSignatureDescription
|
||||
{
|
||||
ByteStride = TubeFieldDrawArgumentBytes,
|
||||
ByteStride = GeneratedMeshDrawArgumentBytes,
|
||||
IndirectArguments = arguments,
|
||||
};
|
||||
return device.CreateCommandSignature<ID3D12CommandSignature>(description, null);
|
||||
|
|
|
|||
|
|
@ -245,3 +245,4 @@
|
|||
{"lesson":"The field evidence DSL can now plan generic resource-backed claims, not only Tube claims. `claim id=... resource=... encoding=... layer=...` creates a selected claim/candidate over the declared resource, so Mesh packages, SurfacePage height/SDF/material pages, and VolumeTexture density/extinction resources can reach AquariumFieldLoweringPlanner and produce backend packets. This closes the planner/resource contract cut. Actual Mesh rendering remains blocked on a vertex attribute/material layout contract; the mesh package owns buffer shape, not byte semantics. Fensalir build and Aquarium.Engine.Tests passed.","timestamp":"2026-05-26T21:42:00+01:00","files":["src/Aquarium.Engine.Contracts/Render/AquariumFieldScriptCompiler.cs","tests/Aquarium.Engine.Tests/FieldScriptCompilerTests.cs","state/map.yaml"],"source":"continued field packet/resource migration after mesh resolver","topic":"generic-field-resource-claims"}
|
||||
{"lesson":"Mesh layout authority is now split by source. Imported/user-facing mesh packages default to the engine standard `PositionNormalUvColor` vertex layout (48-byte position, normal, uv, color contract), which is the lane for FBX/OBJ-style assets. Generated meshes can declare `layout=PipelinePrivate`; those bytes belong to the selected lowering that emits and consumes them, so Fensalir does not force TubeField or future procedural surfaces through a bloated public vertex ABI. Fensalir build and Aquarium.Engine.Tests passed with 23 tests.","timestamp":"2026-05-26T21:58:00+01:00","files":["src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs","src/Aquarium.Engine.Contracts/Render/AquariumFieldScriptCompiler.cs","src/Aquarium.Engine/Render/D3D12FieldMesh.cs","src/Aquarium.Engine/Render/D3D12FieldResourceRegistry.cs","tests/Aquarium.Engine.Tests/FieldScriptCompilerTests.cs","state/map.yaml"],"source":"user clarified imported mesh versus generated mesh layout authority","topic":"field-mesh-layout-authority"}
|
||||
{"lesson":"TubeField now uses the first explicit pipeline-private generated mesh render lane. The compute path still owns the minimal D3D12TubeFieldVertex/index/indirect argument layout, but render now binds those buffers through a named D3D12PipelinePrivateGeneratedMesh before applying TubeField material root bindings and ExecuteIndirect. This implements the chosen generated-mesh option without creating a public imported-mesh renderer or forcing splines through PositionNormalUvColor. Fensalir build, Aquarium.Engine.Tests, and headless reload passed.","timestamp":"2026-05-26T22:49:00+01:00","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","state/map.yaml"],"source":"user chose pipeline-private generated mesh draw path for spline migration","topic":"pipeline-private-generated-mesh-rendering"}
|
||||
{"lesson":"The generated-mesh DrawIndexed indirect ABI is no longer TubeField-owned. D3D12Renderer now creates a generic generatedMeshDrawCommandSignature with the standard five-uint D3D12 DrawIndexedArguments stride; TubeField still owns its compute-emitted argument buffer, but the command signature is reusable for future pipeline-private generated mesh lowerings. Fensalir build, Aquarium.Engine.Tests, and headless reload passed.","timestamp":"2026-05-26T22:52:00+01:00","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","state/map.yaml"],"source":"continued pipeline-private generated mesh migration","topic":"generated-mesh-indirect-draw-abi"}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,10 @@ next_actions:
|
|||
first generated-mesh render cut is TubeField itself: compute emits
|
||||
pipeline-private vertex/index/indirect buffers, render binds them through a
|
||||
named `D3D12PipelinePrivateGeneratedMesh`, and TubeField material state
|
||||
supplies the shader-specific source/ramp/constants.
|
||||
supplies the shader-specific source/ramp/constants. The DrawIndexed indirect
|
||||
command signature is now owned by the generated-mesh lane rather than
|
||||
TubeField, so future generated page/volume/surface lowerings can share that
|
||||
draw ABI while owning their own producer buffers and materials.
|
||||
- Move any remaining client-only Epiphany state found here back to `E:\Projects\Aquarium-Engine`.
|
||||
- Keep Mimir app/adapters out of this repo; Fensalir may expose generic sensor-fusion contracts only.
|
||||
- Package contracts/host deliberately before replacing sibling source references in client repos.
|
||||
|
|
|
|||
Loading…
Reference in a new issue