From 8c4d811295f89bc59c54160bcaf861b47514b458 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 13:16:05 +0000 Subject: [PATCH] r300: Added the vertex program swizzle (aka selection) defines. --- src/mesa/drivers/dri/r300/r300_reg.h | 21 +++++++++----------- src/mesa/drivers/dri/r300/r300_vertprog.h | 24 +++++++++++------------ 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index ac04f84b836..70ccab50af8 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2495,6 +2495,15 @@ enum { PVS_DST_REG_INPUT = 5, /* Output Memory & Replicate X to all channels */ }; +enum { + PVS_SRC_SELECT_X = 0, /* Select X Component */ + PVS_SRC_SELECT_Y = 1, /* Select Y Component */ + PVS_SRC_SELECT_Z = 2, /* Select Z Component */ + PVS_SRC_SELECT_W = 3, /* Select W Component */ + PVS_SRC_SELECT_FORCE_0 = 4, /* Force Component to 0.0 */ + PVS_SRC_SELECT_FORCE_1 = 5, /* Force Component to 1.0 */ +}; + /*\}*/ /*\{*/ @@ -2515,18 +2524,6 @@ enum { /* GUESS based on fglrx native limits */ #define R300_VPI_IN_REG_INDEX_MASK (255 << 5) -/* The R300 can select components from the input register arbitrarily. - * Use the following constants, shifted by the component shift you - * want to select - */ -#define R300_VPI_IN_SELECT_X 0 -#define R300_VPI_IN_SELECT_Y 1 -#define R300_VPI_IN_SELECT_Z 2 -#define R300_VPI_IN_SELECT_W 3 -#define R300_VPI_IN_SELECT_ZERO 4 -#define R300_VPI_IN_SELECT_ONE 5 -#define R300_VPI_IN_SELECT_MASK 7 - #define R300_VPI_IN_X_SHIFT 13 #define R300_VPI_IN_Y_SHIFT 16 #define R300_VPI_IN_Z_SHIFT 19 diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index b0b81b5e748..5eba2d5432c 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -111,20 +111,20 @@ #define VP_IN(class,idx) \ (((idx) << R300_VPI_IN_REG_INDEX_SHIFT) | \ (PVS_SRC_REG_##class << 0) | \ - (R300_VPI_IN_SELECT_X << R300_VPI_IN_X_SHIFT) | \ - (R300_VPI_IN_SELECT_Y << R300_VPI_IN_Y_SHIFT) | \ - (R300_VPI_IN_SELECT_Z << R300_VPI_IN_Z_SHIFT) | \ - (R300_VPI_IN_SELECT_W << R300_VPI_IN_W_SHIFT)) + (PVS_SRC_SELECT_X << R300_VPI_IN_X_SHIFT) | \ + (PVS_SRC_SELECT_Y << R300_VPI_IN_Y_SHIFT) | \ + (PVS_SRC_SELECT_Z << R300_VPI_IN_Z_SHIFT) | \ + (PVS_SRC_SELECT_W << R300_VPI_IN_W_SHIFT)) #define VP_ZERO() \ - ((R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_X_SHIFT) | \ - (R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_Y_SHIFT) | \ - (R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_Z_SHIFT) | \ - (R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_W_SHIFT)) + ((PVS_SRC_SELECT_FORCE_0 << R300_VPI_IN_X_SHIFT) | \ + (PVS_SRC_SELECT_FORCE_0 << R300_VPI_IN_Y_SHIFT) | \ + (PVS_SRC_SELECT_FORCE_0 << R300_VPI_IN_Z_SHIFT) | \ + (PVS_SRC_SELECT_FORCE_0 << R300_VPI_IN_W_SHIFT)) #define VP_ONE() \ - ((R300_VPI_IN_SELECT_ONE << R300_VPI_IN_X_SHIFT) | \ - (R300_VPI_IN_SELECT_ONE << R300_VPI_IN_Y_SHIFT) | \ - (R300_VPI_IN_SELECT_ONE << R300_VPI_IN_Z_SHIFT) | \ - (R300_VPI_IN_SELECT_ONE << R300_VPI_IN_W_SHIFT)) + ((PVS_SRC_SELECT_FORCE_1 << R300_VPI_IN_X_SHIFT) | \ + (PVS_SRC_SELECT_FORCE_1 << R300_VPI_IN_Y_SHIFT) | \ + (PVS_SRC_SELECT_FORCE_1 << R300_VPI_IN_Z_SHIFT) | \ + (PVS_SRC_SELECT_FORCE_1 << R300_VPI_IN_W_SHIFT)) #define VP_NEG(in,comp) ((in) ^ (R300_VPI_IN_NEG_##comp)) #define VP_NEGALL(in,comp) VP_NEG(VP_NEG(VP_NEG(VP_NEG((in),X),Y),Z),W) -- 2.30.2