15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Copyright (C) Intel Corp. 2006. All Rights Reserved. 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) develop this 3D driver. 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Permission is hereby granted, free of charge, to any person obtaining 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) a copy of this software and associated documentation files (the 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) "Software"), to deal in the Software without restriction, including 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) without limitation the rights to use, copy, modify, merge, publish, 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) distribute, sublicense, and/or sell copies of the Software, and to 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) permit persons to whom the Software is furnished to do so, subject to 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) the following conditions: 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) The above copyright notice and this permission notice (including the 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) next paragraph) shall be included in all copies or substantial 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) portions of the Software. 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 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 <keith@tungstengraphics.com> 30 */ 31 32 33#include "brw_context.h" 34#include "brw_defines.h" 35#include "brw_eu.h" 36 37 38void brw_math_invert( struct brw_compile *p, 39 struct brw_reg dst, 40 struct brw_reg src) 41{ 42 brw_math( p, 43 dst, 44 BRW_MATH_FUNCTION_INV, 45 0, 46 src, 47 BRW_MATH_PRECISION_FULL, 48 BRW_MATH_DATA_VECTOR ); 49} 50 51 52 53void brw_copy4(struct brw_compile *p, 54 struct brw_reg dst, 55 struct brw_reg src, 56 GLuint count) 57{ 58 GLuint i; 59 60 dst = vec4(dst); 61 src = vec4(src); 62 63 for (i = 0; i < count; i++) 64 { 65 GLuint delta = i*32; 66 brw_MOV(p, byte_offset(dst, delta), byte_offset(src, delta)); 67 brw_MOV(p, byte_offset(dst, delta+16), byte_offset(src, delta+16)); 68 } 69} 70 71 72void brw_copy8(struct brw_compile *p, 73 struct brw_reg dst, 74 struct brw_reg src, 75 GLuint count) 76{ 77 GLuint i; 78 79 dst = vec8(dst); 80 src = vec8(src); 81 82 for (i = 0; i < count; i++) 83 { 84 GLuint delta = i*32; 85 brw_MOV(p, byte_offset(dst, delta), byte_offset(src, delta)); 86 } 87} 88 89 90void brw_copy_indirect_to_indirect(struct brw_compile *p, 91 struct brw_indirect dst_ptr, 92 struct brw_indirect src_ptr, 93 GLuint count) 94{ 95 GLuint i; 96 97 for (i = 0; i < count; i++) 98 { 99 GLuint delta = i*32; 100 brw_MOV(p, deref_4f(dst_ptr, delta), deref_4f(src_ptr, delta)); 101 brw_MOV(p, deref_4f(dst_ptr, delta+16), deref_4f(src_ptr, delta+16)); 102 } 103} 104 105 106void brw_copy_from_indirect(struct brw_compile *p, 107 struct brw_reg dst, 108 struct brw_indirect ptr, 109 GLuint count) 110{ 111 GLuint i; 112 113 dst = vec4(dst); 114 115 for (i = 0; i < count; i++) 116 { 117 GLuint delta = i*32; 118 brw_MOV(p, byte_offset(dst, delta), deref_4f(ptr, delta)); 119 brw_MOV(p, byte_offset(dst, delta+16), deref_4f(ptr, delta+16)); 120 } 121} 122 123 124 125 126