texturec: Added error message when image width/height doesn't match target format requirements.
This commit is contained in:
parent
d94ffa2882
commit
7a849bec97
@ -477,6 +477,19 @@ int main(int _argc, const char* _argv[])
|
||||
ImageMip dstMip;
|
||||
imageGetRawData(imageContainer, 0, 0, NULL, 0, dstMip);
|
||||
|
||||
if (mip.m_width != dstMip.m_width
|
||||
&& mip.m_height != dstMip.m_height)
|
||||
{
|
||||
printf("Invalid input image size %dx%d, it must be at least %dx%d to be converted to %s format.\n"
|
||||
, mip.m_width
|
||||
, mip.m_height
|
||||
, dstMip.m_width
|
||||
, dstMip.m_height
|
||||
, getName(format)
|
||||
);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t size = imageGetSize(TextureFormat::RGBA32F, dstMip.m_width, dstMip.m_height);
|
||||
temp = BX_ALLOC(&allocator, size);
|
||||
float* rgba = (float*)temp;
|
||||
@ -528,6 +541,19 @@ int main(int _argc, const char* _argv[])
|
||||
ImageMip dstMip;
|
||||
imageGetRawData(imageContainer, 0, 0, NULL, 0, dstMip);
|
||||
|
||||
if (mip.m_width != dstMip.m_width
|
||||
&& mip.m_height != dstMip.m_height)
|
||||
{
|
||||
printf("Invalid input image size %dx%d, it must be at least %dx%d to be converted to %s format.\n"
|
||||
, mip.m_width
|
||||
, mip.m_height
|
||||
, dstMip.m_width
|
||||
, dstMip.m_height
|
||||
, getName(format)
|
||||
);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t size = imageGetSize(TextureFormat::RGBA8, dstMip.m_width, dstMip.m_height);
|
||||
temp = BX_ALLOC(&allocator, size);
|
||||
memset(temp, 0, size);
|
||||
|
Loading…
Reference in New Issue
Block a user