• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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@vmware.com>
30   */
31 
32 
33 #include "brw_context.h"
34 #include "brw_defines.h"
35 #include "brw_eu.h"
36 
37 
brw_math_invert(struct brw_codegen * p,struct brw_reg dst,struct brw_reg src)38 void brw_math_invert( struct brw_codegen *p,
39 			     struct brw_reg dst,
40 			     struct brw_reg src)
41 {
42    gen4_math(p,
43 	     dst,
44 	     BRW_MATH_FUNCTION_INV,
45 	     0,
46 	     src,
47 	     BRW_MATH_PRECISION_FULL);
48 }
49 
50 
51 
brw_copy4(struct brw_codegen * p,struct brw_reg dst,struct brw_reg src,unsigned count)52 void brw_copy4(struct brw_codegen *p,
53 	       struct brw_reg dst,
54 	       struct brw_reg src,
55 	       unsigned count)
56 {
57    unsigned i;
58 
59    dst = vec4(dst);
60    src = vec4(src);
61 
62    for (i = 0; i < count; i++)
63    {
64       unsigned delta = i*32;
65       brw_MOV(p, byte_offset(dst, delta),    byte_offset(src, delta));
66       brw_MOV(p, byte_offset(dst, delta+16), byte_offset(src, delta+16));
67    }
68 }
69 
70 
brw_copy8(struct brw_codegen * p,struct brw_reg dst,struct brw_reg src,unsigned count)71 void brw_copy8(struct brw_codegen *p,
72 	       struct brw_reg dst,
73 	       struct brw_reg src,
74 	       unsigned count)
75 {
76    unsigned i;
77 
78    dst = vec8(dst);
79    src = vec8(src);
80 
81    for (i = 0; i < count; i++)
82    {
83       unsigned delta = i*32;
84       brw_MOV(p, byte_offset(dst, delta),    byte_offset(src, delta));
85    }
86 }
87 
88 
brw_copy_indirect_to_indirect(struct brw_codegen * p,struct brw_indirect dst_ptr,struct brw_indirect src_ptr,unsigned count)89 void brw_copy_indirect_to_indirect(struct brw_codegen *p,
90 				   struct brw_indirect dst_ptr,
91 				   struct brw_indirect src_ptr,
92 				   unsigned count)
93 {
94    unsigned i;
95 
96    for (i = 0; i < count; i++)
97    {
98       unsigned delta = i*32;
99       brw_MOV(p, deref_4f(dst_ptr, delta),    deref_4f(src_ptr, delta));
100       brw_MOV(p, deref_4f(dst_ptr, delta+16), deref_4f(src_ptr, delta+16));
101    }
102 }
103 
104 
brw_copy_from_indirect(struct brw_codegen * p,struct brw_reg dst,struct brw_indirect ptr,unsigned count)105 void brw_copy_from_indirect(struct brw_codegen *p,
106 			    struct brw_reg dst,
107 			    struct brw_indirect ptr,
108 			    unsigned count)
109 {
110    unsigned i;
111 
112    dst = vec4(dst);
113 
114    for (i = 0; i < count; i++)
115    {
116       unsigned delta = i*32;
117       brw_MOV(p, byte_offset(dst, delta),    deref_4f(ptr, delta));
118       brw_MOV(p, byte_offset(dst, delta+16), deref_4f(ptr, delta+16));
119    }
120 }
121 
122 
123 
124 
125