feat(A.5 T22.5): wire QualityPreset into renderer + streaming (commit 2/2)
GameWindow.OnLoad resolves QualitySettings.From(_persistedDisplay.Quality) + WithEnvOverrides() immediately after LoadAndApplyPersistedSettings, stores result in _resolvedQuality field. All six quality dimensions applied: - NearRadius / FarRadius: replace old T16 env-var-only block; preset drives the radii, legacy ACDREAM_STREAM_RADIUS override still honoured. - MsaaSamples: WindowOptions.Samples reads from startup quality resolution in Run() (pre-window-create read from SettingsStore). MSAA cannot change at runtime; ReapplyQualityPreset logs a restart-required warning if the new preset would change it. - AnisotropicLevel: TerrainAtlas.SetAnisotropic() called after Build() and again in ReapplyQualityPreset. Temporarily removes bindless residency before the GL TexParameter call, re-makes resident after. - AlphaToCoverage: WbDrawDispatcher.AlphaToCoverage property gates the glEnable/glDisable(SampleAlphaToCoverage) pair around the opaque pass. - MaxCompletionsPerFrame: set on StreamingController after construction and after each mid-session restart. ReapplyQualityPreset(QualityPreset) method handles mid-session changes (Settings panel Quality dropdown Save): rebuilds streamer + controller for radius changes, toggles A2C and aniso immediately, logs MSAA restart caveat. onSaveDisplay callback updated to call ReapplyQualityPreset when Quality field changes. TerrainModernRenderer.Atlas property added to expose the atlas for mid-session aniso updates. 991 tests passing, 8 pre-existing failures unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
afa4200107
commit
28d2c6018e
5 changed files with 236 additions and 16 deletions
|
|
@ -415,6 +415,43 @@ public sealed unsafe class TerrainAtlas : IDisposable
|
|||
Array.Empty<uint>(), Array.Empty<uint>(), Array.Empty<uint>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A.5 T22.5: update GL_TEXTURE_MAX_ANISOTROPY on the terrain atlas at
|
||||
/// runtime (called by <see cref="GameWindow.ReapplyQualityPreset"/> when
|
||||
/// the user changes Quality preset mid-session). Idempotent — calling with
|
||||
/// the same level as the current setting is safe and produces no visual
|
||||
/// change. The texture must not be resident-bindless when its parameters
|
||||
/// are mutated; we temporarily make it non-resident if needed.
|
||||
/// </summary>
|
||||
public void SetAnisotropic(int level)
|
||||
{
|
||||
// If bindless handles are live we must make them non-resident before
|
||||
// mutating texture state, then re-resident after.
|
||||
bool wasResident = _handlesGenerated && _bindless is not null;
|
||||
if (wasResident)
|
||||
{
|
||||
_bindless!.MakeNonResident(_terrainHandle);
|
||||
// Alpha texture is not affected by anisotropic but we must keep
|
||||
// residency symmetric — re-generate both handles after.
|
||||
_bindless.MakeNonResident(_alphaHandle);
|
||||
_handlesGenerated = false;
|
||||
}
|
||||
|
||||
_gl.BindTexture(TextureTarget.Texture2DArray, GlTexture);
|
||||
// GL_TEXTURE_MAX_ANISOTROPY = 0x84FE
|
||||
_gl.TexParameter(TextureTarget.Texture2DArray, (TextureParameterName)0x84FE, (float)level);
|
||||
_gl.BindTexture(TextureTarget.Texture2DArray, 0);
|
||||
|
||||
// Re-generate bindless handles if they were live before.
|
||||
if (wasResident)
|
||||
{
|
||||
// GetBindlessHandles regenerates and makes resident.
|
||||
_ = GetBindlessHandles();
|
||||
}
|
||||
|
||||
Console.WriteLine($"TerrainAtlas: anisotropic updated to {level}x");
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Phase 1: release bindless residency BEFORE deleting textures.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue