19f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/*
29f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Copyright (C) Intel Corp.  2006.  All Rights Reserved.
39f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
49f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt develop this 3D driver.
59f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
69f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Permission is hereby granted, free of charge, to any person obtaining
79f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt a copy of this software and associated documentation files (the
89f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "Software"), to deal in the Software without restriction, including
99f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt without limitation the rights to use, copy, modify, merge, publish,
109f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt distribute, sublicense, and/or sell copies of the Software, and to
119f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt permit persons to whom the Software is furnished to do so, subject to
129f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt the following conditions:
139f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
149f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt The above copyright notice and this permission notice (including the
159f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt next paragraph) shall be included in all copies or substantial
169f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt portions of the Software.
179f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
189f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
199f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
209f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
219f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
229f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
239f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
249f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
259f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
269f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt **********************************************************************/
279f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt /*
289f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt  * Authors:
299f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt  *   Keith Whitwell <keith@tungstengraphics.com>
309f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt  */
319f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
329f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
339f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#ifndef BRW_SF_H
349f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define BRW_SF_H
359f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
369f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
37ec2b92f98c2e7f161521b447cc1d9a36bce3707cBrian Paul#include "program/program.h"
389f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#include "brw_context.h"
399f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#include "brw_eu.h"
409f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
419f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
429f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define SF_POINTS    0
439f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define SF_LINES     1
449f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define SF_TRIANGLES 2
459f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define SF_UNFILLED_TRIS   3
469f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
479f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_sf_prog_key {
485606dfb572bf4b89b4882265924705bacc8c182bIan Romanick   GLbitfield64 attrs;
49bc632d04370566c1156cbd0345fe303834f0b910Eric Anholt   uint8_t point_sprite_coord_replace;
509f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint primitive:2;
519f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint do_twoside_color:1;
529f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint do_flat_shading:1;
539f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint frontface_ccw:1;
5460179434d15989b81e2d4757f34033009184a678Zou Nan hai   GLuint do_point_sprite:1;
5543af02ac731dac7d80f7e47feb0c80e4da156769Yuanhan Liu   GLuint do_point_coord:1;
5626d22b094bb7b2f37d4bc8edfeb1b2a9a1c96d88Brian Paul   GLuint sprite_origin_lower_left:1;
5718e2e19b07b312c978dfbb6d336f69fa84b3ffe2Paul Berry   GLuint userclip_active:1;
589f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt};
599f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
609f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_sf_compile {
619f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_compile func;
629f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_sf_prog_key key;
639f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_sf_prog_data prog_data;
649f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
659f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg pv;
669f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg det;
679f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg dx0;
689f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg dx2;
699f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg dy0;
709f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg dy2;
719f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
729f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   /* z and 1/w passed in seperately:
739f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt    */
749f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg z[3];
759f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg inv_w[3];
769f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
779f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   /* The vertices:
789f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt    */
799f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg vert[3];
809f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
819f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt    /* Temporaries, allocated after last vertex reg.
829f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt    */
839f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg inv_det;
849f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg a1_sub_a0;
859f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg a2_sub_a0;
869f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg tmp;
879f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
889f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg m1Cx;
899f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg m2Cy;
909f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg m3C0;
919f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
929f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint nr_verts;
939f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint nr_attr_regs;
949f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint nr_setup_regs;
954a1fb81902a7863d5dfe304e5e4ca2c631159be1Paul Berry   int urb_entry_read_offset;
969f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
974a1fb81902a7863d5dfe304e5e4ca2c631159be1Paul Berry   struct brw_vue_map vue_map;
989f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt};
999f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
1009f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
1012e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunkevoid brw_emit_tri_setup( struct brw_sf_compile *c, bool allocate );
1022e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunkevoid brw_emit_line_setup( struct brw_sf_compile *c, bool allocate );
1032e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunkevoid brw_emit_point_setup( struct brw_sf_compile *c, bool allocate );
1042e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunkevoid brw_emit_point_sprite_setup( struct brw_sf_compile *c, bool allocate );
1059f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_emit_anyprim_setup( struct brw_sf_compile *c );
10639fc725b0c81db8d76cb490488cd95de5c4d7a79Paul Berryint brw_sf_compute_urb_entry_read_offset(struct intel_context *intel);
1079f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
1089f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#endif
109