Skip to content

Texture group caps: per-path max texture size applied at load - #167

Closed
CCP-Stefano wants to merge 1 commit into
carbonengine:mainfrom
CCP-Stefano:texture-group-caps
Closed

CCP-Stefano wants to merge 1 commit into
carbonengine:mainfrom
CCP-Stefano:texture-group-caps

Conversation

@CCP-Stefano

Copy link
Copy Markdown

Lets a game cap texture resolution per group of assets (by path substring), similar to texture groups in other engines.

  • trinity.SetTextureGroupCaps([(pattern, maxSize), ...]) replaces the rule table in one swap; AddTextureGroupCap / ClearTextureGroupCaps edit it.
  • When a 2D DDS loads, TriTextureRes::DoLoad reads its header and skips top mips until the larger side fits the first matching rule. Combined with the quality skip, the larger skip wins. Never skips past the last mip; non power of two sizes round down.
  • Cubes, volumes and non-DDS formats are not capped. Folders excluded from the quality skip are excluded from caps.
  • Empty table (the default) loads exactly as before.

Tested on Windows DX12 (TrinityDev): a 4096 texture with 11 mips under a 2048 cap loads at 2048; uncapped textures unchanged. Draft: opened for CI coverage (macOS has not been built locally).

🤖 Generated with Claude Code

trinity.SetTextureGroupCaps(list) sets an ordered list of (path substring, max size) rules;
AddTextureGroupCap(pattern, maxSize) and ClearTextureGroupCaps() edit it. When a 2D DDS
loads, TriTextureRes::DoLoad reads its header and skips top mips until the larger side fits
the first matching rule's max size (never past the last mip), so a capped texture never reads,
uploads or keeps those mips. The reader takes the larger of that skip and the quality skip.
A max size that is not a power of two rounds down. Folders excluded from the quality skip are
excluded from caps. The table is swapped whole under a mutex, so a load on any thread sees the
old table or the new one. An empty list (the default) loads exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ccpgames-carbon

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@CCP-Stefano

Copy link
Copy Markdown
Author

Closing: experimental work, opened by mistake for CI only.

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