|
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';
|
@@ -1526,13 +1525,75 @@ type TextureFormatInfo_TypeCheck = {
|
1526 | 1525 | )
|
1527 | 1526 | );
|
1528 | 1527 |
|
1529 |
| -// MAINTENANCE_TODO: make this private to avoid tests wrongly trying to |
1530 |
| -// filter things on their own. Various features make this hard to do correctly |
1531 |
| -// so we'd prefer to put filtering here, in a central place and add other functions |
1532 |
| -// to get at this data so that they always have enough info to give the correct answer. |
1533 |
| -/** Per-GPUTextureFormat info. */ |
1534 |
| -/** @deprecated */ |
1535 |
| -export const kTextureFormatInfo = { |
| 1528 | +/** |
| 1529 | + * DO NOT EXPORT THIS - functions that need info from this table should use the appropriate |
| 1530 | + * method for their needs. |
| 1531 | + * |
| 1532 | + * For a list of textures formats for test parameters there are: |
| 1533 | + * |
| 1534 | + * Lists of formats that might require features to be enabled |
| 1535 | + * * kPossibleColorRenderableTextureFormats |
| 1536 | + * * kPossibleStorageTextureFormats |
| 1537 | + * * kPossibleReadWriteStorageTextureFormats |
| 1538 | + * * kPossibleMultisampledTextureFormats |
| 1539 | + * |
| 1540 | + * Lists of formats that end in -srgb |
| 1541 | + * * kDifferentBaseFormatTextureFormats (includes compressed textures) |
| 1542 | + * * kDifferentBaseFormatRegularTextureFormats (does not include compressed textures) |
| 1543 | + * |
| 1544 | + * Formats that require a feature to use at all (mostly compressed formats) |
| 1545 | + * * kOptionalTextureFormats |
| 1546 | + * |
| 1547 | + * Misc |
| 1548 | + * * kRegularTextureFormats |
| 1549 | + * * kSizedDepthStencilFormats |
| 1550 | + * * kUnsizedDepthStencilFormats |
| 1551 | + * * kCompressedTextureFormats |
| 1552 | + * * kUncompressedTextureFormats |
| 1553 | + * * kColorTextureFormats - color formats including compressed and sint/uint |
| 1554 | + * * kEncodableTextureFormats - formats that TexelView supports. |
| 1555 | + * * kSizedTextureFormats - formats that have a known size (so not depth24plus ...) |
| 1556 | + * * kDepthStencilFormats - depth, stencil, depth-stencil |
| 1557 | + * * kDepthTextureFormats - depth and depth-stencil |
| 1558 | + * * kStencilTextureFormats - stencil and depth-stencil |
| 1559 | + * * kAllTextureFormats |
| 1560 | + * |
| 1561 | + * If one of the list above does not work, add a new one or to filter in beforeAllSubcases you generally want to use |
| 1562 | + * You will not know if you can actually use a texture for the given use case until the test runs and has a device. |
| 1563 | + * |
| 1564 | + * * isTextureFormatPossiblyUsableAsRenderAttachment |
| 1565 | + * * isTextureFormatPossiblyUsableAsColorRenderAttachment |
| 1566 | + * * isTextureFormatPossiblyMultisampled |
| 1567 | + * * isTextureFormatPossiblyStorageReadable |
| 1568 | + * * isTextureFormatPossiblyStorageReadWritable |
| 1569 | + * * isTextureFormatPossiblyFilterableAsTextureF32 |
| 1570 | + * |
| 1571 | + * These are also usable before or during a test |
| 1572 | + * |
| 1573 | + * * isColorTextureFormat |
| 1574 | + * * isDepthTextureFormat |
| 1575 | + * * isStencilTextureFormat |
| 1576 | + * * isDepthOrStencilTextureFormat |
| 1577 | + * * isEncodableTextureFormat |
| 1578 | + * * isRegularTextureFormat |
| 1579 | + * * isCompressedFloatTextureFormat |
| 1580 | + * * isSintOrUintFormat |
| 1581 | + * |
| 1582 | + * To skip a test use the `skipIfXXX` tests in `GPUTest` if possible. Otherwise these functions |
| 1583 | + * require a device to give a correct answer. |
| 1584 | + * |
| 1585 | + * * isTextureFormatUsableAsRenderAttachment |
| 1586 | + * * isTextureFormatColorRenderable |
| 1587 | + * * isTextureFormatResolvable |
| 1588 | + * * isTextureFormatBlendable |
| 1589 | + * * isTextureFormatMultisampled |
| 1590 | + * * isTextureFormatUsableAsStorageFormat |
| 1591 | + * * isTextureFormatUsableAsReadWriteStorageTexture |
| 1592 | + * * isTextureFormatUsableAsStorageFormatInCreateShaderModule |
| 1593 | + * |
| 1594 | + * Per-GPUTextureFormat info. |
| 1595 | + */ |
| 1596 | +const kTextureFormatInfo = { |
1536 | 1597 | ...kRegularTextureFormatInfo,
|
1537 | 1598 | ...kSizedDepthStencilFormatInfo,
|
1538 | 1599 | ...kUnsizedDepthStencilFormatInfo,
|
@@ -1809,15 +1870,6 @@ export function textureDimensionAndFormatCompatible(
|
1809 | 1870 | );
|
1810 | 1871 | }
|
1811 | 1872 |
|
1812 |
| -/** @deprecated */ |
1813 |
| -export function viewCompatibleDeprecated( |
1814 |
| - compatibilityMode: boolean, |
1815 |
| - a: GPUTextureFormat, |
1816 |
| - b: GPUTextureFormat |
1817 |
| -): boolean { |
1818 |
| - return compatibilityMode ? a === b : a === b || a + '-srgb' === b || b + '-srgb' === a; |
1819 |
| -} |
1820 |
| - |
1821 | 1873 | /**
|
1822 | 1874 | * Check if two formats are view format compatible.
|
1823 | 1875 | */
|
@@ -2047,11 +2099,6 @@ export function isEncodableTextureFormat(format: GPUTextureFormat) {
|
2047 | 2099 | return kEncodableTextureFormats.includes(format as EncodableTextureFormat);
|
2048 | 2100 | }
|
2049 | 2101 |
|
2050 |
| -/** @deprecated use isTextureFormatUsableAsRenderAttachment */ |
2051 |
| -export function canUseAsRenderTargetDeprecated(format: GPUTextureFormat) { |
2052 |
| - return kTextureFormatInfo[format].colorRender || isDepthOrStencilTextureFormat(format); |
2053 |
| -} |
2054 |
| - |
2055 | 2102 | /**
|
2056 | 2103 | * Returns if a texture can be used as a render attachment. some color formats and all
|
2057 | 2104 | * depth textures and stencil textures are usable with usage RENDER_ATTACHMENT.
|
@@ -2185,20 +2232,6 @@ export const kCompatModeUnsupportedStorageTextureFormats: readonly GPUTextureFor
|
2185 | 2232 | 'rg32uint',
|
2186 | 2233 | ] as const;
|
2187 | 2234 |
|
2188 |
| -/** @deprecated */ |
2189 |
| -export function isTextureFormatUsableAsStorageFormatDeprecated( |
2190 |
| - format: GPUTextureFormat, |
2191 |
| - isCompatibilityMode: boolean |
2192 |
| -): boolean { |
2193 |
| - if (isCompatibilityMode) { |
2194 |
| - if (kCompatModeUnsupportedStorageTextureFormats.indexOf(format) >= 0) { |
2195 |
| - return false; |
2196 |
| - } |
2197 |
| - } |
2198 |
| - const info = kTextureFormatInfo[format]; |
2199 |
| - return !!(info.color?.storage || info.depth?.storage || info.stencil?.storage); |
2200 |
| -} |
2201 |
| - |
2202 | 2235 | /**
|
2203 | 2236 | * Return true if the format can be used as a storage texture.
|
2204 | 2237 | * Note: Some formats can be compiled in a shader but can not be used
|
@@ -2293,19 +2326,6 @@ export const kCompatModeUnsupportedMultisampledTextureFormats: readonly GPUTextu
|
2293 | 2326 | 'r32float',
|
2294 | 2327 | ] as const;
|
2295 | 2328 |
|
2296 |
| -/** @deprecated use isTextureFormatMultisampled */ |
2297 |
| -export function isMultisampledTextureFormatDeprecated( |
2298 |
| - format: GPUTextureFormat, |
2299 |
| - isCompatibilityMode: boolean |
2300 |
| -): boolean { |
2301 |
| - if (isCompatibilityMode) { |
2302 |
| - if (kCompatModeUnsupportedMultisampledTextureFormats.indexOf(format) >= 0) { |
2303 |
| - return false; |
2304 |
| - } |
2305 |
| - } |
2306 |
| - return kAllTextureFormatInfo[format].multisample; |
2307 |
| -} |
2308 |
| - |
2309 | 2329 | /**
|
2310 | 2330 | * Returns true if you can make a multisampled texture from the given format.
|
2311 | 2331 | */
|
|
0 commit comments