| 35 | #include "compressonator.h" |
| 36 | |
| 37 | int main(int argc, char** argv) |
| 38 | { |
| 39 | //------------------------------------- |
| 40 | // Initialize example external texture data |
| 41 | //------------------------------------- |
| 42 | |
| 43 | const int inputWidth = 256; |
| 44 | const int inputHeight = 256; |
| 45 | const int inputPixelCount = inputWidth * inputHeight; |
| 46 | const int inputChannelCount = 4; |
| 47 | |
| 48 | int8_t* inputData = (int8_t*)calloc(1, inputPixelCount * inputChannelCount); |
| 49 | |
| 50 | for (int i = 0; i < inputPixelCount; ++i) |
| 51 | { |
| 52 | inputData[i * inputChannelCount + 0] = 0xFF; |
| 53 | inputData[i * inputChannelCount + 1] = 0xFF; |
| 54 | inputData[i * inputChannelCount + 2] = 0x00; |
| 55 | inputData[i * inputChannelCount + 3] = 0xFF; |
| 56 | } |
| 57 | |
| 58 | //-------------------------- |
| 59 | // Init framework plugin and IO interfaces |
| 60 | //-------------------------- |
| 61 | |
| 62 | CMP_InitFramework(); |
| 63 | |
| 64 | //===================================================================================================== |
| 65 | // You can optionally use a 4th argv to set a destFormat other then the example BC7 |
| 66 | // just add additional encoder dll's in the example binary path. |
| 67 | // example: to use BC1 add CMP_BC1_MD.dll. |
| 68 | // You can edit CopyFiles.bat to add additional libs to the correct build folders of this application. |
| 69 | // |
| 70 | // CMP_FORMAT destFormat = CMP_ParseFormat(argv[4]); |
| 71 | //====================================================================================================== |
| 72 | CMP_FORMAT destFormat = CMP_FORMAT_BC7; |
| 73 | |
| 74 | //--------------- |
| 75 | // Create the MipSet to hold the input data |
| 76 | //--------------- |
| 77 | CMP_MipSet inputTexture = {}; |
| 78 | if (CMP_CreateMipSet(&inputTexture, inputWidth, inputHeight, 1, CF_8bit, TT_2D) != CMP_OK) |
| 79 | { |
| 80 | std::printf("Error: Failed to create mipset\n"); |
| 81 | return -1; |
| 82 | } |
| 83 | |
| 84 | //---------------------------------- |
| 85 | // Copy external data into the created MipSet |
| 86 | //---------------------------------- |
| 87 | CMP_MipLevel* baseLevel = 0; |
| 88 | CMP_GetMipLevel(&baseLevel, &inputTexture, 0, 0); |
| 89 | |
| 90 | if (baseLevel == 0) |
| 91 | { |
| 92 | printf("Error: MipSet data allocation failed.\n"); |
| 93 | return -1; |
| 94 | } |
nothing calls this directly
no test coverage detected