/ src / Ryujinx.Graphics.GAL / Format.cs
Format.cs
  1  namespace Ryujinx.Graphics.GAL
  2  {
  3      public enum Format
  4      {
  5          R8Unorm,
  6          R8Snorm,
  7          R8Uint,
  8          R8Sint,
  9          R16Float,
 10          R16Unorm,
 11          R16Snorm,
 12          R16Uint,
 13          R16Sint,
 14          R32Float,
 15          R32Uint,
 16          R32Sint,
 17          R8G8Unorm,
 18          R8G8Snorm,
 19          R8G8Uint,
 20          R8G8Sint,
 21          R16G16Float,
 22          R16G16Unorm,
 23          R16G16Snorm,
 24          R16G16Uint,
 25          R16G16Sint,
 26          R32G32Float,
 27          R32G32Uint,
 28          R32G32Sint,
 29          R8G8B8Unorm,
 30          R8G8B8Snorm,
 31          R8G8B8Uint,
 32          R8G8B8Sint,
 33          R16G16B16Float,
 34          R16G16B16Unorm,
 35          R16G16B16Snorm,
 36          R16G16B16Uint,
 37          R16G16B16Sint,
 38          R32G32B32Float,
 39          R32G32B32Uint,
 40          R32G32B32Sint,
 41          R8G8B8A8Unorm,
 42          R8G8B8A8Snorm,
 43          R8G8B8A8Uint,
 44          R8G8B8A8Sint,
 45          R16G16B16A16Float,
 46          R16G16B16A16Unorm,
 47          R16G16B16A16Snorm,
 48          R16G16B16A16Uint,
 49          R16G16B16A16Sint,
 50          R32G32B32A32Float,
 51          R32G32B32A32Uint,
 52          R32G32B32A32Sint,
 53          S8Uint,
 54          D16Unorm,
 55          S8UintD24Unorm,
 56          D32Float,
 57          D24UnormS8Uint,
 58          D32FloatS8Uint,
 59          R8G8B8A8Srgb,
 60          R4G4Unorm,
 61          R4G4B4A4Unorm,
 62          R5G5B5X1Unorm,
 63          R5G5B5A1Unorm,
 64          R5G6B5Unorm,
 65          R10G10B10A2Unorm,
 66          R10G10B10A2Uint,
 67          R11G11B10Float,
 68          R9G9B9E5Float,
 69          Bc1RgbaUnorm,
 70          Bc2Unorm,
 71          Bc3Unorm,
 72          Bc1RgbaSrgb,
 73          Bc2Srgb,
 74          Bc3Srgb,
 75          Bc4Unorm,
 76          Bc4Snorm,
 77          Bc5Unorm,
 78          Bc5Snorm,
 79          Bc7Unorm,
 80          Bc7Srgb,
 81          Bc6HSfloat,
 82          Bc6HUfloat,
 83          Etc2RgbUnorm,
 84          Etc2RgbaUnorm,
 85          Etc2RgbPtaUnorm,
 86          Etc2RgbSrgb,
 87          Etc2RgbaSrgb,
 88          Etc2RgbPtaSrgb,
 89          R8Uscaled,
 90          R8Sscaled,
 91          R16Uscaled,
 92          R16Sscaled,
 93          R32Uscaled,
 94          R32Sscaled,
 95          R8G8Uscaled,
 96          R8G8Sscaled,
 97          R16G16Uscaled,
 98          R16G16Sscaled,
 99          R32G32Uscaled,
100          R32G32Sscaled,
101          R8G8B8Uscaled,
102          R8G8B8Sscaled,
103          R16G16B16Uscaled,
104          R16G16B16Sscaled,
105          R32G32B32Uscaled,
106          R32G32B32Sscaled,
107          R8G8B8A8Uscaled,
108          R8G8B8A8Sscaled,
109          R16G16B16A16Uscaled,
110          R16G16B16A16Sscaled,
111          R32G32B32A32Uscaled,
112          R32G32B32A32Sscaled,
113          R10G10B10A2Snorm,
114          R10G10B10A2Sint,
115          R10G10B10A2Uscaled,
116          R10G10B10A2Sscaled,
117          Astc4x4Unorm,
118          Astc5x4Unorm,
119          Astc5x5Unorm,
120          Astc6x5Unorm,
121          Astc6x6Unorm,
122          Astc8x5Unorm,
123          Astc8x6Unorm,
124          Astc8x8Unorm,
125          Astc10x5Unorm,
126          Astc10x6Unorm,
127          Astc10x8Unorm,
128          Astc10x10Unorm,
129          Astc12x10Unorm,
130          Astc12x12Unorm,
131          Astc4x4Srgb,
132          Astc5x4Srgb,
133          Astc5x5Srgb,
134          Astc6x5Srgb,
135          Astc6x6Srgb,
136          Astc8x5Srgb,
137          Astc8x6Srgb,
138          Astc8x8Srgb,
139          Astc10x5Srgb,
140          Astc10x6Srgb,
141          Astc10x8Srgb,
142          Astc10x10Srgb,
143          Astc12x10Srgb,
144          Astc12x12Srgb,
145          B5G6R5Unorm,
146          B5G5R5A1Unorm,
147          A1B5G5R5Unorm,
148          B8G8R8A8Unorm,
149          B8G8R8A8Srgb,
150          B10G10R10A2Unorm,
151          X8UintD24Unorm,
152      }
153  
154      public static class FormatExtensions
155      {
156          /// <summary>
157          /// The largest scalar size for a buffer format.
158          /// </summary>
159          public const int MaxBufferFormatScalarSize = 4;
160  
161          /// <summary>
162          /// Gets the byte size for a single component of this format, or its packed size.
163          /// </summary>
164          /// <param name="format">Texture format</param>
165          /// <returns>Byte size for a single component, or packed size</returns>
166          public static int GetScalarSize(this Format format)
167          {
168              switch (format)
169              {
170                  case Format.R8Unorm:
171                  case Format.R8Snorm:
172                  case Format.R8Uint:
173                  case Format.R8Sint:
174                  case Format.R8G8Unorm:
175                  case Format.R8G8Snorm:
176                  case Format.R8G8Uint:
177                  case Format.R8G8Sint:
178                  case Format.R8G8B8Unorm:
179                  case Format.R8G8B8Snorm:
180                  case Format.R8G8B8Uint:
181                  case Format.R8G8B8Sint:
182                  case Format.R8G8B8A8Unorm:
183                  case Format.R8G8B8A8Snorm:
184                  case Format.R8G8B8A8Uint:
185                  case Format.R8G8B8A8Sint:
186                  case Format.R8G8B8A8Srgb:
187                  case Format.R4G4Unorm:
188                  case Format.R8Uscaled:
189                  case Format.R8Sscaled:
190                  case Format.R8G8Uscaled:
191                  case Format.R8G8Sscaled:
192                  case Format.R8G8B8Uscaled:
193                  case Format.R8G8B8Sscaled:
194                  case Format.R8G8B8A8Uscaled:
195                  case Format.R8G8B8A8Sscaled:
196                  case Format.B8G8R8A8Unorm:
197                  case Format.B8G8R8A8Srgb:
198                      return 1;
199  
200                  case Format.R16Float:
201                  case Format.R16Unorm:
202                  case Format.R16Snorm:
203                  case Format.R16Uint:
204                  case Format.R16Sint:
205                  case Format.R16G16Float:
206                  case Format.R16G16Unorm:
207                  case Format.R16G16Snorm:
208                  case Format.R16G16Uint:
209                  case Format.R16G16Sint:
210                  case Format.R16G16B16Float:
211                  case Format.R16G16B16Unorm:
212                  case Format.R16G16B16Snorm:
213                  case Format.R16G16B16Uint:
214                  case Format.R16G16B16Sint:
215                  case Format.R16G16B16A16Float:
216                  case Format.R16G16B16A16Unorm:
217                  case Format.R16G16B16A16Snorm:
218                  case Format.R16G16B16A16Uint:
219                  case Format.R16G16B16A16Sint:
220                  case Format.R4G4B4A4Unorm:
221                  case Format.R5G5B5X1Unorm:
222                  case Format.R5G5B5A1Unorm:
223                  case Format.R5G6B5Unorm:
224                  case Format.R16Uscaled:
225                  case Format.R16Sscaled:
226                  case Format.R16G16Uscaled:
227                  case Format.R16G16Sscaled:
228                  case Format.R16G16B16Uscaled:
229                  case Format.R16G16B16Sscaled:
230                  case Format.R16G16B16A16Uscaled:
231                  case Format.R16G16B16A16Sscaled:
232                  case Format.B5G6R5Unorm:
233                  case Format.B5G5R5A1Unorm:
234                  case Format.A1B5G5R5Unorm:
235                      return 2;
236  
237                  case Format.R32Float:
238                  case Format.R32Uint:
239                  case Format.R32Sint:
240                  case Format.R32G32Float:
241                  case Format.R32G32Uint:
242                  case Format.R32G32Sint:
243                  case Format.R32G32B32Float:
244                  case Format.R32G32B32Uint:
245                  case Format.R32G32B32Sint:
246                  case Format.R32G32B32A32Float:
247                  case Format.R32G32B32A32Uint:
248                  case Format.R32G32B32A32Sint:
249                  case Format.R10G10B10A2Unorm:
250                  case Format.R10G10B10A2Uint:
251                  case Format.R11G11B10Float:
252                  case Format.R9G9B9E5Float:
253                  case Format.R32Uscaled:
254                  case Format.R32Sscaled:
255                  case Format.R32G32Uscaled:
256                  case Format.R32G32Sscaled:
257                  case Format.R32G32B32Uscaled:
258                  case Format.R32G32B32Sscaled:
259                  case Format.R32G32B32A32Uscaled:
260                  case Format.R32G32B32A32Sscaled:
261                  case Format.R10G10B10A2Snorm:
262                  case Format.R10G10B10A2Sint:
263                  case Format.R10G10B10A2Uscaled:
264                  case Format.R10G10B10A2Sscaled:
265                  case Format.B10G10R10A2Unorm:
266                      return 4;
267  
268                  case Format.S8Uint:
269                      return 1;
270                  case Format.D16Unorm:
271                      return 2;
272                  case Format.S8UintD24Unorm:
273                  case Format.X8UintD24Unorm:
274                  case Format.D32Float:
275                  case Format.D24UnormS8Uint:
276                      return 4;
277                  case Format.D32FloatS8Uint:
278                      return 8;
279  
280                  case Format.Bc1RgbaUnorm:
281                  case Format.Bc1RgbaSrgb:
282                      return 8;
283  
284                  case Format.Bc2Unorm:
285                  case Format.Bc3Unorm:
286                  case Format.Bc2Srgb:
287                  case Format.Bc3Srgb:
288                  case Format.Bc4Unorm:
289                  case Format.Bc4Snorm:
290                  case Format.Bc5Unorm:
291                  case Format.Bc5Snorm:
292                  case Format.Bc7Unorm:
293                  case Format.Bc7Srgb:
294                  case Format.Bc6HSfloat:
295                  case Format.Bc6HUfloat:
296                      return 16;
297  
298                  case Format.Etc2RgbUnorm:
299                  case Format.Etc2RgbPtaUnorm:
300                  case Format.Etc2RgbSrgb:
301                  case Format.Etc2RgbPtaSrgb:
302                      return 8;
303  
304                  case Format.Etc2RgbaUnorm:
305                  case Format.Etc2RgbaSrgb:
306                      return 16;
307  
308                  case Format.Astc4x4Unorm:
309                  case Format.Astc5x4Unorm:
310                  case Format.Astc5x5Unorm:
311                  case Format.Astc6x5Unorm:
312                  case Format.Astc6x6Unorm:
313                  case Format.Astc8x5Unorm:
314                  case Format.Astc8x6Unorm:
315                  case Format.Astc8x8Unorm:
316                  case Format.Astc10x5Unorm:
317                  case Format.Astc10x6Unorm:
318                  case Format.Astc10x8Unorm:
319                  case Format.Astc10x10Unorm:
320                  case Format.Astc12x10Unorm:
321                  case Format.Astc12x12Unorm:
322                  case Format.Astc4x4Srgb:
323                  case Format.Astc5x4Srgb:
324                  case Format.Astc5x5Srgb:
325                  case Format.Astc6x5Srgb:
326                  case Format.Astc6x6Srgb:
327                  case Format.Astc8x5Srgb:
328                  case Format.Astc8x6Srgb:
329                  case Format.Astc8x8Srgb:
330                  case Format.Astc10x5Srgb:
331                  case Format.Astc10x6Srgb:
332                  case Format.Astc10x8Srgb:
333                  case Format.Astc10x10Srgb:
334                  case Format.Astc12x10Srgb:
335                  case Format.Astc12x12Srgb:
336                      return 16;
337              }
338  
339              return 1;
340          }
341  
342          /// <summary>
343          /// Checks if the texture format is a depth or depth-stencil format.
344          /// </summary>
345          /// <param name="format">Texture format</param>
346          /// <returns>True if the format is a depth or depth-stencil format, false otherwise</returns>
347          public static bool HasDepth(this Format format)
348          {
349              switch (format)
350              {
351                  case Format.D16Unorm:
352                  case Format.D24UnormS8Uint:
353                  case Format.S8UintD24Unorm:
354                  case Format.X8UintD24Unorm:
355                  case Format.D32Float:
356                  case Format.D32FloatS8Uint:
357                      return true;
358              }
359  
360              return false;
361          }
362  
363          /// <summary>
364          /// Checks if the texture format is a stencil or depth-stencil format.
365          /// </summary>
366          /// <param name="format">Texture format</param>
367          /// <returns>True if the format is a stencil or depth-stencil format, false otherwise</returns>
368          public static bool HasStencil(this Format format)
369          {
370              switch (format)
371              {
372                  case Format.D24UnormS8Uint:
373                  case Format.S8UintD24Unorm:
374                  case Format.D32FloatS8Uint:
375                  case Format.S8Uint:
376                      return true;
377              }
378  
379              return false;
380          }
381  
382          /// <summary>
383          /// Checks if the texture format is valid to use as image format.
384          /// </summary>
385          /// <param name="format">Texture format</param>
386          /// <returns>True if the texture can be used as image, false otherwise</returns>
387          public static bool IsImageCompatible(this Format format)
388          {
389              switch (format)
390              {
391                  case Format.R8Unorm:
392                  case Format.R8Snorm:
393                  case Format.R8Uint:
394                  case Format.R8Sint:
395                  case Format.R16Float:
396                  case Format.R16Unorm:
397                  case Format.R16Snorm:
398                  case Format.R16Uint:
399                  case Format.R16Sint:
400                  case Format.R32Float:
401                  case Format.R32Uint:
402                  case Format.R32Sint:
403                  case Format.R8G8Unorm:
404                  case Format.R8G8Snorm:
405                  case Format.R8G8Uint:
406                  case Format.R8G8Sint:
407                  case Format.R16G16Float:
408                  case Format.R16G16Unorm:
409                  case Format.R16G16Snorm:
410                  case Format.R16G16Uint:
411                  case Format.R16G16Sint:
412                  case Format.R32G32Float:
413                  case Format.R32G32Uint:
414                  case Format.R32G32Sint:
415                  case Format.R8G8B8A8Unorm:
416                  case Format.R8G8B8A8Snorm:
417                  case Format.R8G8B8A8Uint:
418                  case Format.R8G8B8A8Sint:
419                  case Format.R16G16B16A16Float:
420                  case Format.R16G16B16A16Unorm:
421                  case Format.R16G16B16A16Snorm:
422                  case Format.R16G16B16A16Uint:
423                  case Format.R16G16B16A16Sint:
424                  case Format.R32G32B32A32Float:
425                  case Format.R32G32B32A32Uint:
426                  case Format.R32G32B32A32Sint:
427                  case Format.R10G10B10A2Unorm:
428                  case Format.R10G10B10A2Uint:
429                  case Format.R11G11B10Float:
430                  case Format.B8G8R8A8Unorm:
431                      return true;
432              }
433  
434              return false;
435          }
436  
437          /// <summary>
438          /// Checks if the texture format is valid to use as render target color format.
439          /// </summary>
440          /// <param name="format">Texture format</param>
441          /// <returns>True if the texture can be used as render target, false otherwise</returns>
442          public static bool IsRtColorCompatible(this Format format)
443          {
444              switch (format)
445              {
446                  case Format.R32G32B32A32Float:
447                  case Format.R32G32B32A32Sint:
448                  case Format.R32G32B32A32Uint:
449                  case Format.R16G16B16A16Unorm:
450                  case Format.R16G16B16A16Snorm:
451                  case Format.R16G16B16A16Sint:
452                  case Format.R16G16B16A16Uint:
453                  case Format.R16G16B16A16Float:
454                  case Format.R32G32Float:
455                  case Format.R32G32Sint:
456                  case Format.R32G32Uint:
457                  case Format.B8G8R8A8Unorm:
458                  case Format.B8G8R8A8Srgb:
459                  case Format.B10G10R10A2Unorm:
460                  case Format.R10G10B10A2Unorm:
461                  case Format.R10G10B10A2Uint:
462                  case Format.R8G8B8A8Unorm:
463                  case Format.R8G8B8A8Srgb:
464                  case Format.R8G8B8A8Snorm:
465                  case Format.R8G8B8A8Sint:
466                  case Format.R8G8B8A8Uint:
467                  case Format.R16G16Unorm:
468                  case Format.R16G16Snorm:
469                  case Format.R16G16Sint:
470                  case Format.R16G16Uint:
471                  case Format.R16G16Float:
472                  case Format.R11G11B10Float:
473                  case Format.R32Sint:
474                  case Format.R32Uint:
475                  case Format.R32Float:
476                  case Format.B5G6R5Unorm:
477                  case Format.B5G5R5A1Unorm:
478                  case Format.R8G8Unorm:
479                  case Format.R8G8Snorm:
480                  case Format.R8G8Sint:
481                  case Format.R8G8Uint:
482                  case Format.R16Unorm:
483                  case Format.R16Snorm:
484                  case Format.R16Sint:
485                  case Format.R16Uint:
486                  case Format.R16Float:
487                  case Format.R8Unorm:
488                  case Format.R8Snorm:
489                  case Format.R8Sint:
490                  case Format.R8Uint:
491                      return true;
492              }
493  
494              return false;
495          }
496  
497          /// <summary>
498          /// Checks if the texture format is 16 bit packed.
499          /// </summary>
500          /// <param name="format">Texture format</param>
501          /// <returns>True if the texture format is 16 bit packed, false otherwise</returns>
502          public static bool Is16BitPacked(this Format format)
503          {
504              switch (format)
505              {
506                  case Format.B5G6R5Unorm:
507                  case Format.B5G5R5A1Unorm:
508                  case Format.R5G5B5X1Unorm:
509                  case Format.R5G5B5A1Unorm:
510                  case Format.R5G6B5Unorm:
511                  case Format.R4G4B4A4Unorm:
512                      return true;
513              }
514  
515              return false;
516          }
517  
518          /// <summary>
519          /// Checks if the texture format is an ASTC format.
520          /// </summary>
521          /// <param name="format">Texture format</param>
522          /// <returns>True if the texture format is an ASTC format, false otherwise</returns>
523          public static bool IsAstc(this Format format)
524          {
525              return format.IsAstcUnorm() || format.IsAstcSrgb();
526          }
527  
528          /// <summary>
529          /// Checks if the texture format is an ASTC Unorm format.
530          /// </summary>
531          /// <param name="format">Texture format</param>
532          /// <returns>True if the texture format is an ASTC Unorm format, false otherwise</returns>
533          public static bool IsAstcUnorm(this Format format)
534          {
535              switch (format)
536              {
537                  case Format.Astc4x4Unorm:
538                  case Format.Astc5x4Unorm:
539                  case Format.Astc5x5Unorm:
540                  case Format.Astc6x5Unorm:
541                  case Format.Astc6x6Unorm:
542                  case Format.Astc8x5Unorm:
543                  case Format.Astc8x6Unorm:
544                  case Format.Astc8x8Unorm:
545                  case Format.Astc10x5Unorm:
546                  case Format.Astc10x6Unorm:
547                  case Format.Astc10x8Unorm:
548                  case Format.Astc10x10Unorm:
549                  case Format.Astc12x10Unorm:
550                  case Format.Astc12x12Unorm:
551                      return true;
552              }
553  
554              return false;
555          }
556  
557          /// <summary>
558          /// Checks if the texture format is an ASTC SRGB format.
559          /// </summary>
560          /// <param name="format">Texture format</param>
561          /// <returns>True if the texture format is an ASTC SRGB format, false otherwise</returns>
562          public static bool IsAstcSrgb(this Format format)
563          {
564              switch (format)
565              {
566                  case Format.Astc4x4Srgb:
567                  case Format.Astc5x4Srgb:
568                  case Format.Astc5x5Srgb:
569                  case Format.Astc6x5Srgb:
570                  case Format.Astc6x6Srgb:
571                  case Format.Astc8x5Srgb:
572                  case Format.Astc8x6Srgb:
573                  case Format.Astc8x8Srgb:
574                  case Format.Astc10x5Srgb:
575                  case Format.Astc10x6Srgb:
576                  case Format.Astc10x8Srgb:
577                  case Format.Astc10x10Srgb:
578                  case Format.Astc12x10Srgb:
579                  case Format.Astc12x12Srgb:
580                      return true;
581              }
582  
583              return false;
584          }
585  
586          /// <summary>
587          /// Checks if the texture format is an ETC2 format.
588          /// </summary>
589          /// <param name="format">Texture format</param>
590          /// <returns>True if the texture format is an ETC2 format, false otherwise</returns>
591          public static bool IsEtc2(this Format format)
592          {
593              switch (format)
594              {
595                  case Format.Etc2RgbaSrgb:
596                  case Format.Etc2RgbaUnorm:
597                  case Format.Etc2RgbPtaSrgb:
598                  case Format.Etc2RgbPtaUnorm:
599                  case Format.Etc2RgbSrgb:
600                  case Format.Etc2RgbUnorm:
601                      return true;
602              }
603  
604              return false;
605          }
606  
607          /// <summary>
608          /// Checks if the texture format is a BGR format.
609          /// </summary>
610          /// <param name="format">Texture format</param>
611          /// <returns>True if the texture format is a BGR format, false otherwise</returns>
612          public static bool IsBgr(this Format format)
613          {
614              switch (format)
615              {
616                  case Format.B5G6R5Unorm:
617                  case Format.B5G5R5A1Unorm:
618                  case Format.B8G8R8A8Unorm:
619                  case Format.B8G8R8A8Srgb:
620                  case Format.B10G10R10A2Unorm:
621                      return true;
622              }
623  
624              return false;
625          }
626  
627          /// <summary>
628          /// Checks if the texture format is a depth, stencil or depth-stencil format.
629          /// </summary>
630          /// <param name="format">Texture format</param>
631          /// <returns>True if the format is a depth, stencil or depth-stencil format, false otherwise</returns>
632          public static bool IsDepthOrStencil(this Format format)
633          {
634              switch (format)
635              {
636                  case Format.D16Unorm:
637                  case Format.D24UnormS8Uint:
638                  case Format.S8UintD24Unorm:
639                  case Format.X8UintD24Unorm:
640                  case Format.D32Float:
641                  case Format.D32FloatS8Uint:
642                  case Format.S8Uint:
643                      return true;
644              }
645  
646              return false;
647          }
648  
649          /// <summary>
650          /// Checks if the texture format is an unsigned integer color format.
651          /// </summary>
652          /// <param name="format">Texture format</param>
653          /// <returns>True if the texture format is an unsigned integer color format, false otherwise</returns>
654          public static bool IsUint(this Format format)
655          {
656              switch (format)
657              {
658                  case Format.R8Uint:
659                  case Format.R16Uint:
660                  case Format.R32Uint:
661                  case Format.R8G8Uint:
662                  case Format.R16G16Uint:
663                  case Format.R32G32Uint:
664                  case Format.R8G8B8Uint:
665                  case Format.R16G16B16Uint:
666                  case Format.R32G32B32Uint:
667                  case Format.R8G8B8A8Uint:
668                  case Format.R16G16B16A16Uint:
669                  case Format.R32G32B32A32Uint:
670                  case Format.R10G10B10A2Uint:
671                      return true;
672              }
673  
674              return false;
675          }
676  
677          /// <summary>
678          /// Checks if the texture format is a signed integer color format.
679          /// </summary>
680          /// <param name="format">Texture format</param>
681          /// <returns>True if the texture format is a signed integer color format, false otherwise</returns>
682          public static bool IsSint(this Format format)
683          {
684              switch (format)
685              {
686                  case Format.R8Sint:
687                  case Format.R16Sint:
688                  case Format.R32Sint:
689                  case Format.R8G8Sint:
690                  case Format.R16G16Sint:
691                  case Format.R32G32Sint:
692                  case Format.R8G8B8Sint:
693                  case Format.R16G16B16Sint:
694                  case Format.R32G32B32Sint:
695                  case Format.R8G8B8A8Sint:
696                  case Format.R16G16B16A16Sint:
697                  case Format.R32G32B32A32Sint:
698                  case Format.R10G10B10A2Sint:
699                      return true;
700              }
701  
702              return false;
703          }
704  
705          /// <summary>
706          /// Checks if the texture format is an integer color format.
707          /// </summary>
708          /// <param name="format">Texture format</param>
709          /// <returns>True if the texture format is an integer color format, false otherwise</returns>
710          public static bool IsInteger(this Format format)
711          {
712              return format.IsUint() || format.IsSint();
713          }
714  
715          /// <summary>
716          /// Checks if the texture format is a float or sRGB color format.
717          /// </summary>
718          /// <remarks>
719          /// Does not include normalized, compressed or depth formats.
720          /// Float and sRGB formats do not participate in logical operations.
721          /// </remarks>
722          /// <param name="format">Texture format</param>
723          /// <returns>True if the format is a float or sRGB color format, false otherwise</returns>
724          public static bool IsFloatOrSrgb(this Format format)
725          {
726              switch (format)
727              {
728                  case Format.R8G8B8A8Srgb:
729                  case Format.B8G8R8A8Srgb:
730                  case Format.R16Float:
731                  case Format.R16G16Float:
732                  case Format.R16G16B16Float:
733                  case Format.R16G16B16A16Float:
734                  case Format.R32Float:
735                  case Format.R32G32Float:
736                  case Format.R32G32B32Float:
737                  case Format.R32G32B32A32Float:
738                  case Format.R11G11B10Float:
739                  case Format.R9G9B9E5Float:
740                      return true;
741              }
742  
743              return false;
744          }
745      }
746  }