MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / main

Function main

examples/framework_example4/framework_example4.cpp:88–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88int main(int argc, char* argv[])
89{
90 bool bAbortCompression = false;
91
92 if (argc < 4)
93 {
94 std::printf("Example4.exe SourceFile DestFile Quality\n");
95 std::printf("This example shows how to compress a single image\n");
96 std::printf("to a compression format using a quality setting with OpenCL BC1 shaders\n");
97 std::printf("folders plugin/compute is required when encoding with OLC and DXC, see sample source notes.\n");
98 std::printf("usage: Example4.exe ruby.dds ruby_bc1.dds 1.0\n");
99 std::printf("this will generate a high quality compressed ruby file in BC1 format\n");
100 return 0;
101 }
102
103 // please note the params are not checked for errors
104 const char* pszSourceFile = argv[1];
105 const char* pszDestFile = argv[2];
106 CMP_FLOAT fQuality;
107 try
108 {
109 fQuality = std::stof(argv[3]);
110 if (fQuality < 0.0f)
111 {
112 fQuality = 0.0f;
113 std::printf("Warning: Quality setting is out of range using 0.0\n");
114 }
115 if (fQuality > 1.0f)
116 {
117 fQuality = 1.0f;
118 std::printf("Warning: Quality setting is out of range using 1.0\n");
119 }
120 }
121 catch (...)
122 {
123 std::printf("Error: Unable to process quality setting\n");
124 return -1;
125 }
126
127 //--------------------------
128 // Init frameworks
129 // plugin and IO interfaces
130 //--------------------------
131 CMP_InitFramework();
132
133 //=================================================================================
134 // You can optionally use a 4th argv to set a destFormat other then the example BC7
135 // just additional encoder dll's is in the example binary path.
136 // example: to use BC1 add CMP_BC1_MD.dll.
137 // You can edit CopyFiles.bat to add additional libs to the correct build folders of this application.
138 //
139 // CMP_FORMAT destFormat = CMP_ParseFormat(argv[4]);
140 //===================================================================================
141 CMP_FORMAT destFormat = CMP_FORMAT_BC1;
142
143 //-------------------------------------------------------------------------------------------------------
144 // Load the image, CMP_LoadTexture supports DDS, std_image and all compressonator runtime image plugins
145 //-------------------------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 7

CMP_InitFrameworkFunction · 0.85
memsetFunction · 0.85
CMP_LoadTextureFunction · 0.85
CMP_ProcessTextureFunction · 0.85
CMP_FreeMipSetFunction · 0.85
CMP_SaveTextureFunction · 0.85
timeStampsecFunction · 0.70

Tested by

no test coverage detected