summaryrefslogtreecommitdiff
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/texture_manager.cc14
-rw-r--r--src/gpu/texture_manager.h2
2 files changed, 10 insertions, 6 deletions
diff --git a/src/gpu/texture_manager.cc b/src/gpu/texture_manager.cc
index 5da82c0..0c30c94 100644
--- a/src/gpu/texture_manager.cc
+++ b/src/gpu/texture_manager.cc
@@ -2,7 +2,7 @@
// It implements the TextureManager.
#include "gpu/texture_manager.h"
-#include <iostream>
+#include <cstdio>
#include <vector>
#if defined(DEMO_CROSS_COMPILE_WIN32)
@@ -33,14 +33,18 @@ void TextureManager::create_procedural_texture(
// 1. Generate Data on CPU
std::vector<uint8_t> pixel_data;
pixel_data.resize(def.width * def.height * 4);
- def.gen_func(pixel_data.data(), def.width, def.height, def.params.data(),
- (int)def.params.size());
+ if (!def.gen_func(pixel_data.data(), def.width, def.height, def.params.data(),
+ (int)def.params.size())) {
+ fprintf(stderr, "Error: Procedural texture generation failed for: %s\n",
+ name.c_str());
+ return;
+ }
create_texture(name, def.width, def.height, pixel_data.data());
#if !defined(STRIP_ALL)
- std::cout << "Generated procedural texture: " << name << " (" << def.width
- << "x" << def.height << ")" << std::endl;
+ printf("Generated procedural texture: %s (%dx%d)\n", name.c_str(), def.width,
+ def.height);
#endif
}
diff --git a/src/gpu/texture_manager.h b/src/gpu/texture_manager.h
index f49e827..23fdbe8 100644
--- a/src/gpu/texture_manager.h
+++ b/src/gpu/texture_manager.h
@@ -12,7 +12,7 @@
struct ProceduralTextureDef {
int width;
int height;
- void (*gen_func)(uint8_t*, int, int, const float*, int);
+ bool (*gen_func)(uint8_t*, int, int, const float*, int);
std::vector<float> params;
};