-
Notifications
You must be signed in to change notification settings - Fork 109
Texture compression unaligned #4676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
castano
wants to merge
7
commits into
gpuweb:main
Choose a base branch
from
castano:texture-compression-unaligned
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
16a83e2
Add 'texture-compression-unaligned' feature name.
castano e3a9ef9
createTexture tests pass when texture-compression-unaligned feature i…
castano 6494006
Add test to ensure createTexture with unaligned extents fails without…
castano 367f969
Add test to validate correctness of copyTextureToTexture for block co…
castano 982d796
Validate correctness of image copies of compressed textures with unal…
castano 520249e
Fix test `texture_size,3d_texture,compressed_format`.
castano d95bffb
Merge branch 'main' into texture-compression-unaligned
castano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/webgpu/api/validation/capability_checks/features/texture_compression_unaligned.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| export const description = ` | ||
| Tests for capability checking for the 'texture-compression-unaligned' feature. | ||
|
|
||
| When the feature is not enabled, the behavior is unchanged: the size of mip level 0 of a | ||
| block-compressed texture must be a multiple of the texel block size. When the feature is enabled, | ||
| mip level 0 is allowed to have a size that is not a multiple of the texel block size (i.e. partial | ||
| edge blocks). | ||
| `; | ||
|
|
||
| import { makeTestGroup } from '../../../../../common/framework/test_group.js'; | ||
| import { | ||
| kCompressedTextureFormats, | ||
| getBlockInfoForTextureFormat, | ||
| getRequiredFeatureForTextureFormat, | ||
| } from '../../../../format_info.js'; | ||
| import { UniqueFeaturesOrLimitsGPUTest } from '../../../../gpu_test.js'; | ||
|
|
||
| export const g = makeTestGroup(UniqueFeaturesOrLimitsGPUTest); | ||
|
|
||
| const kTextureCompressionUnaligned = 'texture-compression-unaligned' as GPUFeatureName; | ||
|
|
||
| g.test('createTexture,unaligned_size') | ||
| .desc( | ||
| `Test that creating a compressed texture whose mip level 0 size is not a multiple of the texel | ||
| block size succeeds if and only if 'texture-compression-unaligned' is enabled.` | ||
| ) | ||
| .params(u => | ||
| u | ||
| .combine('format', kCompressedTextureFormats) | ||
| .combine('enable_feature', [true, false]) | ||
| // The unaligned dimension(s) of mip level 0 being tested. | ||
| .combine('sizeCase', ['width', 'height', 'both', 'single'] as const) | ||
| ) | ||
| .beforeAllSubcases(t => { | ||
| const { format, enable_feature } = t.params; | ||
|
|
||
| const requiredFeatures: GPUFeatureName[] = []; | ||
| const formatFeature = getRequiredFeatureForTextureFormat(format); | ||
| if (formatFeature) { | ||
| requiredFeatures.push(formatFeature); | ||
| } | ||
| if (enable_feature) { | ||
| requiredFeatures.push(kTextureCompressionUnaligned); | ||
| } | ||
|
|
||
| t.selectDeviceOrSkipTestCase({ requiredFeatures }); | ||
| }) | ||
| .fn(t => { | ||
| const { format, enable_feature, sizeCase } = t.params; | ||
| t.skipIfTextureFormatNotSupported(format); | ||
|
|
||
| const { blockWidth, blockHeight } = getBlockInfoForTextureFormat(format); | ||
|
|
||
| // Construct a mip level 0 size that is not a multiple of the texel block size. | ||
| const size = (() => { | ||
| switch (sizeCase) { | ||
| case 'width': | ||
| return [blockWidth + 1, blockHeight, 1]; | ||
| case 'height': | ||
| return [blockWidth, blockHeight + 1, 1]; | ||
| case 'both': | ||
| return [blockWidth + 1, blockHeight + 1, 1]; | ||
| case 'single': | ||
| // A single partial edge block in both dimensions. | ||
| return [1, 1, 1]; | ||
| } | ||
| })(); | ||
|
|
||
| const descriptor: GPUTextureDescriptor = { | ||
| size, | ||
| format, | ||
| usage: GPUTextureUsage.TEXTURE_BINDING, | ||
| }; | ||
|
|
||
| // Without the feature, an unaligned mip level 0 size is a validation error. | ||
| t.expectValidationError(() => { | ||
| t.createTextureTracked(descriptor); | ||
| }, !enable_feature); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.