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-10-22 13:58:11 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-10-22 14:00:40 +0300
commit2d084d4ec430ec8b280a52286eeeca770f2221bc (patch)
tree2436fda8529effee889b423fabb065826a791307 /source/blender/gpu/intern/gpu_framebuffer.c
parent0e70feab22fd0871d61a03b43c591fb300990de7 (diff)
GPU: Fix Issue with recursive downsample and Intel HDXXX
This is caused by a driver bug that prevent us from rendering to (or even binding) a texture mip level that is below GL_TEXTURE_MAX_LEVEL of the target texture. This is fine in most drivers (and legal AFAIK) but not on thoses Intels HDXXX + Windows. As a fix we just put GL_TEXTURE_MAX_LEVEL lower (which is illegal because it is undefined behaviour), but in practice it works ok and does not trigger any warnings or errors. This commit fixes most of the problems encountered on these GPUs (T56668).
Diffstat (limited to 'source/blender/gpu/intern/gpu_framebuffer.c')
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 346d1320b75..7329eee44b0 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -640,11 +640,15 @@ void GPU_framebuffer_recursive_downsample(
for (GPUAttachmentType type = 0; type < GPU_FB_MAX_ATTACHEMENT; ++type) {
if (fb->attachments[type].tex != NULL) {
+ /* Some Intel HDXXX have issue with rendering to a mipmap that is below
+ * the texture GL_TEXTURE_MAX_LEVEL. So even if it not correct, in this case
+ * we allow GL_TEXTURE_MAX_LEVEL to be one level lower. In practice it does work! */
+ int next_lvl = (GPU_mip_render_workaround()) ? i : i - 1;
/* bind next level for rendering but first restrict fetches only to previous level */
GPUTexture *tex = fb->attachments[type].tex;
GPU_texture_bind(tex, 0);
glTexParameteri(GPU_texture_target(tex), GL_TEXTURE_BASE_LEVEL, i - 1);
- glTexParameteri(GPU_texture_target(tex), GL_TEXTURE_MAX_LEVEL, i - 1);
+ glTexParameteri(GPU_texture_target(tex), GL_TEXTURE_MAX_LEVEL, next_lvl);
GPU_texture_unbind(tex);
/* copy attachment and replace miplevel. */
GPUAttachment attachment = fb->attachments[type];