aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-06-19 19:19:31 -0600
committerBrian <[email protected]>2007-06-19 19:19:31 -0600
commitaf9b5ca0359b5712509d7815a7fbc81a3255f4af (patch)
treea9669c33d78e42d7925f60afd6e54037c39de2ac /src/mesa/pipe
parent03933ad656e5bd776a2e6f93312ee90eff66d3d3 (diff)
Re-org of surface/framebuffer state.
We should be able to render to any depth/format of X window now.
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c1
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h7
-rw-r--r--src/mesa/pipe/softpipe/sp_state.h3
-rw-r--r--src/mesa/pipe/softpipe/sp_state_surface.c17
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.h53
-rw-r--r--src/mesa/pipe/softpipe/sp_tile_output.c45
6 files changed, 29 insertions, 97 deletions
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 9a054265fb1..018f67302dd 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -73,7 +73,6 @@ struct pipe_context *softpipe_create( void )
softpipe->pipe.set_scissor_rect = softpipe_set_scissor_rect;
softpipe->pipe.set_fs_state = softpipe_set_fs_state;
softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
- softpipe->pipe.set_cbuf_state = softpipe_set_cbuf_state;
softpipe->pipe.draw_vb = softpipe_draw_vb;
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index efe453ea2c3..a8733013684 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -54,7 +54,6 @@ enum interp_mode {
#define G_NEW_SETUP 0x2
#define G_NEW_FS 0x4
#define G_NEW_BLEND 0x8
-#define G_NEW_CBUF 0x10
#define G_NEW_CLIP 0x20
#define G_NEW_SCISSOR 0x40
#define G_NEW_STIPPLE 0x80
@@ -74,17 +73,11 @@ struct softpipe_context {
struct pipe_fs_state fs;
struct pipe_blend_state blend;
struct pipe_alpha_test_state alpha_test;
- struct pipe_surface cbuf;
struct pipe_clip_state clip;
struct pipe_scissor_rect scissor;
struct pipe_poly_stipple poly_stipple;
GLuint dirty;
-
- /* Cbuf derived state???
- */
- struct softpipe_surface *cbuf_surface;
-
/* Clip derived state:
*/
GLfloat plane[12][4];
diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h
index bdf10112f6d..5002ce88fcc 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/mesa/pipe/softpipe/sp_state.h
@@ -56,9 +56,6 @@ void softpipe_set_fs_state( struct pipe_context *,
void softpipe_set_polygon_stipple( struct pipe_context *,
const struct pipe_poly_stipple * );
-void softpipe_set_cbuf_state( struct pipe_context *,
- const struct pipe_surface * );
-
void softpipe_update_derived( struct softpipe_context *softpipe );
#endif
diff --git a/src/mesa/pipe/softpipe/sp_state_surface.c b/src/mesa/pipe/softpipe/sp_state_surface.c
index d089fe06322..99332fdd529 100644
--- a/src/mesa/pipe/softpipe/sp_state_surface.c
+++ b/src/mesa/pipe/softpipe/sp_state_surface.c
@@ -34,23 +34,6 @@
#include "sp_surface.h"
-/* This is all a total hack.
- */
-void softpipe_set_cbuf_state( struct pipe_context *pipe,
- const struct pipe_surface *surface )
-{
- struct softpipe_context *softpipe = softpipe_context(pipe);
-
- if (softpipe->cbuf_surface == NULL) {
- softpipe->cbuf_surface = CALLOC_STRUCT(softpipe_surface);
- softpipe->cbuf_surface->type = &gs_rgba8;
- }
-
- softpipe->cbuf_surface->surface = *surface;
- softpipe->dirty |= G_NEW_CBUF;
-}
-
-
/*
* XXX this might get moved someday
*/
diff --git a/src/mesa/pipe/softpipe/sp_surface.h b/src/mesa/pipe/softpipe/sp_surface.h
index 08b6889257a..dde6b90448e 100644
--- a/src/mesa/pipe/softpipe/sp_surface.h
+++ b/src/mesa/pipe/softpipe/sp_surface.h
@@ -38,12 +38,16 @@ struct softpipe_surface;
#define G_SURFACE_RGBA_8888 0x1
-/* Internal structs and helpers for the primitive clip/setup pipeline:
+
+/**
+ * Softpipe surface is derived from pipe_surface.
*/
-struct softpipe_surface_type {
-
- GLuint format;
+struct softpipe_surface {
+ struct pipe_surface surface;
+ /**
+ * Functions for read/writing surface data
+ */
void (*read_quad_f)( struct softpipe_surface *,
GLint x, GLint y,
GLfloat (*rgba)[NUM_CHANNELS] );
@@ -69,47 +73,6 @@ struct softpipe_surface_type {
void (*write_quad_ub)( struct softpipe_surface *,
GLint x, GLint y,
GLubyte (*rgba)[NUM_CHANNELS] );
-
-
};
-
-struct softpipe_surface {
- struct softpipe_surface_type *type;
- struct pipe_surface surface;
-};
-
-
-static INLINE void gs_read_quad_f( struct softpipe_surface *gs,
- GLint x, GLint y,
- GLfloat (*rgba)[NUM_CHANNELS] )
-{
- gs->type->read_quad_f(gs, x, y, rgba);
-}
-
-static INLINE void gs_read_quad_f_swz( struct softpipe_surface *gs,
- GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE] )
-{
- gs->type->read_quad_f_swz(gs, x, y, rrrr);
-}
-
-static INLINE void gs_write_quad_f( struct softpipe_surface *gs,
- GLint x, GLint y,
- GLfloat (*rgba)[NUM_CHANNELS] )
-{
- gs->type->write_quad_f(gs, x, y, rgba);
-}
-
-static INLINE void gs_write_quad_f_swz( struct softpipe_surface *gs,
- GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE] )
-{
- gs->type->write_quad_f_swz(gs, x, y, rrrr);
-}
-
-/* Like this, or hidden?
- */
-struct softpipe_surface_type gs_rgba8;
-
#endif
diff --git a/src/mesa/pipe/softpipe/sp_tile_output.c b/src/mesa/pipe/softpipe/sp_tile_output.c
index b1eb9e8c9ff..d4add4b162b 100644
--- a/src/mesa/pipe/softpipe/sp_tile_output.c
+++ b/src/mesa/pipe/softpipe/sp_tile_output.c
@@ -55,38 +55,35 @@ static void mask_copy( GLfloat (*dest)[4],
}
-/* Write to the output, taking mask into account.
+/**
+ * Write quad to framebuffer, taking mask into account.
*
* Note that surfaces support only full quad reads and writes.
*/
void quad_output( struct softpipe_context *softpipe,
struct quad_header *quad )
{
+ GLuint i;
- if (quad->mask != MASK_ALL)
- {
- GLfloat tmp[4][QUAD_SIZE];
+ for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) {
+ struct softpipe_surface *sps
+ = (struct softpipe_surface *) softpipe->framebuffer.cbufs[i];
- /* Yes, we'll probably have a masked write as well, but this is
- * how blend will be done at least.
- */
- gs_read_quad_f_swz( softpipe->cbuf_surface,
- quad->x0,
- quad->y0,
- tmp );
-
- mask_copy( tmp, quad->outputs.color, quad->mask );
+ if (quad->mask != MASK_ALL) {
+ GLfloat tmp[4][QUAD_SIZE];
- gs_write_quad_f_swz( softpipe->cbuf_surface,
- quad->x0,
- quad->y0,
- tmp );
- }
- else
- {
- gs_write_quad_f_swz( softpipe->cbuf_surface,
- quad->x0,
- quad->y0,
- quad->outputs.color );
+ /* Yes, we'll probably have a masked write as well, but this is
+ * how blend will be done at least.
+ */
+
+ sps->read_quad_f_swz(sps, quad->x0, quad->y0, tmp);
+
+ mask_copy( tmp, quad->outputs.color, quad->mask );
+
+ sps->write_quad_f_swz(sps, quad->x0, quad->y0, tmp);
+ }
+ else {
+ sps->write_quad_f_swz(sps, quad->x0, quad->y0, quad->outputs.color);
+ }
}
}