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.
This commit is contained in:
parent
1b2fc74792
commit
3e61478b1b
Notes:
blender-bot
2023-02-14 09:43:39 +01:00
Referenced by issue #42933, Cylces Normal Render Pass Has Wrong Orientation Referenced by issue #42917, Sun lamp shadows broken in GLSL view
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue