TextureCompatibility.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. using Ryujinx.Common;
  2. using Ryujinx.Graphics.GAL;
  3. using Ryujinx.Graphics.Texture;
  4. using System;
  5. namespace Ryujinx.Graphics.Gpu.Image
  6. {
  7. /// <summary>
  8. /// Texture format compatibility checks.
  9. /// </summary>
  10. static class TextureCompatibility
  11. {
  12. private enum FormatClass
  13. {
  14. Unclassified,
  15. BCn64,
  16. BCn128,
  17. Bc1Rgb,
  18. Bc1Rgba,
  19. Bc2,
  20. Bc3,
  21. Bc4,
  22. Bc5,
  23. Bc6,
  24. Bc7
  25. }
  26. /// <summary>
  27. /// Checks if a format is host incompatible.
  28. /// </summary>
  29. /// <remarks>
  30. /// Host incompatible formats can't be used directly, the texture data needs to be converted
  31. /// to a compatible format first.
  32. /// </remarks>
  33. /// <param name="info">Texture information</param>
  34. /// <param name="caps">Host GPU capabilities</param>
  35. /// <returns>True if the format is incompatible, false otherwise</returns>
  36. public static bool IsFormatHostIncompatible(TextureInfo info, Capabilities caps)
  37. {
  38. Format originalFormat = info.FormatInfo.Format;
  39. return ToHostCompatibleFormat(info, caps).Format != originalFormat;
  40. }
  41. /// <summary>
  42. /// Converts a incompatible format to a host compatible format, or return the format directly
  43. /// if it is already host compatible.
  44. /// </summary>
  45. /// <remarks>
  46. /// This can be used to convert a incompatible compressed format to the decompressor
  47. /// output format.
  48. /// </remarks>
  49. /// <param name="info">Texture information</param>
  50. /// <param name="caps">Host GPU capabilities</param>
  51. /// <returns>A host compatible format</returns>
  52. public static FormatInfo ToHostCompatibleFormat(TextureInfo info, Capabilities caps)
  53. {
  54. if (!caps.SupportsAstcCompression)
  55. {
  56. if (info.FormatInfo.Format.IsAstcUnorm())
  57. {
  58. return new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4);
  59. }
  60. else if (info.FormatInfo.Format.IsAstcSrgb())
  61. {
  62. return new FormatInfo(Format.R8G8B8A8Srgb, 1, 1, 4, 4);
  63. }
  64. }
  65. if (info.Target == Target.Texture3D)
  66. {
  67. // The host API does not support 3D BC4/BC5 compressed formats.
  68. // We assume software decompression will be done for those textures,
  69. // and so we adjust the format here to match the decompressor output.
  70. switch (info.FormatInfo.Format)
  71. {
  72. case Format.Bc4Unorm:
  73. return new FormatInfo(Format.R8Unorm, 1, 1, 1, 1);
  74. case Format.Bc4Snorm:
  75. return new FormatInfo(Format.R8Snorm, 1, 1, 1, 1);
  76. case Format.Bc5Unorm:
  77. return new FormatInfo(Format.R8G8Unorm, 1, 1, 2, 2);
  78. case Format.Bc5Snorm:
  79. return new FormatInfo(Format.R8G8Snorm, 1, 1, 2, 2);
  80. }
  81. }
  82. return info.FormatInfo;
  83. }
  84. /// <summary>
  85. /// Checks if two formats are compatible, according to the host API copy format compatibility rules.
  86. /// </summary>
  87. /// <param name="lhs">First comparand</param>
  88. /// <param name="rhs">Second comparand</param>
  89. /// <returns>True if the formats are compatible, false otherwise</returns>
  90. public static bool FormatCompatible(FormatInfo lhs, FormatInfo rhs)
  91. {
  92. if (lhs.Format.IsDepthOrStencil() || rhs.Format.IsDepthOrStencil())
  93. {
  94. return lhs.Format == rhs.Format;
  95. }
  96. if (lhs.Format.IsAstc() || rhs.Format.IsAstc())
  97. {
  98. return lhs.Format == rhs.Format;
  99. }
  100. if (lhs.IsCompressed && rhs.IsCompressed)
  101. {
  102. FormatClass lhsClass = GetFormatClass(lhs.Format);
  103. FormatClass rhsClass = GetFormatClass(rhs.Format);
  104. return lhsClass == rhsClass;
  105. }
  106. else
  107. {
  108. return lhs.BytesPerPixel == rhs.BytesPerPixel;
  109. }
  110. }
  111. /// <summary>
  112. /// Checks if the texture format matches with the specified texture information.
  113. /// </summary>
  114. /// <param name="lhs">Texture information to compare</param>
  115. /// <param name="rhs">Texture information to compare with</param>
  116. /// <param name="forSampler">Indicates that the texture will be used for shader sampling</param>
  117. /// <param name="forCopy">Indicates that the texture will be used as copy source or target</param>
  118. /// <returns>A value indicating how well the formats match</returns>
  119. public static TextureMatchQuality FormatMatches(TextureInfo lhs, TextureInfo rhs, bool forSampler, bool forCopy)
  120. {
  121. // D32F and R32F texture have the same representation internally,
  122. // however the R32F format is used to sample from depth textures.
  123. if (lhs.FormatInfo.Format == Format.D32Float && rhs.FormatInfo.Format == Format.R32Float && (forSampler || forCopy))
  124. {
  125. return TextureMatchQuality.FormatAlias;
  126. }
  127. if (forCopy)
  128. {
  129. // The 2D engine does not support depth-stencil formats, so it will instead
  130. // use equivalent color formats. We must also consider them as compatible.
  131. if (lhs.FormatInfo.Format == Format.S8Uint && rhs.FormatInfo.Format == Format.R8Unorm)
  132. {
  133. return TextureMatchQuality.FormatAlias;
  134. }
  135. if (lhs.FormatInfo.Format == Format.D16Unorm && rhs.FormatInfo.Format == Format.R16Unorm)
  136. {
  137. return TextureMatchQuality.FormatAlias;
  138. }
  139. if ((lhs.FormatInfo.Format == Format.D24UnormS8Uint ||
  140. lhs.FormatInfo.Format == Format.D24X8Unorm) && rhs.FormatInfo.Format == Format.B8G8R8A8Unorm)
  141. {
  142. return TextureMatchQuality.FormatAlias;
  143. }
  144. }
  145. return lhs.FormatInfo.Format == rhs.FormatInfo.Format ? TextureMatchQuality.Perfect : TextureMatchQuality.NoMatch;
  146. }
  147. /// <summary>
  148. /// Checks if the texture layout specified matches with this texture layout.
  149. /// The layout information is composed of the Stride for linear textures, or GOB block size
  150. /// for block linear textures.
  151. /// </summary>
  152. /// <param name="lhs">Texture information to compare</param>
  153. /// <param name="rhs">Texture information to compare with</param>
  154. /// <returns>True if the layout matches, false otherwise</returns>
  155. public static bool LayoutMatches(TextureInfo lhs, TextureInfo rhs)
  156. {
  157. if (lhs.IsLinear != rhs.IsLinear)
  158. {
  159. return false;
  160. }
  161. // For linear textures, gob block sizes are ignored.
  162. // For block linear textures, the stride is ignored.
  163. if (rhs.IsLinear)
  164. {
  165. return lhs.Stride == rhs.Stride;
  166. }
  167. else
  168. {
  169. return lhs.GobBlocksInY == rhs.GobBlocksInY &&
  170. lhs.GobBlocksInZ == rhs.GobBlocksInZ;
  171. }
  172. }
  173. /// <summary>
  174. /// Obtain the minimum compatibility level of two provided view compatibility results.
  175. /// </summary>
  176. /// <param name="first">The first compatibility level</param>
  177. /// <param name="second">The second compatibility level</param>
  178. /// <returns>The minimum compatibility level of two provided view compatibility results</returns>
  179. public static TextureViewCompatibility PropagateViewCompatibility(TextureViewCompatibility first, TextureViewCompatibility second)
  180. {
  181. if (first == TextureViewCompatibility.Incompatible || second == TextureViewCompatibility.Incompatible)
  182. {
  183. return TextureViewCompatibility.Incompatible;
  184. }
  185. else if (first == TextureViewCompatibility.CopyOnly || second == TextureViewCompatibility.CopyOnly)
  186. {
  187. return TextureViewCompatibility.CopyOnly;
  188. }
  189. else
  190. {
  191. return TextureViewCompatibility.Full;
  192. }
  193. }
  194. /// <summary>
  195. /// Checks if the sizes of two given textures are view compatible.
  196. /// </summary>
  197. /// <param name="lhs">Texture information of the texture view</param>
  198. /// <param name="rhs">Texture information of the texture view to match against</param>
  199. /// <param name="level">Mipmap level of the texture view in relation to this texture</param>
  200. /// <returns>The view compatibility level of the view sizes</returns>
  201. public static TextureViewCompatibility ViewSizeMatches(TextureInfo lhs, TextureInfo rhs, int level)
  202. {
  203. Size size = GetAlignedSize(lhs, level);
  204. Size otherSize = GetAlignedSize(rhs);
  205. TextureViewCompatibility result = TextureViewCompatibility.Full;
  206. // For copies, we can copy a subset of the 3D texture slices,
  207. // so the depth may be different in this case.
  208. if (rhs.Target == Target.Texture3D && size.Depth != otherSize.Depth)
  209. {
  210. result = TextureViewCompatibility.CopyOnly;
  211. }
  212. return (size.Width == otherSize.Width &&
  213. size.Height == otherSize.Height) ? result : TextureViewCompatibility.Incompatible;
  214. }
  215. /// <summary>
  216. /// Checks if the potential child texture fits within the level and layer bounds of the parent.
  217. /// </summary>
  218. /// <param name="parent">Texture information for the parent</param>
  219. /// <param name="child">Texture information for the child</param>
  220. /// <param name="layer">Base layer of the child texture</param>
  221. /// <param name="level">Base level of the child texture</param>
  222. /// <returns>Full compatiblity if the child's layer and level count fit within the parent, incompatible otherwise</returns>
  223. public static TextureViewCompatibility ViewSubImagesInBounds(TextureInfo parent, TextureInfo child, int layer, int level)
  224. {
  225. if (level + child.Levels <= parent.Levels &&
  226. layer + child.GetSlices() <= parent.GetSlices())
  227. {
  228. return TextureViewCompatibility.Full;
  229. }
  230. else
  231. {
  232. return TextureViewCompatibility.Incompatible;
  233. }
  234. }
  235. /// <summary>
  236. /// Checks if the texture sizes of the supplied texture informations match.
  237. /// </summary>
  238. /// <param name="lhs">Texture information to compare</param>
  239. /// <param name="rhs">Texture information to compare with</param>
  240. /// <returns>True if the size matches, false otherwise</returns>
  241. public static bool SizeMatches(TextureInfo lhs, TextureInfo rhs)
  242. {
  243. return SizeMatches(lhs, rhs, alignSizes: false);
  244. }
  245. /// <summary>
  246. /// Checks if the texture sizes of the supplied texture informations match the given level
  247. /// </summary>
  248. /// <param name="lhs">Texture information to compare</param>
  249. /// <param name="rhs">Texture information to compare with</param>
  250. /// <param name="level">Mipmap level of this texture to compare with</param>
  251. /// <returns>True if the size matches with the level, false otherwise</returns>
  252. public static bool SizeMatches(TextureInfo lhs, TextureInfo rhs, int level)
  253. {
  254. return Math.Max(1, lhs.Width >> level) == rhs.Width &&
  255. Math.Max(1, lhs.Height >> level) == rhs.Height &&
  256. Math.Max(1, lhs.GetDepth() >> level) == rhs.GetDepth();
  257. }
  258. /// <summary>
  259. /// Checks if the texture sizes of the supplied texture informations match.
  260. /// </summary>
  261. /// <param name="lhs">Texture information to compare</param>
  262. /// <param name="rhs">Texture information to compare with</param>
  263. /// <param name="alignSizes">True to align the sizes according to the texture layout for comparison</param>
  264. /// <returns>True if the sizes matches, false otherwise</returns>
  265. public static bool SizeMatches(TextureInfo lhs, TextureInfo rhs, bool alignSizes)
  266. {
  267. if (lhs.GetLayers() != rhs.GetLayers())
  268. {
  269. return false;
  270. }
  271. bool isTextureBuffer = lhs.Target == Target.TextureBuffer || rhs.Target == Target.TextureBuffer;
  272. if (alignSizes && !isTextureBuffer)
  273. {
  274. Size size0 = GetAlignedSize(lhs);
  275. Size size1 = GetAlignedSize(rhs);
  276. return size0.Width == size1.Width &&
  277. size0.Height == size1.Height &&
  278. size0.Depth == size1.Depth;
  279. }
  280. else
  281. {
  282. return lhs.Width == rhs.Width &&
  283. lhs.Height == rhs.Height &&
  284. lhs.GetDepth() == rhs.GetDepth();
  285. }
  286. }
  287. /// <summary>
  288. /// Gets the aligned sizes of the specified texture information.
  289. /// The alignment depends on the texture layout and format bytes per pixel.
  290. /// </summary>
  291. /// <param name="info">Texture information to calculate the aligned size from</param>
  292. /// <param name="level">Mipmap level for texture views</param>
  293. /// <returns>The aligned texture size</returns>
  294. public static Size GetAlignedSize(TextureInfo info, int level = 0)
  295. {
  296. int width = Math.Max(1, info.Width >> level);
  297. int height = Math.Max(1, info.Height >> level);
  298. if (info.IsLinear)
  299. {
  300. return SizeCalculator.GetLinearAlignedSize(
  301. width,
  302. height,
  303. info.FormatInfo.BlockWidth,
  304. info.FormatInfo.BlockHeight,
  305. info.FormatInfo.BytesPerPixel);
  306. }
  307. else
  308. {
  309. int depth = Math.Max(1, info.GetDepth() >> level);
  310. return SizeCalculator.GetBlockLinearAlignedSize(
  311. width,
  312. height,
  313. depth,
  314. info.FormatInfo.BlockWidth,
  315. info.FormatInfo.BlockHeight,
  316. info.FormatInfo.BytesPerPixel,
  317. info.GobBlocksInY,
  318. info.GobBlocksInZ,
  319. info.GobBlocksInTileX);
  320. }
  321. }
  322. /// <summary>
  323. /// Check if it's possible to create a view with the layout of the second texture information from the first.
  324. /// The layout information is composed of the Stride for linear textures, or GOB block size
  325. /// for block linear textures.
  326. /// </summary>
  327. /// <param name="lhs">Texture information of the texture view</param>
  328. /// <param name="rhs">Texture information of the texture view to compare against</param>
  329. /// <param name="level">Start level of the texture view, in relation with the first texture</param>
  330. /// <returns>True if the layout is compatible, false otherwise</returns>
  331. public static bool ViewLayoutCompatible(TextureInfo lhs, TextureInfo rhs, int level)
  332. {
  333. if (lhs.IsLinear != rhs.IsLinear)
  334. {
  335. return false;
  336. }
  337. // For linear textures, gob block sizes are ignored.
  338. // For block linear textures, the stride is ignored.
  339. if (rhs.IsLinear)
  340. {
  341. int width = Math.Max(1, lhs.Width >> level);
  342. int stride = width * lhs.FormatInfo.BytesPerPixel;
  343. stride = BitUtils.AlignUp(stride, 32);
  344. return stride == rhs.Stride;
  345. }
  346. else
  347. {
  348. int height = Math.Max(1, lhs.Height >> level);
  349. int depth = Math.Max(1, lhs.GetDepth() >> level);
  350. (int gobBlocksInY, int gobBlocksInZ) = SizeCalculator.GetMipGobBlockSizes(
  351. height,
  352. depth,
  353. lhs.FormatInfo.BlockHeight,
  354. lhs.GobBlocksInY,
  355. lhs.GobBlocksInZ);
  356. return gobBlocksInY == rhs.GobBlocksInY &&
  357. gobBlocksInZ == rhs.GobBlocksInZ;
  358. }
  359. }
  360. /// <summary>
  361. /// Checks if the view format of the first texture format is compatible with the format of the second.
  362. /// In general, the formats are considered compatible if the bytes per pixel values are equal,
  363. /// but there are more complex rules for some formats, like compressed or depth-stencil formats.
  364. /// This follows the host API copy compatibility rules.
  365. /// </summary>
  366. /// <param name="lhs">Texture information of the texture view</param>
  367. /// <param name="rhs">Texture information of the texture view</param>
  368. /// <returns>The view compatibility level of the texture formats</returns>
  369. public static TextureViewCompatibility ViewFormatCompatible(TextureInfo lhs, TextureInfo rhs)
  370. {
  371. if (FormatCompatible(lhs.FormatInfo, rhs.FormatInfo))
  372. {
  373. if (lhs.FormatInfo.IsCompressed != rhs.FormatInfo.IsCompressed)
  374. {
  375. return TextureViewCompatibility.CopyOnly;
  376. }
  377. else
  378. {
  379. return TextureViewCompatibility.Full;
  380. }
  381. }
  382. return TextureViewCompatibility.Incompatible;
  383. }
  384. /// <summary>
  385. /// Check if the target of the first texture view information is compatible with the target of the second texture view information.
  386. /// This follows the host API target compatibility rules.
  387. /// </summary>
  388. /// <param name="lhs">Texture information of the texture view</param
  389. /// <param name="rhs">Texture information of the texture view</param>
  390. /// <param name="isCopy">True to check for copy rather than view compatibility</param>
  391. /// <returns>True if the targets are compatible, false otherwise</returns>
  392. public static TextureViewCompatibility ViewTargetCompatible(TextureInfo lhs, TextureInfo rhs)
  393. {
  394. bool result = false;
  395. switch (lhs.Target)
  396. {
  397. case Target.Texture1D:
  398. case Target.Texture1DArray:
  399. result = rhs.Target == Target.Texture1D ||
  400. rhs.Target == Target.Texture1DArray;
  401. break;
  402. case Target.Texture2D:
  403. result = rhs.Target == Target.Texture2D ||
  404. rhs.Target == Target.Texture2DArray;
  405. break;
  406. case Target.Texture2DArray:
  407. case Target.Cubemap:
  408. case Target.CubemapArray:
  409. result = rhs.Target == Target.Texture2D ||
  410. rhs.Target == Target.Texture2DArray ||
  411. rhs.Target == Target.Cubemap ||
  412. rhs.Target == Target.CubemapArray;
  413. break;
  414. case Target.Texture2DMultisample:
  415. case Target.Texture2DMultisampleArray:
  416. result = rhs.Target == Target.Texture2DMultisample ||
  417. rhs.Target == Target.Texture2DMultisampleArray;
  418. break;
  419. case Target.Texture3D:
  420. if (rhs.Target == Target.Texture2D)
  421. {
  422. return TextureViewCompatibility.CopyOnly;
  423. }
  424. result = rhs.Target == Target.Texture3D;
  425. break;
  426. }
  427. return result ? TextureViewCompatibility.Full : TextureViewCompatibility.Incompatible;
  428. }
  429. /// <summary>
  430. /// Checks if a swizzle component in two textures functionally match, taking into account if the components are defined.
  431. /// </summary>
  432. /// <param name="lhs">Texture information to compare</param>
  433. /// <param name="rhs">Texture information to compare with</param>
  434. /// <param name="swizzleLhs">Swizzle component for the first texture</param>
  435. /// <param name="swizzleRhs">Swizzle component for the second texture</param>
  436. /// <param name="component">Component index, starting at 0 for red</param>
  437. /// <returns>True if the swizzle components functionally match, false othersize</returns>
  438. private static bool SwizzleComponentMatches(TextureInfo lhs, TextureInfo rhs, SwizzleComponent swizzleLhs, SwizzleComponent swizzleRhs, int component)
  439. {
  440. int lhsComponents = lhs.FormatInfo.Components;
  441. int rhsComponents = rhs.FormatInfo.Components;
  442. if (lhsComponents == 4 && rhsComponents == 4)
  443. {
  444. return swizzleLhs == swizzleRhs;
  445. }
  446. // Swizzles after the number of components a format defines are "undefined".
  447. // We allow these to not be equal under certain circumstances.
  448. // This can only happen when there are less than 4 components in a format.
  449. // It tends to happen when float depth textures are sampled.
  450. bool lhsDefined = (swizzleLhs - SwizzleComponent.Red) < lhsComponents;
  451. bool rhsDefined = (swizzleRhs - SwizzleComponent.Red) < rhsComponents;
  452. if (lhsDefined == rhsDefined)
  453. {
  454. // If both are undefined, return true. Otherwise just check if they're equal.
  455. return lhsDefined ? swizzleLhs == swizzleRhs : true;
  456. }
  457. else
  458. {
  459. SwizzleComponent defined = lhsDefined ? swizzleLhs : swizzleRhs;
  460. SwizzleComponent undefined = lhsDefined ? swizzleRhs : swizzleLhs;
  461. // Undefined swizzle can be matched by a forced value (0, 1), exact equality, or expected value.
  462. // For example, R___ matches R001, RGBA but not RBGA.
  463. return defined == undefined || defined < SwizzleComponent.Red || defined == SwizzleComponent.Red + component;
  464. }
  465. }
  466. /// <summary>
  467. /// Checks if the texture shader sampling parameters of two texture informations match.
  468. /// </summary>
  469. /// <param name="lhs">Texture information to compare</param>
  470. /// <param name="rhs">Texture information to compare with</param>
  471. /// <returns>True if the texture shader sampling parameters matches, false otherwise</returns>
  472. public static bool SamplerParamsMatches(TextureInfo lhs, TextureInfo rhs)
  473. {
  474. return lhs.DepthStencilMode == rhs.DepthStencilMode &&
  475. SwizzleComponentMatches(lhs, rhs, lhs.SwizzleR, rhs.SwizzleR, 0) &&
  476. SwizzleComponentMatches(lhs, rhs, lhs.SwizzleG, rhs.SwizzleG, 1) &&
  477. SwizzleComponentMatches(lhs, rhs, lhs.SwizzleB, rhs.SwizzleB, 2) &&
  478. SwizzleComponentMatches(lhs, rhs, lhs.SwizzleA, rhs.SwizzleA, 3);
  479. }
  480. /// <summary>
  481. /// Check if the texture target and samples count (for multisampled textures) matches.
  482. /// </summary>
  483. /// <param name="first">Texture information to compare with</param>
  484. /// <param name="rhs">Texture information to compare with</param>
  485. /// <returns>True if the texture target and samples count matches, false otherwise</returns>
  486. public static bool TargetAndSamplesCompatible(TextureInfo lhs, TextureInfo rhs)
  487. {
  488. return lhs.Target == rhs.Target &&
  489. lhs.SamplesInX == rhs.SamplesInX &&
  490. lhs.SamplesInY == rhs.SamplesInY;
  491. }
  492. /// <summary>
  493. /// Gets the texture format class, for compressed textures, or Unclassified otherwise.
  494. /// </summary>
  495. /// <param name="format">The format</param>
  496. /// <returns>Format class</returns>
  497. private static FormatClass GetFormatClass(Format format)
  498. {
  499. switch (format)
  500. {
  501. case Format.Bc1RgbSrgb:
  502. case Format.Bc1RgbUnorm:
  503. return FormatClass.Bc1Rgb;
  504. case Format.Bc1RgbaSrgb:
  505. case Format.Bc1RgbaUnorm:
  506. return FormatClass.Bc1Rgba;
  507. case Format.Bc2Srgb:
  508. case Format.Bc2Unorm:
  509. return FormatClass.Bc2;
  510. case Format.Bc3Srgb:
  511. case Format.Bc3Unorm:
  512. return FormatClass.Bc3;
  513. case Format.Bc4Snorm:
  514. case Format.Bc4Unorm:
  515. return FormatClass.Bc4;
  516. case Format.Bc5Snorm:
  517. case Format.Bc5Unorm:
  518. return FormatClass.Bc5;
  519. case Format.Bc6HSfloat:
  520. case Format.Bc6HUfloat:
  521. return FormatClass.Bc6;
  522. case Format.Bc7Srgb:
  523. case Format.Bc7Unorm:
  524. return FormatClass.Bc7;
  525. }
  526. return FormatClass.Unclassified;
  527. }
  528. }
  529. }