| 216 | } |
| 217 | |
| 218 | basis_compressor::error_code basis_compressor::process() |
| 219 | { |
| 220 | debug_printf("basis_compressor::process\n"); |
| 221 | |
| 222 | if (!read_source_images()) |
| 223 | return cECFailedReadingSourceImages; |
| 224 | |
| 225 | if (!validate_texture_type_constraints()) |
| 226 | return cECFailedValidating; |
| 227 | |
| 228 | if (m_params.m_create_ktx2_file) |
| 229 | { |
| 230 | if (!validate_ktx2_constraints()) |
| 231 | return cECFailedValidating; |
| 232 | } |
| 233 | |
| 234 | if (!extract_source_blocks()) |
| 235 | return cECFailedFrontEnd; |
| 236 | |
| 237 | if (m_params.m_uastc) |
| 238 | { |
| 239 | error_code ec = encode_slices_to_uastc(); |
| 240 | if (ec != cECSuccess) |
| 241 | return ec; |
| 242 | } |
| 243 | else |
| 244 | { |
| 245 | if (!process_frontend()) |
| 246 | return cECFailedFrontEnd; |
| 247 | |
| 248 | if (!extract_frontend_texture_data()) |
| 249 | return cECFailedFontendExtract; |
| 250 | |
| 251 | if (!process_backend()) |
| 252 | return cECFailedBackend; |
| 253 | } |
| 254 | |
| 255 | if (!create_basis_file_and_transcode()) |
| 256 | return cECFailedCreateBasisFile; |
| 257 | |
| 258 | if (m_params.m_create_ktx2_file) |
| 259 | { |
| 260 | if (!create_ktx2_file()) |
| 261 | return cECFailedCreateKTX2File; |
| 262 | } |
| 263 | |
| 264 | if (!write_output_files_and_compute_stats()) |
| 265 | return cECFailedWritingOutput; |
| 266 | |
| 267 | return cECSuccess; |
| 268 | } |
| 269 | |
| 270 | basis_compressor::error_code basis_compressor::encode_slices_to_uastc() |
| 271 | { |