brw_clip_state.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_context.h"
00033 #include "brw_state.h"
00034 #include "brw_defines.h"
00035 #include "util/u_math.h"
00036 #include "util/u_memory.h"
00037 
00038 
00039 static void upload_clip_unit( struct brw_context *brw )
00040 {
00041    struct brw_clip_unit_state clip;
00042 
00043    memset(&clip, 0, sizeof(clip));
00044 
00045    /* CACHE_NEW_CLIP_PROG */
00046    clip.thread0.grf_reg_count =
00047       align(brw->clip.prog_data->total_grf, 16) / 16 - 1;
00048    clip.thread0.kernel_start_pointer = brw->clip.prog_gs_offset >> 6;
00049    clip.thread3.urb_entry_read_length = brw->clip.prog_data->urb_read_length;
00050    clip.thread3.const_urb_entry_read_length = brw->clip.prog_data->curb_read_length;
00051    clip.clip5.clip_mode = brw->clip.prog_data->clip_mode;
00052 
00053    /* BRW_NEW_CURBE_OFFSETS */
00054    clip.thread3.const_urb_entry_read_offset = brw->curbe.clip_start * 2;
00055 
00056    /* BRW_NEW_URB_FENCE */
00057    clip.thread4.nr_urb_entries = brw->urb.nr_clip_entries; 
00058    clip.thread4.urb_entry_allocation_size = brw->urb.vsize - 1;
00059    clip.thread4.max_threads = 1; /* 2 threads */
00060 
00061    if (BRW_DEBUG & DEBUG_STATS)
00062       clip.thread4.stats_enable = 1; 
00063 
00064    /* CONSTANT */
00065    clip.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754;
00066    clip.thread1.single_program_flow = 1;
00067    clip.thread3.dispatch_grf_start_reg = 1;
00068    clip.thread3.urb_entry_read_offset = 0;
00069    clip.clip5.userclip_enable_flags = 0x7f;
00070    clip.clip5.userclip_must_clip = 1;
00071    clip.clip5.guard_band_enable = 0;
00072    clip.clip5.viewport_z_clip_enable = 1;
00073    clip.clip5.viewport_xy_clip_enable = 1;
00074    clip.clip5.vertex_position_space = BRW_CLIP_NDCSPACE;
00075    clip.clip5.api_mode = BRW_CLIP_API_OGL;   
00076    clip.clip6.clipper_viewport_state_ptr = 0;
00077    clip.viewport_xmin = -1;
00078    clip.viewport_xmax = 1;
00079    clip.viewport_ymin = -1;
00080    clip.viewport_ymax = 1;
00081 
00082    brw->clip.state_gs_offset = brw_cache_data( &brw->cache[BRW_CLIP_UNIT], &clip );
00083 }
00084 
00085 
00086 const struct brw_tracked_state brw_clip_unit = {
00087    .dirty = {
00088       .brw   = (BRW_NEW_CURBE_OFFSETS |
00089                 BRW_NEW_URB_FENCE),
00090       .cache = CACHE_NEW_CLIP_PROG
00091    },
00092    .update = upload_clip_unit
00093 };

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