Eric Anholt | 9f344b3 | 2006-08-09 19:14:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | Copyright (C) Intel Corp. 2006. All Rights Reserved. |
| 3 | Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to |
| 4 | develop this 3D driver. |
| 5 | |
| 6 | Permission is hereby granted, free of charge, to any person obtaining |
| 7 | a copy of this software and associated documentation files (the |
| 8 | "Software"), to deal in the Software without restriction, including |
| 9 | without limitation the rights to use, copy, modify, merge, publish, |
| 10 | distribute, sublicense, and/or sell copies of the Software, and to |
| 11 | permit persons to whom the Software is furnished to do so, subject to |
| 12 | the following conditions: |
| 13 | |
| 14 | The above copyright notice and this permission notice (including the |
| 15 | next paragraph) shall be included in all copies or substantial |
| 16 | portions of the Software. |
| 17 | |
| 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 21 | IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE |
| 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 25 | |
| 26 | **********************************************************************/ |
| 27 | /* |
| 28 | * Authors: |
| 29 | * Keith Whitwell <keith@tungstengraphics.com> |
| 30 | */ |
| 31 | |
| 32 | |
| 33 | #ifndef BRW_SF_H |
| 34 | #define BRW_SF_H |
| 35 | |
| 36 | |
Brian | acfeb3b | 2007-09-11 10:57:37 -0600 | [diff] [blame] | 37 | #include "shader/program.h" |
Eric Anholt | 9f344b3 | 2006-08-09 19:14:05 +0000 | [diff] [blame] | 38 | #include "brw_context.h" |
| 39 | #include "brw_eu.h" |
Eric Anholt | 9f344b3 | 2006-08-09 19:14:05 +0000 | [diff] [blame] | 40 | |
| 41 | |
| 42 | #define SF_POINTS 0 |
| 43 | #define SF_LINES 1 |
| 44 | #define SF_TRIANGLES 2 |
| 45 | #define SF_UNFILLED_TRIS 3 |
| 46 | |
| 47 | struct brw_sf_prog_key { |
Zou Nan hai | 35707db | 2007-04-12 09:43:00 +0800 | [diff] [blame] | 48 | GLuint attrs:32; |
Eric Anholt | 9f344b3 | 2006-08-09 19:14:05 +0000 | [diff] [blame] | 49 | GLuint primitive:2; |
| 50 | GLuint do_twoside_color:1; |
| 51 | GLuint do_flat_shading:1; |
Eric Anholt | 9f344b3 | 2006-08-09 19:14:05 +0000 | [diff] [blame] | 52 | GLuint frontface_ccw:1; |
Zou Nan hai | 6017943 | 2007-07-30 10:18:11 +0800 | [diff] [blame] | 53 | GLuint do_point_sprite:1; |
Brian Paul | 18af7c3 | 2009-06-12 16:21:20 -0600 | [diff] [blame] | 54 | GLuint linear_color:1; /**< linear interp vs. perspective interp */ |
Brian Paul | 26d22b0 | 2009-10-29 16:02:35 -0600 | [diff] [blame] | 55 | GLuint sprite_origin_lower_left:1; |
| 56 | GLuint pad:24; |
Eric Anholt | 9f344b3 | 2006-08-09 19:14:05 +0000 | [diff] [blame] | 57 | }; |
| 58 | |
Zou Nan hai | 6017943 | 2007-07-30 10:18:11 +0800 | [diff] [blame] | 59 | struct brw_sf_point_tex { |
Brian Paul | 217a40d | 2009-10-29 16:06:30 -0600 | [diff] [blame] | 60 | GLboolean CoordReplace; |
Zou Nan hai | 6017943 | 2007-07-30 10:18:11 +0800 | [diff] [blame] | 61 | }; |
Eric Anholt | 9f344b3 | 2006-08-09 19:14:05 +0000 | [diff] [blame] | 62 | |
| 63 | struct brw_sf_compile { |
| 64 | struct brw_compile func; |
| 65 | struct brw_sf_prog_key key; |
| 66 | struct brw_sf_prog_data prog_data; |
| 67 | |
| 68 | struct brw_reg pv; |
| 69 | struct brw_reg det; |
| 70 | struct brw_reg dx0; |
| 71 | struct brw_reg dx2; |
| 72 | struct brw_reg dy0; |
| 73 | struct brw_reg dy2; |
| 74 | |
| 75 | /* z and 1/w passed in seperately: |
| 76 | */ |
| 77 | struct brw_reg z[3]; |
| 78 | struct brw_reg inv_w[3]; |
| 79 | |
| 80 | /* The vertices: |
| 81 | */ |
| 82 | struct brw_reg vert[3]; |
| 83 | |
| 84 | /* Temporaries, allocated after last vertex reg. |
| 85 | */ |
| 86 | struct brw_reg inv_det; |
| 87 | struct brw_reg a1_sub_a0; |
| 88 | struct brw_reg a2_sub_a0; |
| 89 | struct brw_reg tmp; |
| 90 | |
| 91 | struct brw_reg m1Cx; |
| 92 | struct brw_reg m2Cy; |
| 93 | struct brw_reg m3C0; |
| 94 | |
| 95 | GLuint nr_verts; |
| 96 | GLuint nr_attrs; |
| 97 | GLuint nr_attr_regs; |
| 98 | GLuint nr_setup_attrs; |
| 99 | GLuint nr_setup_regs; |
| 100 | |
| 101 | GLubyte attr_to_idx[VERT_RESULT_MAX]; |
| 102 | GLubyte idx_to_attr[VERT_RESULT_MAX]; |
Zou Nan hai | 6017943 | 2007-07-30 10:18:11 +0800 | [diff] [blame] | 103 | struct brw_sf_point_tex point_attrs[VERT_RESULT_MAX]; |
Eric Anholt | 9f344b3 | 2006-08-09 19:14:05 +0000 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | |
Xiang, Haihao | 4cca760 | 2007-12-19 10:22:28 +0800 | [diff] [blame] | 107 | void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate ); |
| 108 | void brw_emit_line_setup( struct brw_sf_compile *c, GLboolean allocate ); |
| 109 | void brw_emit_point_setup( struct brw_sf_compile *c, GLboolean allocate ); |
| 110 | void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate ); |
Eric Anholt | 9f344b3 | 2006-08-09 19:14:05 +0000 | [diff] [blame] | 111 | void brw_emit_anyprim_setup( struct brw_sf_compile *c ); |
| 112 | |
| 113 | #endif |