Home | History | Annotate | Download | only in i965
      1 /*
      2  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
      3  Intel funded Tungsten Graphics 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 <keithw (at) vmware.com>
     30   */
     31 
     32 
     33 #ifndef BRW_SF_H
     34 #define BRW_SF_H
     35 
     36 
     37 #include "program/program.h"
     38 #include "brw_context.h"
     39 #include "brw_eu.h"
     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 {
     48    GLbitfield64 attrs;
     49    bool contains_flat_varying;
     50    const unsigned char *interp_mode;
     51    uint8_t point_sprite_coord_replace;
     52    GLuint primitive:2;
     53    GLuint do_twoside_color:1;
     54    GLuint frontface_ccw:1;
     55    GLuint do_point_sprite:1;
     56    GLuint do_point_coord:1;
     57    GLuint sprite_origin_lower_left:1;
     58    GLuint userclip_active:1;
     59 };
     60 
     61 struct brw_sf_compile {
     62    struct brw_codegen func;
     63    struct brw_sf_prog_key key;
     64    struct brw_sf_prog_data prog_data;
     65 
     66    struct brw_reg pv;
     67    struct brw_reg det;
     68    struct brw_reg dx0;
     69    struct brw_reg dx2;
     70    struct brw_reg dy0;
     71    struct brw_reg dy2;
     72 
     73    /* z and 1/w passed in seperately:
     74     */
     75    struct brw_reg z[3];
     76    struct brw_reg inv_w[3];
     77 
     78    /* The vertices:
     79     */
     80    struct brw_reg vert[3];
     81 
     82     /* Temporaries, allocated after last vertex reg.
     83     */
     84    struct brw_reg inv_det;
     85    struct brw_reg a1_sub_a0;
     86    struct brw_reg a2_sub_a0;
     87    struct brw_reg tmp;
     88 
     89    struct brw_reg m1Cx;
     90    struct brw_reg m2Cy;
     91    struct brw_reg m3C0;
     92 
     93    GLuint nr_verts;
     94    GLuint nr_attr_regs;
     95    GLuint nr_setup_regs;
     96    int urb_entry_read_offset;
     97 
     98    /** The last known value of the f0.0 flag register. */
     99    unsigned flag_value;
    100 
    101    struct brw_vue_map vue_map;
    102 };
    103 
    104 
    105 void brw_emit_tri_setup( struct brw_sf_compile *c, bool allocate );
    106 void brw_emit_line_setup( struct brw_sf_compile *c, bool allocate );
    107 void brw_emit_point_setup( struct brw_sf_compile *c, bool allocate );
    108 void brw_emit_point_sprite_setup( struct brw_sf_compile *c, bool allocate );
    109 void brw_emit_anyprim_setup( struct brw_sf_compile *c );
    110 
    111 #endif
    112