From e0398f43a2d7b454592135e1ed33a8a6c303ecc9 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 20 Jun 2007 16:12:26 -0600 Subject: Rename "tile" files to "quad". --- src/mesa/pipe/softpipe/sp_quad.c | 24 ++++ src/mesa/pipe/softpipe/sp_quad.h | 56 ++++++++ src/mesa/pipe/softpipe/sp_quad_blend.c | 184 ++++++++++++++++++++++++ src/mesa/pipe/softpipe/sp_quad_depth_test.c | 73 ++++++++++ src/mesa/pipe/softpipe/sp_quad_fs.c | 208 ++++++++++++++++++++++++++++ src/mesa/pipe/softpipe/sp_quad_output.c | 103 ++++++++++++++ src/mesa/pipe/softpipe/sp_tile.c | 24 ---- src/mesa/pipe/softpipe/sp_tile.h | 56 -------- src/mesa/pipe/softpipe/sp_tile_blend.c | 184 ------------------------ src/mesa/pipe/softpipe/sp_tile_depth_test.c | 73 ---------- src/mesa/pipe/softpipe/sp_tile_fs.c | 208 ---------------------------- src/mesa/pipe/softpipe/sp_tile_output.c | 103 -------------- 12 files changed, 648 insertions(+), 648 deletions(-) create mode 100644 src/mesa/pipe/softpipe/sp_quad.c create mode 100644 src/mesa/pipe/softpipe/sp_quad.h create mode 100644 src/mesa/pipe/softpipe/sp_quad_blend.c create mode 100644 src/mesa/pipe/softpipe/sp_quad_depth_test.c create mode 100644 src/mesa/pipe/softpipe/sp_quad_fs.c create mode 100644 src/mesa/pipe/softpipe/sp_quad_output.c delete mode 100644 src/mesa/pipe/softpipe/sp_tile.c delete mode 100644 src/mesa/pipe/softpipe/sp_tile.h delete mode 100644 src/mesa/pipe/softpipe/sp_tile_blend.c delete mode 100644 src/mesa/pipe/softpipe/sp_tile_depth_test.c delete mode 100644 src/mesa/pipe/softpipe/sp_tile_fs.c delete mode 100644 src/mesa/pipe/softpipe/sp_tile_output.c (limited to 'src/mesa') diff --git a/src/mesa/pipe/softpipe/sp_quad.c b/src/mesa/pipe/softpipe/sp_quad.c new file mode 100644 index 0000000000..168872c64d --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_quad.c @@ -0,0 +1,24 @@ + + +#include "sp_context.h" + + + +void +sp_build_quad_pipeline(struct softpipe_context *sp) +{ + + sp->quad.first = sp->quad.output; + + if (sp->blend.blend_enable) { + sp->quad.blend->next = sp->quad.first; + sp->quad.first = sp->quad.blend; + } + + /* XXX always enable shader? */ + if (1) { + sp->quad.shade->next = sp->quad.first; + sp->quad.first = sp->quad.shade; + } + +} diff --git a/src/mesa/pipe/softpipe/sp_quad.h b/src/mesa/pipe/softpipe/sp_quad.h new file mode 100644 index 0000000000..86c17180bf --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_quad.h @@ -0,0 +1,56 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/* Authors: Keith Whitwell + */ +#ifndef G_TILE_H +#define G_TILE_H + +struct softpipe_context; +struct quad_header; + + +struct quad_stage { + struct softpipe_context *softpipe; + + struct quad_stage *next; + + /** the stage action */ + void (*run)(struct quad_stage *qs, struct quad_header *quad); +}; + + + +struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe ); +struct quad_stage *sp_quad_depth_test_stage( struct softpipe_context *softpipe ); +struct quad_stage *sp_quad_blend_stage( struct softpipe_context *softpipe ); +struct quad_stage *sp_quad_output_stage( struct softpipe_context *softpipe ); + +void +sp_build_quad_pipeline(struct softpipe_context *sp); + +#endif diff --git a/src/mesa/pipe/softpipe/sp_quad_blend.c b/src/mesa/pipe/softpipe/sp_quad_blend.c new file mode 100644 index 0000000000..9ac0ccbfa5 --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_quad_blend.c @@ -0,0 +1,184 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * quad blending + * \author Brian Paul + */ + +#include "glheader.h" +#include "imports.h" +#include "macros.h" +#include "pipe/p_defines.h" +#include "sp_context.h" +#include "sp_headers.h" +#include "sp_surface.h" +#include "sp_tile.h" + + + +static void +blend_quad(struct quad_stage *qs, struct quad_header *quad) +{ + struct softpipe_context *softpipe = qs->softpipe; + GLfloat source[4][QUAD_SIZE], dest[4][QUAD_SIZE]; + GLuint i, j; + + /* XXX we're also looping in output_quad() !?! */ + + /* copy quad's colors since we'll modify them in the loop */ + memcpy(source, quad->outputs.color, 4 * 4 * sizeof(GLfloat)); + + for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) { + GLfloat srcTerm[4], dstTerm[4]; + struct softpipe_surface *sps + = softpipe_surface(softpipe->framebuffer.cbufs[i]); + + sps->read_quad_f_swz(sps, quad->x0, quad->y0, dest); + + /* XXX this loop could be factored out - we'd compute the src/dstTerm + * for all four pixels in the quad at once. + */ + for (j = 0; j < QUAD_SIZE; j++) { + + /* if this pixel in the quad is alive */ + if (quad->mask & (1 << j)) { + + switch (softpipe->blend.rgb_src_factor) { + case PIPE_BLENDFACTOR_ONE: + srcTerm[0] = srcTerm[1] = srcTerm[2] = 1.0; + break; + case PIPE_BLENDFACTOR_SRC_ALPHA: + srcTerm[0] = srcTerm[1] = srcTerm[2] = quad->outputs.color[3][j]; + break; + case PIPE_BLENDFACTOR_ZERO: + srcTerm[0] = srcTerm[1] = srcTerm[2] = 0.0; + break; + /* XXX fill in remaining terms */ + default: + abort(); + } + + switch (softpipe->blend.alpha_src_factor) { + case PIPE_BLENDFACTOR_ONE: + srcTerm[3] = 1.0; + break; + case PIPE_BLENDFACTOR_SRC_ALPHA: + srcTerm[3] = quad->outputs.color[3][j]; + break; + case PIPE_BLENDFACTOR_ZERO: + srcTerm[3] = 0.0; + break; + /* XXX fill in remaining terms */ + default: + abort(); + } + + switch (softpipe->blend.rgb_dst_factor) { + case PIPE_BLENDFACTOR_ONE: + dstTerm[0] = dstTerm[1] = dstTerm[2] = 1.0; + break; + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + dstTerm[0] = dstTerm[1] = dstTerm[2] = 1.0 - quad->outputs.color[3][j]; + break; + case PIPE_BLENDFACTOR_ZERO: + dstTerm[0] = dstTerm[1] = dstTerm[2] = 0.0; + break; + /* XXX fill in remaining terms */ + default: + abort(); + } + + switch (softpipe->blend.alpha_dst_factor) { + case PIPE_BLENDFACTOR_ONE: + dstTerm[3] = 1.0; + break; + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + dstTerm[3] = 1.0 - quad->outputs.color[3][j]; + break; + case PIPE_BLENDFACTOR_ZERO: + dstTerm[3] = 0.0; + break; + /* XXX fill in remaining terms */ + default: + abort(); + } + + switch (softpipe->blend.rgb_func) { + case PIPE_BLEND_ADD: + quad->outputs.color[0][j] = source[0][j] * srcTerm[0] + dest[0][j] * dstTerm[0]; + quad->outputs.color[1][j] = source[1][j] * srcTerm[1] + dest[1][j] * dstTerm[1]; + quad->outputs.color[2][j] = source[2][j] * srcTerm[2] + dest[2][j] * dstTerm[2]; + quad->outputs.color[3][j] = source[3][j] * srcTerm[3] + dest[3][j] * dstTerm[3]; + break; + case PIPE_BLEND_SUBTRACT: + quad->outputs.color[0][j] = source[0][j] * srcTerm[0] - dest[0][j] * dstTerm[0]; + quad->outputs.color[1][j] = source[1][j] * srcTerm[1] - dest[1][j] * dstTerm[1]; + quad->outputs.color[2][j] = source[2][j] * srcTerm[2] - dest[2][j] * dstTerm[2]; + quad->outputs.color[3][j] = source[3][j] * srcTerm[3] - dest[3][j] * dstTerm[3]; + break; + case PIPE_BLEND_REVERSE_SUBTRACT: + quad->outputs.color[0][j] = dest[0][j] * dstTerm[0] - source[0][j] * srcTerm[0]; + quad->outputs.color[1][j] = dest[1][j] * dstTerm[1] - source[1][j] * srcTerm[1]; + quad->outputs.color[2][j] = dest[2][j] * dstTerm[2] - source[2][j] * srcTerm[2]; + quad->outputs.color[3][j] = dest[3][j] * dstTerm[3] - source[3][j] * srcTerm[3]; + break; + case PIPE_BLEND_MIN: + quad->outputs.color[0][j] = MIN2(dest[0][j], source[0][j]); + quad->outputs.color[1][j] = MIN2(dest[1][j], source[1][j]); + quad->outputs.color[2][j] = MIN2(dest[2][j], source[2][j]); + quad->outputs.color[3][j] = MIN2(dest[3][j], source[3][j]); + break; + case PIPE_BLEND_MAX: + quad->outputs.color[0][j] = MAX2(dest[0][j], source[0][j]); + quad->outputs.color[1][j] = MAX2(dest[1][j], source[1][j]); + quad->outputs.color[2][j] = MAX2(dest[2][j], source[2][j]); + quad->outputs.color[3][j] = MAX2(dest[3][j], source[3][j]); + break; + default: + abort(); + } + } + } /* loop over quad's pixels*/ + + /* pass blended quad to next stage */ + qs->next->run(qs->next, quad); + } +} + + + + +struct quad_stage *sp_quad_blend_stage( struct softpipe_context *softpipe ) +{ + struct quad_stage *stage = CALLOC_STRUCT(quad_stage); + + stage->softpipe = softpipe; + stage->run = blend_quad; + + return stage; +} diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/mesa/pipe/softpipe/sp_quad_depth_test.c new file mode 100644 index 0000000000..5bc2648531 --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_quad_depth_test.c @@ -0,0 +1,73 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * quad blending + */ + +#include "glheader.h" +#include "imports.h" +#include "sp_context.h" +#include "sp_headers.h" +#include "sp_surface.h" +#include "sp_tile.h" + + + +static void +depth_test_quad(struct quad_stage *qs, struct quad_header *quad) +{ +#if 0 + struct softpipe_context *softpipe = qs->softpipe; + GLfloat dest[4][QUAD_SIZE], result[4][QUAD_SIZE]; + GLuint i; + + /* XXX we're also looping in output_quad() !?! */ + + for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) { + struct softpipe_surface *sps + = softpipe_surface(softpipe->framebuffer.cbufs[i]); + + sps->read_quad_f_swz(sps, quad->x0, quad->y0, dest); + + /* XXX do blend here */ + + } +#endif + + qs->next->run(qs->next, quad); +} + + + + +struct quad_stage *sp_quad_depth_test_stage( struct softpipe_context *softpipe ) +{ + struct quad_stage *stage = CALLOC_STRUCT(quad_stage); + + stage->softpipe = softpipe; + stage->run = depth_test_quad; + + return stage; +} diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c new file mode 100644 index 0000000000..912831fefa --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -0,0 +1,208 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* Vertices are just an array of floats, with all the attributes + * packed. We currently assume a layout like: + * + * attr[0][0..3] - window position + * attr[1..n][0..3] - remaining attributes. + * + * Attributes are assumed to be 4 floats wide but are packed so that + * all the enabled attributes run contiguously. + */ + +#include "glheader.h" +#include "imports.h" +#include "sp_context.h" +#include "sp_headers.h" +#include "sp_tile.h" + +struct exec_machine { + const struct setup_coefficient *coef; + + GLfloat attr[FRAG_ATTRIB_MAX][4][QUAD_SIZE]; +}; + + +/** + * Compute quad's attributes values, as constants (GL_FLAT shading). + */ +static INLINE void cinterp( struct exec_machine *exec, + GLuint attrib, + GLuint i ) +{ + GLuint j; + + for (j = 0; j < QUAD_SIZE; j++) { + exec->attr[attrib][i][j] = exec->coef[attrib].a0[i]; + } +} + + +/** + * Compute quad's attribute values by linear interpolation. + * + * Push into the fp: + * + * INPUT[attr] = MAD COEF_A0[attr], COEF_DADX[attr], INPUT_WPOS.xxxx + * INPUT[attr] = MAD INPUT[attr], COEF_DADY[attr], INPUT_WPOS.yyyy + */ +static INLINE void linterp( struct exec_machine *exec, + GLuint attrib, + GLuint i ) +{ + GLuint j; + + for (j = 0; j < QUAD_SIZE; j++) { + const GLfloat x = exec->attr[FRAG_ATTRIB_WPOS][0][j]; + const GLfloat y = exec->attr[FRAG_ATTRIB_WPOS][1][j]; + exec->attr[attrib][i][j] = (exec->coef[attrib].a0[i] + + exec->coef[attrib].dadx[i] * x + + exec->coef[attrib].dady[i] * y); + } +} + + +/** + * Compute quad's attribute values by linear interpolation with + * perspective correction. + * + * Push into the fp: + * + * INPUT[attr] = MAD COEF_A0[attr], COEF_DADX[attr], INPUT_WPOS.xxxx + * INPUT[attr] = MAD INPUT[attr], COEF_DADY[attr], INPUT_WPOS.yyyy + * INPUT[attr] = MUL INPUT[attr], INPUT_WPOS.wwww + * + * (Or should that be 1/w ???) + */ +static INLINE void pinterp( struct exec_machine *exec, + GLuint attrib, + GLuint i ) +{ + GLuint j; + + for (j = 0; j < QUAD_SIZE; j++) { + const GLfloat x = exec->attr[FRAG_ATTRIB_WPOS][0][j]; + const GLfloat y = exec->attr[FRAG_ATTRIB_WPOS][1][j]; + const GLfloat invW = exec->attr[FRAG_ATTRIB_WPOS][3][j]; + exec->attr[attrib][i][j] = ((exec->coef[attrib].a0[i] + + exec->coef[attrib].dadx[i] * x + + exec->coef[attrib].dady[i] * y) * invW); + } +} + + + +/* This should be done by the fragment shader execution unit (code + * generated from the decl instructions). Do it here for now. + */ +static void +shade_quad( struct quad_stage *qs, struct quad_header *quad ) +{ + struct softpipe_context *softpipe = qs->softpipe; + struct exec_machine exec; + GLfloat fx = quad->x0; + GLfloat fy = quad->y0; + GLuint i, j; + + exec.coef = quad->coef; + + /* Position: + */ + exec.attr[FRAG_ATTRIB_WPOS][0][0] = fx; + exec.attr[FRAG_ATTRIB_WPOS][0][1] = fx + 1.0; + exec.attr[FRAG_ATTRIB_WPOS][0][2] = fx; + exec.attr[FRAG_ATTRIB_WPOS][0][3] = fx + 1.0; + + exec.attr[FRAG_ATTRIB_WPOS][1][0] = fy; + exec.attr[FRAG_ATTRIB_WPOS][1][1] = fy; + exec.attr[FRAG_ATTRIB_WPOS][1][2] = fy + 1.0; + exec.attr[FRAG_ATTRIB_WPOS][1][3] = fy + 1.0; + + /* Z and W are done by linear interpolation: + * XXX we'll probably have to use integers for Z + */ + if (softpipe->need_z) { + linterp(&exec, 0, 2); + } + + if (softpipe->need_w) { + linterp(&exec, 0, 3); +// invert(&exec, 0, 3); + } + + /* Interpolate all the remaining attributes. This will get pushed + * into the fragment program's responsibilities at some point. + */ + for (i = 1; i < quad->nr_attrs; i++) { +#if 1 + for (j = 0; j < NUM_CHANNELS; j++) + linterp(&exec, i, j); +#else + switch (quad->interp[i]) { + case INTERP_CONSTANT: + for (j = 0; j < NUM_CHANNELS; j++) + cinterp(&exec, i, j); + break; + + case INTERP_LINEAR: + for (j = 0; j < NUM_CHANNELS; j++) + linterp(&exec, i, j); + break; + + case INTERP_PERSPECTIVE: + for (j = 0; j < NUM_CHANNELS; j++) + pinterp(&exec, i, j); + break; + } +#endif + } + +#if 0 + softpipe->run_fs( tri->fp, quad, &tri->outputs ); +#else + { + GLuint attr = softpipe->fp_attr_to_slot[FRAG_ATTRIB_COL0]; + assert(attr); + + memcpy(quad->outputs.color, + exec.attr[attr], + sizeof(quad->outputs.color)); + } +#endif + + qs->next->run(qs->next, quad); +} + + + +struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe ) +{ + struct quad_stage *stage = CALLOC_STRUCT(quad_stage); + + stage->softpipe = softpipe; + stage->run = shade_quad; + + return stage; +} diff --git a/src/mesa/pipe/softpipe/sp_quad_output.c b/src/mesa/pipe/softpipe/sp_quad_output.c new file mode 100644 index 0000000000..4f4421891b --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_quad_output.c @@ -0,0 +1,103 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* Vertices are just an array of floats, with all the attributes + * packed. We currently assume a layout like: + * + * attr[0][0..3] - window position + * attr[1..n][0..3] - remaining attributes. + * + * Attributes are assumed to be 4 floats wide but are packed so that + * all the enabled attributes run contiguously. + */ + +#include "glheader.h" +#include "imports.h" +#include "sp_context.h" +#include "sp_headers.h" +#include "sp_surface.h" +#include "sp_tile.h" + + +static void mask_copy( GLfloat (*dest)[4], + GLfloat (*src)[4], + GLuint mask ) +{ + GLuint i, j; + + for (i = 0; i < 4; i++) { + if (mask & (1<softpipe; + GLuint i; + + for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) { + struct softpipe_surface *sps + = softpipe_surface(softpipe->framebuffer.cbufs[i]); + + if (quad->mask != MASK_ALL) { + GLfloat tmp[4][QUAD_SIZE]; + + /* 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); + } + } +} + + +struct quad_stage *sp_quad_output_stage( struct softpipe_context *softpipe ) +{ + struct quad_stage *stage = CALLOC_STRUCT(quad_stage); + + stage->softpipe = softpipe; + stage->run = output_quad; + + return stage; +} + diff --git a/src/mesa/pipe/softpipe/sp_tile.c b/src/mesa/pipe/softpipe/sp_tile.c deleted file mode 100644 index 168872c64d..0000000000 --- a/src/mesa/pipe/softpipe/sp_tile.c +++ /dev/null @@ -1,24 +0,0 @@ - - -#include "sp_context.h" - - - -void -sp_build_quad_pipeline(struct softpipe_context *sp) -{ - - sp->quad.first = sp->quad.output; - - if (sp->blend.blend_enable) { - sp->quad.blend->next = sp->quad.first; - sp->quad.first = sp->quad.blend; - } - - /* XXX always enable shader? */ - if (1) { - sp->quad.shade->next = sp->quad.first; - sp->quad.first = sp->quad.shade; - } - -} diff --git a/src/mesa/pipe/softpipe/sp_tile.h b/src/mesa/pipe/softpipe/sp_tile.h deleted file mode 100644 index 86c17180bf..0000000000 --- a/src/mesa/pipe/softpipe/sp_tile.h +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -/* Authors: Keith Whitwell - */ -#ifndef G_TILE_H -#define G_TILE_H - -struct softpipe_context; -struct quad_header; - - -struct quad_stage { - struct softpipe_context *softpipe; - - struct quad_stage *next; - - /** the stage action */ - void (*run)(struct quad_stage *qs, struct quad_header *quad); -}; - - - -struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe ); -struct quad_stage *sp_quad_depth_test_stage( struct softpipe_context *softpipe ); -struct quad_stage *sp_quad_blend_stage( struct softpipe_context *softpipe ); -struct quad_stage *sp_quad_output_stage( struct softpipe_context *softpipe ); - -void -sp_build_quad_pipeline(struct softpipe_context *sp); - -#endif diff --git a/src/mesa/pipe/softpipe/sp_tile_blend.c b/src/mesa/pipe/softpipe/sp_tile_blend.c deleted file mode 100644 index 9ac0ccbfa5..0000000000 --- a/src/mesa/pipe/softpipe/sp_tile_blend.c +++ /dev/null @@ -1,184 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -/** - * quad blending - * \author Brian Paul - */ - -#include "glheader.h" -#include "imports.h" -#include "macros.h" -#include "pipe/p_defines.h" -#include "sp_context.h" -#include "sp_headers.h" -#include "sp_surface.h" -#include "sp_tile.h" - - - -static void -blend_quad(struct quad_stage *qs, struct quad_header *quad) -{ - struct softpipe_context *softpipe = qs->softpipe; - GLfloat source[4][QUAD_SIZE], dest[4][QUAD_SIZE]; - GLuint i, j; - - /* XXX we're also looping in output_quad() !?! */ - - /* copy quad's colors since we'll modify them in the loop */ - memcpy(source, quad->outputs.color, 4 * 4 * sizeof(GLfloat)); - - for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) { - GLfloat srcTerm[4], dstTerm[4]; - struct softpipe_surface *sps - = softpipe_surface(softpipe->framebuffer.cbufs[i]); - - sps->read_quad_f_swz(sps, quad->x0, quad->y0, dest); - - /* XXX this loop could be factored out - we'd compute the src/dstTerm - * for all four pixels in the quad at once. - */ - for (j = 0; j < QUAD_SIZE; j++) { - - /* if this pixel in the quad is alive */ - if (quad->mask & (1 << j)) { - - switch (softpipe->blend.rgb_src_factor) { - case PIPE_BLENDFACTOR_ONE: - srcTerm[0] = srcTerm[1] = srcTerm[2] = 1.0; - break; - case PIPE_BLENDFACTOR_SRC_ALPHA: - srcTerm[0] = srcTerm[1] = srcTerm[2] = quad->outputs.color[3][j]; - break; - case PIPE_BLENDFACTOR_ZERO: - srcTerm[0] = srcTerm[1] = srcTerm[2] = 0.0; - break; - /* XXX fill in remaining terms */ - default: - abort(); - } - - switch (softpipe->blend.alpha_src_factor) { - case PIPE_BLENDFACTOR_ONE: - srcTerm[3] = 1.0; - break; - case PIPE_BLENDFACTOR_SRC_ALPHA: - srcTerm[3] = quad->outputs.color[3][j]; - break; - case PIPE_BLENDFACTOR_ZERO: - srcTerm[3] = 0.0; - break; - /* XXX fill in remaining terms */ - default: - abort(); - } - - switch (softpipe->blend.rgb_dst_factor) { - case PIPE_BLENDFACTOR_ONE: - dstTerm[0] = dstTerm[1] = dstTerm[2] = 1.0; - break; - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: - dstTerm[0] = dstTerm[1] = dstTerm[2] = 1.0 - quad->outputs.color[3][j]; - break; - case PIPE_BLENDFACTOR_ZERO: - dstTerm[0] = dstTerm[1] = dstTerm[2] = 0.0; - break; - /* XXX fill in remaining terms */ - default: - abort(); - } - - switch (softpipe->blend.alpha_dst_factor) { - case PIPE_BLENDFACTOR_ONE: - dstTerm[3] = 1.0; - break; - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: - dstTerm[3] = 1.0 - quad->outputs.color[3][j]; - break; - case PIPE_BLENDFACTOR_ZERO: - dstTerm[3] = 0.0; - break; - /* XXX fill in remaining terms */ - default: - abort(); - } - - switch (softpipe->blend.rgb_func) { - case PIPE_BLEND_ADD: - quad->outputs.color[0][j] = source[0][j] * srcTerm[0] + dest[0][j] * dstTerm[0]; - quad->outputs.color[1][j] = source[1][j] * srcTerm[1] + dest[1][j] * dstTerm[1]; - quad->outputs.color[2][j] = source[2][j] * srcTerm[2] + dest[2][j] * dstTerm[2]; - quad->outputs.color[3][j] = source[3][j] * srcTerm[3] + dest[3][j] * dstTerm[3]; - break; - case PIPE_BLEND_SUBTRACT: - quad->outputs.color[0][j] = source[0][j] * srcTerm[0] - dest[0][j] * dstTerm[0]; - quad->outputs.color[1][j] = source[1][j] * srcTerm[1] - dest[1][j] * dstTerm[1]; - quad->outputs.color[2][j] = source[2][j] * srcTerm[2] - dest[2][j] * dstTerm[2]; - quad->outputs.color[3][j] = source[3][j] * srcTerm[3] - dest[3][j] * dstTerm[3]; - break; - case PIPE_BLEND_REVERSE_SUBTRACT: - quad->outputs.color[0][j] = dest[0][j] * dstTerm[0] - source[0][j] * srcTerm[0]; - quad->outputs.color[1][j] = dest[1][j] * dstTerm[1] - source[1][j] * srcTerm[1]; - quad->outputs.color[2][j] = dest[2][j] * dstTerm[2] - source[2][j] * srcTerm[2]; - quad->outputs.color[3][j] = dest[3][j] * dstTerm[3] - source[3][j] * srcTerm[3]; - break; - case PIPE_BLEND_MIN: - quad->outputs.color[0][j] = MIN2(dest[0][j], source[0][j]); - quad->outputs.color[1][j] = MIN2(dest[1][j], source[1][j]); - quad->outputs.color[2][j] = MIN2(dest[2][j], source[2][j]); - quad->outputs.color[3][j] = MIN2(dest[3][j], source[3][j]); - break; - case PIPE_BLEND_MAX: - quad->outputs.color[0][j] = MAX2(dest[0][j], source[0][j]); - quad->outputs.color[1][j] = MAX2(dest[1][j], source[1][j]); - quad->outputs.color[2][j] = MAX2(dest[2][j], source[2][j]); - quad->outputs.color[3][j] = MAX2(dest[3][j], source[3][j]); - break; - default: - abort(); - } - } - } /* loop over quad's pixels*/ - - /* pass blended quad to next stage */ - qs->next->run(qs->next, quad); - } -} - - - - -struct quad_stage *sp_quad_blend_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->run = blend_quad; - - return stage; -} diff --git a/src/mesa/pipe/softpipe/sp_tile_depth_test.c b/src/mesa/pipe/softpipe/sp_tile_depth_test.c deleted file mode 100644 index 5bc2648531..0000000000 --- a/src/mesa/pipe/softpipe/sp_tile_depth_test.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * quad blending - */ - -#include "glheader.h" -#include "imports.h" -#include "sp_context.h" -#include "sp_headers.h" -#include "sp_surface.h" -#include "sp_tile.h" - - - -static void -depth_test_quad(struct quad_stage *qs, struct quad_header *quad) -{ -#if 0 - struct softpipe_context *softpipe = qs->softpipe; - GLfloat dest[4][QUAD_SIZE], result[4][QUAD_SIZE]; - GLuint i; - - /* XXX we're also looping in output_quad() !?! */ - - for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) { - struct softpipe_surface *sps - = softpipe_surface(softpipe->framebuffer.cbufs[i]); - - sps->read_quad_f_swz(sps, quad->x0, quad->y0, dest); - - /* XXX do blend here */ - - } -#endif - - qs->next->run(qs->next, quad); -} - - - - -struct quad_stage *sp_quad_depth_test_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->run = depth_test_quad; - - return stage; -} diff --git a/src/mesa/pipe/softpipe/sp_tile_fs.c b/src/mesa/pipe/softpipe/sp_tile_fs.c deleted file mode 100644 index 912831fefa..0000000000 --- a/src/mesa/pipe/softpipe/sp_tile_fs.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* Vertices are just an array of floats, with all the attributes - * packed. We currently assume a layout like: - * - * attr[0][0..3] - window position - * attr[1..n][0..3] - remaining attributes. - * - * Attributes are assumed to be 4 floats wide but are packed so that - * all the enabled attributes run contiguously. - */ - -#include "glheader.h" -#include "imports.h" -#include "sp_context.h" -#include "sp_headers.h" -#include "sp_tile.h" - -struct exec_machine { - const struct setup_coefficient *coef; - - GLfloat attr[FRAG_ATTRIB_MAX][4][QUAD_SIZE]; -}; - - -/** - * Compute quad's attributes values, as constants (GL_FLAT shading). - */ -static INLINE void cinterp( struct exec_machine *exec, - GLuint attrib, - GLuint i ) -{ - GLuint j; - - for (j = 0; j < QUAD_SIZE; j++) { - exec->attr[attrib][i][j] = exec->coef[attrib].a0[i]; - } -} - - -/** - * Compute quad's attribute values by linear interpolation. - * - * Push into the fp: - * - * INPUT[attr] = MAD COEF_A0[attr], COEF_DADX[attr], INPUT_WPOS.xxxx - * INPUT[attr] = MAD INPUT[attr], COEF_DADY[attr], INPUT_WPOS.yyyy - */ -static INLINE void linterp( struct exec_machine *exec, - GLuint attrib, - GLuint i ) -{ - GLuint j; - - for (j = 0; j < QUAD_SIZE; j++) { - const GLfloat x = exec->attr[FRAG_ATTRIB_WPOS][0][j]; - const GLfloat y = exec->attr[FRAG_ATTRIB_WPOS][1][j]; - exec->attr[attrib][i][j] = (exec->coef[attrib].a0[i] + - exec->coef[attrib].dadx[i] * x + - exec->coef[attrib].dady[i] * y); - } -} - - -/** - * Compute quad's attribute values by linear interpolation with - * perspective correction. - * - * Push into the fp: - * - * INPUT[attr] = MAD COEF_A0[attr], COEF_DADX[attr], INPUT_WPOS.xxxx - * INPUT[attr] = MAD INPUT[attr], COEF_DADY[attr], INPUT_WPOS.yyyy - * INPUT[attr] = MUL INPUT[attr], INPUT_WPOS.wwww - * - * (Or should that be 1/w ???) - */ -static INLINE void pinterp( struct exec_machine *exec, - GLuint attrib, - GLuint i ) -{ - GLuint j; - - for (j = 0; j < QUAD_SIZE; j++) { - const GLfloat x = exec->attr[FRAG_ATTRIB_WPOS][0][j]; - const GLfloat y = exec->attr[FRAG_ATTRIB_WPOS][1][j]; - const GLfloat invW = exec->attr[FRAG_ATTRIB_WPOS][3][j]; - exec->attr[attrib][i][j] = ((exec->coef[attrib].a0[i] + - exec->coef[attrib].dadx[i] * x + - exec->coef[attrib].dady[i] * y) * invW); - } -} - - - -/* This should be done by the fragment shader execution unit (code - * generated from the decl instructions). Do it here for now. - */ -static void -shade_quad( struct quad_stage *qs, struct quad_header *quad ) -{ - struct softpipe_context *softpipe = qs->softpipe; - struct exec_machine exec; - GLfloat fx = quad->x0; - GLfloat fy = quad->y0; - GLuint i, j; - - exec.coef = quad->coef; - - /* Position: - */ - exec.attr[FRAG_ATTRIB_WPOS][0][0] = fx; - exec.attr[FRAG_ATTRIB_WPOS][0][1] = fx + 1.0; - exec.attr[FRAG_ATTRIB_WPOS][0][2] = fx; - exec.attr[FRAG_ATTRIB_WPOS][0][3] = fx + 1.0; - - exec.attr[FRAG_ATTRIB_WPOS][1][0] = fy; - exec.attr[FRAG_ATTRIB_WPOS][1][1] = fy; - exec.attr[FRAG_ATTRIB_WPOS][1][2] = fy + 1.0; - exec.attr[FRAG_ATTRIB_WPOS][1][3] = fy + 1.0; - - /* Z and W are done by linear interpolation: - * XXX we'll probably have to use integers for Z - */ - if (softpipe->need_z) { - linterp(&exec, 0, 2); - } - - if (softpipe->need_w) { - linterp(&exec, 0, 3); -// invert(&exec, 0, 3); - } - - /* Interpolate all the remaining attributes. This will get pushed - * into the fragment program's responsibilities at some point. - */ - for (i = 1; i < quad->nr_attrs; i++) { -#if 1 - for (j = 0; j < NUM_CHANNELS; j++) - linterp(&exec, i, j); -#else - switch (quad->interp[i]) { - case INTERP_CONSTANT: - for (j = 0; j < NUM_CHANNELS; j++) - cinterp(&exec, i, j); - break; - - case INTERP_LINEAR: - for (j = 0; j < NUM_CHANNELS; j++) - linterp(&exec, i, j); - break; - - case INTERP_PERSPECTIVE: - for (j = 0; j < NUM_CHANNELS; j++) - pinterp(&exec, i, j); - break; - } -#endif - } - -#if 0 - softpipe->run_fs( tri->fp, quad, &tri->outputs ); -#else - { - GLuint attr = softpipe->fp_attr_to_slot[FRAG_ATTRIB_COL0]; - assert(attr); - - memcpy(quad->outputs.color, - exec.attr[attr], - sizeof(quad->outputs.color)); - } -#endif - - qs->next->run(qs->next, quad); -} - - - -struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->run = shade_quad; - - return stage; -} diff --git a/src/mesa/pipe/softpipe/sp_tile_output.c b/src/mesa/pipe/softpipe/sp_tile_output.c deleted file mode 100644 index 4f4421891b..0000000000 --- a/src/mesa/pipe/softpipe/sp_tile_output.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* Vertices are just an array of floats, with all the attributes - * packed. We currently assume a layout like: - * - * attr[0][0..3] - window position - * attr[1..n][0..3] - remaining attributes. - * - * Attributes are assumed to be 4 floats wide but are packed so that - * all the enabled attributes run contiguously. - */ - -#include "glheader.h" -#include "imports.h" -#include "sp_context.h" -#include "sp_headers.h" -#include "sp_surface.h" -#include "sp_tile.h" - - -static void mask_copy( GLfloat (*dest)[4], - GLfloat (*src)[4], - GLuint mask ) -{ - GLuint i, j; - - for (i = 0; i < 4; i++) { - if (mask & (1<softpipe; - GLuint i; - - for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) { - struct softpipe_surface *sps - = softpipe_surface(softpipe->framebuffer.cbufs[i]); - - if (quad->mask != MASK_ALL) { - GLfloat tmp[4][QUAD_SIZE]; - - /* 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); - } - } -} - - -struct quad_stage *sp_quad_output_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->run = output_quad; - - return stage; -} - -- cgit v1.2.3