1848b8605Smrg/************************************************************************** 2848b8605Smrg * 3848b8605Smrg * Copyright 2007 VMware, Inc. 4848b8605Smrg * All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the 8848b8605Smrg * "Software"), to deal in the Software without restriction, including 9848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish, 10848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to 11848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to 12848b8605Smrg * the following conditions: 13848b8605Smrg * 14848b8605Smrg * The above copyright notice and this permission notice (including the 15848b8605Smrg * next paragraph) shall be included in all copies or substantial portions 16848b8605Smrg * of the Software. 17848b8605Smrg * 18848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21848b8605Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22848b8605Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24848b8605Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25848b8605Smrg * 26848b8605Smrg **************************************************************************/ 27848b8605Smrg 28848b8605Smrg/* Authors: Keith Whitwell <keithw@vmware.com> 29848b8605Smrg */ 30848b8605Smrg 31848b8605Smrg#ifndef SP_QUAD_H 32848b8605Smrg#define SP_QUAD_H 33848b8605Smrg 34848b8605Smrg#include "pipe/p_state.h" 35848b8605Smrg#include "tgsi/tgsi_exec.h" 36848b8605Smrg 37848b8605Smrg 38848b8605Smrg#define QUAD_PRIM_POINT 1 39848b8605Smrg#define QUAD_PRIM_LINE 2 40848b8605Smrg#define QUAD_PRIM_TRI 3 41848b8605Smrg 42848b8605Smrg 43848b8605Smrg/* The rasterizer generates 2x2 quads of fragment and feeds them to 44848b8605Smrg * the current fp_machine (see below). 45848b8605Smrg * Remember that Y=0=top with Y increasing down the window. 46848b8605Smrg */ 47848b8605Smrg#define QUAD_TOP_LEFT 0 48848b8605Smrg#define QUAD_TOP_RIGHT 1 49848b8605Smrg#define QUAD_BOTTOM_LEFT 2 50848b8605Smrg#define QUAD_BOTTOM_RIGHT 3 51848b8605Smrg 52848b8605Smrg#define MASK_TOP_LEFT (1 << QUAD_TOP_LEFT) 53848b8605Smrg#define MASK_TOP_RIGHT (1 << QUAD_TOP_RIGHT) 54848b8605Smrg#define MASK_BOTTOM_LEFT (1 << QUAD_BOTTOM_LEFT) 55848b8605Smrg#define MASK_BOTTOM_RIGHT (1 << QUAD_BOTTOM_RIGHT) 56848b8605Smrg#define MASK_ALL 0xf 57848b8605Smrg 58848b8605Smrg 59848b8605Smrg/** 60848b8605Smrg * Quad stage inputs (pos, coverage, front/back face, etc) 61848b8605Smrg */ 62848b8605Smrgstruct quad_header_input 63848b8605Smrg{ 64848b8605Smrg int x0, y0; /**< quad window pos, always even */ 65848b8605Smrg unsigned layer; 66b8e80941Smrg unsigned viewport_index; 67848b8605Smrg float coverage[TGSI_QUAD_SIZE]; /**< fragment coverage for antialiasing */ 68848b8605Smrg unsigned facing:1; /**< Front (0) or back (1) facing? */ 69848b8605Smrg unsigned prim:2; /**< QUAD_PRIM_POINT, LINE, TRI */ 70848b8605Smrg}; 71848b8605Smrg 72848b8605Smrg 73848b8605Smrg/** 74848b8605Smrg * Quad stage inputs/outputs. 75848b8605Smrg */ 76848b8605Smrgstruct quad_header_inout 77848b8605Smrg{ 78848b8605Smrg unsigned mask:4; 79848b8605Smrg}; 80848b8605Smrg 81848b8605Smrg 82848b8605Smrg/** 83848b8605Smrg * Quad stage outputs (color & depth). 84848b8605Smrg */ 85848b8605Smrgstruct quad_header_output 86848b8605Smrg{ 87848b8605Smrg /** colors in SOA format (rrrr, gggg, bbbb, aaaa) */ 88848b8605Smrg float color[PIPE_MAX_COLOR_BUFS][TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]; 89848b8605Smrg float depth[TGSI_QUAD_SIZE]; 90848b8605Smrg uint8_t stencil[TGSI_QUAD_SIZE]; 91848b8605Smrg}; 92848b8605Smrg 93848b8605Smrg 94848b8605Smrg/** 95848b8605Smrg * Encodes everything we need to know about a 2x2 pixel block. Uses 96848b8605Smrg * "Channel-Serial" or "SoA" layout. 97848b8605Smrg */ 98848b8605Smrgstruct quad_header { 99848b8605Smrg struct quad_header_input input; 100848b8605Smrg struct quad_header_inout inout; 101848b8605Smrg struct quad_header_output output; 102848b8605Smrg 103848b8605Smrg /* Redundant/duplicated: 104848b8605Smrg */ 105848b8605Smrg const struct tgsi_interp_coef *posCoef; 106848b8605Smrg const struct tgsi_interp_coef *coef; 107848b8605Smrg}; 108848b8605Smrg 109848b8605Smrg#endif /* SP_QUAD_H */ 110