Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
4.3 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // ATI Technologies Inc.
  4. // 1 Commerce Valley Drive East
  5. // Markham, Ontario
  6. // CANADA L3T 7X6
  7. //
  8. // File Name: ATI_Compress.h
  9. // Description: A library to compress/decompress textures
  10. //
  11. // Copyright (c) 2004-2006 ATI Technologies Inc.
  12. //
  13. // Version: 1.4
  14. //
  15. // Developer: Seth Sowerby
  16. // Email: [email protected]
  17. //
  18. //////////////////////////////////////////////////////////////////////////////
  19. #ifndef ATI_COMPRESS
  20. #define ATI_COMPRESS
  21. #define ATI_COMPRESS_VERSION_MAJOR 1
  22. #define ATI_COMPRESS_VERSION_MINOR 4
  23. typedef unsigned long ATI_TC_DWORD;
  24. typedef unsigned short ATI_TC_WORD;
  25. typedef unsigned char ATI_TC_BYTE;
  26. #if defined(WIN32) || defined(_WIN64)
  27. # define ATI_TC_API __cdecl
  28. #else
  29. # define ATI_TC_API
  30. #endif
  31. #ifdef ATI_COMPRESS_INTERNAL_BUILD
  32. #include "ATI_Compress_Internal.h"
  33. #else // ATI_COMPRESS_INTERNAL_BUILD
  34. typedef enum
  35. {
  36. ATI_TC_FORMAT_ARGB_8888,
  37. ATI_TC_FORMAT_ARGB_2101010,
  38. ATI_TC_FORMAT_ARGB_16,
  39. ATI_TC_FORMAT_ARGB_16F,
  40. ATI_TC_FORMAT_ARGB_32F,
  41. ATI_TC_FORMAT_DXT1,
  42. ATI_TC_FORMAT_DXT3,
  43. ATI_TC_FORMAT_DXT5,
  44. ATI_TC_FORMAT_DXT5_xGBR,
  45. ATI_TC_FORMAT_DXT5_RxBG,
  46. ATI_TC_FORMAT_DXT5_RBxG,
  47. ATI_TC_FORMAT_DXT5_xRBG,
  48. ATI_TC_FORMAT_DXT5_RGxB,
  49. ATI_TC_FORMAT_DXT5_xGxR,
  50. ATI_TC_FORMAT_ATI1N,
  51. ATI_TC_FORMAT_ATI2N,
  52. ATI_TC_FORMAT_ATI2N_XY,
  53. ATI_TC_FORMAT_ATI2N_DXT5,
  54. ATI_TC_FORMAT_MAX = ATI_TC_FORMAT_ATI2N_DXT5
  55. } ATI_TC_FORMAT;
  56. typedef struct _ATI_TC_CompressOptions
  57. {
  58. ATI_TC_DWORD dwSize; /* Size of this structure */
  59. /* Channel Weightings */
  60. /* With swizzled formats the weighting applies to the data within the specified channel */
  61. /* not the channel itself. */
  62. BOOL bUseChannelWeighting;
  63. double fWeightingRed; /* Weighting of the Red or X Channel */
  64. double fWeightingGreen; /* Weighting of the Green or Y Channel */
  65. double fWeightingBlue; /* Weighting of the Blue or Z Channel */
  66. BOOL bUseAdaptiveWeighting; /* Adapt weighting on a per-block basis */
  67. BOOL bDXT1UseAlpha;
  68. ATI_TC_BYTE nAlphaThreshold;
  69. } ATI_TC_CompressOptions;
  70. #endif // !ATI_COMPRESS_INTERNAL_BUILD
  71. typedef struct _ATI_TC_Texture
  72. {
  73. ATI_TC_DWORD dwSize; /* Size of this structure */
  74. ATI_TC_DWORD dwWidth; /* Width of the texture */
  75. ATI_TC_DWORD dwHeight; /* Height of the texture */
  76. ATI_TC_DWORD dwPitch; /* Distance to start of next line - necessary only for uncompressed textures */
  77. ATI_TC_FORMAT format; /* Format of the texture */
  78. ATI_TC_DWORD dwDataSize; /* Size of the allocated texture data */
  79. ATI_TC_BYTE* pData; /* Pointer to the texture data */
  80. } ATI_TC_Texture;
  81. typedef enum
  82. {
  83. ATI_TC_OK = 0,
  84. ATI_TC_ABORTED,
  85. ATI_TC_ERR_INVALID_SOURCE_TEXTURE,
  86. ATI_TC_ERR_INVALID_DEST_TEXTURE,
  87. ATI_TC_ERR_UNSUPPORTED_SOURCE_FORMAT,
  88. ATI_TC_ERR_UNSUPPORTED_DEST_FORMAT,
  89. ATI_TC_ERR_SIZE_MISMATCH,
  90. ATI_TC_ERR_UNABLE_TO_INIT_CODEC,
  91. ATI_TC_ERR_GENERIC
  92. } ATI_TC_ERROR;
  93. #define MINIMUM_WEIGHT_VALUE 0.01f
  94. #ifdef __cplusplus
  95. extern "C" {
  96. #endif
  97. /*
  98. ** ATI_TC_Feedback_Proc
  99. ** Feedback proc for conversion
  100. ** Return non-NULL(true) value to abort conversion
  101. */
  102. typedef bool (ATI_TC_API * ATI_TC_Feedback_Proc)(float fProgress, uint32* pUser1, uint32* pUser2);
  103. /*
  104. ** ATI_TC_CalculateBufferSize
  105. ** Calculates the required buffer size for the specified texture
  106. */
  107. ATI_TC_DWORD ATI_TC_API ATI_TC_CalculateBufferSize(const ATI_TC_Texture* pTexture);
  108. /*
  109. ** ATI_TC_ConvertTexture
  110. ** Converts the source texture to the destination texture
  111. */
  112. ATI_TC_ERROR ATI_TC_API ATI_TC_ConvertTexture(const ATI_TC_Texture* pSourceTexture, /* [in] - Pointer to the source texture */
  113. ATI_TC_Texture* pDestTexture, /* [out] - Pointer to the destination texture */
  114. const ATI_TC_CompressOptions* pOptions, /* [in] - Pointer to the compression options - can be NULL */
  115. ATI_TC_Feedback_Proc pFeedbackProc, /* [in] - Pointer to the feedback proc - can be NULL */
  116. uint32* pUser1, /* [in] - User data to pass to the feedback proc */
  117. uint32* pUser2); /* [in] - User data to pass to the feedback proc */
  118. #ifdef __cplusplus
  119. };
  120. #endif
  121. #endif // !ATI_COMPRESS