diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-12-16 23:52:55 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-12-16 23:52:55 +0300 |
commit | 3e61478b1be7b11b11fbccc37d6d64c99f354717 (patch) | |
tree | e51253443b9c84a127e99bd31f42758325245e42 | |
parent | 1b2fc747925ff369719fdcf97c56a01d1f28b76a (diff) |
Fix T42917 shadow maps not working on ATIs.
This is yet another issue with framebuffers. There are two issues: We
need the framebuffer fully bound to check for completeness and when we
bind a depth texture as frame buffer we need to disable read/write.
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 14 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 9 |
2 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index e38686938fb..05c40d65df5 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -969,10 +969,16 @@ void GPU_texture_bind_as_framebuffer(GPUTexture *tex) /* bind framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, tex->fb->object); - /* last bound prevails here, better allow explicit control here too */ - glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + tex->fb_attachment); - glReadBuffer(GL_COLOR_ATTACHMENT0_EXT + tex->fb_attachment); - + if (tex->depth) { + glDrawBuffer(GL_NONE); + glReadBuffer(GL_NONE); + } + else { + /* last bound prevails here, better allow explicit control here too */ + glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + tex->fb_attachment); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT + tex->fb_attachment); + } + /* push matrices and set default viewport and matrix */ glViewport(0, 0, tex->w, tex->h); GG.currentfb = tex->fb->object; diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 31b499d54ab..fcf3425e9c6 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1953,10 +1953,15 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par) return lamp; } + /* we need to properly bind to test for completeness */ + GPU_texture_bind_as_framebuffer(lamp->blurtex); + if (!GPU_framebuffer_check_valid(lamp->blurfb, NULL)) { gpu_lamp_shadow_free(lamp); - return lamp; - } + return lamp; + } + + GPU_framebuffer_texture_unbind(lamp->blurfb, lamp->blurtex); } else { lamp->tex = GPU_texture_create_depth(lamp->size, lamp->size, NULL); |