brw_wm_iz.c

Go to the documentation of this file.
00001 /*
00002  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
00003  Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
00004  develop this 3D driver.
00005  
00006  Permission is hereby granted, free of charge, to any person obtaining
00007  a copy of this software and associated documentation files (the
00008  "Software"), to deal in the Software without restriction, including
00009  without limitation the rights to use, copy, modify, merge, publish,
00010  distribute, sublicense, and/or sell copies of the Software, and to
00011  permit persons to whom the Software is furnished to do so, subject to
00012  the following conditions:
00013  
00014  The above copyright notice and this permission notice (including the
00015  next paragraph) shall be included in all copies or substantial
00016  portions of the Software.
00017  
00018  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00019  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00021  IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
00022  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00023  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00024  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025  
00026  **********************************************************************/
00027  /*
00028   * Authors:
00029   *   Keith Whitwell <keith@tungstengraphics.com>
00030   */
00031 
00032 #include "brw_wm.h"
00033 
00034 
00035 #undef P                        /* prompted depth */
00036 #undef C                        /* computed */
00037 #undef N                        /* non-promoted? */
00038 
00039 #define P 0
00040 #define C 1
00041 #define N 2
00042 
00043 const struct {
00044    unsigned mode:2;
00045    unsigned sd_present:1;
00046    unsigned sd_to_rt:1;
00047    unsigned dd_present:1;
00048    unsigned ds_present:1;
00049 } wm_iz_table[IZ_BIT_MAX] =
00050 {
00051  { P, 0, 0, 0, 0 }, 
00052  { P, 0, 0, 0, 0 }, 
00053  { C, 0, 1, 0, 0 }, 
00054  { C, 0, 1, 0, 0 }, 
00055  { C, 1, 1, 0, 0 }, 
00056  { C, 1, 1, 0, 0 }, 
00057  { C, 0, 1, 0, 0 }, 
00058  { C, 0, 1, 0, 0 }, 
00059  { C, 1, 1, 1, 0 }, 
00060  { C, 1, 1, 1, 0 }, 
00061  { C, 0, 1, 1, 0 }, 
00062  { C, 0, 1, 1, 0 }, 
00063  { C, 1, 1, 1, 0 }, 
00064  { C, 1, 1, 1, 0 }, 
00065  { C, 0, 1, 1, 0 }, 
00066  { C, 0, 1, 1, 0 }, 
00067  { P, 0, 0, 0, 0 }, 
00068  { P, 0, 0, 0, 0 }, 
00069  { C, 0, 1, 0, 0 }, 
00070  { C, 0, 1, 0, 0 }, 
00071  { C, 1, 1, 0, 0 }, 
00072  { C, 1, 1, 0, 0 }, 
00073  { C, 0, 1, 0, 0 }, 
00074  { C, 0, 1, 0, 0 }, 
00075  { C, 1, 1, 1, 0 }, 
00076  { C, 1, 1, 1, 0 }, 
00077  { C, 0, 1, 1, 0 }, 
00078  { C, 0, 1, 1, 0 }, 
00079  { C, 1, 1, 1, 0 }, 
00080  { C, 1, 1, 1, 0 }, 
00081  { C, 0, 1, 1, 0 }, 
00082  { C, 0, 1, 1, 0 }, 
00083  { C, 0, 0, 0, 1 }, 
00084  { C, 0, 0, 0, 1 }, 
00085  { C, 0, 1, 0, 1 }, 
00086  { C, 0, 1, 0, 1 }, 
00087  { C, 1, 1, 0, 1 }, 
00088  { C, 1, 1, 0, 1 }, 
00089  { C, 0, 1, 0, 1 }, 
00090  { C, 0, 1, 0, 1 }, 
00091  { C, 1, 1, 1, 1 }, 
00092  { C, 1, 1, 1, 1 }, 
00093  { C, 0, 1, 1, 1 }, 
00094  { C, 0, 1, 1, 1 }, 
00095  { C, 1, 1, 1, 1 }, 
00096  { C, 1, 1, 1, 1 }, 
00097  { C, 0, 1, 1, 1 }, 
00098  { C, 0, 1, 1, 1 }, 
00099  { C, 0, 0, 0, 1 }, 
00100  { C, 0, 0, 0, 1 }, 
00101  { C, 0, 1, 0, 1 }, 
00102  { C, 0, 1, 0, 1 }, 
00103  { C, 1, 1, 0, 1 }, 
00104  { C, 1, 1, 0, 1 }, 
00105  { C, 0, 1, 0, 1 }, 
00106  { C, 0, 1, 0, 1 }, 
00107  { C, 1, 1, 1, 1 }, 
00108  { C, 1, 1, 1, 1 }, 
00109  { C, 0, 1, 1, 1 }, 
00110  { C, 0, 1, 1, 1 }, 
00111  { C, 1, 1, 1, 1 }, 
00112  { C, 1, 1, 1, 1 }, 
00113  { C, 0, 1, 1, 1 }, 
00114  { C, 0, 1, 1, 1 }, 
00115  { P, 0, 0, 0, 0 }, 
00116  { P, 0, 0, 0, 0 }, 
00117  { P, 0, 0, 0, 0 }, 
00118  { P, 0, 0, 0, 0 }, 
00119  { P, 0, 0, 0, 0 }, 
00120  { N, 1, 1, 0, 0 }, 
00121  { N, 0, 1, 0, 0 }, 
00122  { N, 0, 1, 0, 0 }, 
00123  { P, 0, 0, 0, 0 }, 
00124  { P, 0, 0, 0, 0 }, 
00125  { C, 0, 1, 1, 0 }, 
00126  { C, 0, 1, 1, 0 }, 
00127  { P, 0, 0, 0, 0 }, 
00128  { N, 1, 1, 0, 0 }, 
00129  { C, 0, 1, 1, 0 }, 
00130  { C, 0, 1, 1, 0 }, 
00131  { P, 0, 0, 0, 0 }, 
00132  { P, 0, 0, 0, 0 }, 
00133  { P, 0, 0, 0, 0 }, 
00134  { P, 0, 0, 0, 0 }, 
00135  { P, 0, 0, 0, 0 }, 
00136  { N, 1, 1, 0, 0 }, 
00137  { N, 0, 1, 0, 0 }, 
00138  { N, 0, 1, 0, 0 }, 
00139  { P, 0, 0, 0, 0 }, 
00140  { P, 0, 0, 0, 0 }, 
00141  { C, 0, 1, 1, 0 }, 
00142  { C, 0, 1, 1, 0 }, 
00143  { P, 0, 0, 0, 0 }, 
00144  { N, 1, 1, 0, 0 }, 
00145  { C, 0, 1, 1, 0 }, 
00146  { C, 0, 1, 1, 0 }, 
00147  { P, 0, 0, 0, 0 }, 
00148  { P, 0, 0, 0, 0 }, 
00149  { P, 0, 0, 0, 0 }, 
00150  { P, 0, 0, 0, 0 }, 
00151  { P, 0, 0, 0, 0 }, 
00152  { N, 1, 1, 0, 1 }, 
00153  { N, 0, 1, 0, 1 }, 
00154  { N, 0, 1, 0, 1 }, 
00155  { P, 0, 0, 0, 0 }, 
00156  { P, 0, 0, 0, 0 }, 
00157  { C, 0, 1, 1, 1 }, 
00158  { C, 0, 1, 1, 1 }, 
00159  { P, 0, 0, 0, 0 }, 
00160  { N, 1, 1, 0, 1 }, 
00161  { C, 0, 1, 1, 1 }, 
00162  { C, 0, 1, 1, 1 }, 
00163  { P, 0, 0, 0, 0 }, 
00164  { C, 0, 0, 0, 1 }, 
00165  { P, 0, 0, 0, 0 }, 
00166  { C, 0, 1, 0, 1 }, 
00167  { P, 0, 0, 0, 0 }, 
00168  { C, 1, 1, 0, 1 }, 
00169  { C, 0, 1, 0, 1 }, 
00170  { C, 0, 1, 0, 1 }, 
00171  { P, 0, 0, 0, 0 }, 
00172  { C, 1, 1, 1, 1 }, 
00173  { C, 0, 1, 1, 1 }, 
00174  { C, 0, 1, 1, 1 }, 
00175  { P, 0, 0, 0, 0 }, 
00176  { C, 1, 1, 1, 1 }, 
00177  { C, 0, 1, 1, 1 }, 
00178  { C, 0, 1, 1, 1 } 
00179 };
00180 
00181 void brw_wm_lookup_iz( unsigned line_aa,
00182                        unsigned lookup,
00183                        struct brw_wm_prog_key *key )
00184 {
00185    unsigned reg = 2;
00186 
00187    assert (lookup < IZ_BIT_MAX);
00188       
00189    if (lookup & IZ_PS_COMPUTES_DEPTH_BIT)
00190       key->computes_depth = 1;
00191 
00192    if (wm_iz_table[lookup].sd_present) {
00193       key->source_depth_reg = reg;
00194       reg += 2;
00195    }
00196 
00197    if (wm_iz_table[lookup].sd_to_rt)
00198       key->source_depth_to_render_target = 1;
00199 
00200    if (wm_iz_table[lookup].ds_present || line_aa != AA_NEVER) {
00201       key->aa_dest_stencil_reg = reg;
00202       key->runtime_check_aads_emit = (!wm_iz_table[lookup].ds_present &&
00203                                       line_aa == AA_SOMETIMES);
00204       reg++;
00205    }
00206 
00207    if (wm_iz_table[lookup].dd_present) {
00208       key->dest_depth_reg = reg;
00209       reg+=2;
00210    }
00211 
00212    key->nr_depth_regs = (reg+1)/2;
00213 }
00214 

Generated on Tue Sep 29 06:25:17 2009 for Gallium3D by  doxygen 1.5.4