浏览代码

Merge pull request #72 from RazielXYZ/master

Break out of astc encoding on astc error
Бранимир Караџић 3 年之前
父节点
当前提交
08ade536c8
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/image_encode.cpp

+ 5 - 3
src/image_encode.cpp

@@ -162,15 +162,17 @@ namespace bimg
 					}
 					status = astcenc_config_init(profile, astcBlockInfo.blockWidth, astcBlockInfo.blockHeight, 1, quality, astcFlags, &config);
 					if (status != ASTCENC_SUCCESS) {
-						BX_TRACE("astc error %s", astcenc_get_error_string(status));
+						BX_TRACE("astc error in config init %s", astcenc_get_error_string(status));
 						BX_ERROR_SET(_err, BIMG_ERROR, "Unable to initialize astc config!");
+						break;
 					}
 
 					astcenc_context* context;
 					status = astcenc_context_alloc(&config, thread_count, &context);
 					if (status != ASTCENC_SUCCESS) {
-						BX_TRACE("astc error %s", astcenc_get_error_string(status));
+						BX_TRACE("astc error in context alloc %s", astcenc_get_error_string(status));
 						BX_ERROR_SET(_err, BIMG_ERROR, "Unable to alloc astc context!");
+						break;
 					}
 
 					//Put image data into an astcenc_image
@@ -200,7 +202,7 @@ namespace bimg
 						status = astcenc_compress_image(context, &image, &swizzle, dst, comp_len, 0);
 					}
 					if (status != ASTCENC_SUCCESS) {
-						BX_TRACE("astc error %s", astcenc_get_error_string(status));
+						BX_TRACE("astc error in compress image %s", astcenc_get_error_string(status));
 						BX_ERROR_SET(_err, BIMG_ERROR, "Unable to compress astc image!");
 					}
 					astcenc_context_free(context);