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 <clement@Clements-MacBook-Pro.local>2020-09-08 17:05:36 +0300
committerClément <clement@Clements-MacBook-Pro.local>2020-09-08 17:05:36 +0300
commitab758c30d2ba46eabd9774951afaed52c8344855 (patch)
tree60c1961165e531ad8de291265aad02a726e046df /source/blender/gpu
parent0fb9f22d8b37c73451123ff9035ff3c5506cc2e2 (diff)
GLBackend: Fix gl error inside the mip rendering workaround detection
This was caused by an incorrect mipmap size. Also add debug checks for good mesure.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/opengl/gl_backend.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc
index 3dfe0e1e412..e55e07d5a0b 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -28,6 +28,8 @@
#include "glew-mx.h"
+#include "gl_debug.hh"
+
#include "gl_backend.hh"
namespace blender::gpu {
@@ -151,6 +153,8 @@ static bool detect_mip_render_workaround(void)
float clear_color[4] = {1.0f, 0.5f, 0.0f, 0.0f};
float *source_pix = (float *)MEM_callocN(sizeof(float[4]) * cube_size * cube_size * 6, __func__);
+ /* NOTE: Debug layers are not yet enabled. Force use of glGetError. */
+ debug::check_gl_error("Cubemap Workaround Start");
/* Not using GPU API since it is not yet fully initialized. */
GLuint tex, fb;
/* Create cubemap with 2 mip level. */
@@ -158,8 +162,9 @@ static bool detect_mip_render_workaround(void)
glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
for (int mip = 0; mip < 2; mip++) {
for (int i = 0; i < 6; i++) {
+ const int width = cube_size / (1 << mip);
GLenum target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i;
- glTexImage2D(target, mip, GL_RGBA16F, 2, 2, 0, GL_RGBA, GL_FLOAT, source_pix);
+ glTexImage2D(target, mip, GL_RGBA16F, width, width, 0, GL_RGBA, GL_FLOAT, source_pix);
}
}
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 0);
@@ -182,6 +187,8 @@ static bool detect_mip_render_workaround(void)
glDeleteFramebuffers(1, &fb);
glDeleteTextures(1, &tex);
+ debug::check_gl_error("Cubemap Workaround End9");
+
return enable_workaround;
}