Skip to content

Commit c2bc370

Browse files
committed
Remove deprecated from gpu_test.ts/format_info.ts
And make `kTextureFormatInfo` private. Note: I didn't remove 100% of things labeled deprecated in gpu_test.ts. I'll save the few remaining for a future PR.
1 parent b6d5d59 commit c2bc370

File tree

3 files changed

+84
-193
lines changed

3 files changed

+84
-193
lines changed

src/webgpu/format_info.ts

+69-49
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// MAINTENANCE_TODO: Remove all deprecated functions once they are no longer in use.
21
import { isCompatibilityDevice } from '../common/framework/test_config.js';
32
import { keysOf } from '../common/util/data_tables.js';
43
import { assert, unreachable } from '../common/util/util.js';
@@ -1526,13 +1525,75 @@ type TextureFormatInfo_TypeCheck = {
15261525
)
15271526
);
15281527

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 = {
15361597
...kRegularTextureFormatInfo,
15371598
...kSizedDepthStencilFormatInfo,
15381599
...kUnsizedDepthStencilFormatInfo,
@@ -1809,15 +1870,6 @@ export function textureDimensionAndFormatCompatible(
18091870
);
18101871
}
18111872

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-
18211873
/**
18221874
* Check if two formats are view format compatible.
18231875
*/
@@ -2047,11 +2099,6 @@ export function isEncodableTextureFormat(format: GPUTextureFormat) {
20472099
return kEncodableTextureFormats.includes(format as EncodableTextureFormat);
20482100
}
20492101

2050-
/** @deprecated use isTextureFormatUsableAsRenderAttachment */
2051-
export function canUseAsRenderTargetDeprecated(format: GPUTextureFormat) {
2052-
return kTextureFormatInfo[format].colorRender || isDepthOrStencilTextureFormat(format);
2053-
}
2054-
20552102
/**
20562103
* Returns if a texture can be used as a render attachment. some color formats and all
20572104
* depth textures and stencil textures are usable with usage RENDER_ATTACHMENT.
@@ -2185,20 +2232,6 @@ export const kCompatModeUnsupportedStorageTextureFormats: readonly GPUTextureFor
21852232
'rg32uint',
21862233
] as const;
21872234

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-
22022235
/**
22032236
* Return true if the format can be used as a storage texture.
22042237
* Note: Some formats can be compiled in a shader but can not be used
@@ -2293,19 +2326,6 @@ export const kCompatModeUnsupportedMultisampledTextureFormats: readonly GPUTextu
22932326
'r32float',
22942327
] as const;
22952328

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-
23092329
/**
23102330
* Returns true if you can make a multisampled texture from the given format.
23112331
*/

0 commit comments

Comments
 (0)