MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / writeKTX2

Method writeKTX2

tools/ktx/command.cpp:175–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175void OutputStream::writeKTX2(ktxTexture* texture, Reporter& report) {
176 const auto ret = ktxTexture_WriteToStdioStream(texture, file);
177 if (KTX_SUCCESS != ret) {
178 if (file != stdout)
179 std::filesystem::remove(DecodeUTF8Path(filepath).c_str());
180 report.fatal(rc::IO_FAILURE, "Failed to write KTX file \"{}\": KTX error: {}.", filepath, ktxErrorString(ret));
181 }
182
183 // TODO: Investigate and resolve the portability issue with the C++ streams. The issue will most likely
184 // be in StreambufStream's position reporting and seeking. Currently a fallback is implemented in C above.
185 // StreambufStream<std::streambuf*> stream(activeStream->rdbuf(), std::ios::in | std::ios::binary);
186 // const auto ret = ktxTexture_WriteToStream(texture, stream.stream());
187 //
188 // if (KTX_SUCCESS != ret) {
189 // if (activeStream != &std::cout)
190 // std::filesystem::remove(DecodeUTF8Path(filepath).c_str());
191 // report.fatal(rc::IO_FAILURE, "Failed to write KTX file \"{}\": {}.", fmtOutFile(filepath), ktxErrorString(ret));
192 // }
193}
194
195// -------------------------------------------------------------------------------------------------
196

Callers 4

executeDeflateMethod · 0.80
executeEncodeMethod · 0.80
executeTranscodeMethod · 0.80
executeCreateMethod · 0.80

Calls 4

ktxErrorStringFunction · 0.85
DecodeUTF8PathFunction · 0.50
c_strMethod · 0.45
fatalMethod · 0.45

Tested by

no test coverage detected