Skip to content

Add BC block copy support to CopyRectangle - #752

Open
nv3ifu (nv3ifu) wants to merge 2 commits into
microsoft:mainfrom
nv3ifu:copyrectangle-bc-blocks
Open

nv3ifu (nv3ifu) wants to merge 2 commits into
microsoft:mainfrom
nv3ifu:copyrectangle-bc-blocks

Conversation

@nv3ifu

Copy link
Copy Markdown

Related to #568.

CopyRectangle currently rejects BC-compressed images. This change adds direct block copies between images with identical BC formats, without decompression or recompression.

The source rectangle is expanded to cover all intersecting 4x4 blocks. The destination origin is rounded down to a block boundary, so pixels outside the requested rectangle may also be overwritten. Both the original pixel bounds and the resulting block bounds are checked.

Copies use each image's row pitch, with source and destination storage ranges validated before writing. Different formats remain unsupported by the BC path, and filter flags do not affect the block copy.

Validation

I wrote local tests covering BC formats, aligned and unaligned regions, small images, padded row pitches, randomized copies, and invalid inputs. These tests passed with an x64 Release build.

The existing CopyRectangle tests in walbourn/directxtextest do not yet cover BC block copies.

Is this rounding behavior consistent with the intended semantics of #568? Should I adapt these local tests and submit a companion PR to walbourn/directxtextest?

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@nv3ifu

Copy link
Copy Markdown
Author

Applied clang-format 21.1.2 using the repository configuration.

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