summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/tools/texturec/texturec.cpp
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-04-07 11:10:57 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-04-07 11:10:57 +0200
commit0386367805a78c83a8e1719c1c4193f15a12e377 (patch)
treeed17c2f34b099ed35b9a05cdbb75e89f4dd4a777 /3rdparty/bgfx/tools/texturec/texturec.cpp
parentdc885b1996a0f678d456d18cf54f03d06571bbf5 (diff)
Update BGFX (nw)
Diffstat (limited to '3rdparty/bgfx/tools/texturec/texturec.cpp')
-rw-r--r--3rdparty/bgfx/tools/texturec/texturec.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/3rdparty/bgfx/tools/texturec/texturec.cpp b/3rdparty/bgfx/tools/texturec/texturec.cpp
index 12a5bda84bf..21d256ffbbb 100644
--- a/3rdparty/bgfx/tools/texturec/texturec.cpp
+++ b/3rdparty/bgfx/tools/texturec/texturec.cpp
@@ -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);