brw_eu_util.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 
00033 #include "brw_context.h"
00034 #include "brw_defines.h"
00035 #include "brw_eu.h"
00036 
00037 
00038 void brw_math_invert( struct brw_compile *p, 
00039                              struct brw_reg dst,
00040                              struct brw_reg src)
00041 {
00042    brw_math( p, 
00043              dst,
00044              BRW_MATH_FUNCTION_INV, 
00045              BRW_MATH_SATURATE_NONE,
00046              0,
00047              src,
00048              BRW_MATH_PRECISION_FULL, 
00049              BRW_MATH_DATA_VECTOR );
00050 }
00051 
00052 
00053 
00054 void brw_copy4(struct brw_compile *p,
00055                struct brw_reg dst,
00056                struct brw_reg src,
00057                unsigned count)
00058 {
00059    unsigned i;
00060 
00061    dst = vec4(dst);
00062    src = vec4(src);
00063 
00064    for (i = 0; i < count; i++)
00065    {
00066       unsigned delta = i*32;
00067       brw_MOV(p, byte_offset(dst, delta),    byte_offset(src, delta));
00068       brw_MOV(p, byte_offset(dst, delta+16), byte_offset(src, delta+16));
00069    }
00070 }
00071 
00072 
00073 void brw_copy8(struct brw_compile *p,
00074                struct brw_reg dst,
00075                struct brw_reg src,
00076                unsigned count)
00077 {
00078    unsigned i;
00079 
00080    dst = vec8(dst);
00081    src = vec8(src);
00082 
00083    for (i = 0; i < count; i++)
00084    {
00085       unsigned delta = i*32;
00086       brw_MOV(p, byte_offset(dst, delta),    byte_offset(src, delta));
00087    }
00088 }
00089 
00090 
00091 void brw_copy_indirect_to_indirect(struct brw_compile *p,
00092                                    struct brw_indirect dst_ptr,
00093                                    struct brw_indirect src_ptr,
00094                                    unsigned count)
00095 {
00096    unsigned i;
00097 
00098    for (i = 0; i < count; i++)
00099    {
00100       unsigned delta = i*32;
00101       brw_MOV(p, deref_4f(dst_ptr, delta),    deref_4f(src_ptr, delta));
00102       brw_MOV(p, deref_4f(dst_ptr, delta+16), deref_4f(src_ptr, delta+16));
00103    }
00104 }
00105 
00106 
00107 void brw_copy_from_indirect(struct brw_compile *p,
00108                             struct brw_reg dst,
00109                             struct brw_indirect ptr,
00110                             unsigned count)
00111 {
00112    unsigned i;
00113 
00114    dst = vec4(dst);
00115 
00116    for (i = 0; i < count; i++)
00117    {
00118       unsigned delta = i*32;
00119       brw_MOV(p, byte_offset(dst, delta),    deref_4f(ptr, delta));
00120       brw_MOV(p, byte_offset(dst, delta+16), deref_4f(ptr, delta+16));
00121    }
00122 }
00123 
00124 
00125 
00126 

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