|
1 |
| -// MAINTENANCE_TODO: Remove all deprecated functions once they are no longer in use. |
2 | 1 | import { isCompatibilityDevice } from '../common/framework/test_config.js';
|
3 | 2 | import { keysOf } from '../common/util/data_tables.js';
|
4 | 3 | import { assert, unreachable } from '../common/util/util.js';
|
@@ -1518,13 +1517,75 @@ type TextureFormatInfo_TypeCheck = {
|
1518 | 1517 | )
|
1519 | 1518 | );
|
1520 | 1519 |
|
1521 |
| -// MAINTENANCE_TODO: make this private to avoid tests wrongly trying to |
1522 |
| -// filter things on their own. Various features make this hard to do correctly |
1523 |
| -// so we'd prefer to put filtering here, in a central place and add other functions |
1524 |
| -// to get at this data so that they always have enough info to give the correct answer. |
1525 |
| -/** Per-GPUTextureFormat info. */ |
1526 |
| -/** @deprecated */ |
1527 |
| -export const kTextureFormatInfo = { |
| 1520 | +/** |
| 1521 | + * DO NOT EXPORT THIS - functions that need info from this table should use the appropriate |
| 1522 | + * method for their needs. |
| 1523 | + * |
| 1524 | + * For a list of textures formats for test parameters there are: |
| 1525 | + * |
| 1526 | + * Lists of formats that might require features to be enabled |
| 1527 | + * * kPossibleColorRenderableTextureFormats |
| 1528 | + * * kPossibleStorageTextureFormats |
| 1529 | + * * kPossibleReadWriteStorageTextureFormats |
| 1530 | + * * kPossibleMultisampledTextureFormats |
| 1531 | + * |
| 1532 | + * Lists of formats that end in -srgb |
| 1533 | + * * kDifferentBaseFormatTextureFormats (includes compressed textures) |
| 1534 | + * * kDifferentBaseFormatRegularTextureFormats (does not include compressed textures) |
| 1535 | + * |
| 1536 | + * Formats that require a feature to use at all (mostly compressed formats) |
| 1537 | + * * kOptionalTextureFormats |
| 1538 | + * |
| 1539 | + * Misc |
| 1540 | + * * kRegularTextureFormats |
| 1541 | + * * kSizedDepthStencilFormats |
| 1542 | + * * kUnsizedDepthStencilFormats |
| 1543 | + * * kCompressedTextureFormats |
| 1544 | + * * kUncompressedTextureFormats |
| 1545 | + * * kColorTextureFormats - color formats including compressed and sint/uint |
| 1546 | + * * kEncodableTextureFormats - formats that TexelView supports. |
| 1547 | + * * kSizedTextureFormats - formats that have a known size (so not depth24plus ...) |
| 1548 | + * * kDepthStencilFormats - depth, stencil, depth-stencil |
| 1549 | + * * kDepthTextureFormats - depth and depth-stencil |
| 1550 | + * * kStencilTextureFormats - stencil and depth-stencil |
| 1551 | + * * kAllTextureFormats |
| 1552 | + * |
| 1553 | + * If one of the list above does not work, add a new one or to filter in beforeAllSubcases you generally want to use |
| 1554 | + * You will not know if you can actually use a texture for the given use case until the test runs and has a device. |
| 1555 | + * |
| 1556 | + * * isTextureFormatPossiblyUsableAsRenderAttachment |
| 1557 | + * * isTextureFormatPossiblyUsableAsColorRenderAttachment |
| 1558 | + * * isTextureFormatPossiblyMultisampled |
| 1559 | + * * isTextureFormatPossiblyStorageReadable |
| 1560 | + * * isTextureFormatPossiblyStorageReadWritable |
| 1561 | + * * isTextureFormatPossiblyFilterableAsTextureF32 |
| 1562 | + * |
| 1563 | + * These are also usable before or during a test |
| 1564 | + * |
| 1565 | + * * isColorTextureFormat |
| 1566 | + * * isDepthTextureFormat |
| 1567 | + * * isStencilTextureFormat |
| 1568 | + * * isDepthOrStencilTextureFormat |
| 1569 | + * * isEncodableTextureFormat |
| 1570 | + * * isRegularTextureFormat |
| 1571 | + * * isCompressedFloatTextureFormat |
| 1572 | + * * isSintOrUintFormat |
| 1573 | + * |
| 1574 | + * To skip a test use the `skipIfXXX` tests in `GPUTest` if possible. Otherwise these functions |
| 1575 | + * require a device to give a correct answer. |
| 1576 | + * |
| 1577 | + * * isTextureFormatUsableAsRenderAttachment |
| 1578 | + * * isTextureFormatColorRenderable |
| 1579 | + * * isTextureFormatResolvable |
| 1580 | + * * isTextureFormatBlendable |
| 1581 | + * * isTextureFormatMultisampled |
| 1582 | + * * isTextureFormatUsableAsStorageFormat |
| 1583 | + * * isTextureFormatUsableAsReadWriteStorageTexture |
| 1584 | + * * isTextureFormatUsableAsStorageFormatInCreateShaderModule |
| 1585 | + * |
| 1586 | + * Per-GPUTextureFormat info. |
| 1587 | + */ |
| 1588 | +const kTextureFormatInfo = { |
1528 | 1589 | ...kRegularTextureFormatInfo,
|
1529 | 1590 | ...kSizedDepthStencilFormatInfo,
|
1530 | 1591 | ...kUnsizedDepthStencilFormatInfo,
|
@@ -1801,15 +1862,6 @@ export function textureDimensionAndFormatCompatible(
|
1801 | 1862 | );
|
1802 | 1863 | }
|
1803 | 1864 |
|
1804 |
| -/** @deprecated */ |
1805 |
| -export function viewCompatibleDeprecated( |
1806 |
| - compatibilityMode: boolean, |
1807 |
| - a: GPUTextureFormat, |
1808 |
| - b: GPUTextureFormat |
1809 |
| -): boolean { |
1810 |
| - return compatibilityMode ? a === b : a === b || a + '-srgb' === b || b + '-srgb' === a; |
1811 |
| -} |
1812 |
| - |
1813 | 1865 | /**
|
1814 | 1866 | * Check if two formats are view format compatible.
|
1815 | 1867 | */
|
@@ -2039,11 +2091,6 @@ export function isEncodableTextureFormat(format: GPUTextureFormat) {
|
2039 | 2091 | return kEncodableTextureFormats.includes(format as EncodableTextureFormat);
|
2040 | 2092 | }
|
2041 | 2093 |
|
2042 |
| -/** @deprecated use isTextureFormatUsableAsRenderAttachment */ |
2043 |
| -export function canUseAsRenderTargetDeprecated(format: GPUTextureFormat) { |
2044 |
| - return kTextureFormatInfo[format].colorRender || isDepthOrStencilTextureFormat(format); |
2045 |
| -} |
2046 |
| - |
2047 | 2094 | /**
|
2048 | 2095 | * Returns if a texture can be used as a render attachment. some color formats and all
|
2049 | 2096 | * depth textures and stencil textures are usable with usage RENDER_ATTACHMENT.
|
@@ -2177,20 +2224,6 @@ export const kCompatModeUnsupportedStorageTextureFormats: readonly GPUTextureFor
|
2177 | 2224 | 'rg32uint',
|
2178 | 2225 | ] as const;
|
2179 | 2226 |
|
2180 |
| -/** @deprecated */ |
2181 |
| -export function isTextureFormatUsableAsStorageFormatDeprecated( |
2182 |
| - format: GPUTextureFormat, |
2183 |
| - isCompatibilityMode: boolean |
2184 |
| -): boolean { |
2185 |
| - if (isCompatibilityMode) { |
2186 |
| - if (kCompatModeUnsupportedStorageTextureFormats.indexOf(format) >= 0) { |
2187 |
| - return false; |
2188 |
| - } |
2189 |
| - } |
2190 |
| - const info = kTextureFormatInfo[format]; |
2191 |
| - return !!(info.color?.storage || info.depth?.storage || info.stencil?.storage); |
2192 |
| -} |
2193 |
| - |
2194 | 2227 | /**
|
2195 | 2228 | * Return true if the format can be used as a storage texture.
|
2196 | 2229 | * Note: Some formats can be compiled in a shader but can not be used
|
@@ -2285,19 +2318,6 @@ export const kCompatModeUnsupportedMultisampledTextureFormats: readonly GPUTextu
|
2285 | 2318 | 'r32float',
|
2286 | 2319 | ] as const;
|
2287 | 2320 |
|
2288 |
| -/** @deprecated use isTextureFormatMultisampled */ |
2289 |
| -export function isMultisampledTextureFormatDeprecated( |
2290 |
| - format: GPUTextureFormat, |
2291 |
| - isCompatibilityMode: boolean |
2292 |
| -): boolean { |
2293 |
| - if (isCompatibilityMode) { |
2294 |
| - if (kCompatModeUnsupportedMultisampledTextureFormats.indexOf(format) >= 0) { |
2295 |
| - return false; |
2296 |
| - } |
2297 |
| - } |
2298 |
| - return kAllTextureFormatInfo[format].multisample; |
2299 |
| -} |
2300 |
| - |
2301 | 2321 | /**
|
2302 | 2322 | * Returns true if you can make a multisampled texture from the given format.
|
2303 | 2323 | */
|
|
0 commit comments