minor changes, comments about multiple color buffers, MRT.

This commit is contained in:
Brian
2007-07-12 16:17:14 -06:00
parent a48d767cf2
commit f0f9a22609
2 changed files with 14 additions and 5 deletions

View File

@@ -49,7 +49,7 @@
#define PIPE_MAX_CLIP_PLANES 6 #define PIPE_MAX_CLIP_PLANES 6
#define PIPE_MAX_CONSTANT 32 #define PIPE_MAX_CONSTANT 32
#define PIPE_ATTRIB_MAX 32 #define PIPE_ATTRIB_MAX 32
#define PIPE_MAX_COLOR_BUFS 8
/* fwd decl */ /* fwd decl */
@@ -192,9 +192,10 @@ struct pipe_stencil_state {
struct pipe_framebuffer_state struct pipe_framebuffer_state
{ {
GLuint num_cbufs; /**< Number of color bufs to draw to */ /** multiple colorbuffers for multiple render targets */
struct pipe_surface *cbufs[4]; /**< OpenGL can write to as many as GLuint num_cbufs;
4 color buffers at once */ struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS];
struct pipe_surface *zbuf; /**< Z buffer */ struct pipe_surface *zbuf; /**< Z buffer */
struct pipe_surface *sbuf; /**< Stencil buffer */ struct pipe_surface *sbuf; /**< Stencil buffer */
struct pipe_surface *abuf; /**< Accum buffer */ struct pipe_surface *abuf; /**< Accum buffer */
@@ -221,6 +222,7 @@ struct pipe_sampler_state
#if 0 /* need these? */ #if 0 /* need these? */
GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */ GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */ GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
GLfloat border_color[4];
#endif #endif
GLfloat max_anisotropy; GLfloat max_anisotropy;
}; };

View File

@@ -23,9 +23,15 @@ cbuf_loop_quad(struct quad_stage *qs, struct quad_header *quad)
/* make copy of original colors since they can get modified /* make copy of original colors since they can get modified
* by blending and masking. * by blending and masking.
* XXX we won't have to do this if the fragment program actually emits
* N separate colors and we're drawing to N color buffers (MRT).
* But if we emitted one color and glDrawBuffer(GL_FRONT_AND_BACK) is
* in effect, we need to save/restore colors like this.
*/ */
memcpy(tmp, quad->outputs.color, sz); memcpy(tmp, quad->outputs.color, sz);
assert(softpipe->framebuffer.num_cbufs <= PIPE_MAX_COLOR_BUFS);
for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) { for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) {
/* set current cbuffer */ /* set current cbuffer */
softpipe->cbuf = softpipe->framebuffer.cbufs[i]; softpipe->cbuf = softpipe->framebuffer.cbufs[i];
@@ -45,7 +51,8 @@ cbuf_loop_quad(struct quad_stage *qs, struct quad_header *quad)
/** /**
* Create the colorbuffer loop stage. * Create the colorbuffer loop stage.
* This is used to implement GL_FRONT_AND_BACK rendering. * This is used to implement multiple render targets and GL_FRONT_AND_BACK
* rendering.
*/ */
struct quad_stage *sp_quad_bufloop_stage( struct softpipe_context *softpipe ) struct quad_stage *sp_quad_bufloop_stage( struct softpipe_context *softpipe )
{ {