Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-12-11 23:14:52 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-11 23:15:50 +0300
commit0ba02c6e9e5459936438c6a0f69b8a2a8336c936 (patch)
tree825c9637f0846a6d9011c8489210cbb11e67c80c /source/blender/gpu/intern
parent73b19bfb2756ff562eb936f5a1a30172e85fca6c (diff)
GPUTexture: Add debug output to check what texture was created
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_texture.c60
1 files changed, 56 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 0944e5e4e44..052674e7090 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -134,6 +134,49 @@ uint GPU_texture_memory_usage_get(void)
/* -------------------------------- */
+static const char *gl_enum_to_str(GLenum e)
+{
+#define ENUM_TO_STRING(e) [GL_##e] = STRINGIFY_ARG(e)
+ static const char *enum_strings[] = {
+ ENUM_TO_STRING(TEXTURE_2D),
+ ENUM_TO_STRING(TEXTURE_2D_ARRAY),
+ ENUM_TO_STRING(TEXTURE_1D),
+ ENUM_TO_STRING(TEXTURE_1D_ARRAY),
+ ENUM_TO_STRING(TEXTURE_3D),
+ ENUM_TO_STRING(TEXTURE_2D_MULTISAMPLE),
+ ENUM_TO_STRING(RGBA32F),
+ ENUM_TO_STRING(RGBA16F),
+ ENUM_TO_STRING(RGBA16),
+ ENUM_TO_STRING(RG32F),
+ ENUM_TO_STRING(RGB16F),
+ ENUM_TO_STRING(RG16F),
+ ENUM_TO_STRING(RG16I),
+ ENUM_TO_STRING(RG16),
+ ENUM_TO_STRING(RGBA8),
+ ENUM_TO_STRING(RGBA8UI),
+ ENUM_TO_STRING(R32F),
+ ENUM_TO_STRING(R32UI),
+ ENUM_TO_STRING(R32I),
+ ENUM_TO_STRING(R16F),
+ ENUM_TO_STRING(R16I),
+ ENUM_TO_STRING(R16UI),
+ ENUM_TO_STRING(RG8),
+ ENUM_TO_STRING(RG16UI),
+ ENUM_TO_STRING(R16),
+ ENUM_TO_STRING(R8),
+ ENUM_TO_STRING(R8UI),
+ ENUM_TO_STRING(R11F_G11F_B10F),
+ ENUM_TO_STRING(DEPTH24_STENCIL8),
+ ENUM_TO_STRING(DEPTH32F_STENCIL8),
+ ENUM_TO_STRING(DEPTH_COMPONENT32F),
+ ENUM_TO_STRING(DEPTH_COMPONENT24),
+ ENUM_TO_STRING(DEPTH_COMPONENT16),
+ };
+#undef ENUM_TO_STRING
+
+ return enum_strings[e];
+}
+
static int gpu_get_component_count(GPUTextureFormat format)
{
switch (format) {
@@ -600,11 +643,20 @@ GPUTexture *GPU_texture_create_nD(
float *rescaled_pixels = NULL;
bool valid = gpu_texture_try_alloc(tex, proxy, internalformat, data_format, data_type, tex->components, can_rescale,
pixels, &rescaled_pixels);
+
+ if (G.debug & G_DEBUG_GPU || !valid) {
+
+ printf("GPUTexture: create : %s, %s, w : %d, h : %d, d : %d, comp : %d\n",
+ gl_enum_to_str(tex->target), gl_enum_to_str(internalformat), w, h, d, tex->components);
+ }
+
if (!valid) {
- if (err_out)
- BLI_snprintf(err_out, 256, "GPUTexture: texture alloc failed");
- else
- fprintf(stderr, "GPUTexture: texture alloc failed. Not enough Video Memory.");
+ if (err_out) {
+ BLI_snprintf(err_out, 256, "GPUTexture: texture alloc failed\n");
+ }
+ else {
+ fprintf(stderr, "GPUTexture: texture alloc failed. Likely not enough Video Memory.\n");
+ }
GPU_texture_free(tex);
return NULL;
}