On 01/20/2017 07:18 AM, Manolova, Plamena wrote:
This looks good to me :)
Reviewed-by: Plamena Manolova <plamena.manol...@intel.com
<mailto:plamena.manol...@intel.com>>
On Fri, Jan 20, 2017 at 9:38 AM, Boyan Ding <boyan.j.d...@gmail.com
<mailto:boyan.j.d...@gmail.com>> wrote:
When draw buffers are changed on a bound framebuffer, DrawBuffer(s) hook
should be called. However, it is missing in update_framebuffer with
window-system framebuffer, in which FB's draw buffer state should match
context state, potentially resulting in a change.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99116
<https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D99116&d=DwMFaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=2GGgfjdsGMbJ2pASP3bJmF1nMiMrJOccqZRrDIWqBOs&s=gFMFh5kphG6qUCsOIbyrliSjbX9cw3WsydU46OcuE14&e=>
Signed-off-by: Boyan Ding <boyan.j.d...@gmail.com
<mailto:boyan.j.d...@gmail.com>>
---
src/mesa/main/framebuffer.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index c06130dc8d..55a6d5c004 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -670,6 +670,16 @@ update_framebuffer(struct gl_context *ctx,
struct gl_framebuffer *fb)
if (fb->ColorDrawBuffer[0] != ctx->Color.DrawBuffer[0]) {
_mesa_drawbuffers(ctx, fb, ctx->Const.MaxDrawBuffers,
ctx->Color.DrawBuffer, NULL);
+
+ /* Call device driver function if fb is the bound draw
buffer. */
+ if (fb == ctx->DrawBuffer) {
+ if (ctx->Driver.DrawBuffers) {
+ ctx->Driver.DrawBuffers(ctx, ctx->Const.MaxDrawBuffers,
+ ctx->Color.DrawBuffer);
+ } else if (ctx->Driver.DrawBuffer) {
+ ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]);
+ }
+ }
}
}
else {
This makes three places in the code where we call
ctx->Driver.DrawBuffers() or ctx->Driver.DrawBuffer() like this. I
think some refactoring would be good.
Perhaps these calls can go into _mesa_drawbuffers(). I'll try to look
into that in a few days.
-Brian
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev