Skip to content

Keep the fog RT shader table alive and cache the reference point cast - #126

Open
JohnGreenFC wants to merge 1 commit into
mainfrom
optimization-fog-table-and-reference-point-cache
Open

JohnGreenFC wants to merge 1 commit into
mainfrom
optimization-fog-table-and-reference-point-cache

Conversation

@JohnGreenFC

Copy link
Copy Markdown

Summary

Goal: remove two pieces of per-frame work whose inputs rarely change, so they become do-once-and-reuse.

1. Volumetric fog raytraced shadow shader table (Tr2VolumetricsRenderer).
The froxel fog pass that traces sun shadows built a local Tr2RtShaderTableAL on the stack every frame, which created a committed GPU upload buffer, filled it, and released it again at the end of the frame. The shader table is now a member of the renderer, so its buffer persists and is only rebuilt when the description changes. The same pass was also constructing BlueSharedString objects for its technique name, shader options and parameter names on every call; those are now file-scope constants.

2. Reference point cast (EveSpaceObject2).
Each update cast the object's ball-position function to IEveReferencePoint to read the reference position, which is an interface query on every object every frame. The cast result is now cached together with the pointer it was taken from, and only redone when the ball-position object is replaced.

Linked issue (optional)

Testing

Windows, DX12, release build. Measured in the EVE Frontier client on the QA Megastructure route (1080p, low preset) against origin/main: about -0.5 ms frame mean with raytraced shadows and -0.65 ms with cascaded shadows (single flights, ~0.5 ms noise band; the low preset sets volumetrics to LOW, so the fog part is understated there). Smoke test of this branch alone: full route flown with raytraced shadows, no frames over 100 ms, no crash dumps. Not built on Mac.

AI assistance

AI testing, investigation and CL explanation

…nce point cast

Keep the volumetric fog raytraced shadow shader table alive between frames.
Cache the reference point cast in EveSpaceObject2.
Copilot AI balanced review requested due to automatic review settings October 16, 2026 12:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@JohnGreenFC
JohnGreenFC marked this pull request as ready for review October 16, 2026 13:10
@filipppavlov
filipppavlov requested a balanced review from Copilot October 20, 2026 13:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

GPU allocation reuse remains unimplemented, and source-address reuse can leave the reference-point cache stale.

2 open issues

Review effort: Balanced

Comment on lines +541 to +544
if( m_referencePointSource != m_ballPosition.p )
{
refObject->GetReferencePoint( &referencePosition, time );
m_referencePointSource = m_ballPosition.p;
m_referencePoint = BlueCastPtr( m_ballPosition );
TRINITY_STATS_ZONE( "Create shader table" );
m_shaderTableDesc.AddRayGenShader( rayGenName.c_str(), material );
m_shaderTableDesc.AddMissShader( missName.c_str(), material );
m_rtShadowShaderTable.Create( m_shaderTableDesc, pipelineState, renderContext.GetPrimaryRenderContext() );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants