18e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell/************************************************************************** 28e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 38e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. 48e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * All Rights Reserved. 58e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 68e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a 78e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * copy of this software and associated documentation files (the 88e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * "Software"), to deal in the Software without restriction, including 98e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * without limitation the rights to use, copy, modify, merge, publish, 108e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * distribute, sub license, and/or sell copies of the Software, and to 118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * permit persons to whom the Software is furnished to do so, subject to 128e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * the following conditions: 138e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * The above copyright notice and this permission notice (including the 158e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * next paragraph) shall be included in all copies or substantial portions 168e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * of the Software. 178e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 188e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 198e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 208e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 218e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 228e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 238e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 248e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell **************************************************************************/ 278e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 288e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell/* Authors: Keith Whitwell <keith@tungstengraphics.com> 298e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 30ebafc193fac22c4d1d8d4f1c5a129d5dbe1679a2Brian 317925274da323d5a896b557181d4016e0391f026fBrian#ifndef SP_QUAD_H 327925274da323d5a896b557181d4016e0391f026fBrian#define SP_QUAD_H 33ebafc193fac22c4d1d8d4f1c5a129d5dbe1679a2Brian 34c7daa68ca312cc98abe351be2fef8d8246929627Brian#include "pipe/p_state.h" 35c208a2c791fa24c7c5887fc496738cbddbfafc72José Fonseca#include "tgsi/tgsi_exec.h" 368e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 37460b62336d83379a98948168a4bbe177fc6df835Brian 38253d2d1676e07ddfc566f3761e409f9cabde1937Brian#define QUAD_PRIM_POINT 1 39253d2d1676e07ddfc566f3761e409f9cabde1937Brian#define QUAD_PRIM_LINE 2 40253d2d1676e07ddfc566f3761e409f9cabde1937Brian#define QUAD_PRIM_TRI 3 418e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 428e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 438e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell/* The rasterizer generates 2x2 quads of fragment and feeds them to 440edd490a96a53f83d2fb18a570cf20a4a0c5ee40Brian * the current fp_machine (see below). 450edd490a96a53f83d2fb18a570cf20a4a0c5ee40Brian * Remember that Y=0=top with Y increasing down the window. 468e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 470edd490a96a53f83d2fb18a570cf20a4a0c5ee40Brian#define QUAD_TOP_LEFT 0 480edd490a96a53f83d2fb18a570cf20a4a0c5ee40Brian#define QUAD_TOP_RIGHT 1 490edd490a96a53f83d2fb18a570cf20a4a0c5ee40Brian#define QUAD_BOTTOM_LEFT 2 500edd490a96a53f83d2fb18a570cf20a4a0c5ee40Brian#define QUAD_BOTTOM_RIGHT 3 518e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 520edd490a96a53f83d2fb18a570cf20a4a0c5ee40Brian#define MASK_TOP_LEFT (1 << QUAD_TOP_LEFT) 530edd490a96a53f83d2fb18a570cf20a4a0c5ee40Brian#define MASK_TOP_RIGHT (1 << QUAD_TOP_RIGHT) 540edd490a96a53f83d2fb18a570cf20a4a0c5ee40Brian#define MASK_BOTTOM_LEFT (1 << QUAD_BOTTOM_LEFT) 550edd490a96a53f83d2fb18a570cf20a4a0c5ee40Brian#define MASK_BOTTOM_RIGHT (1 << QUAD_BOTTOM_RIGHT) 568e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#define MASK_ALL 0xf 578e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 588e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 5980362a90d8ad1fca14d7276169fc962f953d936dBrian/** 60460b62336d83379a98948168a4bbe177fc6df835Brian * Quad stage inputs (pos, coverage, front/back face, etc) 618e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 6201f9e5120395f88bba8321e8639cac0bb9c85296Michal Krolstruct quad_header_input 6301f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol{ 64460b62336d83379a98948168a4bbe177fc6df835Brian int x0, y0; /**< quad window pos, always even */ 656b63e25b3d7a6ac0bd738c139ead0c7e7ad84368Tom Stellard float coverage[TGSI_QUAD_SIZE]; /**< fragment coverage for antialiasing */ 66460b62336d83379a98948168a4bbe177fc6df835Brian unsigned facing:1; /**< Front (0) or back (1) facing? */ 67460b62336d83379a98948168a4bbe177fc6df835Brian unsigned prim:2; /**< QUAD_PRIM_POINT, LINE, TRI */ 6801f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol}; 6901f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol 70460b62336d83379a98948168a4bbe177fc6df835Brian 71460b62336d83379a98948168a4bbe177fc6df835Brian/** 72460b62336d83379a98948168a4bbe177fc6df835Brian * Quad stage inputs/outputs. 73460b62336d83379a98948168a4bbe177fc6df835Brian */ 7401f9e5120395f88bba8321e8639cac0bb9c85296Michal Krolstruct quad_header_inout 7501f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol{ 7601f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol unsigned mask:4; 7701f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol}; 788e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 79460b62336d83379a98948168a4bbe177fc6df835Brian 80460b62336d83379a98948168a4bbe177fc6df835Brian/** 81460b62336d83379a98948168a4bbe177fc6df835Brian * Quad stage outputs (color & depth). 82460b62336d83379a98948168a4bbe177fc6df835Brian */ 8301f9e5120395f88bba8321e8639cac0bb9c85296Michal Krolstruct quad_header_output 8401f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol{ 8501f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol /** colors in SOA format (rrrr, gggg, bbbb, aaaa) */ 866b63e25b3d7a6ac0bd738c139ead0c7e7ad84368Tom Stellard float color[PIPE_MAX_COLOR_BUFS][TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]; 876b63e25b3d7a6ac0bd738c139ead0c7e7ad84368Tom Stellard float depth[TGSI_QUAD_SIZE]; 886b63e25b3d7a6ac0bd738c139ead0c7e7ad84368Tom Stellard uint8_t stencil[TGSI_QUAD_SIZE]; 8901f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol}; 908e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 91460b62336d83379a98948168a4bbe177fc6df835Brian 92460b62336d83379a98948168a4bbe177fc6df835Brian/** 93460b62336d83379a98948168a4bbe177fc6df835Brian * Encodes everything we need to know about a 2x2 pixel block. Uses 94460b62336d83379a98948168a4bbe177fc6df835Brian * "Channel-Serial" or "SoA" layout. 95460b62336d83379a98948168a4bbe177fc6df835Brian */ 9601f9e5120395f88bba8321e8639cac0bb9c85296Michal Krolstruct quad_header { 9701f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol struct quad_header_input input; 9801f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol struct quad_header_inout inout; 9901f9e5120395f88bba8321e8639cac0bb9c85296Michal Krol struct quad_header_output output; 10046bba80a54afbcabc0f064433cc2194473661c30Brian 101a1dbd7aa159e266592a1e52504680992327ca9e0Keith Whitwell /* Redundant/duplicated: 102a1dbd7aa159e266592a1e52504680992327ca9e0Keith Whitwell */ 103e785f190f0d49f0367f7468c22b77962d0f14ea0Brian const struct tgsi_interp_coef *posCoef; 104a1dbd7aa159e266592a1e52504680992327ca9e0Keith Whitwell const struct tgsi_interp_coef *coef; 1058e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1068e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1077925274da323d5a896b557181d4016e0391f026fBrian#endif /* SP_QUAD_H */ 108