From 3772441c498b997947f68e98830f72649bbc8442 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 20 Aug 2007 18:45:14 -0600 Subject: [PATCH] move ALIGN16-related macros into p_compiler.h --- src/mesa/pipe/draw/draw_arrays.c | 10 ---------- src/mesa/pipe/p_compiler.h | 10 ++++++++++ src/mesa/pipe/softpipe/sp_quad_fs.c | 27 ++++----------------------- 3 files changed, 14 insertions(+), 33 deletions(-) diff --git a/src/mesa/pipe/draw/draw_arrays.c b/src/mesa/pipe/draw/draw_arrays.c index 34a031ddf06..9b1426d1ec6 100644 --- a/src/mesa/pipe/draw/draw_arrays.c +++ b/src/mesa/pipe/draw/draw_arrays.c @@ -50,16 +50,6 @@ #define VERT_RESULT_MAX 24 -#if defined __GNUC__ -#define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME[SIZE] __attribute__(( aligned( 16 ) )) -#define ALIGN16_ASSIGN(P) P -#else -#define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME[SIZE + 1] -#define ALIGN16_ASSIGN(P) align16(P) -#endif - - - static INLINE unsigned compute_clipmask(float cx, float cy, float cz, float cw) { diff --git a/src/mesa/pipe/p_compiler.h b/src/mesa/pipe/p_compiler.h index d139cb18449..a4d05f74cdd 100644 --- a/src/mesa/pipe/p_compiler.h +++ b/src/mesa/pipe/p_compiler.h @@ -68,4 +68,14 @@ typedef unsigned long long uint64; #endif +#if defined __GNUC__ +#define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME[SIZE] __attribute__(( aligned( 16 ) )) +#define ALIGN16_ASSIGN(P) P +#else +#define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME[SIZE + 1] +#define ALIGN16_ASSIGN(P) align16(P) +#endif + + + #endif /* P_COMPILER_H */ diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index c2decfecf86..c20f09d3090 100755 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -40,15 +40,6 @@ #include "sp_tex_sample.h" -#if defined __GNUC__ -#define USE_ALIGNED_ATTRIBS 1 -#define ALIGN16_SUFFIX __attribute__(( aligned( 16 ) )) -#else -#define USE_ALIGNED_ATTRIBS 0 -#define ALIGN16_SUFFIX -#endif - - struct quad_shade_stage { struct quad_stage stage; @@ -77,13 +68,8 @@ shade_quad( const float fy = (float) quad->y0; struct tgsi_exec_machine machine; -#if USE_ALIGNED_ATTRIBS - struct tgsi_exec_vector inputs[PIPE_ATTRIB_MAX] ALIGN16_SUFFIX; - struct tgsi_exec_vector outputs[PIPE_ATTRIB_MAX] ALIGN16_SUFFIX; -#else - struct tgsi_exec_vector inputs[PIPE_ATTRIB_MAX + 1]; - struct tgsi_exec_vector outputs[PIPE_ATTRIB_MAX + 1]; -#endif + ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_ATTRIB_MAX); + ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_ATTRIB_MAX); #ifdef DEBUG memset( &machine, 0, sizeof( machine ) ); @@ -99,13 +85,8 @@ shade_quad( /* Consts does not require 16 byte alignment. */ machine.Consts = softpipe->fs.constants->constant; -#if USE_ALIGNED_ATTRIBS - machine.Inputs = inputs; - machine.Outputs = outputs; -#else - machine.Inputs = (struct tgsi_exec_vector *) tgsi_align_128bit( inputs ); - machine.Outputs = (struct tgsi_exec_vector *) tgsi_align_128bit( outputs ); -#endif + machine.Inputs = ALIGN16_ASSIGN(inputs); + machine.Outputs = ALIGN16_ASSIGN(outputs); machine.InterpCoefs = quad->coef; -- 2.30.2