From 9baa45f78b8ca7d66280e36009b6a685055d7cd6 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 8 Jan 2014 01:09:15 +0100 Subject: st/mesa: bind NULL colorbuffers as specified by glDrawBuffers An example why it is required: Let's say there's a fragment shader writing to gl_FragData[0..1]. The user calls: glDrawBuffers(2, {GL_NONE, GL_COLOR_ATTACHMENT0}); That means gl_FragData[0] is unused and gl_FragData[1] is written to GL_COLOR_ATTACHMENT0. st/mesa was skipping the GL_NONE draw buffer, therefore gl_FragData[0] was written to GL_COLOR_ATTACHMENT0, which was wrong. This commit fixes it, but drivers must also be fixed not to crash when binding NULL colorbuffers. There is also a new set of piglit tests for this. The MSAA state also had to be fixed not to crash when reading fb->cbufs[0]. Reviewed-by: Brian Paul --- src/gallium/auxiliary/util/u_framebuffer.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gallium/auxiliary/util/u_framebuffer.h') diff --git a/src/gallium/auxiliary/util/u_framebuffer.h b/src/gallium/auxiliary/util/u_framebuffer.h index 0e6c98363a8..c73942c9c14 100644 --- a/src/gallium/auxiliary/util/u_framebuffer.h +++ b/src/gallium/auxiliary/util/u_framebuffer.h @@ -60,6 +60,10 @@ extern unsigned util_framebuffer_get_num_layers(const struct pipe_framebuffer_state *fb); +extern unsigned +util_framebuffer_get_num_samples(const struct pipe_framebuffer_state *fb); + + #ifdef __cplusplus } #endif -- cgit v1.2.3