00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef BRW_CLIP_H
00033 #define BRW_CLIP_H
00034
00035
00036 #include "brw_context.h"
00037 #include "brw_eu.h"
00038
00039 #define MAX_VERTS (3+6+6)
00040
00041
00042
00043
00044 struct brw_clip_prog_key {
00045 unsigned attrs:32;
00046 unsigned primitive:4;
00047 unsigned nr_userclip:3;
00048 unsigned do_flat_shading:1;
00049 unsigned do_unfilled:1;
00050 unsigned fill_cw:2;
00051 unsigned fill_ccw:2;
00052 unsigned offset_cw:1;
00053 unsigned offset_ccw:1;
00054 unsigned pad0:17;
00055
00056 unsigned copy_bfc_cw:1;
00057 unsigned copy_bfc_ccw:1;
00058 unsigned clip_mode:3;
00059 unsigned pad1:27;
00060
00061 float offset_factor;
00062 float offset_units;
00063 };
00064
00065
00066 #define CLIP_LINE 0
00067 #define CLIP_POINT 1
00068 #define CLIP_FILL 2
00069 #define CLIP_CULL 3
00070
00071
00072 #define PRIM_MASK (0x1f)
00073
00074 struct brw_clip_compile {
00075 struct brw_compile func;
00076 struct brw_clip_prog_key key;
00077 struct brw_clip_prog_data prog_data;
00078
00079 struct {
00080 struct brw_reg R0;
00081 struct brw_reg vertex[MAX_VERTS];
00082
00083 struct brw_reg t;
00084 struct brw_reg t0, t1;
00085 struct brw_reg dp0, dp1;
00086
00087 struct brw_reg dpPrev;
00088 struct brw_reg dp;
00089 struct brw_reg loopcount;
00090 struct brw_reg nr_verts;
00091 struct brw_reg planemask;
00092
00093 struct brw_reg inlist;
00094 struct brw_reg outlist;
00095 struct brw_reg freelist;
00096
00097 struct brw_reg dir;
00098 struct brw_reg tmp0, tmp1;
00099 struct brw_reg offset;
00100
00101 struct brw_reg fixed_planes;
00102 struct brw_reg plane_equation;
00103 } reg;
00104
00105
00106
00107 unsigned nr_attrs;
00108 unsigned nr_regs;
00109 unsigned nr_bytes;
00110
00111 unsigned first_tmp;
00112 unsigned last_tmp;
00113
00114 boolean need_direction;
00115
00116 unsigned last_mrf;
00117
00118 unsigned header_position_offset;
00119 unsigned offset[PIPE_MAX_ATTRIBS];
00120 };
00121
00122 #define ATTR_SIZE (4*4)
00123
00124
00125
00126
00127 void brw_emit_unfilled_clip( struct brw_clip_compile *c );
00128 void brw_emit_tri_clip( struct brw_clip_compile *c );
00129 void brw_emit_line_clip( struct brw_clip_compile *c );
00130 void brw_emit_point_clip( struct brw_clip_compile *c );
00131
00132
00133
00134 void brw_clip_tri_init_vertices( struct brw_clip_compile *c );
00135 void brw_clip_tri_flat_shade( struct brw_clip_compile *c );
00136 void brw_clip_tri( struct brw_clip_compile *c );
00137 void brw_clip_tri_emit_polygon( struct brw_clip_compile *c );
00138 void brw_clip_tri_alloc_regs( struct brw_clip_compile *c,
00139 unsigned nr_verts );
00140
00141
00142
00143
00144
00145 void brw_clip_interp_vertex( struct brw_clip_compile *c,
00146 struct brw_indirect dest_ptr,
00147 struct brw_indirect v0_ptr,
00148 struct brw_indirect v1_ptr,
00149 struct brw_reg t0,
00150 boolean force_edgeflag );
00151
00152 void brw_clip_init_planes( struct brw_clip_compile *c );
00153
00154 void brw_clip_emit_vue(struct brw_clip_compile *c,
00155 struct brw_indirect vert,
00156 boolean allocate,
00157 boolean eot,
00158 unsigned header);
00159
00160 void brw_clip_kill_thread(struct brw_clip_compile *c);
00161
00162 struct brw_reg brw_clip_plane_stride( struct brw_clip_compile *c );
00163 struct brw_reg brw_clip_plane0_address( struct brw_clip_compile *c );
00164
00165 void brw_clip_copy_colors( struct brw_clip_compile *c,
00166 unsigned to, unsigned from );
00167
00168 void brw_clip_init_clipmask( struct brw_clip_compile *c );
00169
00170 #endif