Skip to content

Proper X360 tiling/detiling support#13

Merged
JeBobs merged 2 commits into
BurnoutHints:mainfrom
BurnoutDecomp:360-tiling
Jul 6, 2026
Merged

Proper X360 tiling/detiling support#13
JeBobs merged 2 commits into
BurnoutHints:mainfrom
BurnoutDecomp:360-tiling

Conversation

@JeBobs

@JeBobs JeBobs commented Jul 6, 2026

Copy link
Copy Markdown
Member

No description provided.

@JeBobs JeBobs merged commit 98ede08 into BurnoutHints:main Jul 6, 2026
3 of 4 checks passed
@JeBobs JeBobs deleted the 360-tiling branch July 6, 2026 18:39

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 92e458f633

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{
LogVerbose(verbose, $"Tiling X360 bitmap data ({Math.Max(1, (int)destTiled.MipmapLevels)} mip level(s))...");
byte[] linearData = await File.ReadAllBytesAsync(destinationBitmapPath, cancellationToken);
byte[] tiledData = X360TextureUtilities.GetTiled360TextureData(destTiled, linearData);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Swap X360 texture words before tiling

When porting TUB/BPR data to X360, ConvertFormat leaves the destination fetch constant at the GPUTEXTURE_FETCH_CONSTANT default GPUENDIAN_8IN16, and this path now marks the payload tiled. This new write-back only calls GetTiled360TextureData, which reorders blocks but never applies the new SwapEndian8in16 helper, so multi-byte texel/block data is written in PC byte order while the X360 header advertises 8-in-16 endian storage; those converted textures will be byte-swapped incorrectly on load and render corrupted.

Useful? React with 👍 / 👎.

Comment on lines +301 to +302
int blockWidth = Math.Max(1, mipWidth / blockSize);
int blockHeight = Math.Max(1, mipHeight / blockSize);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use ceil block counts for compressed X360 mips

For block-compressed formats GetX360BlockInfo returns BlockSize = 4, but these calculations floor-divide the mip dimensions. A 10x10 DXT1 mip has 3x3 blocks, while this code treats it as 2x2, dropping the final block row/column and advancing subsequent mip offsets too little; the same floor division appears in ConvertToLinearTexture, so both porting to X360 and detiling existing X360 NPOT compressed textures corrupt their bitmap data. The older CalculateMipSize already uses (width + 3) / 4, which is the shape needed here too.

Useful? React with 👍 / 👎.

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.

1 participant