From e0a5194a5427442869ace6772d16bb687cc87ec4 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 11:56:43 +0000 Subject: r300: Moved the vertex and fragment program macros into the appropriate files. --- src/mesa/drivers/dri/r300/r300_fragprog.h | 60 ++++++++++++ src/mesa/drivers/dri/r300/r300_ioctl.c | 2 +- src/mesa/drivers/dri/r300/r300_program.h | 150 ------------------------------ src/mesa/drivers/dri/r300/r300_vertprog.h | 60 ++++++++++++ 4 files changed, 121 insertions(+), 151 deletions(-) delete mode 100644 src/mesa/drivers/dri/r300/r300_program.h (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index 72fca77845..73efe49fc1 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -96,6 +96,66 @@ typedef struct r300_fragment_program_swizzle { #define DRI_CONF_FP_OPTIMIZATION_SPEED 0 #define DRI_CONF_FP_OPTIMIZATION_QUALITY 1 +#if 1 + +/** + * Fragment program helper macros + */ + +/* Produce unshifted source selectors */ +#define FP_TMP(idx) (idx) +#define FP_CONST(idx) ((idx) | (1 << 5)) + +/* Produce source/dest selector dword */ +#define FP_SELC_MASK_NO 0 +#define FP_SELC_MASK_X 1 +#define FP_SELC_MASK_Y 2 +#define FP_SELC_MASK_XY 3 +#define FP_SELC_MASK_Z 4 +#define FP_SELC_MASK_XZ 5 +#define FP_SELC_MASK_YZ 6 +#define FP_SELC_MASK_XYZ 7 + +#define FP_SELC(destidx,regmask,outmask,src0,src1,src2) \ + (((destidx) << R300_FPI1_DSTC_SHIFT) | \ + (FP_SELC_MASK_##regmask << 23) | \ + (FP_SELC_MASK_##outmask << 26) | \ + ((src0) << R300_FPI1_SRC0C_SHIFT) | \ + ((src1) << R300_FPI1_SRC1C_SHIFT) | \ + ((src2) << R300_FPI1_SRC2C_SHIFT)) + +#define FP_SELA_MASK_NO 0 +#define FP_SELA_MASK_W 1 + +#define FP_SELA(destidx,regmask,outmask,src0,src1,src2) \ + (((destidx) << R300_FPI3_DSTA_SHIFT) | \ + (FP_SELA_MASK_##regmask << 23) | \ + (FP_SELA_MASK_##outmask << 24) | \ + ((src0) << R300_FPI3_SRC0A_SHIFT) | \ + ((src1) << R300_FPI3_SRC1A_SHIFT) | \ + ((src2) << R300_FPI3_SRC2A_SHIFT)) + +/* Produce unshifted argument selectors */ +#define FP_ARGC(source) R300_FPI0_ARGC_##source +#define FP_ARGA(source) R300_FPI2_ARGA_##source +#define FP_ABS(arg) ((arg) | (1 << 6)) +#define FP_NEG(arg) ((arg) ^ (1 << 5)) + +/* Produce instruction dword */ +#define FP_INSTRC(opcode,arg0,arg1,arg2) \ + (R300_FPI0_OUTC_##opcode | \ + ((arg0) << R300_FPI0_ARG0C_SHIFT) | \ + ((arg1) << R300_FPI0_ARG1C_SHIFT) | \ + ((arg2) << R300_FPI0_ARG2C_SHIFT)) + +#define FP_INSTRA(opcode,arg0,arg1,arg2) \ + (R300_FPI2_OUTA_##opcode | \ + ((arg0) << R300_FPI2_ARG0A_SHIFT) | \ + ((arg1) << R300_FPI2_ARG1A_SHIFT) | \ + ((arg2) << R300_FPI2_ARG2A_SHIFT)) + +#endif + struct r300_fragment_program; extern void r300TranslateFragmentShader(r300ContextPtr r300, diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 02c67e8ef9..082cb6b6e3 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -51,7 +51,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_ioctl.h" #include "r300_cmdbuf.h" #include "r300_state.h" -#include "r300_program.h" +#include "r300_vertprog.h" #include "radeon_reg.h" #include "r300_emit.h" diff --git a/src/mesa/drivers/dri/r300/r300_program.h b/src/mesa/drivers/dri/r300/r300_program.h deleted file mode 100644 index eddd783f07..0000000000 --- a/src/mesa/drivers/dri/r300/r300_program.h +++ /dev/null @@ -1,150 +0,0 @@ -/* -Copyright (C) 2004 Nicolai Haehnle. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Nicolai Haehnle - */ - -#ifndef __R300_PROGRAM_H__ -#define __R300_PROGRAM_H__ - -#include "r300_reg.h" - -/** - * Vertex program helper macros - */ - -/* Produce out dword */ -#define VP_OUTCLASS_TMP R300_VPI_OUT_REG_CLASS_TEMPORARY -#define VP_OUTCLASS_OUT R300_VPI_OUT_REG_CLASS_RESULT - -#define VP_OUTMASK_X R300_VPI_OUT_WRITE_X -#define VP_OUTMASK_Y R300_VPI_OUT_WRITE_Y -#define VP_OUTMASK_Z R300_VPI_OUT_WRITE_Z -#define VP_OUTMASK_W R300_VPI_OUT_WRITE_W -#define VP_OUTMASK_XY (VP_OUTMASK_X|VP_OUTMASK_Y) -#define VP_OUTMASK_XZ (VP_OUTMASK_X|VP_OUTMASK_Z) -#define VP_OUTMASK_XW (VP_OUTMASK_X|VP_OUTMASK_W) -#define VP_OUTMASK_XYZ (VP_OUTMASK_XY|VP_OUTMASK_Z) -#define VP_OUTMASK_XYW (VP_OUTMASK_XY|VP_OUTMASK_W) -#define VP_OUTMASK_XZW (VP_OUTMASK_XZ|VP_OUTMASK_W) -#define VP_OUTMASK_XYZW (VP_OUTMASK_XYZ|VP_OUTMASK_W) -#define VP_OUTMASK_YZ (VP_OUTMASK_Y|VP_OUTMASK_Z) -#define VP_OUTMASK_YW (VP_OUTMASK_Y|VP_OUTMASK_W) -#define VP_OUTMASK_YZW (VP_OUTMASK_YZ|VP_OUTMASK_W) -#define VP_OUTMASK_ZW (VP_OUTMASK_Z|VP_OUTMASK_W) - -#define VP_OUT(instr,outclass,outidx,outmask) \ - (R300_VPI_OUT_OP_##instr | \ - ((outidx) << R300_VPI_OUT_REG_INDEX_SHIFT) | \ - VP_OUTCLASS_##outclass | \ - VP_OUTMASK_##outmask) - -/* Produce in dword */ -#define VP_INCLASS_TMP R300_VPI_IN_REG_CLASS_TEMPORARY -#define VP_INCLASS_IN R300_VPI_IN_REG_CLASS_ATTRIBUTE -#define VP_INCLASS_CONST R300_VPI_IN_REG_CLASS_PARAMETER - -#define VP_IN(class,idx) \ - (((idx) << R300_VPI_IN_REG_INDEX_SHIFT) | \ - VP_INCLASS_##class | \ - (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)) -#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)) -#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)) - -#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) - -/** - * Fragment program helper macros - */ - -/* Produce unshifted source selectors */ -#define FP_TMP(idx) (idx) -#define FP_CONST(idx) ((idx) | (1 << 5)) - -/* Produce source/dest selector dword */ -#define FP_SELC_MASK_NO 0 -#define FP_SELC_MASK_X 1 -#define FP_SELC_MASK_Y 2 -#define FP_SELC_MASK_XY 3 -#define FP_SELC_MASK_Z 4 -#define FP_SELC_MASK_XZ 5 -#define FP_SELC_MASK_YZ 6 -#define FP_SELC_MASK_XYZ 7 - -#define FP_SELC(destidx,regmask,outmask,src0,src1,src2) \ - (((destidx) << R300_FPI1_DSTC_SHIFT) | \ - (FP_SELC_MASK_##regmask << 23) | \ - (FP_SELC_MASK_##outmask << 26) | \ - ((src0) << R300_FPI1_SRC0C_SHIFT) | \ - ((src1) << R300_FPI1_SRC1C_SHIFT) | \ - ((src2) << R300_FPI1_SRC2C_SHIFT)) - -#define FP_SELA_MASK_NO 0 -#define FP_SELA_MASK_W 1 - -#define FP_SELA(destidx,regmask,outmask,src0,src1,src2) \ - (((destidx) << R300_FPI3_DSTA_SHIFT) | \ - (FP_SELA_MASK_##regmask << 23) | \ - (FP_SELA_MASK_##outmask << 24) | \ - ((src0) << R300_FPI3_SRC0A_SHIFT) | \ - ((src1) << R300_FPI3_SRC1A_SHIFT) | \ - ((src2) << R300_FPI3_SRC2A_SHIFT)) - -/* Produce unshifted argument selectors */ -#define FP_ARGC(source) R300_FPI0_ARGC_##source -#define FP_ARGA(source) R300_FPI2_ARGA_##source -#define FP_ABS(arg) ((arg) | (1 << 6)) -#define FP_NEG(arg) ((arg) ^ (1 << 5)) - -/* Produce instruction dword */ -#define FP_INSTRC(opcode,arg0,arg1,arg2) \ - (R300_FPI0_OUTC_##opcode | \ - ((arg0) << R300_FPI0_ARG0C_SHIFT) | \ - ((arg1) << R300_FPI0_ARG1C_SHIFT) | \ - ((arg2) << R300_FPI0_ARG2C_SHIFT)) - -#define FP_INSTRA(opcode,arg0,arg1,arg2) \ - (R300_FPI2_OUTA_##opcode | \ - ((arg0) << R300_FPI2_ARG0A_SHIFT) | \ - ((arg1) << R300_FPI2_ARG1A_SHIFT) | \ - ((arg2) << R300_FPI2_ARG2A_SHIFT)) - -extern void debug_vp(GLcontext * ctx, struct gl_vertex_program *vp); - -#endif /* __R300_PROGRAM_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 3df0eee799..786fb6c466 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -81,4 +81,64 @@ #define VSF_ATTR_Z(reg) EASY_VSF_SOURCE(reg, Z, Z, Z, Z, ATTR, NONE) #define VSF_ATTR_W(reg) EASY_VSF_SOURCE(reg, W, W, W, W, ATTR, NONE) +#if 1 + +/** + * Vertex program helper macros + */ + +/* Produce out dword */ +#define VP_OUTCLASS_TMP R300_VPI_OUT_REG_CLASS_TEMPORARY +#define VP_OUTCLASS_OUT R300_VPI_OUT_REG_CLASS_RESULT + +#define VP_OUTMASK_X R300_VPI_OUT_WRITE_X +#define VP_OUTMASK_Y R300_VPI_OUT_WRITE_Y +#define VP_OUTMASK_Z R300_VPI_OUT_WRITE_Z +#define VP_OUTMASK_W R300_VPI_OUT_WRITE_W +#define VP_OUTMASK_XY (VP_OUTMASK_X|VP_OUTMASK_Y) +#define VP_OUTMASK_XZ (VP_OUTMASK_X|VP_OUTMASK_Z) +#define VP_OUTMASK_XW (VP_OUTMASK_X|VP_OUTMASK_W) +#define VP_OUTMASK_XYZ (VP_OUTMASK_XY|VP_OUTMASK_Z) +#define VP_OUTMASK_XYW (VP_OUTMASK_XY|VP_OUTMASK_W) +#define VP_OUTMASK_XZW (VP_OUTMASK_XZ|VP_OUTMASK_W) +#define VP_OUTMASK_XYZW (VP_OUTMASK_XYZ|VP_OUTMASK_W) +#define VP_OUTMASK_YZ (VP_OUTMASK_Y|VP_OUTMASK_Z) +#define VP_OUTMASK_YW (VP_OUTMASK_Y|VP_OUTMASK_W) +#define VP_OUTMASK_YZW (VP_OUTMASK_YZ|VP_OUTMASK_W) +#define VP_OUTMASK_ZW (VP_OUTMASK_Z|VP_OUTMASK_W) + +#define VP_OUT(instr,outclass,outidx,outmask) \ + (R300_VPI_OUT_OP_##instr | \ + ((outidx) << R300_VPI_OUT_REG_INDEX_SHIFT) | \ + VP_OUTCLASS_##outclass | \ + VP_OUTMASK_##outmask) + +/* Produce in dword */ +#define VP_INCLASS_TMP R300_VPI_IN_REG_CLASS_TEMPORARY +#define VP_INCLASS_IN R300_VPI_IN_REG_CLASS_ATTRIBUTE +#define VP_INCLASS_CONST R300_VPI_IN_REG_CLASS_PARAMETER + +#define VP_IN(class,idx) \ + (((idx) << R300_VPI_IN_REG_INDEX_SHIFT) | \ + VP_INCLASS_##class | \ + (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)) +#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)) +#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)) + +#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) + +#endif + #endif -- cgit v1.2.3 From bccb56d5f395be994bcdb11a9f1007aca1dad1d8 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 12:08:09 +0000 Subject: r300: Added the Vector Engine and Math Engine defines from AMD's documentation. --- src/mesa/drivers/dri/r300/r300_reg.h | 86 +++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index fc7a952660..9b2e1f5ed3 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2402,7 +2402,86 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define ZB_STENCILREFMASK_BF_STENCILWRITEMASK_SHIFT 16 # define ZB_STENCILREFMASK_BF_STENCILWRITEMASK_MASK 0xffff0000 -/* BEGIN: Vertex program instruction set */ +/** + * \defgroup R3XX_R5XX_PROGRAMMABLE_VERTEX_SHADER_DESCRIPTION R3XX-R5XX PROGRAMMABLE VERTEX SHADER DESCRIPTION + * + * The PVS_DST_MATH_INST is used to identify whether the instruction is a Vector + * Engine instruction or a Math Engine instruction. + */ + +/*\{*/ + +enum { + /* R3XX */ + VECTOR_NO_OP = 0, + VE_DOT_PRODUCT = 1, + VE_MULTIPLY = 2, + VE_ADD = 3, + VE_MULTIPLY_ADD = 4, + VE_DISTANCE_VECTOR = 5, + VE_FRACTION = 6, + VE_MAXIMUM = 7, + VE_MINIMUM = 8, + VE_SET_GREATER_THAN_EQUAL = 9, + VE_SET_LESS_THAN = 10, + VE_MULTIPLYX2_ADD = 11, + VE_MULTIPLY_CLAMP = 12, + VE_FLT2FIX_DX = 13, + VE_FLT2FIX_DX_RND = 14, + /* R5XX */ + VE_PRED_SET_EQ_PUSH = 15, + VE_PRED_SET_GT_PUSH = 16, + VE_PRED_SET_GTE_PUSH = 17, + VE_PRED_SET_NEQ_PUSH = 18, + VE_COND_WRITE_EQ = 19, + VE_COND_WRITE_GT = 20, + VE_COND_WRITE_GTE = 21, + VE_COND_WRITE_NEQ = 22, + VE_COND_MUX_EQ = 23, + VE_COND_MUX_GT = 24, + VE_COND_MUX_GTE = 25, + VE_SET_GREATER_THAN = 26, + VE_SET_EQUAL = 27, + VE_SET_NOT_EQUAL = 28, +}; + +enum { + /* R3XX */ + MATH_NO_OP = 0, + ME_EXP_BASE2_DX = 1, + ME_LOG_BASE2_DX = 2, + ME_EXP_BASEE_FF = 3, + ME_LIGHT_COEFF_DX = 4, + ME_POWER_FUNC_FF = 5, + ME_RECIP_DX = 6, + ME_RECIP_FF = 7, + ME_RECIP_SQRT_DX = 8, + ME_RECIP_SQRT_FF = 9, + ME_MULTIPLY = 10, + ME_EXP_BASE2_FULL_DX = 11, + ME_LOG_BASE2_FULL_DX = 12, + ME_POWER_FUNC_FF_CLAMP_B = 13, + ME_POWER_FUNC_FF_CLAMP_B1 = 14, + ME_POWER_FUNC_FF_CLAMP_01 = 15, + ME_SIN = 16, + ME_COS = 17, + /* R5XX */ + ME_LOG_BASE2_IEEE = 18, + ME_RECIP_IEEE = 19, + ME_RECIP_SQRT_IEEE = 20, + ME_PRED_SET_EQ = 21, + ME_PRED_SET_GT = 22, + ME_PRED_SET_GTE = 23, + ME_PRED_SET_NEQ = 24, + ME_PRED_SET_CLR = 25, + ME_PRED_SET_INV = 26, + ME_PRED_SET_POP = 27, + ME_PRED_SET_RESTORE = 28, +}; + +/*\}*/ + +/*\{*/ /* Every instruction is four dwords long: * DWORD 0: output and opcode @@ -2510,7 +2589,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_VPI_IN_NEG_Y (1 << 26) #define R300_VPI_IN_NEG_Z (1 << 27) #define R300_VPI_IN_NEG_W (1 << 28) -/* END: Vertex program instruction set */ + +/*\}*/ /* BEGIN: Packet 3 commands */ @@ -2632,3 +2712,5 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #endif /* _R300_REG_H */ /* *INDENT-ON* */ + +/* vim: set foldenable foldmarker=\\{,\\} foldmethod=marker : */ -- cgit v1.2.3 From ea8299040f3a70b2912723bdea00778512da2897 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 12:22:08 +0000 Subject: r300: Added the vertex program src/dest register defines. --- src/mesa/drivers/dri/r300/r300_reg.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 9b2e1f5ed3..29d2e7f4f3 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2479,6 +2479,22 @@ enum { ME_PRED_SET_RESTORE = 28, }; +enum { + PVS_SRC_REG_TEMPORARY = 0, /* Intermediate Storage */ + PVS_SRC_REG_INPUT = 1, /* Input Vertex Storage */ + PVS_SRC_REG_CONSTANT = 2, /* Constant State Storage */ + PVS_SRC_REG_ALT_TEMPORARY = 3, /* Alternate Intermediate Storage */ +}; + +enum { + PVS_DST_REG_TEMPORARY = 0, /* Intermediate Storage */ + PVS_DST_REG_A0 = 1, /* Address Register Storage */ + PVS_DST_REG_OUT = 2, /* Output Memory. Used for all outputs */ + PVS_DST_REG_OUT_REPL_X = 3, /* Output Memory & Replicate X to all channels */ + PVS_DST_REG_ALT_TEMPORARY = 4, /* Alternate Intermediate Storage */ + PVS_DST_REG_INPUT = 5, /* Output Memory & Replicate X to all channels */ +}; + /*\}*/ /*\{*/ -- cgit v1.2.3 From 8a646b80ef518fd36bc5643ee91c0339d4ccb2fb Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 12:15:22 +0000 Subject: r300: Removed the duplicate "easy" vertex program macros. --- src/mesa/drivers/dri/r300/r300_state.c | 2 +- src/mesa/drivers/dri/r300/r300_vertprog.h | 38 +++++++++++++++---------------- 2 files changed, 19 insertions(+), 21 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 3cd009904e..488ed3d3cc 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1659,7 +1659,7 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { if (rmesa->state.sw_tcl_inputs[i] != -1) { - prog->program.body.i[program_end + 0] = EASY_VSF_OP(MUL, o_reg++, ALL, RESULT); + prog->program.body.i[program_end + 0] = MAKE_VSF_OP(R300_VPI_OUT_OP_MUL, o_reg++, VSF_FLAG_ALL, VSF_OUT_CLASS_RESULT); prog->program.body.i[program_end + 1] = VSF_REG(rmesa->state.sw_tcl_inputs[i]); prog->program.body.i[program_end + 2] = VSF_ATTR_UNITY(rmesa->state.sw_tcl_inputs[i]); prog->program.body.i[program_end + 3] = VSF_UNITY(rmesa->state.sw_tcl_inputs[i]); diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 786fb6c466..62e5c70a4f 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -27,9 +27,6 @@ | ((out_reg_fields) << 20) \ | ( (class) << 8 ) ) -#define EASY_VSF_OP(op, out_reg_index, out_reg_fields, class) \ - MAKE_VSF_OP(R300_VPI_OUT_OP_##op, out_reg_index, VSF_FLAG_##out_reg_fields, VSF_OUT_CLASS_##class) \ - /* according to Nikolai, the subsequent 3 DWORDs are sources, use same define for each */ #define VSF_IN_CLASS_TMP 0 @@ -52,34 +49,35 @@ | ((comp_w)< Date: Mon, 25 Feb 2008 12:26:48 +0000 Subject: r300: Removed the duplicate dest register defines. --- src/mesa/drivers/dri/r300/r300_state.c | 2 +- src/mesa/drivers/dri/r300/r300_vertprog.c | 14 +++++++------- src/mesa/drivers/dri/r300/r300_vertprog.h | 4 ---- 3 files changed, 8 insertions(+), 12 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 488ed3d3cc..6f9f3fbf5d 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1659,7 +1659,7 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { if (rmesa->state.sw_tcl_inputs[i] != -1) { - prog->program.body.i[program_end + 0] = MAKE_VSF_OP(R300_VPI_OUT_OP_MUL, o_reg++, VSF_FLAG_ALL, VSF_OUT_CLASS_RESULT); + prog->program.body.i[program_end + 0] = MAKE_VSF_OP(R300_VPI_OUT_OP_MUL, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); prog->program.body.i[program_end + 1] = VSF_REG(rmesa->state.sw_tcl_inputs[i]); prog->program.body.i[program_end + 2] = VSF_ATTR_UNITY(rmesa->state.sw_tcl_inputs[i]); prog->program.body.i[program_end + 3] = VSF_UNITY(rmesa->state.sw_tcl_inputs[i]); diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index c1329f13f7..7e724514b0 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -174,11 +174,11 @@ static unsigned long t_dst_class(enum register_file file) switch (file) { case PROGRAM_TEMPORARY: - return VSF_OUT_CLASS_TMP; + return PVS_DST_REG_TEMPORARY; case PROGRAM_OUTPUT: - return VSF_OUT_CLASS_RESULT; + return PVS_DST_REG_OUT; case PROGRAM_ADDRESS: - return VSF_OUT_CLASS_ADDR; + return PVS_DST_REG_A0; /* case PROGRAM_INPUT: case PROGRAM_LOCAL_PARAM: @@ -580,7 +580,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, inst[0] = MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), - VSF_OUT_CLASS_TMP); + PVS_DST_REG_TEMPORARY); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; @@ -994,7 +994,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, inst[0] = MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), - VSF_OUT_CLASS_TMP); + PVS_DST_REG_TEMPORARY); inst[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z @@ -1149,7 +1149,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, inst[0] = MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, u_temp_i, VSF_FLAG_ALL, - VSF_OUT_CLASS_TMP); + PVS_DST_REG_TEMPORARY); inst[1] = MAKE_VSF_SOURCE(t_src_index @@ -1177,7 +1177,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, inst[0] = MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, u_temp_i, VSF_FLAG_ALL, - VSF_OUT_CLASS_TMP); + PVS_DST_REG_TEMPORARY); inst[1] = MAKE_VSF_SOURCE(t_src_index diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 62e5c70a4f..6f7afec3f3 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -11,10 +11,6 @@ #define VSF_FLAG_ALL 0xf #define VSF_FLAG_NONE 0 -#define VSF_OUT_CLASS_TMP 0 -#define VSF_OUT_CLASS_ADDR 1 -#define VSF_OUT_CLASS_RESULT 2 - /* first DWORD of an instruction */ /* possible operations: -- cgit v1.2.3 From bd46a482c479e7ce765e45f444ba0f7e54432a4e Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 12:35:55 +0000 Subject: r300: Converted to the new Vector Engine defines. --- src/mesa/drivers/dri/r300/r300_reg.h | 45 ----------------------- src/mesa/drivers/dri/r300/r300_state.c | 2 +- src/mesa/drivers/dri/r300/r300_vertprog.c | 59 ++++++++++++++++--------------- src/mesa/drivers/dri/r300/r300_vertprog.h | 2 +- 4 files changed, 32 insertions(+), 76 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 29d2e7f4f3..48b91cfd7b 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2499,51 +2499,6 @@ enum { /*\{*/ -/* Every instruction is four dwords long: - * DWORD 0: output and opcode - * DWORD 1: first argument - * DWORD 2: second argument - * DWORD 3: third argument - * - * Notes: - * - ABS r, a is implemented as MAX r, a, -a - * - MOV is implemented as ADD to zero - * - XPD is implemented as MUL + MAD - * - FLR is implemented as FRC + ADD - * - apparently, fglrx tries to schedule instructions so that there is at - * least one instruction between the write to a temporary and the first - * read from said temporary; however, violations of this scheduling are - * allowed - * - register indices seem to be unrelated with OpenGL aliasing to - * conventional state - * - only one attribute and one parameter can be loaded at a time; however, - * the same attribute/parameter can be used for more than one argument - * - the second software argument for POW is the third hardware argument - * (no idea why) - * - MAD with only temporaries as input seems to use VPI_OUT_SELECT_MAD_2 - * - * There is some magic surrounding LIT: - * The single argument is replicated across all three inputs, but swizzled: - * First argument: xyzy - * Second argument: xyzx - * Third argument: xyzw - * Whenever the result is used later in the fragment program, fglrx forces - * x and w to be 1.0 in the input selection; I don't know whether this is - * strictly necessary - */ -#define R300_VPI_OUT_OP_DOT (1 << 0) -#define R300_VPI_OUT_OP_MUL (2 << 0) -#define R300_VPI_OUT_OP_ADD (3 << 0) -#define R300_VPI_OUT_OP_MAD (4 << 0) -#define R300_VPI_OUT_OP_DST (5 << 0) -#define R300_VPI_OUT_OP_FRC (6 << 0) -#define R300_VPI_OUT_OP_MAX (7 << 0) -#define R300_VPI_OUT_OP_MIN (8 << 0) -#define R300_VPI_OUT_OP_SGE (9 << 0) -#define R300_VPI_OUT_OP_SLT (10 << 0) - /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, vector(scalar, vector) */ -#define R300_VPI_OUT_OP_UNK12 (12 << 0) -#define R300_VPI_OUT_OP_ARL (13 << 0) #define R300_VPI_OUT_OP_EXP (65 << 0) #define R300_VPI_OUT_OP_LOG (66 << 0) /* Used in fog computations, scalar(scalar) */ diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 6f9f3fbf5d..2387b15171 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1659,7 +1659,7 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { if (rmesa->state.sw_tcl_inputs[i] != -1) { - prog->program.body.i[program_end + 0] = MAKE_VSF_OP(R300_VPI_OUT_OP_MUL, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); + prog->program.body.i[program_end + 0] = MAKE_VSF_OP(VE_MULTIPLY, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); prog->program.body.i[program_end + 1] = VSF_REG(rmesa->state.sw_tcl_inputs[i]); prog->program.body.i[program_end + 2] = VSF_ATTR_UNITY(rmesa->state.sw_tcl_inputs[i]); prog->program.body.i[program_end + 3] = VSF_UNITY(rmesa->state.sw_tcl_inputs[i]); diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 7e724514b0..ec2299f4c8 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -376,7 +376,7 @@ static GLuint *t_opcode_abs(struct r300_vertex_program *vp, //MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -406,7 +406,7 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, hw_op = (src[0].File == PROGRAM_TEMPORARY && src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -417,7 +417,7 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, inst[3] = t_src(vp, &src[1]); #else inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -434,7 +434,7 @@ static GLuint *t_opcode_arl(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ARL, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_FLT2FIX_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -452,7 +452,7 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO} inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -486,7 +486,7 @@ static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -503,7 +503,7 @@ static GLuint *t_opcode_dph(struct r300_vertex_program *vp, { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W} inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -527,7 +527,7 @@ static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_DST, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_DISTANCE_VECTOR, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -578,7 +578,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */ inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, *u_temp_i, + MAKE_VSF_OP(VE_FRACTION, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); @@ -588,7 +588,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, inst += 4; inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -613,7 +613,7 @@ static GLuint *t_opcode_frc(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_FRACTION, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -716,7 +716,7 @@ static GLuint *t_opcode_mad(struct r300_vertex_program *vp, && src[1].File == PROGRAM_TEMPORARY && src[2].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -734,7 +734,7 @@ static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -750,7 +750,7 @@ static GLuint *t_opcode_min(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_MIN, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_MINIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -769,7 +769,7 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, #if 1 inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -779,7 +779,7 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, hw_op = (src[0].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -804,7 +804,7 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, hw_op = (src[0].File == PROGRAM_TEMPORARY && src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -870,7 +870,7 @@ static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_SGE, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_SET_GREATER_THAN_EQUAL, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -886,7 +886,7 @@ static GLuint *t_opcode_slt(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_SLT, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_SET_LESS_THAN, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -909,7 +909,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, hw_op = (src[0].File == PROGRAM_TEMPORARY && src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -929,7 +929,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, (src[1].RelAddr << 4); #else inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -958,7 +958,7 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, #if 1 inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -968,7 +968,7 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, hw_op = (src[0].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -992,7 +992,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, */ inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, *u_temp_i, + MAKE_VSF_OP(VE_MULTIPLY_ADD, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); @@ -1019,7 +1019,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, (*u_temp_i)--; inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -1147,7 +1147,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, if (CMP_SRCS(src[1], src[2]) || CMP_SRCS(src[0], src[2])) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, + MAKE_VSF_OP(VE_ADD, u_temp_i, VSF_FLAG_ALL, PVS_DST_REG_TEMPORARY); @@ -1175,7 +1175,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, if (num_operands >= 2) { if (CMP_SRCS(src[1], src[0])) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, + MAKE_VSF_OP(VE_ADD, u_temp_i, VSF_FLAG_ALL, PVS_DST_REG_TEMPORARY); @@ -1296,8 +1296,9 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, of the fragment program. Blank the outputs here. */ for (i = 0; i < VERT_RESULT_MAX; i++) { if (vp->key.OutputsAdded & (1 << i)) { - inst[0] = MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, vp->outputs[i], - VSF_FLAG_ALL, VSF_OUT_CLASS_RESULT); + inst[0] = MAKE_VSF_OP(VE_ADD, vp->outputs[i], + VSF_FLAG_ALL, + VSF_OUT_CLASS_RESULT); inst[1] = ZERO_SRC_0; inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 6f7afec3f3..90906cc1e3 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -102,7 +102,7 @@ #define VP_OUTMASK_ZW (VP_OUTMASK_Z|VP_OUTMASK_W) #define VP_OUT(instr,outclass,outidx,outmask) \ - (R300_VPI_OUT_OP_##instr | \ + (VE_##instr | \ ((outidx) << R300_VPI_OUT_REG_INDEX_SHIFT) | \ VP_OUTCLASS_##outclass | \ VP_OUTMASK_##outmask) -- cgit v1.2.3 From 7c4add02f80c7f16241ddbae18117d7cb264079d Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 12:37:26 +0000 Subject: r300: Renamed the Vector Engine opcode macro. --- src/mesa/drivers/dri/r300/r300_state.c | 2 +- src/mesa/drivers/dri/r300/r300_vertprog.c | 76 +++++++++++++++---------------- src/mesa/drivers/dri/r300/r300_vertprog.h | 2 +- 3 files changed, 40 insertions(+), 40 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 2387b15171..76a7252f38 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1659,7 +1659,7 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { if (rmesa->state.sw_tcl_inputs[i] != -1) { - prog->program.body.i[program_end + 0] = MAKE_VSF_OP(VE_MULTIPLY, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); + prog->program.body.i[program_end + 0] = PVS_VECTOR_OPCODE(VE_MULTIPLY, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); prog->program.body.i[program_end + 1] = VSF_REG(rmesa->state.sw_tcl_inputs[i]); prog->program.body.i[program_end + 2] = VSF_ATTR_UNITY(rmesa->state.sw_tcl_inputs[i]); prog->program.body.i[program_end + 3] = VSF_UNITY(rmesa->state.sw_tcl_inputs[i]); diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index ec2299f4c8..142e4b89e2 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -376,7 +376,7 @@ static GLuint *t_opcode_abs(struct r300_vertex_program *vp, //MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W inst[0] = - MAKE_VSF_OP(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -409,7 +409,7 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, VE_MULTIPLY_ADD; inst[0] = - MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = ONE_SRC_0; @@ -417,7 +417,7 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, inst[3] = t_src(vp, &src[1]); #else inst[0] = - MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -434,7 +434,7 @@ static GLuint *t_opcode_arl(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(VE_FLT2FIX_DX, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_FLT2FIX_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -452,7 +452,7 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO} inst[0] = - MAKE_VSF_OP(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -486,7 +486,7 @@ static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -503,7 +503,7 @@ static GLuint *t_opcode_dph(struct r300_vertex_program *vp, { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W} inst[0] = - MAKE_VSF_OP(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -527,7 +527,7 @@ static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(VE_DISTANCE_VECTOR, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_DISTANCE_VECTOR, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -543,7 +543,7 @@ static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_EX2, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_EX2, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -559,7 +559,7 @@ static GLuint *t_opcode_exp(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_EXP, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_EXP, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -578,7 +578,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */ inst[0] = - MAKE_VSF_OP(VE_FRACTION, *u_temp_i, + PVS_VECTOR_OPCODE(VE_FRACTION, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); @@ -588,7 +588,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, inst += 4; inst[0] = - MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -613,7 +613,7 @@ static GLuint *t_opcode_frc(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(VE_FRACTION, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_FRACTION, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -631,7 +631,7 @@ static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, // LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X} inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_LG2, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_LG2, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -658,7 +658,7 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, //LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W} inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_LIT, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_LIT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); /* NOTE: Users swizzling might not work. */ @@ -695,7 +695,7 @@ static GLuint *t_opcode_log(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_LOG, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_LOG, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -719,7 +719,7 @@ static GLuint *t_opcode_mad(struct r300_vertex_program *vp, VE_MULTIPLY_ADD; inst[0] = - MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -734,7 +734,7 @@ static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -750,7 +750,7 @@ static GLuint *t_opcode_min(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(VE_MINIMUM, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MINIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -769,7 +769,7 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, #if 1 inst[0] = - MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -782,7 +782,7 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, VE_MULTIPLY_ADD; inst[0] = - MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -807,7 +807,7 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, VE_MULTIPLY_ADD; inst[0] = - MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -823,7 +823,7 @@ static GLuint *t_opcode_pow(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_POW, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_POW, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); @@ -838,7 +838,7 @@ static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_RCP, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_RCP, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -854,7 +854,7 @@ static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_RSQ, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_RSQ, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -870,7 +870,7 @@ static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(VE_SET_GREATER_THAN_EQUAL, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_SET_GREATER_THAN_EQUAL, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -886,7 +886,7 @@ static GLuint *t_opcode_slt(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(VE_SET_LESS_THAN, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_SET_LESS_THAN, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -912,7 +912,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, VE_MULTIPLY_ADD; inst[0] = - MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -929,7 +929,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, (src[1].RelAddr << 4); #else inst[0] = - MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -958,7 +958,7 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, #if 1 inst[0] = - MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -971,7 +971,7 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, VE_MULTIPLY_ADD; inst[0] = - MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -992,7 +992,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, */ inst[0] = - MAKE_VSF_OP(VE_MULTIPLY_ADD, *u_temp_i, + PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); @@ -1019,7 +1019,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, (*u_temp_i)--; inst[0] = - MAKE_VSF_OP(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -1147,7 +1147,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, if (CMP_SRCS(src[1], src[2]) || CMP_SRCS(src[0], src[2])) { inst[0] = - MAKE_VSF_OP(VE_ADD, + PVS_VECTOR_OPCODE(VE_ADD, u_temp_i, VSF_FLAG_ALL, PVS_DST_REG_TEMPORARY); @@ -1175,7 +1175,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, if (num_operands >= 2) { if (CMP_SRCS(src[1], src[0])) { inst[0] = - MAKE_VSF_OP(VE_ADD, + PVS_VECTOR_OPCODE(VE_ADD, u_temp_i, VSF_FLAG_ALL, PVS_DST_REG_TEMPORARY); @@ -1296,9 +1296,9 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, of the fragment program. Blank the outputs here. */ for (i = 0; i < VERT_RESULT_MAX; i++) { if (vp->key.OutputsAdded & (1 << i)) { - inst[0] = MAKE_VSF_OP(VE_ADD, vp->outputs[i], - VSF_FLAG_ALL, - VSF_OUT_CLASS_RESULT); + inst[0] = PVS_VECTOR_OPCODE(VE_ADD, vp->outputs[i], + VSF_FLAG_ALL, + PVS_DST_REG_OUT); inst[1] = ZERO_SRC_0; inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 90906cc1e3..ca76f3f69a 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -17,7 +17,7 @@ DOT, MUL, ADD, MAD, FRC, MAX, MIN, SGE, SLT, EXP, LOG, LIT, POW, RCP, RSQ, EX2, LG2, MAD_2 */ -#define MAKE_VSF_OP(op, out_reg_index, out_reg_fields, class) \ +#define PVS_VECTOR_OPCODE(op, out_reg_index, out_reg_fields, class) \ ((op) \ | ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ | ((out_reg_fields) << 20) \ -- cgit v1.2.3 From 0ced26099d3ff2e82ffd5fe7915504b13341c812 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 12:39:36 +0000 Subject: r300: Added the Math Engine opcode macro. --- src/mesa/drivers/dri/r300/r300_vertprog.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index ca76f3f69a..ff44066d2b 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -23,6 +23,15 @@ | ((out_reg_fields) << 20) \ | ( (class) << 8 ) ) +#define PVS_DST_MATH_INST (1 << 6) + +#define PVS_MATH_OPCODE(op, out_reg_index, out_reg_fields, class) \ + ((op) \ + | PVS_DST_MATH_INST \ + | ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ + | ((out_reg_fields) << 20) \ + | ( (class) << 8 ) ) + /* according to Nikolai, the subsequent 3 DWORDs are sources, use same define for each */ #define VSF_IN_CLASS_TMP 0 -- cgit v1.2.3 From 41c3ae577894f1e577753a94cb87d6c93a8b1c63 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 12:50:46 +0000 Subject: r300: Converted to the new Math Engine defines. --- src/mesa/drivers/dri/r300/r300_reg.h | 15 +-------------- src/mesa/drivers/dri/r300/r300_vertprog.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 22 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 48b91cfd7b..f852660dcc 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2499,21 +2499,8 @@ enum { /*\{*/ -#define R300_VPI_OUT_OP_EXP (65 << 0) -#define R300_VPI_OUT_OP_LOG (66 << 0) - /* Used in fog computations, scalar(scalar) */ -#define R300_VPI_OUT_OP_UNK67 (67 << 0) -#define R300_VPI_OUT_OP_LIT (68 << 0) -#define R300_VPI_OUT_OP_POW (69 << 0) -#define R300_VPI_OUT_OP_RCP (70 << 0) -#define R300_VPI_OUT_OP_RSQ (72 << 0) - /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, scalar(scalar) */ -#define R300_VPI_OUT_OP_UNK73 (73 << 0) -#define R300_VPI_OUT_OP_EX2 (75 << 0) -#define R300_VPI_OUT_OP_LG2 (76 << 0) +/* FIXME */ #define R300_VPI_OUT_OP_MAD_2 (128 << 0) - /* all temps, vector(scalar, vector, vector) */ -#define R300_VPI_OUT_OP_UNK129 (129 << 0) #define R300_VPI_OUT_REG_CLASS_TEMPORARY (0 << 8) #define R300_VPI_OUT_REG_CLASS_ADDR (1 << 8) diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 142e4b89e2..13d233357a 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -543,7 +543,7 @@ static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_EX2, t_dst_index(vp, &vpi->DstReg), + PVS_MATH_OPCODE(ME_EXP_BASE2_FULL_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -559,7 +559,7 @@ static GLuint *t_opcode_exp(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_EXP, t_dst_index(vp, &vpi->DstReg), + PVS_MATH_OPCODE(ME_EXP_BASE2_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -631,7 +631,7 @@ static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, // LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X} inst[0] = - PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_LG2, t_dst_index(vp, &vpi->DstReg), + PVS_MATH_OPCODE(ME_LOG_BASE2_FULL_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -658,7 +658,7 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, //LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W} inst[0] = - PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_LIT, t_dst_index(vp, &vpi->DstReg), + PVS_MATH_OPCODE(ME_LIGHT_COEFF_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); /* NOTE: Users swizzling might not work. */ @@ -695,7 +695,7 @@ static GLuint *t_opcode_log(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_LOG, t_dst_index(vp, &vpi->DstReg), + PVS_MATH_OPCODE(ME_LOG_BASE2_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -823,7 +823,7 @@ static GLuint *t_opcode_pow(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_POW, t_dst_index(vp, &vpi->DstReg), + PVS_MATH_OPCODE(ME_POWER_FUNC_FF, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); @@ -838,7 +838,7 @@ static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_RCP, t_dst_index(vp, &vpi->DstReg), + PVS_MATH_OPCODE(ME_RECIP_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -854,7 +854,7 @@ static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - PVS_VECTOR_OPCODE(R300_VPI_OUT_OP_RSQ, t_dst_index(vp, &vpi->DstReg), + PVS_MATH_OPCODE(ME_RECIP_SQRT_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); -- cgit v1.2.3 From b0e81fd19e7147927e9dbc3277886942f3b8c0f3 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 12:51:56 +0000 Subject: r300: Removed an obsolete comment from the vertex program header file. --- src/mesa/drivers/dri/r300/r300_vertprog.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index ff44066d2b..006dddacc8 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -13,10 +13,6 @@ /* first DWORD of an instruction */ -/* possible operations: - DOT, MUL, ADD, MAD, FRC, MAX, MIN, SGE, SLT, EXP, LOG, LIT, POW, RCP, RSQ, EX2, - LG2, MAD_2 */ - #define PVS_VECTOR_OPCODE(op, out_reg_index, out_reg_fields, class) \ ((op) \ | ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ -- cgit v1.2.3 From b2c02a4a7c2948f06fc2470d3c53b2292a9d482f Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 13:09:15 +0000 Subject: r300: Converted to the new src/dest register defines. --- src/mesa/drivers/dri/r300/r300_ioctl.c | 4 ++-- src/mesa/drivers/dri/r300/r300_reg.h | 11 ----------- src/mesa/drivers/dri/r300/r300_vertprog.h | 13 ++----------- 3 files changed, 4 insertions(+), 24 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 082cb6b6e3..ae2dcffe38 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -327,12 +327,12 @@ static void r300EmitClearState(GLcontext * ctx) R300_STATECHANGE(r300, vpi); vsf_start_fragment(0x0, 8); e32(VP_OUT(ADD, OUT, 0, XYZW)); - e32(VP_IN(IN, 0)); + e32(VP_IN(INPUT, 0)); e32(VP_ZERO()); e32(0x0); e32(VP_OUT(ADD, OUT, 1, XYZW)); - e32(VP_IN(IN, 1)); + e32(VP_IN(INPUT, 1)); e32(VP_ZERO()); e32(0x0); } diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index f852660dcc..ac04f84b83 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2502,11 +2502,6 @@ enum { /* FIXME */ #define R300_VPI_OUT_OP_MAD_2 (128 << 0) -#define R300_VPI_OUT_REG_CLASS_TEMPORARY (0 << 8) -#define R300_VPI_OUT_REG_CLASS_ADDR (1 << 8) -#define R300_VPI_OUT_REG_CLASS_RESULT (2 << 8) -#define R300_VPI_OUT_REG_CLASS_MASK (31 << 8) - #define R300_VPI_OUT_REG_INDEX_SHIFT 13 /* GUESS based on fglrx native limits */ #define R300_VPI_OUT_REG_INDEX_MASK (31 << 13) @@ -2516,12 +2511,6 @@ enum { #define R300_VPI_OUT_WRITE_Z (1 << 22) #define R300_VPI_OUT_WRITE_W (1 << 23) -#define R300_VPI_IN_REG_CLASS_TEMPORARY (0 << 0) -#define R300_VPI_IN_REG_CLASS_ATTRIBUTE (1 << 0) -#define R300_VPI_IN_REG_CLASS_PARAMETER (2 << 0) -#define R300_VPI_IN_REG_CLASS_NONE (9 << 0) -#define R300_VPI_IN_REG_CLASS_MASK (31 << 0) - #define R300_VPI_IN_REG_INDEX_SHIFT 5 /* GUESS based on fglrx native limits */ #define R300_VPI_IN_REG_INDEX_MASK (255 << 5) diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 006dddacc8..b0b81b5e74 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -86,10 +86,6 @@ * Vertex program helper macros */ -/* Produce out dword */ -#define VP_OUTCLASS_TMP R300_VPI_OUT_REG_CLASS_TEMPORARY -#define VP_OUTCLASS_OUT R300_VPI_OUT_REG_CLASS_RESULT - #define VP_OUTMASK_X R300_VPI_OUT_WRITE_X #define VP_OUTMASK_Y R300_VPI_OUT_WRITE_Y #define VP_OUTMASK_Z R300_VPI_OUT_WRITE_Z @@ -109,17 +105,12 @@ #define VP_OUT(instr,outclass,outidx,outmask) \ (VE_##instr | \ ((outidx) << R300_VPI_OUT_REG_INDEX_SHIFT) | \ - VP_OUTCLASS_##outclass | \ + (PVS_DST_REG_##outclass << 8) | \ VP_OUTMASK_##outmask) -/* Produce in dword */ -#define VP_INCLASS_TMP R300_VPI_IN_REG_CLASS_TEMPORARY -#define VP_INCLASS_IN R300_VPI_IN_REG_CLASS_ATTRIBUTE -#define VP_INCLASS_CONST R300_VPI_IN_REG_CLASS_PARAMETER - #define VP_IN(class,idx) \ (((idx) << R300_VPI_IN_REG_INDEX_SHIFT) | \ - VP_INCLASS_##class | \ + (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) | \ -- cgit v1.2.3 From 8c4d811295f89bc59c54160bcaf861b47514b458 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 25 Feb 2008 13:16:05 +0000 Subject: 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(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index ac04f84b83..70ccab50af 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 b0b81b5e74..5eba2d5432 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) -- cgit v1.2.3 From 440a6fbf6e6b390b050e99b9c320a0fe8c9f798b Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Wed, 27 Feb 2008 02:06:40 +0000 Subject: r300: Cleaned up the special vertex program source register macros. --- src/mesa/drivers/dri/r300/r300_vertprog.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 5eba2d5432..2bcbf28c82 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -54,31 +54,40 @@ /* (1.0,1.0,1.0,1.0) vector (ATTR, plain ) */ #define VSF_ATTR_UNITY(reg) \ - MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) + MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, \ + VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) #define VSF_UNITY(reg) \ - MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_CLASS_NONE, VSF_FLAG_NONE) + MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, \ + VSF_IN_CLASS_NONE, VSF_FLAG_NONE) /* contents of unmodified register */ #define VSF_REG(reg) \ - MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_W, VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) + MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_W, \ + VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) /* contents of unmodified parameter */ #define VSF_PARAM(reg) \ - MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_W, VSF_IN_CLASS_PARAM, VSF_FLAG_NONE) + MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_W, \ + VSF_IN_CLASS_PARAM, VSF_FLAG_NONE) /* contents of unmodified temporary register */ #define VSF_TMP(reg) \ - MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_W, VSF_IN_CLASS_TMP, VSF_FLAG_NONE) + MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_W, \ + VSF_IN_CLASS_TMP, VSF_FLAG_NONE) /* components of ATTR register */ #define VSF_ATTR_X(reg) \ - MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_X, VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) + MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_X, \ + VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) #define VSF_ATTR_Y(reg) \ - MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Y, VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) + MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Y, \ + VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) #define VSF_ATTR_Z(reg) \ - MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_Z, VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) + MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_Z, \ + VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) #define VSF_ATTR_W(reg) \ - MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_W, VSF_IN_COMPONENT_W, VSF_IN_COMPONENT_W, VSF_IN_COMPONENT_W, VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) + MAKE_VSF_SOURCE(reg, VSF_IN_COMPONENT_W, VSF_IN_COMPONENT_W, VSF_IN_COMPONENT_W, VSF_IN_COMPONENT_W, \ + VSF_IN_CLASS_ATTR, VSF_FLAG_NONE) #if 1 -- cgit v1.2.3 From 9c742911970b5131ed08204165e04a59cd0d26bf Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Wed, 27 Feb 2008 02:10:13 +0000 Subject: r300: Removed the (obsolete) special source register macros. --- src/mesa/drivers/dri/r300/r300_state.c | 28 ++++++++++++++++++---- src/mesa/drivers/dri/r300/r300_vertprog.h | 39 ------------------------------- 2 files changed, 24 insertions(+), 43 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 76a7252f38..3b9b198415 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1659,10 +1659,30 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { if (rmesa->state.sw_tcl_inputs[i] != -1) { - prog->program.body.i[program_end + 0] = PVS_VECTOR_OPCODE(VE_MULTIPLY, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); - prog->program.body.i[program_end + 1] = VSF_REG(rmesa->state.sw_tcl_inputs[i]); - prog->program.body.i[program_end + 2] = VSF_ATTR_UNITY(rmesa->state.sw_tcl_inputs[i]); - prog->program.body.i[program_end + 3] = VSF_UNITY(rmesa->state.sw_tcl_inputs[i]); + prog->program.body.i[program_end + 0] = + PVS_VECTOR_OPCODE(VE_MULTIPLY, o_reg++, + VSF_FLAG_ALL, PVS_DST_REG_OUT); + prog->program.body.i[program_end + 1] = + MAKE_VSF_SOURCE(rmesa->state.sw_tcl_inputs[i], + VSF_IN_COMPONENT_X, + VSF_IN_COMPONENT_Y, + VSF_IN_COMPONENT_Z, + VSF_IN_COMPONENT_W, + VSF_IN_CLASS_ATTR, VSF_FLAG_NONE); + prog->program.body.i[program_end + 2] = + MAKE_VSF_SOURCE(rmesa->state.sw_tcl_inputs[i], + VSF_IN_COMPONENT_ONE, + VSF_IN_COMPONENT_ONE, + VSF_IN_COMPONENT_ONE, + VSF_IN_COMPONENT_ONE, + VSF_IN_CLASS_ATTR, VSF_FLAG_NONE); + prog->program.body.i[program_end + 3] = + MAKE_VSF_SOURCE(rmesa->state.sw_tcl_inputs[i], + VSF_IN_COMPONENT_ONE, + VSF_IN_COMPONENT_ONE, + VSF_IN_COMPONENT_ONE, + VSF_IN_COMPONENT_ONE, + VSF_IN_CLASS_NONE, VSF_FLAG_NONE); program_end += 4; } } diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 2bcbf28c82..64243927de 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -50,45 +50,6 @@ | ((comp_w)< Date: Wed, 27 Feb 2008 02:11:29 +0000 Subject: r300: Renamed the vertex program source register macro. --- src/mesa/drivers/dri/r300/r300_state.c | 6 ++-- src/mesa/drivers/dri/r300/r300_vertprog.c | 52 +++++++++++++++---------------- src/mesa/drivers/dri/r300/r300_vertprog.h | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 3b9b198415..f6849b8f6e 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1663,21 +1663,21 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) PVS_VECTOR_OPCODE(VE_MULTIPLY, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); prog->program.body.i[program_end + 1] = - MAKE_VSF_SOURCE(rmesa->state.sw_tcl_inputs[i], + PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_W, VSF_IN_CLASS_ATTR, VSF_FLAG_NONE); prog->program.body.i[program_end + 2] = - MAKE_VSF_SOURCE(rmesa->state.sw_tcl_inputs[i], + PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_CLASS_ATTR, VSF_FLAG_NONE); prog->program.body.i[program_end + 3] = - MAKE_VSF_SOURCE(rmesa->state.sw_tcl_inputs[i], + PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 13d233357a..0f26e5ed5b 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -66,32 +66,32 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. (t_src_class(a.File) == VSF_IN_CLASS_ATTR && \ t_src_class(b.File) == VSF_IN_CLASS_ATTR)))) \ -#define ZERO_SRC_0 (MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), \ +#define ZERO_SRC_0 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), \ SWIZZLE_ZERO, SWIZZLE_ZERO, \ SWIZZLE_ZERO, SWIZZLE_ZERO, \ t_src_class(src[0].File), VSF_FLAG_NONE) | (src[0].RelAddr << 4)) -#define ZERO_SRC_1 (MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), \ +#define ZERO_SRC_1 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), \ SWIZZLE_ZERO, SWIZZLE_ZERO, \ SWIZZLE_ZERO, SWIZZLE_ZERO, \ t_src_class(src[1].File), VSF_FLAG_NONE) | (src[1].RelAddr << 4)) -#define ZERO_SRC_2 (MAKE_VSF_SOURCE(t_src_index(vp, &src[2]), \ +#define ZERO_SRC_2 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[2]), \ SWIZZLE_ZERO, SWIZZLE_ZERO, \ SWIZZLE_ZERO, SWIZZLE_ZERO, \ t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4)) -#define ONE_SRC_0 (MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), \ +#define ONE_SRC_0 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), \ SWIZZLE_ONE, SWIZZLE_ONE, \ SWIZZLE_ONE, SWIZZLE_ONE, \ t_src_class(src[0].File), VSF_FLAG_NONE) | (src[0].RelAddr << 4)) -#define ONE_SRC_1 (MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), \ +#define ONE_SRC_1 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), \ SWIZZLE_ONE, SWIZZLE_ONE, \ SWIZZLE_ONE, SWIZZLE_ONE, \ t_src_class(src[1].File), VSF_FLAG_NONE) | (src[1].RelAddr << 4)) -#define ONE_SRC_2 (MAKE_VSF_SOURCE(t_src_index(vp, &src[2]), \ +#define ONE_SRC_2 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[2]), \ SWIZZLE_ONE, SWIZZLE_ONE, \ SWIZZLE_ONE, SWIZZLE_ONE, \ t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4)) @@ -293,7 +293,7 @@ static unsigned long t_src(struct r300_vertex_program *vp, /* src->NegateBase uses the NEGATE_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ - return MAKE_VSF_SOURCE(t_src_index(vp, src), + return PVS_SOURCE_OPCODE(t_src_index(vp, src), t_swizzle(GET_SWZ(src->Swizzle, 0)), t_swizzle(GET_SWZ(src->Swizzle, 1)), t_swizzle(GET_SWZ(src->Swizzle, 2)), @@ -308,7 +308,7 @@ static unsigned long t_src_scalar(struct r300_vertex_program *vp, /* src->NegateBase uses the NEGATE_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ - return MAKE_VSF_SOURCE(t_src_index(vp, src), + return PVS_SOURCE_OPCODE(t_src_index(vp, src), t_swizzle(GET_SWZ(src->Swizzle, 0)), t_swizzle(GET_SWZ(src->Swizzle, 0)), t_swizzle(GET_SWZ(src->Swizzle, 0)), @@ -382,7 +382,7 @@ static GLuint *t_opcode_abs(struct r300_vertex_program *vp, inst[1] = t_src(vp, &src[0]); inst[2] = - MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), + PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), @@ -457,7 +457,7 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, t_dst_class(vpi->DstReg.File)); inst[1] = - MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), + PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), @@ -467,7 +467,7 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, (src[0].RelAddr << 4); inst[2] = - MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), + PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 0)), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), @@ -508,7 +508,7 @@ static GLuint *t_opcode_dph(struct r300_vertex_program *vp, t_dst_class(vpi->DstReg.File)); inst[1] = - MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), + PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), @@ -594,7 +594,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, inst[1] = t_src(vp, &src[0]); inst[2] = - MAKE_VSF_SOURCE(*u_temp_i, VSF_IN_COMPONENT_X, + PVS_SOURCE_OPCODE(*u_temp_i, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_W, VSF_IN_CLASS_TMP, /* Not 100% sure about this */ @@ -636,7 +636,7 @@ static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, t_dst_class(vpi->DstReg.File)); inst[1] = - MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), + PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), @@ -662,7 +662,7 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); /* NOTE: Users swizzling might not work. */ - inst[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w VSF_IN_COMPONENT_ZERO, // z t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y @@ -670,7 +670,7 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, src[0]. NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y + inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w VSF_IN_COMPONENT_ZERO, // z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x @@ -678,7 +678,7 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, src[0]. NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[3] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y + inst[3] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x VSF_IN_COMPONENT_ZERO, // z t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w @@ -918,7 +918,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, inst[1] = t_src(vp, &src[0]); inst[2] = ONE_SRC_0; inst[3] = - MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), + PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 0)), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), @@ -935,7 +935,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, inst[1] = t_src(vp, &src[0]); inst[2] = - MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), + PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 0)), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), @@ -996,7 +996,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); - inst[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w @@ -1005,7 +1005,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z + inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w @@ -1023,7 +1023,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w @@ -1032,7 +1032,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z + inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w @@ -1042,7 +1042,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[3] = - MAKE_VSF_SOURCE(*u_temp_i + 1, VSF_IN_COMPONENT_X, + PVS_SOURCE_OPCODE(*u_temp_i + 1, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_W, VSF_IN_CLASS_TMP, VSF_FLAG_NONE); @@ -1152,7 +1152,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, PVS_DST_REG_TEMPORARY); inst[1] = - MAKE_VSF_SOURCE(t_src_index + PVS_SOURCE_OPCODE(t_src_index (vp, &src[2]), SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, @@ -1180,7 +1180,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, PVS_DST_REG_TEMPORARY); inst[1] = - MAKE_VSF_SOURCE(t_src_index + PVS_SOURCE_OPCODE(t_src_index (vp, &src[0]), SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 64243927de..57682dcfba 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -42,7 +42,7 @@ #define VSF_IN_COMPONENT_ZERO 4 #define VSF_IN_COMPONENT_ONE 5 -#define MAKE_VSF_SOURCE(in_reg_index, comp_x, comp_y, comp_z, comp_w, class, negate) \ +#define PVS_SOURCE_OPCODE(in_reg_index, comp_x, comp_y, comp_z, comp_w, class, negate) \ ( ((in_reg_index)< Date: Wed, 27 Feb 2008 02:34:26 +0000 Subject: r300: Removed duplicate source register class defines. --- src/mesa/drivers/dri/r300/r300_state.c | 6 +++--- src/mesa/drivers/dri/r300/r300_vertprog.c | 18 +++++++++--------- src/mesa/drivers/dri/r300/r300_vertprog.h | 5 ----- 3 files changed, 12 insertions(+), 17 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index f6849b8f6e..64d3872470 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1668,21 +1668,21 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, VSF_IN_COMPONENT_W, - VSF_IN_CLASS_ATTR, VSF_FLAG_NONE); + PVS_SRC_REG_INPUT, VSF_FLAG_NONE); prog->program.body.i[program_end + 2] = PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, - VSF_IN_CLASS_ATTR, VSF_FLAG_NONE); + PVS_SRC_REG_INPUT, VSF_FLAG_NONE); prog->program.body.i[program_end + 3] = PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, VSF_IN_COMPONENT_ONE, - VSF_IN_CLASS_NONE, VSF_FLAG_NONE); + /* FIXME */ 0, VSF_FLAG_NONE); program_end += 4; } } diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 0f26e5ed5b..16955d7c0f 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -61,10 +61,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* TODO: Get rid of t_src_class call */ #define CMP_SRCS(a, b) ((a.RelAddr != b.RelAddr) || (a.Index != b.Index && \ - ((t_src_class(a.File) == VSF_IN_CLASS_PARAM && \ - t_src_class(b.File) == VSF_IN_CLASS_PARAM) || \ - (t_src_class(a.File) == VSF_IN_CLASS_ATTR && \ - t_src_class(b.File) == VSF_IN_CLASS_ATTR)))) \ + ((t_src_class(a.File) == PVS_SRC_REG_CONSTANT && \ + t_src_class(b.File) == PVS_SRC_REG_CONSTANT) || \ + (t_src_class(a.File) == PVS_SRC_REG_INPUT && \ + t_src_class(b.File) == PVS_SRC_REG_INPUT)))) \ #define ZERO_SRC_0 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), \ SWIZZLE_ZERO, SWIZZLE_ZERO, \ @@ -209,16 +209,16 @@ static unsigned long t_src_class(enum register_file file) switch (file) { case PROGRAM_TEMPORARY: - return VSF_IN_CLASS_TMP; + return PVS_SRC_REG_TEMPORARY; case PROGRAM_INPUT: - return VSF_IN_CLASS_ATTR; + return PVS_SRC_REG_INPUT; case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_NAMED_PARAM: case PROGRAM_STATE_VAR: - return VSF_IN_CLASS_PARAM; + return PVS_SRC_REG_CONSTANT; /* case PROGRAM_OUTPUT: case PROGRAM_WRITE_ONLY: @@ -596,7 +596,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, inst[2] = PVS_SOURCE_OPCODE(*u_temp_i, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, - VSF_IN_COMPONENT_W, VSF_IN_CLASS_TMP, + VSF_IN_COMPONENT_W, PVS_SRC_REG_TEMPORARY, /* Not 100% sure about this */ (!src[0]. NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE @@ -1044,7 +1044,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, inst[3] = PVS_SOURCE_OPCODE(*u_temp_i + 1, VSF_IN_COMPONENT_X, VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, - VSF_IN_COMPONENT_W, VSF_IN_CLASS_TMP, + VSF_IN_COMPONENT_W, PVS_SRC_REG_TEMPORARY, VSF_FLAG_NONE); return inst; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 57682dcfba..c0e418a936 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -30,11 +30,6 @@ /* according to Nikolai, the subsequent 3 DWORDs are sources, use same define for each */ -#define VSF_IN_CLASS_TMP 0 -#define VSF_IN_CLASS_ATTR 1 -#define VSF_IN_CLASS_PARAM 2 -#define VSF_IN_CLASS_NONE 9 - #define VSF_IN_COMPONENT_X 0 #define VSF_IN_COMPONENT_Y 1 #define VSF_IN_COMPONENT_Z 2 -- cgit v1.2.3 From e3a0a8dc7def2e154048d2c327896e99561b53e4 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Wed, 27 Feb 2008 03:15:53 +0000 Subject: r300: Removed duplicate component selection defines. --- src/mesa/drivers/dri/r300/r300_state.c | 24 +++++++++++----------- src/mesa/drivers/dri/r300/r300_vertprog.c | 33 ++++++++++--------------------- src/mesa/drivers/dri/r300/r300_vertprog.h | 7 ------- 3 files changed, 22 insertions(+), 42 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 64d3872470..f4d10d8e17 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1664,24 +1664,24 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) VSF_FLAG_ALL, PVS_DST_REG_OUT); prog->program.body.i[program_end + 1] = PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], - VSF_IN_COMPONENT_X, - VSF_IN_COMPONENT_Y, - VSF_IN_COMPONENT_Z, - VSF_IN_COMPONENT_W, + PVS_SRC_SELECT_X, + PVS_SRC_SELECT_Y, + PVS_SRC_SELECT_Z, + PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); prog->program.body.i[program_end + 2] = PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], - VSF_IN_COMPONENT_ONE, - VSF_IN_COMPONENT_ONE, - VSF_IN_COMPONENT_ONE, - VSF_IN_COMPONENT_ONE, + PVS_SRC_SELECT_FORCE_1, + PVS_SRC_SELECT_FORCE_1, + PVS_SRC_SELECT_FORCE_1, + PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); prog->program.body.i[program_end + 3] = PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], - VSF_IN_COMPONENT_ONE, - VSF_IN_COMPONENT_ONE, - VSF_IN_COMPONENT_ONE, - VSF_IN_COMPONENT_ONE, + PVS_SRC_SELECT_FORCE_1, + PVS_SRC_SELECT_FORCE_1, + PVS_SRC_SELECT_FORCE_1, + PVS_SRC_SELECT_FORCE_1, /* FIXME */ 0, VSF_FLAG_NONE); program_end += 4; } diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 16955d7c0f..e0946420a4 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -46,19 +46,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_context.h" -#if SWIZZLE_X != VSF_IN_COMPONENT_X || \ - SWIZZLE_Y != VSF_IN_COMPONENT_Y || \ - SWIZZLE_Z != VSF_IN_COMPONENT_Z || \ - SWIZZLE_W != VSF_IN_COMPONENT_W || \ - SWIZZLE_ZERO != VSF_IN_COMPONENT_ZERO || \ - SWIZZLE_ONE != VSF_IN_COMPONENT_ONE || \ - WRITEMASK_X != VSF_FLAG_X || \ - WRITEMASK_Y != VSF_FLAG_Y || \ - WRITEMASK_Z != VSF_FLAG_Z || \ - WRITEMASK_W != VSF_FLAG_W -#error Cannot change these! -#endif - /* TODO: Get rid of t_src_class call */ #define CMP_SRCS(a, b) ((a.RelAddr != b.RelAddr) || (a.Index != b.Index && \ ((t_src_class(a.File) == PVS_SRC_REG_CONSTANT && \ @@ -512,7 +499,7 @@ static GLuint *t_opcode_dph(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), - VSF_IN_COMPONENT_ONE, t_src_class(src[0].File), + PVS_SRC_SELECT_FORCE_1, t_src_class(src[0].File), src[0]. NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); @@ -594,9 +581,9 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, inst[1] = t_src(vp, &src[0]); inst[2] = - PVS_SOURCE_OPCODE(*u_temp_i, VSF_IN_COMPONENT_X, - VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, - VSF_IN_COMPONENT_W, PVS_SRC_REG_TEMPORARY, + PVS_SOURCE_OPCODE(*u_temp_i, PVS_SRC_SELECT_X, + PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, + PVS_SRC_SELECT_W, PVS_SRC_REG_TEMPORARY, /* Not 100% sure about this */ (!src[0]. NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE @@ -664,7 +651,7 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, /* NOTE: Users swizzling might not work. */ inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w - VSF_IN_COMPONENT_ZERO, // z + PVS_SRC_SELECT_FORCE_0, // z t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y t_src_class(src[0].File), src[0]. @@ -672,7 +659,7 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w - VSF_IN_COMPONENT_ZERO, // z + PVS_SRC_SELECT_FORCE_0, // z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x t_src_class(src[0].File), src[0]. @@ -680,7 +667,7 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[3] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x - VSF_IN_COMPONENT_ZERO, // z + PVS_SRC_SELECT_FORCE_0, // z t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w t_src_class(src[0].File), src[0]. @@ -1042,9 +1029,9 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[3] = - PVS_SOURCE_OPCODE(*u_temp_i + 1, VSF_IN_COMPONENT_X, - VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z, - VSF_IN_COMPONENT_W, PVS_SRC_REG_TEMPORARY, + PVS_SOURCE_OPCODE(*u_temp_i + 1, PVS_SRC_SELECT_X, + PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, + PVS_SRC_SELECT_W, PVS_SRC_REG_TEMPORARY, VSF_FLAG_NONE); return inst; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index c0e418a936..462f655c00 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -30,13 +30,6 @@ /* according to Nikolai, the subsequent 3 DWORDs are sources, use same define for each */ -#define VSF_IN_COMPONENT_X 0 -#define VSF_IN_COMPONENT_Y 1 -#define VSF_IN_COMPONENT_Z 2 -#define VSF_IN_COMPONENT_W 3 -#define VSF_IN_COMPONENT_ZERO 4 -#define VSF_IN_COMPONENT_ONE 5 - #define PVS_SOURCE_OPCODE(in_reg_index, comp_x, comp_y, comp_z, comp_w, class, negate) \ ( ((in_reg_index)< Date: Wed, 27 Feb 2008 04:23:11 +0000 Subject: r300: Cleaned up the vertex program macros. --- src/mesa/drivers/dri/r300/r300_vertprog.h | 57 +++++++++++++------------------ 1 file changed, 24 insertions(+), 33 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 462f655c00..b8dc5a5ad6 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -3,6 +3,30 @@ #include "r300_reg.h" +#define PVS_VECTOR_OPCODE(op, out_reg_index, out_reg_fields, class) \ + ((op) \ + | ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ + | ((out_reg_fields) << 20) \ + | ((class) << 8)) + +#define PVS_MATH_OPCODE(op, out_reg_index, out_reg_fields, class) \ + ((op) \ + | (1 << 6) /* FIXME: PVS_DST_MATH_INST */ \ + | ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ + | ((out_reg_fields) << 20) \ + | ((class) << 8)) + +#define PVS_SOURCE_OPCODE(in_reg_index, comp_x, comp_y, comp_z, comp_w, class, negate) \ + (((in_reg_index) << R300_VPI_IN_REG_INDEX_SHIFT) \ + | ((comp_x) << R300_VPI_IN_X_SHIFT) \ + | ((comp_y) << R300_VPI_IN_Y_SHIFT) \ + | ((comp_z) << R300_VPI_IN_Z_SHIFT) \ + | ((comp_w) << R300_VPI_IN_W_SHIFT) \ + | ((negate) << 25) \ + | ((class))) + +#if 1 + #define VSF_FLAG_X 1 #define VSF_FLAG_Y 2 #define VSF_FLAG_Z 4 @@ -11,39 +35,6 @@ #define VSF_FLAG_ALL 0xf #define VSF_FLAG_NONE 0 -/* first DWORD of an instruction */ - -#define PVS_VECTOR_OPCODE(op, out_reg_index, out_reg_fields, class) \ - ((op) \ - | ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ - | ((out_reg_fields) << 20) \ - | ( (class) << 8 ) ) - -#define PVS_DST_MATH_INST (1 << 6) - -#define PVS_MATH_OPCODE(op, out_reg_index, out_reg_fields, class) \ - ((op) \ - | PVS_DST_MATH_INST \ - | ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ - | ((out_reg_fields) << 20) \ - | ( (class) << 8 ) ) - -/* according to Nikolai, the subsequent 3 DWORDs are sources, use same define for each */ - -#define PVS_SOURCE_OPCODE(in_reg_index, comp_x, comp_y, comp_z, comp_w, class, negate) \ - ( ((in_reg_index)< Date: Wed, 27 Feb 2008 12:36:33 +0000 Subject: r300: Renamed some misleading macro arguments. --- src/mesa/drivers/dri/r300/r300_vertprog.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index b8dc5a5ad6..aa25418efe 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -3,27 +3,27 @@ #include "r300_reg.h" -#define PVS_VECTOR_OPCODE(op, out_reg_index, out_reg_fields, class) \ - ((op) \ - | ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ - | ((out_reg_fields) << 20) \ - | ((class) << 8)) +#define PVS_VECTOR_OPCODE(opcode, reg_index, reg_writemask, reg_class) \ + ((opcode) \ + | ((reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ + | ((reg_writemask) << 20) \ + | ((reg_class) << 8)) -#define PVS_MATH_OPCODE(op, out_reg_index, out_reg_fields, class) \ - ((op) \ +#define PVS_MATH_OPCODE(opcode, reg_index, reg_writemask, reg_class) \ + ((opcode) \ | (1 << 6) /* FIXME: PVS_DST_MATH_INST */ \ - | ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ - | ((out_reg_fields) << 20) \ - | ((class) << 8)) + | ((reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ + | ((reg_writemask) << 20) \ + | ((reg_class) << 8)) -#define PVS_SOURCE_OPCODE(in_reg_index, comp_x, comp_y, comp_z, comp_w, class, negate) \ +#define PVS_SOURCE_OPCODE(in_reg_index, comp_x, comp_y, comp_z, comp_w, reg_class, negate) \ (((in_reg_index) << R300_VPI_IN_REG_INDEX_SHIFT) \ | ((comp_x) << R300_VPI_IN_X_SHIFT) \ | ((comp_y) << R300_VPI_IN_Y_SHIFT) \ | ((comp_z) << R300_VPI_IN_Z_SHIFT) \ | ((comp_w) << R300_VPI_IN_W_SHIFT) \ | ((negate) << 25) \ - | ((class))) + | ((reg_class))) #if 1 @@ -57,9 +57,9 @@ (PVS_DST_REG_##outclass << 8) | \ VP_OUTMASK_##outmask) -#define VP_IN(class,idx) \ - (((idx) << R300_VPI_IN_REG_INDEX_SHIFT) | \ - (PVS_SRC_REG_##class << 0) | \ +#define VP_IN(inclass,inidx) \ + (((inidx) << R300_VPI_IN_REG_INDEX_SHIFT) | \ + (PVS_SRC_REG_##inclass << 0) | \ (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) | \ -- cgit v1.2.3 From 7e1878cdadcc98b18f926bb600dac10f0904327d Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 09:16:48 +0000 Subject: r300: Cleaned up the MAD/MAD_2 opcode selection. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 61 ++++++++++++++++++------------- 1 file changed, 36 insertions(+), 25 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index e0946420a4..3b86f66dc8 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -390,10 +390,12 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, unsigned long hw_op; #if 1 - hw_op = (src[0].File == PROGRAM_TEMPORARY - && src[1].File == - PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - VE_MULTIPLY_ADD; + if (src[0].File == PROGRAM_TEMPORARY + && src[1].File == PROGRAM_TEMPORARY) { + hw_op = R300_VPI_OUT_OP_MAD_2; + } else { + hw_op = VE_MULTIPLY_ADD; + } inst[0] = PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -699,11 +701,12 @@ static GLuint *t_opcode_mad(struct r300_vertex_program *vp, { unsigned long hw_op; - hw_op = (src[0].File == PROGRAM_TEMPORARY - && src[1].File == PROGRAM_TEMPORARY - && src[2].File == - PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - VE_MULTIPLY_ADD; + if (src[0].File == PROGRAM_TEMPORARY + && src[1].File == PROGRAM_TEMPORARY) { + hw_op = R300_VPI_OUT_OP_MAD_2; + } else { + hw_op = VE_MULTIPLY_ADD; + } inst[0] = PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -763,10 +766,12 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; #else - hw_op = - (src[0].File == - PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - VE_MULTIPLY_ADD; + if (src[0].File == PROGRAM_TEMPORARY + && src[1].File == PROGRAM_TEMPORARY) { + hw_op = R300_VPI_OUT_OP_MAD_2; + } else { + hw_op = VE_MULTIPLY_ADD; + } inst[0] = PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -788,10 +793,12 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, // HW mul can take third arg but appears to have some other limitations. - hw_op = (src[0].File == PROGRAM_TEMPORARY - && src[1].File == - PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - VE_MULTIPLY_ADD; + if (src[0].File == PROGRAM_TEMPORARY + && src[1].File == PROGRAM_TEMPORARY) { + hw_op = R300_VPI_OUT_OP_MAD_2; + } else { + hw_op = VE_MULTIPLY_ADD; + } inst[0] = PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -893,10 +900,12 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, //ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W #if 1 - hw_op = (src[0].File == PROGRAM_TEMPORARY - && src[1].File == - PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - VE_MULTIPLY_ADD; + if (src[0].File == PROGRAM_TEMPORARY + && src[1].File == PROGRAM_TEMPORARY) { + hw_op = R300_VPI_OUT_OP_MAD_2; + } else { + hw_op = VE_MULTIPLY_ADD; + } inst[0] = PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -952,10 +961,12 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; #else - hw_op = - (src[0].File == - PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - VE_MULTIPLY_ADD; + if (src[0].File == PROGRAM_TEMPORARY + && src[1].File == PROGRAM_TEMPORARY) { + hw_op = R300_VPI_OUT_OP_MAD_2; + } else { + hw_op = VE_MULTIPLY_ADD; + } inst[0] = PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), -- cgit v1.2.3 From 7504981074c43f057176ffc6cc54754fae903a98 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 09:27:15 +0000 Subject: r300: Removed the (undocumented) MAD_2 opcode. This opcode is likely a mistake from reverse engineering. MAD_2 isn't included in AMD's documentation, and my testing reviles there is no problem using the documented MAD opcode. --- src/mesa/drivers/dri/r300/r300_reg.h | 3 -- src/mesa/drivers/dri/r300/r300_vertprog.c | 67 +++---------------------------- 2 files changed, 6 insertions(+), 64 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 70ccab50af..83af3b72e8 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2508,9 +2508,6 @@ enum { /*\{*/ -/* FIXME */ -#define R300_VPI_OUT_OP_MAD_2 (128 << 0) - #define R300_VPI_OUT_REG_INDEX_SHIFT 13 /* GUESS based on fglrx native limits */ #define R300_VPI_OUT_REG_INDEX_MASK (31 << 13) diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 3b86f66dc8..1b76d4bae2 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -387,18 +387,9 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - unsigned long hw_op; - #if 1 - if (src[0].File == PROGRAM_TEMPORARY - && src[1].File == PROGRAM_TEMPORARY) { - hw_op = R300_VPI_OUT_OP_MAD_2; - } else { - hw_op = VE_MULTIPLY_ADD; - } - inst[0] = - PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = ONE_SRC_0; @@ -412,7 +403,6 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; - #endif return inst; @@ -699,17 +689,8 @@ static GLuint *t_opcode_mad(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - unsigned long hw_op; - - if (src[0].File == PROGRAM_TEMPORARY - && src[1].File == PROGRAM_TEMPORARY) { - hw_op = R300_VPI_OUT_OP_MAD_2; - } else { - hw_op = VE_MULTIPLY_ADD; - } - inst[0] = - PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -766,15 +747,8 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; #else - if (src[0].File == PROGRAM_TEMPORARY - && src[1].File == PROGRAM_TEMPORARY) { - hw_op = R300_VPI_OUT_OP_MAD_2; - } else { - hw_op = VE_MULTIPLY_ADD; - } - inst[0] = - PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -789,19 +763,8 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - unsigned long hw_op; - - // HW mul can take third arg but appears to have some other limitations. - - if (src[0].File == PROGRAM_TEMPORARY - && src[1].File == PROGRAM_TEMPORARY) { - hw_op = R300_VPI_OUT_OP_MAD_2; - } else { - hw_op = VE_MULTIPLY_ADD; - } - inst[0] = - PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -895,20 +858,10 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - unsigned long hw_op; - //ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W - #if 1 - if (src[0].File == PROGRAM_TEMPORARY - && src[1].File == PROGRAM_TEMPORARY) { - hw_op = R300_VPI_OUT_OP_MAD_2; - } else { - hw_op = VE_MULTIPLY_ADD; - } - inst[0] = - PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -961,15 +914,8 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; #else - if (src[0].File == PROGRAM_TEMPORARY - && src[1].File == PROGRAM_TEMPORARY) { - hw_op = R300_VPI_OUT_OP_MAD_2; - } else { - hw_op = VE_MULTIPLY_ADD; - } - inst[0] = - PVS_VECTOR_OPCODE(hw_op, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -986,7 +932,6 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, { /* mul r0, r1.yzxw, r2.zxyw mad r0, -r2.yzxw, r1.zxyw, r0 - NOTE: might need MAD_2 */ inst[0] = -- cgit v1.2.3 From dda906fcdbc2c1daa6de12873998290a1486138e Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 09:39:09 +0000 Subject: r300: Prefer to use the VE_ADD for simple MOV style opcodes. The VE_MULTIPLY_ADD has further restrictions on reading temporary memory which may complicate things. See AMD's documentation. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 1b76d4bae2..4c7cafe9bf 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -387,15 +387,6 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { -#if 1 - inst[0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); - inst[1] = ONE_SRC_0; - inst[2] = t_src(vp, &src[0]); - inst[3] = t_src(vp, &src[1]); -#else inst[0] = PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), @@ -403,7 +394,6 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; -#endif return inst; } @@ -738,7 +728,6 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} -#if 1 inst[0] = PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), @@ -746,15 +735,6 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; -#else - inst[0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); - inst[2] = ONE_SRC_0; - inst[3] = ZERO_SRC_0; -#endif return inst; } @@ -905,7 +885,6 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} -#if 1 inst[0] = PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), @@ -913,15 +892,6 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; -#else - inst[0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); - inst[2] = ONE_SRC_0; - inst[3] = ZERO_SRC_0; -#endif return inst; } -- cgit v1.2.3 From b795e8db5f994f5bb6eabfe72ddc3f52e5bbc9f9 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 09:41:47 +0000 Subject: r300: Cleaned up extra white space. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 33 ------------------------------- 1 file changed, 33 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 4c7cafe9bf..05176e14ce 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -366,7 +366,6 @@ static GLuint *t_opcode_abs(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), @@ -406,7 +405,6 @@ static GLuint *t_opcode_arl(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_FLT2FIX_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -424,7 +422,6 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), @@ -434,7 +431,6 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, src[0]. NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 0)), @@ -444,7 +440,6 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, src[1]. NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[3] = ZERO_SRC_1; return inst; @@ -475,7 +470,6 @@ static GLuint *t_opcode_dph(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), @@ -499,7 +493,6 @@ static GLuint *t_opcode_dst(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_DISTANCE_VECTOR, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -515,7 +508,6 @@ static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, PVS_MATH_OPCODE(ME_EXP_BASE2_FULL_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -531,7 +523,6 @@ static GLuint *t_opcode_exp(struct r300_vertex_program *vp, PVS_MATH_OPCODE(ME_EXP_BASE2_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -550,7 +541,6 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_FRACTION, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); - inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -560,7 +550,6 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); inst[2] = PVS_SOURCE_OPCODE(*u_temp_i, PVS_SRC_SELECT_X, @@ -570,7 +559,6 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, (!src[0]. NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE /*VSF_FLAG_ALL */ ); - inst[3] = ZERO_SRC_0; (*u_temp_i)--; @@ -585,7 +573,6 @@ static GLuint *t_opcode_frc(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_FRACTION, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -603,7 +590,6 @@ static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, PVS_MATH_OPCODE(ME_LOG_BASE2_FULL_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), @@ -667,7 +653,6 @@ static GLuint *t_opcode_log(struct r300_vertex_program *vp, PVS_MATH_OPCODE(ME_LOG_BASE2_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -698,7 +683,6 @@ static GLuint *t_opcode_max(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -714,7 +698,6 @@ static GLuint *t_opcode_min(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_MINIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -749,7 +732,6 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = ZERO_SRC_1; return inst; @@ -778,7 +760,6 @@ static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, PVS_MATH_OPCODE(ME_RECIP_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -794,7 +775,6 @@ static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, PVS_MATH_OPCODE(ME_RECIP_SQRT_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -810,7 +790,6 @@ static GLuint *t_opcode_sge(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_SET_GREATER_THAN_EQUAL, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -826,7 +805,6 @@ static GLuint *t_opcode_slt(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_SET_LESS_THAN, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -861,7 +839,6 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), @@ -908,7 +885,6 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x @@ -917,7 +893,6 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, src[0]. NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y @@ -926,7 +901,6 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, src[1]. NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[3] = ZERO_SRC_1; inst += 4; (*u_temp_i)--; @@ -935,7 +909,6 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x @@ -944,7 +917,6 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, (!src[1]. NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y @@ -953,7 +925,6 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, src[0]. NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[3] = PVS_SOURCE_OPCODE(*u_temp_i + 1, PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, @@ -1063,7 +1034,6 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_ADD, u_temp_i, VSF_FLAG_ALL, PVS_DST_REG_TEMPORARY); - inst[1] = PVS_SOURCE_OPCODE(t_src_index (vp, &src[2]), @@ -1073,7 +1043,6 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, File), VSF_FLAG_NONE) | (src[2].RelAddr << 4); - inst[2] = ZERO_SRC_2; inst[3] = ZERO_SRC_2; inst += 4; @@ -1091,7 +1060,6 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, PVS_VECTOR_OPCODE(VE_ADD, u_temp_i, VSF_FLAG_ALL, PVS_DST_REG_TEMPORARY); - inst[1] = PVS_SOURCE_OPCODE(t_src_index (vp, &src[0]), @@ -1101,7 +1069,6 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, File), VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; inst += 4; -- cgit v1.2.3 From f80223d9ffac6c2c3a94ab7f896dad6a04da5c8b Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 09:53:29 +0000 Subject: r300: Cleaned up the XPD opcode temporary register usage. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 05176e14ce..563b02b7a5 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -903,7 +903,6 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, VSF_FLAG_NONE) | (src[1].RelAddr << 4); inst[3] = ZERO_SRC_1; inst += 4; - (*u_temp_i)--; inst[0] = PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), @@ -926,11 +925,13 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[3] = - PVS_SOURCE_OPCODE(*u_temp_i + 1, PVS_SRC_SELECT_X, + PVS_SOURCE_OPCODE(*u_temp_i, PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, PVS_SRC_REG_TEMPORARY, VSF_FLAG_NONE); + (*u_temp_i)--; + return inst; } -- cgit v1.2.3 From a6d772ed16eddda85bae59e28eaab0d46debc30f Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 10:04:54 +0000 Subject: r300: Use the VE_MULTIPLY hardware opcode for the MUL opcode. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 563b02b7a5..9c733597af 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -727,7 +727,7 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), + PVS_VECTOR_OPCODE(VE_MULTIPLY, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); -- cgit v1.2.3 From 2a8b6c62a7a2c807dc1b4a515da62fc8918101c1 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 10:09:02 +0000 Subject: r300: Use the VE_ADD hardware opcode for the SUB opcode. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 9c733597af..bbe42afa25 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -817,24 +817,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_src_register src[3]) { //ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W -#if 1 - inst[0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); - inst[1] = t_src(vp, &src[0]); - inst[2] = ONE_SRC_0; - inst[3] = - PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), - t_swizzle(GET_SWZ(src[1].Swizzle, 0)), - t_swizzle(GET_SWZ(src[1].Swizzle, 1)), - t_swizzle(GET_SWZ(src[1].Swizzle, 2)), - t_swizzle(GET_SWZ(src[1].Swizzle, 3)), - t_src_class(src[1].File), - (!src[1]. - NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | - (src[1].RelAddr << 4); -#else + inst[0] = PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), @@ -851,7 +834,6 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); inst[3] = 0; -#endif return inst; } -- cgit v1.2.3 From bbab0f97b83b07184bc7c5a736292c8558903855 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 10:13:29 +0000 Subject: r300: Added a TODO comment for the MAD opcodes. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index bbe42afa25..35fa3daa98 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -32,6 +32,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * * \author Oliver McFadden * + * \todo A VE_MULTIPLY_ADD or VE_MULTIPLYX2_ADD opcode with all 3 source + * operands using unique PVS_REG_TEMPORARY vector addresses requires special + * handling, which is currently not implemented! + * * For a description of the vertex program instruction set see r300_reg.h. */ -- cgit v1.2.3 From 5dcbdc09f354d96cef93a28215f7776a5e84dd1f Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 10:25:58 +0000 Subject: r300: Moved the PREFER_DP4 define near the position invariant function. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 35fa3daa98..b9f6d28357 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -87,9 +87,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. SWIZZLE_ONE, SWIZZLE_ONE, \ t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4)) -/* DP4 version seems to trigger some hw peculiarity */ -//#define PREFER_DP4 - #define FREE_TEMPS() \ do { \ int u_temp_used = (VSF_MAX_FRAGMENT_TEMPS - 1) - u_temp_i; \ @@ -1185,6 +1182,9 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, #endif } +/* DP4 version seems to trigger some hw peculiarity */ +//#define PREFER_DP4 + static void position_invariant(struct gl_program *prog) { struct prog_instruction *vpi; -- cgit v1.2.3 From 038e13b1ee04fe97191409b64c337f7bbe176b22 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 11:07:08 +0000 Subject: r300: Indented the vertex program code with longer lines. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 766 ++++++++++++------------------ 1 file changed, 304 insertions(+), 462 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index b9f6d28357..e0d81d0795 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -97,9 +97,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. u_temp_i=VSF_MAX_FRAGMENT_TEMPS-1; \ } while (0) -int r300VertexProgUpdateParams(GLcontext * ctx, - struct r300_vertex_program_cont *vp, - float *dst) +int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_program_cont *vp, float *dst) { int pi; struct gl_vertex_program *mesa_vp = &vp->mesa_program; @@ -121,8 +119,7 @@ int r300VertexProgUpdateParams(GLcontext * ctx, assert(mesa_vp->Base.Parameters); _mesa_load_state_parameters(ctx, mesa_vp->Base.Parameters); - if (mesa_vp->Base.Parameters->NumParameters * 4 > - VSF_MAX_FRAGMENT_LENGTH) { + if (mesa_vp->Base.Parameters->NumParameters * 4 > VSF_MAX_FRAGMENT_LENGTH) { fprintf(stderr, "%s:Params exhausted\n", __FUNCTION__); _mesa_exit(-1); } @@ -130,7 +127,6 @@ int r300VertexProgUpdateParams(GLcontext * ctx, paramList = mesa_vp->Base.Parameters; for (pi = 0; pi < paramList->NumParameters; pi++) { switch (paramList->Parameters[pi].Type) { - case PROGRAM_STATE_VAR: case PROGRAM_NAMED_PARAM: //fprintf(stderr, "%s", vp->Parameters->Parameters[pi].Name); @@ -140,10 +136,8 @@ int r300VertexProgUpdateParams(GLcontext * ctx, *dst++ = paramList->ParameterValues[pi][2]; *dst++ = paramList->ParameterValues[pi][3]; break; - default: - _mesa_problem(NULL, "Bad param type in %s", - __FUNCTION__); + _mesa_problem(NULL, "Bad param type in %s", __FUNCTION__); } } @@ -183,8 +177,7 @@ static unsigned long t_dst_class(enum register_file file) } } -static unsigned long t_dst_index(struct r300_vertex_program *vp, - struct prog_dst_register *dst) +static unsigned long t_dst_index(struct r300_vertex_program *vp, struct prog_dst_register *dst) { if (dst->File == PROGRAM_OUTPUT) return vp->outputs[dst->Index]; @@ -194,14 +187,11 @@ static unsigned long t_dst_index(struct r300_vertex_program *vp, static unsigned long t_src_class(enum register_file file) { - switch (file) { case PROGRAM_TEMPORARY: return PVS_SRC_REG_TEMPORARY; - case PROGRAM_INPUT: return PVS_SRC_REG_INPUT; - case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_NAMED_PARAM: @@ -231,8 +221,7 @@ static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller) int i; if (vp == NULL) { - fprintf(stderr, "vp null in call to %s from %s\n", - __FUNCTION__, caller); + fprintf(stderr, "vp null in call to %s from %s\n", __FUNCTION__, caller); return; } @@ -244,8 +233,7 @@ static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller) } #endif -static unsigned long t_src_index(struct r300_vertex_program *vp, - struct prog_src_register *src) +static unsigned long t_src_index(struct r300_vertex_program *vp, struct prog_src_register *src) { int i; int max_reg = -1; @@ -265,8 +253,7 @@ static unsigned long t_src_index(struct r300_vertex_program *vp, return vp->inputs[src->Index]; } else { if (src->Index < 0) { - fprintf(stderr, - "negative offsets for indirect addressing do not work.\n"); + fprintf(stderr, "negative offsets for indirect addressing do not work.\n"); return 0; } return src->Index; @@ -275,40 +262,35 @@ static unsigned long t_src_index(struct r300_vertex_program *vp, /* these two functions should probably be merged... */ -static unsigned long t_src(struct r300_vertex_program *vp, - struct prog_src_register *src) +static unsigned long t_src(struct r300_vertex_program *vp, struct prog_src_register *src) { /* src->NegateBase uses the NEGATE_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ return PVS_SOURCE_OPCODE(t_src_index(vp, src), - t_swizzle(GET_SWZ(src->Swizzle, 0)), - t_swizzle(GET_SWZ(src->Swizzle, 1)), - t_swizzle(GET_SWZ(src->Swizzle, 2)), - t_swizzle(GET_SWZ(src->Swizzle, 3)), - t_src_class(src->File), - src->NegateBase) | (src->RelAddr << 4); + t_swizzle(GET_SWZ(src->Swizzle, 0)), + t_swizzle(GET_SWZ(src->Swizzle, 1)), + t_swizzle(GET_SWZ(src->Swizzle, 2)), + t_swizzle(GET_SWZ(src->Swizzle, 3)), + t_src_class(src->File), + src->NegateBase) | (src->RelAddr << 4); } -static unsigned long t_src_scalar(struct r300_vertex_program *vp, - struct prog_src_register *src) +static unsigned long t_src_scalar(struct r300_vertex_program *vp, struct prog_src_register *src) { /* src->NegateBase uses the NEGATE_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ return PVS_SOURCE_OPCODE(t_src_index(vp, src), - t_swizzle(GET_SWZ(src->Swizzle, 0)), - t_swizzle(GET_SWZ(src->Swizzle, 0)), - t_swizzle(GET_SWZ(src->Swizzle, 0)), - t_swizzle(GET_SWZ(src->Swizzle, 0)), - t_src_class(src->File), - src-> - NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | - (src->RelAddr << 4); + t_swizzle(GET_SWZ(src->Swizzle, 0)), + t_swizzle(GET_SWZ(src->Swizzle, 0)), + t_swizzle(GET_SWZ(src->Swizzle, 0)), + t_swizzle(GET_SWZ(src->Swizzle, 0)), + t_src_class(src->File), + src->NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src->RelAddr << 4); } -static GLboolean valid_dst(struct r300_vertex_program *vp, - struct prog_dst_register *dst) +static GLboolean valid_dst(struct r300_vertex_program *vp, struct prog_dst_register *dst) { if (dst->File == PROGRAM_OUTPUT && vp->outputs[dst->Index] == -1) { return GL_FALSE; @@ -319,78 +301,33 @@ static GLboolean valid_dst(struct r300_vertex_program *vp, return GL_TRUE; } -/* - * Instruction Inputs Output Description - * ----------- ------ ------ -------------------------------- - * ABS v v absolute value - * ADD v,v v add - * ARL s a address register load - * DP3 v,v ssss 3-component dot product - * DP4 v,v ssss 4-component dot product - * DPH v,v ssss homogeneous dot product - * DST v,v v distance vector - * EX2 s ssss exponential base 2 - * EXP s v exponential base 2 (approximate) - * FLR v v floor - * FRC v v fraction - * LG2 s ssss logarithm base 2 - * LIT v v compute light coefficients - * LOG s v logarithm base 2 (approximate) - * MAD v,v,v v multiply and add - * MAX v,v v maximum - * MIN v,v v minimum - * MOV v v move - * MUL v,v v multiply - * POW s,s ssss exponentiate - * RCP s ssss reciprocal - * RSQ s ssss reciprocal square root - * SGE v,v v set on greater than or equal - * SLT v,v v set on less than - * SUB v,v v subtract - * SWZ v v extended swizzle - * XPD v,v v cross product - * - * Table X.5: Summary of vertex program instructions. "v" indicates a - * floating-point vector input or output, "s" indicates a floating-point - * scalar input, "ssss" indicates a scalar output replicated across a - * 4-component result vector, and "a" indicates a single address register - * component. - */ - -static GLuint *t_opcode_abs(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_abs(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W - inst[0] = - PVS_VECTOR_OPCODE(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_MAXIMUM, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = - PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), - t_swizzle(GET_SWZ(src[0].Swizzle, 2)), - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), - t_src_class(src[0].File), - (!src[0]. - NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | - (src[0].RelAddr << 4); + inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), + t_swizzle(GET_SWZ(src[0].Swizzle, 2)), + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), + t_src_class(src[0].File), + (!src[0].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[3] = 0; return inst; } -static GLuint *t_opcode_add(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_add(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_ADD, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -398,14 +335,12 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_arl(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_arl(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_FLT2FIX_DX, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_FLT2FIX_DX, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -413,48 +348,39 @@ static GLuint *t_opcode_arl(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO} - inst[0] = - PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); - inst[1] = - PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), - t_swizzle(GET_SWZ(src[0].Swizzle, 2)), - SWIZZLE_ZERO, t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | - (src[0].RelAddr << 4); - inst[2] = - PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), - t_swizzle(GET_SWZ(src[1].Swizzle, 0)), - t_swizzle(GET_SWZ(src[1].Swizzle, 1)), - t_swizzle(GET_SWZ(src[1].Swizzle, 2)), - SWIZZLE_ZERO, t_src_class(src[1].File), - src[1]. - NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | - (src[1].RelAddr << 4); + inst[0] = PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), + t_swizzle(GET_SWZ(src[0].Swizzle, 2)), + SWIZZLE_ZERO, + t_src_class(src[0].File), + src[0].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), + t_swizzle(GET_SWZ(src[1].Swizzle, 0)), + t_swizzle(GET_SWZ(src[1].Swizzle, 1)), + t_swizzle(GET_SWZ(src[1].Swizzle, 2)), + SWIZZLE_ZERO, + t_src_class(src[1].File), + src[1].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[1].RelAddr << 4); inst[3] = ZERO_SRC_1; return inst; } -static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); - + inst[0] = PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -462,38 +388,32 @@ static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_dph(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_dph(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W} - inst[0] = - PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); - inst[1] = - PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), - t_swizzle(GET_SWZ(src[0].Swizzle, 2)), - PVS_SRC_SELECT_FORCE_1, t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | - (src[0].RelAddr << 4); + inst[0] = PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), + t_swizzle(GET_SWZ(src[0].Swizzle, 2)), + PVS_SRC_SELECT_FORCE_1, + t_src_class(src[0].File), + src[0].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; return inst; } -static GLuint *t_opcode_dst(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_DISTANCE_VECTOR, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_DISTANCE_VECTOR, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -501,14 +421,9 @@ static GLuint *t_opcode_dst(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_MATH_OPCODE(ME_EXP_BASE2_FULL_DX, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_MATH_OPCODE(ME_EXP_BASE2_FULL_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -516,14 +431,9 @@ static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_exp(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_exp(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_MATH_OPCODE(ME_EXP_BASE2_DX, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_MATH_OPCODE(ME_EXP_BASE2_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -531,49 +441,46 @@ static GLuint *t_opcode_exp(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_flr(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3], int *u_temp_i) +static GLuint *t_opcode_flr(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3], int *u_temp_i) { /* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W} ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */ - inst[0] = - PVS_VECTOR_OPCODE(VE_FRACTION, *u_temp_i, - t_dst_mask(vpi->DstReg.WriteMask), - PVS_DST_REG_TEMPORARY); + inst[0] = PVS_VECTOR_OPCODE(VE_FRACTION, + *u_temp_i, + t_dst_mask(vpi->DstReg.WriteMask), + PVS_DST_REG_TEMPORARY); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; inst += 4; - inst[0] = - PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_ADD, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = - PVS_SOURCE_OPCODE(*u_temp_i, PVS_SRC_SELECT_X, - PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, - PVS_SRC_SELECT_W, PVS_SRC_REG_TEMPORARY, - /* Not 100% sure about this */ - (!src[0]. - NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE - /*VSF_FLAG_ALL */ ); + inst[2] = PVS_SOURCE_OPCODE(*u_temp_i, + PVS_SRC_SELECT_X, + PVS_SRC_SELECT_Y, + PVS_SRC_SELECT_Z, + PVS_SRC_SELECT_W, + PVS_SRC_REG_TEMPORARY, + /* Not 100% sure about this */ + (!src[0].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE + /*VSF_FLAG_ALL */ ); inst[3] = ZERO_SRC_0; (*u_temp_i)--; return inst; } -static GLuint *t_opcode_frc(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_frc(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_FRACTION, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_FRACTION, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -581,79 +488,64 @@ static GLuint *t_opcode_frc(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { // LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X} - inst[0] = - PVS_MATH_OPCODE(ME_LOG_BASE2_FULL_DX, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); - inst[1] = - PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | - (src[0].RelAddr << 4); + inst[0] = PVS_MATH_OPCODE(ME_LOG_BASE2_FULL_DX, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_src_class(src[0].File), + src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; return inst; } -static GLuint *t_opcode_lit(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_lit(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W} - inst[0] = - PVS_MATH_OPCODE(ME_LIGHT_COEFF_DX, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_MATH_OPCODE(ME_LIGHT_COEFF_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); /* NOTE: Users swizzling might not work. */ - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w - PVS_SRC_SELECT_FORCE_0, // z - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y - t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : - VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w - PVS_SRC_SELECT_FORCE_0, // z - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x - t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : - VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[3] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x - PVS_SRC_SELECT_FORCE_0, // z - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w - t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : - VSF_FLAG_NONE) | (src[0].RelAddr << 4); + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W + PVS_SRC_SELECT_FORCE_0, // Z + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y + t_src_class(src[0].File), + src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W + PVS_SRC_SELECT_FORCE_0, // Z + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X + t_src_class(src[0].File), + src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + inst[3] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X + PVS_SRC_SELECT_FORCE_0, // Z + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W + t_src_class(src[0].File), + src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); return inst; } -static GLuint *t_opcode_log(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_log(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_MATH_OPCODE(ME_LOG_BASE2_DX, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_MATH_OPCODE(ME_LOG_BASE2_DX, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -661,14 +553,12 @@ static GLuint *t_opcode_log(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_mad(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_mad(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = t_src(vp, &src[2]); @@ -676,14 +566,12 @@ static GLuint *t_opcode_mad(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_max(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_MAXIMUM, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -691,14 +579,12 @@ static GLuint *t_opcode_max(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_min(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_min(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_MINIMUM, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_MINIMUM, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -706,16 +592,14 @@ static GLuint *t_opcode_min(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_mov(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_mov(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} - inst[0] = - PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_ADD, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -723,14 +607,12 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_mul(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_mul(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_MULTIPLY, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -738,14 +620,12 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_pow(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_pow(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_MATH_OPCODE(ME_POWER_FUNC_FF, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_MATH_OPCODE(ME_POWER_FUNC_FF, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = t_src_scalar(vp, &src[1]); @@ -753,14 +633,12 @@ static GLuint *t_opcode_pow(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_MATH_OPCODE(ME_RECIP_DX, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_MATH_OPCODE(ME_RECIP_DX, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -768,14 +646,12 @@ static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_MATH_OPCODE(ME_RECIP_SQRT_DX, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_MATH_OPCODE(ME_RECIP_SQRT_DX, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -783,14 +659,12 @@ static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_sge(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_SET_GREATER_THAN_EQUAL, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_SET_GREATER_THAN_EQUAL, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -798,14 +672,12 @@ static GLuint *t_opcode_sge(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_slt(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_slt(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = - PVS_VECTOR_OPCODE(VE_SET_LESS_THAN, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_SET_LESS_THAN, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -813,42 +685,35 @@ static GLuint *t_opcode_slt(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_sub(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W - inst[0] = - PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_ADD, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = - PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), - t_swizzle(GET_SWZ(src[1].Swizzle, 0)), - t_swizzle(GET_SWZ(src[1].Swizzle, 1)), - t_swizzle(GET_SWZ(src[1].Swizzle, 2)), - t_swizzle(GET_SWZ(src[1].Swizzle, 3)), - t_src_class(src[1].File), - (!src[1]. - NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | - (src[1].RelAddr << 4); + inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), + t_swizzle(GET_SWZ(src[1].Swizzle, 0)), + t_swizzle(GET_SWZ(src[1].Swizzle, 1)), + t_swizzle(GET_SWZ(src[1].Swizzle, 2)), + t_swizzle(GET_SWZ(src[1].Swizzle, 3)), + t_src_class(src[1].File), + (!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); inst[3] = 0; return inst; } -static GLuint *t_opcode_swz(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3]) +static GLuint *t_opcode_swz(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} - inst[0] = - PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_VECTOR_OPCODE(VE_ADD, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -856,62 +721,58 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, return inst; } -static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, - struct prog_instruction *vpi, GLuint * inst, - struct prog_src_register src[3], int *u_temp_i) +static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3], int *u_temp_i) { /* mul r0, r1.yzxw, r2.zxyw mad r0, -r2.yzxw, r1.zxyw, r0 */ - inst[0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, *u_temp_i, - t_dst_mask(vpi->DstReg.WriteMask), - PVS_DST_REG_TEMPORARY); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y - t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w - t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : - VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z - t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x - t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y - t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w - t_src_class(src[1].File), - src[1]. - NegateBase ? VSF_FLAG_ALL : - VSF_FLAG_NONE) | (src[1].RelAddr << 4); + inst[0] = PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, + *u_temp_i, + t_dst_mask(vpi->DstReg.WriteMask), + PVS_DST_REG_TEMPORARY); + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // Z + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W + t_src_class(src[0].File), + src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), + t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // Z + t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // X + t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W + t_src_class(src[1].File), + src[1].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); inst[3] = ZERO_SRC_1; inst += 4; - inst[0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y - t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z - t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x - t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w - t_src_class(src[1].File), - (!src[1]. - NegateBase) ? VSF_FLAG_ALL : - VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w - t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : - VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[3] = - PVS_SOURCE_OPCODE(*u_temp_i, PVS_SRC_SELECT_X, - PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, - PVS_SRC_SELECT_W, PVS_SRC_REG_TEMPORARY, - VSF_FLAG_NONE); + inst[0] = PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), + t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // Z + t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // X + t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W + t_src_class(src[1].File), + (!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); + inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // Z + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W + t_src_class(src[0].File), + src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + inst[3] = PVS_SOURCE_OPCODE(*u_temp_i, + PVS_SRC_SELECT_X, + PVS_SRC_SELECT_Y, + PVS_SRC_SELECT_Z, + PVS_SRC_SELECT_W, + PVS_SRC_REG_TEMPORARY, + VSF_FLAG_NONE); (*u_temp_i)--; @@ -944,20 +805,17 @@ static void t_inputs_outputs(struct r300_vertex_program *vp) } if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL1)) { - vp->outputs[VERT_RESULT_COL1] = - vp->outputs[VERT_RESULT_COL0] + 1; + vp->outputs[VERT_RESULT_COL1] = vp->outputs[VERT_RESULT_COL0] + 1; cur_reg = vp->outputs[VERT_RESULT_COL1] + 1; } if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0)) { - vp->outputs[VERT_RESULT_BFC0] = - vp->outputs[VERT_RESULT_COL0] + 2; + vp->outputs[VERT_RESULT_BFC0] = vp->outputs[VERT_RESULT_COL0] + 2; cur_reg = vp->outputs[VERT_RESULT_BFC0] + 2; } if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) { - vp->outputs[VERT_RESULT_BFC1] = - vp->outputs[VERT_RESULT_COL0] + 3; + vp->outputs[VERT_RESULT_BFC1] = vp->outputs[VERT_RESULT_COL0] + 3; cur_reg = vp->outputs[VERT_RESULT_BFC1] + 1; } #if 0 @@ -973,8 +831,7 @@ static void t_inputs_outputs(struct r300_vertex_program *vp) } } -static void r300TranslateVertexShader(struct r300_vertex_program *vp, - struct prog_instruction *vpi) +static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct prog_instruction *vpi) { int i; GLuint *inst; @@ -993,8 +850,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, t_inputs_outputs(vp); - for (inst = vp->program.body.i; vpi->Opcode != OPCODE_END; - vpi++, inst += 4) { + for (inst = vp->program.body.i; vpi->Opcode != OPCODE_END; vpi++, inst += 4) { FREE_TEMPS(); @@ -1014,19 +870,17 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, if (num_operands == 3) { /* TODO: scalars */ if (CMP_SRCS(src[1], src[2]) || CMP_SRCS(src[0], src[2])) { - inst[0] = - PVS_VECTOR_OPCODE(VE_ADD, - u_temp_i, VSF_FLAG_ALL, - PVS_DST_REG_TEMPORARY); - inst[1] = - PVS_SOURCE_OPCODE(t_src_index - (vp, &src[2]), - SWIZZLE_X, SWIZZLE_Y, - SWIZZLE_Z, SWIZZLE_W, - t_src_class(src[2]. - File), - VSF_FLAG_NONE) | - (src[2].RelAddr << 4); + inst[0] = PVS_VECTOR_OPCODE(VE_ADD, + u_temp_i, + VSF_FLAG_ALL, + PVS_DST_REG_TEMPORARY); + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[2]), + SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_W, + t_src_class(src[2].File), + VSF_FLAG_NONE) | (src[2].RelAddr << 4); inst[2] = ZERO_SRC_2; inst[3] = ZERO_SRC_2; inst += 4; @@ -1040,19 +894,17 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, if (num_operands >= 2) { if (CMP_SRCS(src[1], src[0])) { - inst[0] = - PVS_VECTOR_OPCODE(VE_ADD, - u_temp_i, VSF_FLAG_ALL, - PVS_DST_REG_TEMPORARY); - inst[1] = - PVS_SOURCE_OPCODE(t_src_index - (vp, &src[0]), - SWIZZLE_X, SWIZZLE_Y, - SWIZZLE_Z, SWIZZLE_W, - t_src_class(src[0]. - File), - VSF_FLAG_NONE) | - (src[0].RelAddr << 4); + inst[0] = PVS_VECTOR_OPCODE(VE_ADD, + u_temp_i, + VSF_FLAG_ALL, + PVS_DST_REG_TEMPORARY); + inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_W, + t_src_class(src[0].File), + VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; inst += 4; @@ -1093,9 +945,8 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, inst = t_opcode_exp(vp, vpi, inst, src); break; case OPCODE_FLR: - inst = - t_opcode_flr(vp, vpi, inst, src, /* FIXME */ - &u_temp_i); + inst = t_opcode_flr(vp, vpi, inst, src, /* FIXME */ + &u_temp_i); break; case OPCODE_FRC: inst = t_opcode_frc(vp, vpi, inst, src); @@ -1146,9 +997,8 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, inst = t_opcode_swz(vp, vpi, inst, src); break; case OPCODE_XPD: - inst = - t_opcode_xpd(vp, vpi, inst, src, /* FIXME */ - &u_temp_i); + inst = t_opcode_xpd(vp, vpi, inst, src, /* FIXME */ + &u_temp_i); break; default: assert(0); @@ -1160,7 +1010,8 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, of the fragment program. Blank the outputs here. */ for (i = 0; i < VERT_RESULT_MAX; i++) { if (vp->key.OutputsAdded & (1 << i)) { - inst[0] = PVS_VECTOR_OPCODE(VE_ADD, vp->outputs[i], + inst[0] = PVS_VECTOR_OPCODE(VE_ADD, + vp->outputs[i], VSF_FLAG_ALL, PVS_DST_REG_OUT); inst[1] = ZERO_SRC_0; @@ -1191,8 +1042,7 @@ static void position_invariant(struct gl_program *prog) struct gl_program_parameter_list *paramList; int i; - gl_state_index tokens[STATE_LENGTH] = - { STATE_MVP_MATRIX, 0, 0, 0, 0 }; + gl_state_index tokens[STATE_LENGTH] = { STATE_MVP_MATRIX, 0, 0, 0, 0 }; /* tokens[4] = matrix modifier */ #ifdef PREFER_DP4 @@ -1259,8 +1109,7 @@ static void position_invariant(struct gl_program *prog) #endif } - _mesa_copy_instructions(&vpi[i], prog->Instructions, - prog->NumInstructions); + _mesa_copy_instructions(&vpi[i], prog->Instructions, prog->NumInstructions); free(prog->Instructions); @@ -1272,8 +1121,7 @@ static void position_invariant(struct gl_program *prog) assert(vpi->Opcode == OPCODE_END); } -static void insert_wpos(struct r300_vertex_program *vp, - struct gl_program *prog, GLuint temp_index) +static void insert_wpos(struct r300_vertex_program *vp, struct gl_program *prog, GLuint temp_index) { struct prog_instruction *vpi; struct prog_instruction *vpi_insert; @@ -1282,12 +1130,9 @@ static void insert_wpos(struct r300_vertex_program *vp, vpi = _mesa_alloc_instructions(prog->NumInstructions + 2); _mesa_init_instructions(vpi, prog->NumInstructions + 2); /* all but END */ - _mesa_copy_instructions(vpi, prog->Instructions, - prog->NumInstructions - 1); + _mesa_copy_instructions(vpi, prog->Instructions, prog->NumInstructions - 1); /* END */ - _mesa_copy_instructions(&vpi[prog->NumInstructions + 1], - &prog->Instructions[prog->NumInstructions - - 1], 1); + _mesa_copy_instructions(&vpi[prog->NumInstructions + 1], &prog->Instructions[prog->NumInstructions - 1], 1); vpi_insert = &vpi[prog->NumInstructions - 1]; vpi_insert[i].Opcode = OPCODE_MOV; @@ -1324,8 +1169,7 @@ static void insert_wpos(struct r300_vertex_program *vp, assert(vpi->Opcode == OPCODE_END); } -static void pos_as_texcoord(struct r300_vertex_program *vp, - struct gl_program *prog) +static void pos_as_texcoord(struct r300_vertex_program *vp, struct gl_program *prog) { struct prog_instruction *vpi; GLuint tempregi = prog->NumTemporaries; @@ -1333,8 +1177,7 @@ static void pos_as_texcoord(struct r300_vertex_program *vp, prog->NumTemporaries++; for (vpi = prog->Instructions; vpi->Opcode != OPCODE_END; vpi++) { - if (vpi->DstReg.File == PROGRAM_OUTPUT - && vpi->DstReg.Index == VERT_RESULT_HPOS) { + if (vpi->DstReg.File == PROGRAM_OUTPUT && vpi->DstReg.Index == VERT_RESULT_HPOS) { vpi->DstReg.File = PROGRAM_TEMPORARY; vpi->DstReg.Index = tempregi; } @@ -1386,8 +1229,7 @@ void r300SelectVertexShader(r300ContextPtr r300) struct r300_vertex_program *vp; GLint wpos_idx; - vpc = - (struct r300_vertex_program_cont *)ctx->VertexProgram._Current; + vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current; InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; wpos_idx = -1; -- cgit v1.2.3 From 916a53088ed7e34ec7df967329a7d87b25197e3c Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 11:16:52 +0000 Subject: r300: Moved the vertex program shift/mask defines into the appropriate file. --- src/mesa/drivers/dri/r300/r300_reg.h | 27 --------------------------- src/mesa/drivers/dri/r300/r300_vertprog.h | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 27 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 83af3b72e8..338782e6b0 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2506,33 +2506,6 @@ enum { /*\}*/ -/*\{*/ - -#define R300_VPI_OUT_REG_INDEX_SHIFT 13 - /* GUESS based on fglrx native limits */ -#define R300_VPI_OUT_REG_INDEX_MASK (31 << 13) - -#define R300_VPI_OUT_WRITE_X (1 << 20) -#define R300_VPI_OUT_WRITE_Y (1 << 21) -#define R300_VPI_OUT_WRITE_Z (1 << 22) -#define R300_VPI_OUT_WRITE_W (1 << 23) - -#define R300_VPI_IN_REG_INDEX_SHIFT 5 - /* GUESS based on fglrx native limits */ -#define R300_VPI_IN_REG_INDEX_MASK (255 << 5) - -#define R300_VPI_IN_X_SHIFT 13 -#define R300_VPI_IN_Y_SHIFT 16 -#define R300_VPI_IN_Z_SHIFT 19 -#define R300_VPI_IN_W_SHIFT 22 - -#define R300_VPI_IN_NEG_X (1 << 25) -#define R300_VPI_IN_NEG_Y (1 << 26) -#define R300_VPI_IN_NEG_Z (1 << 27) -#define R300_VPI_IN_NEG_W (1 << 28) - -/*\}*/ - /* BEGIN: Packet 3 commands */ /* A primitive emission dword. */ diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index aa25418efe..87d48dac6d 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -3,6 +3,29 @@ #include "r300_reg.h" +#define R300_VPI_OUT_REG_INDEX_SHIFT 13 + /* GUESS based on fglrx native limits */ +#define R300_VPI_OUT_REG_INDEX_MASK (31 << 13) + +#define R300_VPI_OUT_WRITE_X (1 << 20) +#define R300_VPI_OUT_WRITE_Y (1 << 21) +#define R300_VPI_OUT_WRITE_Z (1 << 22) +#define R300_VPI_OUT_WRITE_W (1 << 23) + +#define R300_VPI_IN_REG_INDEX_SHIFT 5 + /* GUESS based on fglrx native limits */ +#define R300_VPI_IN_REG_INDEX_MASK (255 << 5) + +#define R300_VPI_IN_X_SHIFT 13 +#define R300_VPI_IN_Y_SHIFT 16 +#define R300_VPI_IN_Z_SHIFT 19 +#define R300_VPI_IN_W_SHIFT 22 + +#define R300_VPI_IN_NEG_X (1 << 25) +#define R300_VPI_IN_NEG_Y (1 << 26) +#define R300_VPI_IN_NEG_Z (1 << 27) +#define R300_VPI_IN_NEG_W (1 << 28) + #define PVS_VECTOR_OPCODE(opcode, reg_index, reg_writemask, reg_class) \ ((opcode) \ | ((reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ -- cgit v1.2.3 From 9a3d4b14e968c1203b58d782f7ad60bfb61150d9 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 28 Feb 2008 11:32:53 +0000 Subject: r300: Added a TODO comment for registers missing from AMD's documentation. --- src/mesa/drivers/dri/r300/r300_vertprog.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 87d48dac6d..5727449bc0 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -3,6 +3,8 @@ #include "r300_reg.h" +/* TODO: get documentation from AMD for these... */ + #define R300_VPI_OUT_REG_INDEX_SHIFT 13 /* GUESS based on fglrx native limits */ #define R300_VPI_OUT_REG_INDEX_MASK (31 << 13) -- cgit v1.2.3 From 3129d8b512d50335fc5c219b65e36fcaaffcd247 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Fri, 29 Feb 2008 05:01:02 +0000 Subject: r300: Added the PVS_OP_DST_OPERAND documentation from AMD. --- src/mesa/drivers/dri/r300/r300_reg.h | 39 +++++++++++++++++++++++++++++++ src/mesa/drivers/dri/r300/r300_vertprog.h | 39 ++++++++++++++----------------- 2 files changed, 56 insertions(+), 22 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 338782e6b0..041ba85665 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2504,6 +2504,45 @@ enum { PVS_SRC_SELECT_FORCE_1 = 5, /* Force Component to 1.0 */ }; +/* PVS Opcode & Destination Operand Description */ + +enum { + PVS_DST_OPCODE_MASK = 0x3f, + PVS_DST_OPCODE_SHIFT = 0, + PVS_DST_MATH_INST_MASK = 0x1, + PVS_DST_MATH_INST_SHIFT = 6, + PVS_DST_MACRO_INST_MASK = 0x1, + PVS_DST_MACRO_INST_SHIFT = 7, + PVS_DST_REG_TYPE_MASK = 0xf, + PVS_DST_REG_TYPE_SHIFT = 8, + PVS_DST_ADDR_MODE_1_MASK = 0x1, + PVS_DST_ADDR_MODE_1_SHIFT = 12, + PVS_DST_OFFSET_MASK = 0x7f, + PVS_DST_OFFSET_SHIFT = 13, + PVS_DST_WE_X_MASK = 0x1, + PVS_DST_WE_X_SHIFT = 20, + PVS_DST_WE_Y_MASK = 0x1, + PVS_DST_WE_Y_SHIFT = 21, + PVS_DST_WE_Z_MASK = 0x1, + PVS_DST_WE_Z_SHIFT = 22, + PVS_DST_WE_W_MASK = 0x1, + PVS_DST_WE_W_SHIFT = 23, + PVS_DST_VE_SAT_MASK = 0x1, + PVS_DST_VE_SAT_SHIFT = 24, + PVS_DST_ME_SAT_MASK = 0x1, + PVS_DST_ME_SAT_SHIFT = 25, + PVS_DST_PRED_ENABLE_MASK = 0x1, + PVS_DST_PRED_ENABLE_SHIFT = 26, + PVS_DST_PRED_SENSE_MASK = 0x1, + PVS_DST_PRED_SENSE_SHIFT = 27, + PVS_DST_DUAL_MATH_OP_MASK = 0x3, + PVS_DST_DUAL_MATH_OP_SHIFT = 27, + PVS_DST_ADDR_SEL_MASK = 0x3, + PVS_DST_ADDR_SEL_SHIFT = 29, + PVS_DST_ADDR_MODE_0_MASK = 0x1, + PVS_DST_ADDR_MODE_0_SHIFT = 31, +}; + /*\}*/ /* BEGIN: Packet 3 commands */ diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 5727449bc0..61da603371 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -3,17 +3,6 @@ #include "r300_reg.h" -/* TODO: get documentation from AMD for these... */ - -#define R300_VPI_OUT_REG_INDEX_SHIFT 13 - /* GUESS based on fglrx native limits */ -#define R300_VPI_OUT_REG_INDEX_MASK (31 << 13) - -#define R300_VPI_OUT_WRITE_X (1 << 20) -#define R300_VPI_OUT_WRITE_Y (1 << 21) -#define R300_VPI_OUT_WRITE_Z (1 << 22) -#define R300_VPI_OUT_WRITE_W (1 << 23) - #define R300_VPI_IN_REG_INDEX_SHIFT 5 /* GUESS based on fglrx native limits */ #define R300_VPI_IN_REG_INDEX_MASK (255 << 5) @@ -29,17 +18,18 @@ #define R300_VPI_IN_NEG_W (1 << 28) #define PVS_VECTOR_OPCODE(opcode, reg_index, reg_writemask, reg_class) \ - ((opcode) \ - | ((reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ - | ((reg_writemask) << 20) \ - | ((reg_class) << 8)) + (((opcode & PVS_DST_OPCODE_MASK) << PVS_DST_OPCODE_SHIFT) \ + | ((reg_index & PVS_DST_OFFSET_MASK) << PVS_DST_OFFSET_SHIFT) \ + | ((reg_writemask & 0xf) << PVS_DST_WE_X_SHIFT) /* X Y Z W */ \ + | ((reg_class & PVS_DST_REG_TYPE_MASK) << PVS_DST_REG_TYPE_SHIFT)) #define PVS_MATH_OPCODE(opcode, reg_index, reg_writemask, reg_class) \ - ((opcode) \ - | (1 << 6) /* FIXME: PVS_DST_MATH_INST */ \ - | ((reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \ - | ((reg_writemask) << 20) \ - | ((reg_class) << 8)) + (((opcode & PVS_DST_OPCODE_MASK) << PVS_DST_OPCODE_SHIFT) \ + | ((1 & PVS_DST_MATH_INST_MASK) << PVS_DST_MATH_INST_SHIFT) \ + | ((reg_index & PVS_DST_OFFSET_MASK) << PVS_DST_OFFSET_SHIFT) \ + | ((reg_writemask & 0xf) << PVS_DST_WE_X_SHIFT) /* X Y Z W */ \ + | ((reg_class & PVS_DST_REG_TYPE_MASK) << PVS_DST_REG_TYPE_SHIFT)) + #define PVS_SOURCE_OPCODE(in_reg_index, comp_x, comp_y, comp_z, comp_w, reg_class, negate) \ (((in_reg_index) << R300_VPI_IN_REG_INDEX_SHIFT) \ @@ -60,6 +50,11 @@ #define VSF_FLAG_ALL 0xf #define VSF_FLAG_NONE 0 +#define R300_VPI_OUT_WRITE_X (1 << 20) +#define R300_VPI_OUT_WRITE_Y (1 << 21) +#define R300_VPI_OUT_WRITE_Z (1 << 22) +#define R300_VPI_OUT_WRITE_W (1 << 23) + #define VP_OUTMASK_X R300_VPI_OUT_WRITE_X #define VP_OUTMASK_Y R300_VPI_OUT_WRITE_Y #define VP_OUTMASK_Z R300_VPI_OUT_WRITE_Z @@ -78,8 +73,8 @@ #define VP_OUT(instr,outclass,outidx,outmask) \ (VE_##instr | \ - ((outidx) << R300_VPI_OUT_REG_INDEX_SHIFT) | \ - (PVS_DST_REG_##outclass << 8) | \ + ((outidx & PVS_DST_OFFSET_MASK) << PVS_DST_OFFSET_SHIFT) | \ + ((PVS_DST_REG_##outclass & PVS_DST_REG_TYPE_MASK) << PVS_DST_REG_TYPE_SHIFT) | \ VP_OUTMASK_##outmask) #define VP_IN(inclass,inidx) \ -- cgit v1.2.3 From c30cc5904dc61c27ea7a4ebf5928c53bca6a7b1d Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Fri, 29 Feb 2008 05:48:31 +0000 Subject: r300: Added the PVS_SRC_OPERAND documentation from AMD. --- src/mesa/drivers/dri/r300/r300_reg.h | 35 ++++++++++++++++++ src/mesa/drivers/dri/r300/r300_vertprog.h | 59 +++++++++++-------------------- 2 files changed, 56 insertions(+), 38 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 041ba85665..b059c1671d 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2543,6 +2543,41 @@ enum { PVS_DST_ADDR_MODE_0_SHIFT = 31, }; +/* PVS Source Operand Description */ + +enum { + PVS_SRC_REG_TYPE_MASK = 0x3, + PVS_SRC_REG_TYPE_SHIFT = 0, + SPARE_0_MASK = 0x1, + SPARE_0_SHIFT = 2, + PVS_SRC_ABS_XYZW_MASK = 0x1, + PVS_SRC_ABS_XYZW_SHIFT = 3, + PVS_SRC_ADDR_MODE_0_MASK = 0x1, + PVS_SRC_ADDR_MODE_0_SHIFT = 4, + PVS_SRC_OFFSET_MASK = 0xff, + PVS_SRC_OFFSET_SHIFT = 5, + PVS_SRC_SWIZZLE_X_MASK = 0x7, + PVS_SRC_SWIZZLE_X_SHIFT = 13, + PVS_SRC_SWIZZLE_Y_MASK = 0x7, + PVS_SRC_SWIZZLE_Y_SHIFT = 16, + PVS_SRC_SWIZZLE_Z_MASK = 0x7, + PVS_SRC_SWIZZLE_Z_SHIFT = 19, + PVS_SRC_SWIZZLE_W_MASK = 0x7, + PVS_SRC_SWIZZLE_W_SHIFT = 22, + PVS_SRC_MODIFIER_X_MASK = 0x1, + PVS_SRC_MODIFIER_X_SHIFT = 25, + PVS_SRC_MODIFIER_Y_MASK = 0x1, + PVS_SRC_MODIFIER_Y_SHIFT = 26, + PVS_SRC_MODIFIER_Z_MASK = 0x1, + PVS_SRC_MODIFIER_Z_SHIFT = 27, + PVS_SRC_MODIFIER_W_MASK = 0x1, + PVS_SRC_MODIFIER_W_SHIFT = 28, + PVS_SRC_ADDR_SEL_MASK = 0x3, + PVS_SRC_ADDR_SEL_SHIFT = 29, + PVS_SRC_ADDR_MODE_1_MASK = 0x0, + PVS_SRC_ADDR_MODE_1_SHIFT = 32, +}; + /*\}*/ /* BEGIN: Packet 3 commands */ diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 61da603371..984233e2ea 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -3,20 +3,6 @@ #include "r300_reg.h" -#define R300_VPI_IN_REG_INDEX_SHIFT 5 - /* GUESS based on fglrx native limits */ -#define R300_VPI_IN_REG_INDEX_MASK (255 << 5) - -#define R300_VPI_IN_X_SHIFT 13 -#define R300_VPI_IN_Y_SHIFT 16 -#define R300_VPI_IN_Z_SHIFT 19 -#define R300_VPI_IN_W_SHIFT 22 - -#define R300_VPI_IN_NEG_X (1 << 25) -#define R300_VPI_IN_NEG_Y (1 << 26) -#define R300_VPI_IN_NEG_Z (1 << 27) -#define R300_VPI_IN_NEG_W (1 << 28) - #define PVS_VECTOR_OPCODE(opcode, reg_index, reg_writemask, reg_class) \ (((opcode & PVS_DST_OPCODE_MASK) << PVS_DST_OPCODE_SHIFT) \ | ((reg_index & PVS_DST_OFFSET_MASK) << PVS_DST_OFFSET_SHIFT) \ @@ -32,13 +18,13 @@ #define PVS_SOURCE_OPCODE(in_reg_index, comp_x, comp_y, comp_z, comp_w, reg_class, negate) \ - (((in_reg_index) << R300_VPI_IN_REG_INDEX_SHIFT) \ - | ((comp_x) << R300_VPI_IN_X_SHIFT) \ - | ((comp_y) << R300_VPI_IN_Y_SHIFT) \ - | ((comp_z) << R300_VPI_IN_Z_SHIFT) \ - | ((comp_w) << R300_VPI_IN_W_SHIFT) \ - | ((negate) << 25) \ - | ((reg_class))) + (((in_reg_index & PVS_SRC_OFFSET_MASK) << PVS_SRC_OFFSET_SHIFT) \ + | ((comp_x & PVS_SRC_SWIZZLE_X_MASK) << PVS_SRC_SWIZZLE_X_SHIFT) \ + | ((comp_y & PVS_SRC_SWIZZLE_Y_MASK) << PVS_SRC_SWIZZLE_Y_SHIFT) \ + | ((comp_z & PVS_SRC_SWIZZLE_Z_MASK) << PVS_SRC_SWIZZLE_Z_SHIFT) \ + | ((comp_w & PVS_SRC_SWIZZLE_W_MASK) << PVS_SRC_SWIZZLE_W_SHIFT) \ + | ((negate & 0xf) << PVS_SRC_MODIFIER_X_SHIFT) /* X Y Z W */ \ + | ((reg_class & PVS_SRC_REG_TYPE_MASK) << PVS_SRC_REG_TYPE_SHIFT)) #if 1 @@ -78,25 +64,22 @@ VP_OUTMASK_##outmask) #define VP_IN(inclass,inidx) \ - (((inidx) << R300_VPI_IN_REG_INDEX_SHIFT) | \ - (PVS_SRC_REG_##inclass << 0) | \ - (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)) + (((inidx & PVS_SRC_OFFSET_MASK) << PVS_SRC_OFFSET_SHIFT) | \ + ((PVS_SRC_REG_##inclass & PVS_SRC_REG_TYPE_MASK) << PVS_SRC_REG_TYPE_SHIFT) | \ + ((PVS_SRC_SELECT_X & PVS_SRC_SWIZZLE_X_MASK) << PVS_SRC_SWIZZLE_X_SHIFT) | \ + ((PVS_SRC_SELECT_Y & PVS_SRC_SWIZZLE_Y_MASK) << PVS_SRC_SWIZZLE_Y_SHIFT) | \ + ((PVS_SRC_SELECT_Z & PVS_SRC_SWIZZLE_Z_MASK) << PVS_SRC_SWIZZLE_Z_SHIFT) | \ + ((PVS_SRC_SELECT_W & PVS_SRC_SWIZZLE_W_MASK) << PVS_SRC_SWIZZLE_W_SHIFT)) #define VP_ZERO() \ - ((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)) + (((PVS_SRC_SELECT_FORCE_0 & PVS_SRC_SWIZZLE_X_MASK) << PVS_SRC_SWIZZLE_X_SHIFT) | \ + ((PVS_SRC_SELECT_FORCE_0 & PVS_SRC_SWIZZLE_Y_MASK) << PVS_SRC_SWIZZLE_Y_SHIFT) | \ + ((PVS_SRC_SELECT_FORCE_0 & PVS_SRC_SWIZZLE_Z_MASK) << PVS_SRC_SWIZZLE_Z_SHIFT) | \ + ((PVS_SRC_SELECT_FORCE_0 & PVS_SRC_SWIZZLE_W_MASK) << PVS_SRC_SWIZZLE_W_SHIFT)) #define VP_ONE() \ - ((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) + (((PVS_SRC_SELECT_FORCE_1 & PVS_SRC_SWIZZLE_X_MASK) << PVS_SRC_SWIZZLE_X_SHIFT) | \ + ((PVS_SRC_SELECT_FORCE_1 & PVS_SRC_SWIZZLE_Y_MASK) << PVS_SRC_SWIZZLE_Y_SHIFT) | \ + ((PVS_SRC_SELECT_FORCE_1 & PVS_SRC_SWIZZLE_Z_MASK) << PVS_SRC_SWIZZLE_Z_SHIFT) | \ + ((PVS_SRC_SELECT_FORCE_1 & PVS_SRC_SWIZZLE_W_MASK) << PVS_SRC_SWIZZLE_W_SHIFT)) #endif -- cgit v1.2.3 From e239871d5b28c05eceae91a748d36ea3ff4e5f18 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Sun, 2 Mar 2008 06:28:53 +0000 Subject: r300: Corrected a bug with the MAD instruction. The PVS_VECTOR_OPCODE macro should be modified to support macro instructions, too. --- src/mesa/drivers/dri/r300/r300_reg.h | 6 ++++++ src/mesa/drivers/dri/r300/r300_vertprog.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index b059c1671d..0614c8b2e0 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2479,6 +2479,12 @@ enum { ME_PRED_SET_RESTORE = 28, }; +enum { + /* R3XX */ + PVS_MACRO_OP_2CLK_MADD = 0, + PVS_MACRO_OP_2CLK_M2X_ADD = 1, +}; + enum { PVS_SRC_REG_TEMPORARY = 0, /* Intermediate Storage */ PVS_SRC_REG_INPUT = 1, /* Input Vertex Storage */ diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index e0d81d0795..8aa1a1c816 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -555,10 +555,12 @@ static GLuint *t_opcode_log(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_mad(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + /* FIXME */ + inst[0] = (((PVS_MACRO_OP_2CLK_MADD & PVS_DST_OPCODE_MASK) << PVS_DST_OPCODE_SHIFT) | + ((1 & PVS_DST_MACRO_INST_MASK) << PVS_DST_MACRO_INST_SHIFT) | + ((t_dst_index(vp, &vpi->DstReg) & PVS_DST_OFFSET_MASK) << PVS_DST_OFFSET_SHIFT) | + ((t_dst_mask(vpi->DstReg.WriteMask) & 0xf) << PVS_DST_WE_X_SHIFT) | + ((t_dst_class(vpi->DstReg.File) & PVS_DST_REG_TYPE_MASK) << PVS_DST_REG_TYPE_SHIFT)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = t_src(vp, &src[2]); -- cgit v1.2.3 From 47f08a9fb5ca3179ebf3c7a214b4062e27aead86 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Sun, 2 Mar 2008 08:36:19 +0000 Subject: r300: Corrected a bug with the SUB instruction. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 8aa1a1c816..d7f8a85cc2 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -691,6 +691,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruct { //ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W +#if 0 inst[0] = PVS_VECTOR_OPCODE(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), @@ -704,6 +705,21 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruct t_src_class(src[1].File), (!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); inst[3] = 0; +#else + inst[0] = + PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); + inst[1] = t_src(vp, &src[0]); + inst[2] = ONE_SRC_0; + inst[3] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), + t_swizzle(GET_SWZ(src[1].Swizzle, 0)), + t_swizzle(GET_SWZ(src[1].Swizzle, 1)), + t_swizzle(GET_SWZ(src[1].Swizzle, 2)), + t_swizzle(GET_SWZ(src[1].Swizzle, 3)), + t_src_class(src[1].File), + (!src[1]. NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); +#endif return inst; } -- cgit v1.2.3 From 8d5231a3582e4f2769ac0685cf0174e09750700e Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Mon, 17 Mar 2008 17:52:26 +0800 Subject: [i965] round pointsize to nearest int according to spec --- src/mesa/drivers/dri/i965/brw_sf_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index 2b6087d691..398048429b 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -224,11 +224,11 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key, sf.sf6.line_width = 0; /* _NEW_POINT */ - sf.sf6.point_rast_rule = 1; /* opengl conventions */ + sf.sf6.point_rast_rule = BRW_RASTRULE_UPPER_RIGHT; /* opengl conventions */ /* XXX clamp max depends on AA vs. non-AA */ sf.sf7.sprite_point = key->point_sprite; - sf.sf7.point_size = CLAMP(key->point_size, 1.0, 255.0) * (1<<3); + sf.sf7.point_size = CLAMP(nearbyint(key->point_size), 1, 255) * (1<<3); sf.sf7.use_point_size_state = !key->point_attenuated; sf.sf7.aa_line_distance_mode = 0; -- cgit v1.2.3 From f0c8863dbb71b2c3605bb8eb9526c7d8d13793cf Mon Sep 17 00:00:00 2001 From: Markus Amsler Date: Mon, 17 Mar 2008 12:02:56 +0100 Subject: r300: Simplify r300VAPInputRoute0, check for valid input. --- src/mesa/drivers/dri/r300/r300_emit.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index a135376398..8e1d801a8d 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -210,22 +210,18 @@ static void r300EmitVec(GLcontext * ctx, struct r300_dma_region *rvb, static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, int *inputs, GLint * tab, GLuint nr) { - GLuint i, dw; - + GLushort i, w; + uint16_t * dst16 = (uint16_t *) dst; + /* type, inputs, stop bit, size */ - for (i = 0; i + 1 < nr; i += 2) { - dw = R300_INPUT_ROUTE_FLOAT | (inputs[tab[i]] << 8) | (attribptr[tab[i]]->size - 1); - dw |= (R300_INPUT_ROUTE_FLOAT | (inputs[tab[i + 1]] << 8) | (attribptr[tab[i + 1]]->size - 1)) << 16; - if (i + 2 == nr) { - dw |= (R300_VAP_INPUT_ROUTE_END << 16); + for (i = 0; i < nr; i++) { + /* make sure input is valid, would lockup the gpu */ + assert(inputs[tab[i]] != -1); + w = R300_INPUT_ROUTE_FLOAT | (inputs[tab[i]] << 8) | (attribptr[tab[i]]->size - 1); + if (i + 1 == nr) { + w |= R300_VAP_INPUT_ROUTE_END; } - dst[i >> 1] = dw; - } - - if (nr & 1) { - dw = R300_INPUT_ROUTE_FLOAT | (inputs[tab[nr - 1]] << 8) | (attribptr[tab[nr - 1]]->size - 1); - dw |= R300_VAP_INPUT_ROUTE_END; - dst[nr >> 1] = dw; + dst16[i] = w; } return (nr + 1) >> 1; -- cgit v1.2.3 From c48212fe5861291efd134b35e67568c79b15f960 Mon Sep 17 00:00:00 2001 From: Markus Amsler Date: Mon, 17 Mar 2008 12:03:54 +0100 Subject: r300: Simplify r300VAPInputRoute1. --- src/mesa/drivers/dri/r300/r300_emit.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index 8e1d801a8d..deb62b2762 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -238,14 +238,10 @@ static GLuint r300VAPInputRoute1Swizzle(int swizzle[4]) GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr) { GLuint i; + uint16_t * dst16 = (uint16_t *) dst; - for (i = 0; i + 1 < nr; i += 2) { - dst[i >> 1] = r300VAPInputRoute1Swizzle(swizzle[i]) | R300_INPUT_ROUTE_ENABLE; - dst[i >> 1] |= (r300VAPInputRoute1Swizzle(swizzle[i + 1]) | R300_INPUT_ROUTE_ENABLE) << 16; - } - - if (nr & 1) { - dst[nr >> 1] = r300VAPInputRoute1Swizzle(swizzle[nr - 1]) | R300_INPUT_ROUTE_ENABLE; + for (i = 0; i < nr; i++) { + dst16[i] = r300VAPInputRoute1Swizzle(swizzle[i]) | R300_INPUT_ROUTE_ENABLE; } return (nr + 1) >> 1; -- cgit v1.2.3 From d787850ae6d60f8287ff320d4da2adf4254589c3 Mon Sep 17 00:00:00 2001 From: Markus Amsler Date: Mon, 17 Mar 2008 12:11:11 +0100 Subject: mesa: Add vertex.attrib 0-15 to arb_input_attrib_string. --- src/mesa/shader/prog_print.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index e92837f739..308cce2206 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -99,7 +99,23 @@ arb_input_attrib_string(GLint index, GLenum progType) "vertex.texcoord[4]", "vertex.texcoord[5]", "vertex.texcoord[6]", - "vertex.texcoord[7]" + "vertex.texcoord[7]", + "vertex.attrib[0]", + "vertex.attrib[1]", + "vertex.attrib[2]", + "vertex.attrib[3]", + "vertex.attrib[4]", + "vertex.attrib[5]", + "vertex.attrib[6]", + "vertex.attrib[7]", + "vertex.attrib[8]", + "vertex.attrib[9]", + "vertex.attrib[10]", + "vertex.attrib[11]", + "vertex.attrib[12]", + "vertex.attrib[13]", + "vertex.attrib[14]", + "vertex.attrib[15]" }; const char *fragAttribs[] = { "fragment.position", -- cgit v1.2.3 From f2b914298f677555d1e605cbcc2b7f73c0f0847a Mon Sep 17 00:00:00 2001 From: Markus Amsler Date: Mon, 17 Mar 2008 08:35:27 -0600 Subject: only set InputsRead bit if input is really used --- src/mesa/shader/arbprogparse.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 10fa196586..8803658c1e 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1616,8 +1616,6 @@ parse_attrib_binding(GLcontext * ctx, const GLubyte ** inst, if (err) { program_error(ctx, Program->Position, "Bad attribute binding"); - } else { - Program->Base.InputsRead |= (1 << *inputReg); } return err; @@ -2574,6 +2572,11 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, return 1; } + /* Add attributes to InputsRead only if they are used the program. + * This avoids the handling of unused ATTRIB declarations in the drivers. */ + if (*File == PROGRAM_INPUT) + Program->Base.InputsRead |= (1 << *Index); + return 0; } -- cgit v1.2.3 From e9809a36aaea3480cba5bd62360bf9d481ff9011 Mon Sep 17 00:00:00 2001 From: Andrzej Trznadel Date: Mon, 17 Mar 2008 15:52:08 -0700 Subject: Fix compat implementation of ffs() to return 1-based bit numbers. --- src/mesa/main/imports.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 3ae56c8b0b..7d4b120099 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -560,6 +560,7 @@ _mesa_ffs(int i) bit++; i >>= 1; } + bit++; } return bit; #else -- cgit v1.2.3 From 3105bc1d885ea8ce083d2be85cbeac46d4d873a1 Mon Sep 17 00:00:00 2001 From: Andrzej Trznadel Date: Mon, 17 Mar 2008 15:54:24 -0700 Subject: [965] Fix fp temp reg release code to not usually release all temps. Also, use wrapped ffs() instead of native. --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 682b16d74d..621106f14d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -144,7 +144,7 @@ static struct prog_dst_register dst_undef( void ) static struct prog_dst_register get_temp( struct brw_wm_compile *c ) { - int bit = ffs( ~c->fp_temp ); + int bit = _mesa_ffs( ~c->fp_temp ); if (!bit) { _mesa_printf("%s: out of temporaries\n", __FILE__); @@ -158,7 +158,7 @@ static struct prog_dst_register get_temp( struct brw_wm_compile *c ) static void release_temp( struct brw_wm_compile *c, struct prog_dst_register temp ) { - c->fp_temp &= ~1<<(temp.Index + 1 - FIRST_INTERNAL_TEMP); + c->fp_temp &= ~(1 << (temp.Index - FIRST_INTERNAL_TEMP)); } -- cgit v1.2.3 From 48efb769e983bea6baf934eba8865ab3fa61a77a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 18 Mar 2008 10:29:16 +1000 Subject: r300: add new rs690 pci id --- src/mesa/drivers/dri/radeon/radeon_chipset.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/radeon/radeon_chipset.h b/src/mesa/drivers/dri/radeon/radeon_chipset.h index 4dece95a98..6ad441bdd0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_chipset.h +++ b/src/mesa/drivers/dri/radeon/radeon_chipset.h @@ -149,6 +149,7 @@ #define PCI_CHIP_RS350_7834 0x7834 #define PCI_CHIP_RS350_7835 0x7835 #define PCI_CHIP_RS690_791E 0x791E +#define PCI_CHIP_RS690_791F 0x791F enum { CHIP_FAMILY_R100, -- cgit v1.2.3 From 5a0314b431ab147c6156c3011f4cb54161ba4b25 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 18 Mar 2008 10:27:20 +0800 Subject: [i965] make stipple pattern continue across GL_LINE_LOOP and GL_LINE_STRIP --- src/mesa/drivers/dri/i965/brw_draw.c | 2 +- src/mesa/drivers/dri/i965/brw_gs_emit.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 0990dcfac4..c323fbe792 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -54,7 +54,7 @@ static GLuint hw_prim[GL_POLYGON+1] = { _3DPRIM_POINTLIST, _3DPRIM_LINELIST, _3DPRIM_LINELOOP, - _3DPRIM_LINESTRIP, + _3DPRIM_LINESTRIP_CONT, _3DPRIM_TRILIST, _3DPRIM_TRISTRIP, _3DPRIM_TRIFAN, diff --git a/src/mesa/drivers/dri/i965/brw_gs_emit.c b/src/mesa/drivers/dri/i965/brw_gs_emit.c index 9abb94d82e..0c589c3c52 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_gs_emit.c @@ -137,8 +137,8 @@ void brw_gs_tris( struct brw_gs_compile *c ) void brw_gs_lines( struct brw_gs_compile *c ) { brw_gs_alloc_regs(c, 2); - brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_START)); - brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_END)); + brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_LINESTRIP_CONT << 2) | R02_PRIM_START)); + brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_LINESTRIP_CONT << 2) | R02_PRIM_END)); } void brw_gs_points( struct brw_gs_compile *c ) -- cgit v1.2.3 From f7cfc51b057d9d2fa109b32796b992e8f4f3bfcc Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 18 Mar 2008 17:37:25 +0800 Subject: Revert "[i965] make stipple pattern continue across GL_LINE_LOOP and GL_LINE_STRIP" There is no information in GS to determinate when to reset line stipple count, still fallback to software This reverts commit 5a0314b431ab147c6156c3011f4cb54161ba4b25. --- src/mesa/drivers/dri/i965/brw_draw.c | 2 +- src/mesa/drivers/dri/i965/brw_gs_emit.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index c323fbe792..0990dcfac4 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -54,7 +54,7 @@ static GLuint hw_prim[GL_POLYGON+1] = { _3DPRIM_POINTLIST, _3DPRIM_LINELIST, _3DPRIM_LINELOOP, - _3DPRIM_LINESTRIP_CONT, + _3DPRIM_LINESTRIP, _3DPRIM_TRILIST, _3DPRIM_TRISTRIP, _3DPRIM_TRIFAN, diff --git a/src/mesa/drivers/dri/i965/brw_gs_emit.c b/src/mesa/drivers/dri/i965/brw_gs_emit.c index 0c589c3c52..9abb94d82e 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_gs_emit.c @@ -137,8 +137,8 @@ void brw_gs_tris( struct brw_gs_compile *c ) void brw_gs_lines( struct brw_gs_compile *c ) { brw_gs_alloc_regs(c, 2); - brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_LINESTRIP_CONT << 2) | R02_PRIM_START)); - brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_LINESTRIP_CONT << 2) | R02_PRIM_END)); + brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_START)); + brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_END)); } void brw_gs_points( struct brw_gs_compile *c ) -- cgit v1.2.3 From a3b5ae783e18040349f1736c2ad812e0ec24a7b8 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Wed, 19 Mar 2008 01:03:48 +0000 Subject: set outputs_safe to 0 as it's possible for the code generation to slip over the allocated memory for the vb. pull in sse fixes from gallium-0.1 --- src/mesa/tnl/t_vertex_sse.c | 2 +- src/mesa/x86/rtasm/x86sse.c | 246 ++++++++++++++++++++++++++++++-------------- src/mesa/x86/rtasm/x86sse.h | 63 +++++++----- 3 files changed, 205 insertions(+), 106 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/tnl/t_vertex_sse.c b/src/mesa/tnl/t_vertex_sse.c index 9515d9f81f..922737009a 100644 --- a/src/mesa/tnl/t_vertex_sse.c +++ b/src/mesa/tnl/t_vertex_sse.c @@ -648,7 +648,7 @@ void _tnl_generate_sse_emit( GLcontext *ctx ) p.ctx = ctx; p.inputs_safe = 0; /* for now */ - p.outputs_safe = 1; /* for now */ + p.outputs_safe = 0; /* for now */ p.have_sse2 = cpu_has_xmm2; p.identity = x86_make_reg(file_XMM, 6); p.chan0 = x86_make_reg(file_XMM, 7); diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c index 612cd51a6e..39c0e9b851 100644 --- a/src/mesa/x86/rtasm/x86sse.c +++ b/src/mesa/x86/rtasm/x86sse.c @@ -1,4 +1,4 @@ -#if defined(USE_X86_ASM) || defined(SLANG_X86) +#if defined(__i386__) || defined(__386__) #include "imports.h" #include "x86sse.h" @@ -6,54 +6,78 @@ #define DISASSEM 0 #define X86_TWOB 0x0f -/* Emit bytes to the instruction stream: - */ -static void emit_1b( struct x86_function *p, GLbyte b0 ) +static unsigned char *cptr( void (*label)() ) { - *(GLbyte *)(p->csr++) = b0; + return (unsigned char *)(unsigned long)label; } -static void emit_1i( struct x86_function *p, GLint i0 ) + +static void do_realloc( struct x86_function *p ) { - *(GLint *)(p->csr) = i0; - p->csr += 4; + if (p->size == 0) { + p->size = 1024; + p->store = _mesa_exec_malloc(p->size); + p->csr = p->store; + } + else { + unsigned used = p->csr - p->store; + unsigned char *tmp = p->store; + p->size *= 2; + p->store = _mesa_exec_malloc(p->size); + memcpy(p->store, tmp, used); + p->csr = p->store + used; + _mesa_exec_free(tmp); + } } -static void disassem( struct x86_function *p, const char *fn ) +/* Emit bytes to the instruction stream: + */ +static unsigned char *reserve( struct x86_function *p, int bytes ) { -#if DISASSEM && 0 - if (fn && fn != p->fn) { - _mesa_printf("0x%x: %s\n", p->csr, fn); - p->fn = fn; + if (p->csr + bytes - p->store > p->size) + do_realloc(p); + + { + unsigned char *csr = p->csr; + p->csr += bytes; + return csr; } -#endif } -static void emit_1ub_fn( struct x86_function *p, GLubyte b0, const char *fn ) + + +static void emit_1b( struct x86_function *p, char b0 ) { - disassem(p, fn); - *(p->csr++) = b0; + char *csr = (char *)reserve(p, 1); + *csr = b0; } -static void emit_2ub_fn( struct x86_function *p, GLubyte b0, GLubyte b1, const char *fn ) +static void emit_1i( struct x86_function *p, int i0 ) { - disassem(p, fn); - *(p->csr++) = b0; - *(p->csr++) = b1; + int *icsr = (int *)reserve(p, sizeof(i0)); + *icsr = i0; } -static void emit_3ub_fn( struct x86_function *p, GLubyte b0, GLubyte b1, GLubyte b2, const char *fn ) +static void emit_1ub( struct x86_function *p, unsigned char b0 ) { - disassem(p, fn); - *(p->csr++) = b0; - *(p->csr++) = b1; - *(p->csr++) = b2; + unsigned char *csr = reserve(p, 1); + *csr++ = b0; } -#define emit_1ub(p, b0) emit_1ub_fn(p, b0, __FUNCTION__) -#define emit_2ub(p, b0, b1) emit_2ub_fn(p, b0, b1, __FUNCTION__) -#define emit_3ub(p, b0, b1, b2) emit_3ub_fn(p, b0, b1, b2, __FUNCTION__) +static void emit_2ub( struct x86_function *p, unsigned char b0, unsigned char b1 ) +{ + unsigned char *csr = reserve(p, 2); + *csr++ = b0; + *csr++ = b1; +} +static void emit_3ub( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2 ) +{ + unsigned char *csr = reserve(p, 3); + *csr++ = b0; + *csr++ = b1; + *csr++ = b2; +} /* Build a modRM byte + possible displacement. No treatment of SIB @@ -63,7 +87,7 @@ static void emit_modrm( struct x86_function *p, struct x86_reg reg, struct x86_reg regmem ) { - GLubyte val = 0; + unsigned char val = 0; assert(reg.mod == mod_REG); @@ -71,13 +95,13 @@ static void emit_modrm( struct x86_function *p, val |= reg.idx << 3; /* reg field */ val |= regmem.idx; /* r/m field */ - emit_1ub_fn(p, val, 0); + emit_1ub(p, val); /* Oh-oh we've stumbled into the SIB thing. */ if (regmem.file == file_REG32 && regmem.idx == reg_SP) { - emit_1ub_fn(p, 0x24, 0); /* simplistic! */ + emit_1ub(p, 0x24); /* simplistic! */ } switch (regmem.mod) { @@ -98,7 +122,7 @@ static void emit_modrm( struct x86_function *p, static void emit_modrm_noreg( struct x86_function *p, - GLuint op, + unsigned op, struct x86_reg regmem ) { struct x86_reg dummy = x86_make_reg(file_REG32, op); @@ -111,21 +135,21 @@ static void emit_modrm_noreg( struct x86_function *p, * the arguments presented. */ static void emit_op_modrm( struct x86_function *p, - GLubyte op_dst_is_reg, - GLubyte op_dst_is_mem, + unsigned char op_dst_is_reg, + unsigned char op_dst_is_mem, struct x86_reg dst, struct x86_reg src ) { switch (dst.mod) { case mod_REG: - emit_1ub_fn(p, op_dst_is_reg, 0); + emit_1ub(p, op_dst_is_reg); emit_modrm(p, dst, src); break; case mod_INDIRECT: case mod_DISP32: case mod_DISP8: assert(src.mod == mod_REG); - emit_1ub_fn(p, op_dst_is_mem, 0); + emit_1ub(p, op_dst_is_mem); emit_modrm(p, src, dst); break; default: @@ -156,7 +180,7 @@ struct x86_reg x86_make_reg( enum x86_reg_file file, } struct x86_reg x86_make_disp( struct x86_reg reg, - GLint disp ) + int disp ) { assert(reg.file == file_REG32); @@ -185,7 +209,7 @@ struct x86_reg x86_get_base_reg( struct x86_reg reg ) return x86_make_reg( reg.file, reg.idx ); } -GLubyte *x86_get_label( struct x86_function *p ) +unsigned char *x86_get_label( struct x86_function *p ) { return p->csr; } @@ -199,13 +223,13 @@ GLubyte *x86_get_label( struct x86_function *p ) void x86_jcc( struct x86_function *p, enum x86_cc cc, - GLubyte *label ) + unsigned char *label ) { - GLint offset = label - (x86_get_label(p) + 2); + int offset = label - (x86_get_label(p) + 2); if (offset <= 127 && offset >= -128) { emit_1ub(p, 0x70 + cc); - emit_1b(p, (GLbyte) offset); + emit_1b(p, (char) offset); } else { offset = label - (x86_get_label(p) + 6); @@ -216,7 +240,7 @@ void x86_jcc( struct x86_function *p, /* Always use a 32bit offset for forward jumps: */ -GLubyte *x86_jcc_forward( struct x86_function *p, +unsigned char *x86_jcc_forward( struct x86_function *p, enum x86_cc cc ) { emit_2ub(p, 0x0f, 0x80 + cc); @@ -224,14 +248,14 @@ GLubyte *x86_jcc_forward( struct x86_function *p, return x86_get_label(p); } -GLubyte *x86_jmp_forward( struct x86_function *p) +unsigned char *x86_jmp_forward( struct x86_function *p) { emit_1ub(p, 0xe9); emit_1i(p, 0); return x86_get_label(p); } -GLubyte *x86_call_forward( struct x86_function *p) +unsigned char *x86_call_forward( struct x86_function *p) { emit_1ub(p, 0xe8); emit_1i(p, 0); @@ -241,28 +265,41 @@ GLubyte *x86_call_forward( struct x86_function *p) /* Fixup offset from forward jump: */ void x86_fixup_fwd_jump( struct x86_function *p, - GLubyte *fixup ) + unsigned char *fixup ) { *(int *)(fixup - 4) = x86_get_label(p) - fixup; } -void x86_jmp( struct x86_function *p, GLubyte *label) +void x86_jmp( struct x86_function *p, unsigned char *label) { emit_1ub(p, 0xe9); emit_1i(p, label - x86_get_label(p) - 4); } -void x86_call( struct x86_function *p, GLubyte *label) +#if 0 +/* This doesn't work once we start reallocating & copying the + * generated code on buffer fills, because the call is relative to the + * current pc. + */ +void x86_call( struct x86_function *p, void (*label)()) { emit_1ub(p, 0xe8); - emit_1i(p, label - x86_get_label(p) - 4); + emit_1i(p, cptr(label) - x86_get_label(p) - 4); +} +#else +void x86_call( struct x86_function *p, struct x86_reg reg) +{ + emit_1ub(p, 0xff); + emit_modrm(p, reg, reg); } +#endif + /* michal: * Temporary. As I need immediate operands, and dont want to mess with the codegen, * I load the immediate into general purpose register and use it. */ -void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, GLint imm ) +void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ) { assert(dst.mod == mod_REG); emit_1ub(p, 0xb8 + dst.idx); @@ -502,6 +539,14 @@ void sse_addss( struct x86_function *p, emit_modrm( p, dst, src ); } +void sse_andnps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x55); + emit_modrm( p, dst, src ); +} + void sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) @@ -510,6 +555,13 @@ void sse_andps( struct x86_function *p, emit_modrm( p, dst, src ); } +void sse_rsqrtps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x52); + emit_modrm( p, dst, src ); +} void sse_rsqrtss( struct x86_function *p, struct x86_reg dst, @@ -538,6 +590,21 @@ void sse_movlhps( struct x86_function *p, emit_modrm( p, dst, src ); } +void sse_orps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x56); + emit_modrm( p, dst, src ); +} + +void sse_xorps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x57); + emit_modrm( p, dst, src ); +} void sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, @@ -559,7 +626,7 @@ void sse_cvtps2pi( struct x86_function *p, void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - GLubyte shuf) + unsigned char shuf) { emit_2ub(p, X86_TWOB, 0xC6); emit_modrm(p, dest, arg0); @@ -569,13 +636,21 @@ void sse_shufps( struct x86_function *p, void sse_cmpps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - GLubyte cc) + unsigned char cc) { emit_2ub(p, X86_TWOB, 0xC2); emit_modrm(p, dest, arg0); emit_1ub(p, cc); } +void sse_pmovmskb( struct x86_function *p, + struct x86_reg dest, + struct x86_reg src) +{ + emit_3ub(p, 0x66, X86_TWOB, 0xD7); + emit_modrm(p, dest, src); +} + /*********************************************************************** * SSE2 instructions */ @@ -586,13 +661,21 @@ void sse_cmpps( struct x86_function *p, void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - GLubyte shuf) + unsigned char shuf) { emit_3ub(p, 0x66, X86_TWOB, 0x70); emit_modrm(p, dest, arg0); emit_1ub(p, shuf); } +void sse2_cvttps2dq( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub( p, 0xF3, X86_TWOB, 0x5B ); + emit_modrm( p, dst, src ); +} + void sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) @@ -625,6 +708,14 @@ void sse2_packuswb( struct x86_function *p, emit_modrm( p, dst, src ); } +void sse2_rcpps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x53); + emit_modrm( p, dst, src ); +} + void sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) @@ -712,11 +803,11 @@ void x87_fclex( struct x86_function *p ) static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86_reg arg, - GLubyte dst0ub0, - GLubyte dst0ub1, - GLubyte arg0ub0, - GLubyte arg0ub1, - GLubyte argmem_noreg) + unsigned char dst0ub0, + unsigned char dst0ub1, + unsigned char arg0ub0, + unsigned char arg0ub1, + unsigned char argmem_noreg) { assert(dst.file == file_x87); @@ -729,7 +820,7 @@ static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86 assert(0); } else if (dst.idx == 0) { - assert(arg.file = file_REG32); + assert(arg.file == file_REG32); emit_1ub(p, 0xd8); emit_modrm_noreg(p, argmem_noreg, arg); } @@ -1056,44 +1147,41 @@ void mmx_movq( struct x86_function *p, * account any push/pop activity: */ struct x86_reg x86_fn_arg( struct x86_function *p, - GLuint arg ) + unsigned arg ) { return x86_make_disp(x86_make_reg(file_REG32, reg_SP), p->stack_offset + arg * 4); /* ??? */ } -/** - * Initialize an x86_function object, allocating space for up to - * 'code_size' bytes of code. - */ -GLboolean x86_init_func( struct x86_function *p, GLuint code_size ) +void x86_init_func( struct x86_function *p ) { - assert(!p->store); + p->size = 0; + p->store = NULL; + p->csr = p->store; +} + +void x86_init_func_size( struct x86_function *p, unsigned code_size ) +{ + p->size = code_size; p->store = _mesa_exec_malloc(code_size); - if (p->store) { - p->csr = p->store; - return GL_TRUE; - } - else { - p->csr = NULL; - return GL_FALSE; - } + p->csr = p->store; } void x86_release_func( struct x86_function *p ) { - if (p->store) - _mesa_exec_free(p->store); - p->store = p->csr = NULL; + _mesa_exec_free(p->store); + p->store = NULL; + p->csr = NULL; + p->size = 0; } void (*x86_get_func( struct x86_function *p ))(void) { - if (DISASSEM) + if (DISASSEM && p->store) _mesa_printf("disassemble %p %p\n", p->store, p->csr); - return (void (*)(void))p->store; + return (void (*)(void)) (unsigned long) p->store; } #else diff --git a/src/mesa/x86/rtasm/x86sse.h b/src/mesa/x86/rtasm/x86sse.h index 42b09937bc..c2aa416492 100644 --- a/src/mesa/x86/rtasm/x86sse.h +++ b/src/mesa/x86/rtasm/x86sse.h @@ -2,26 +2,25 @@ #ifndef _X86SSE_H_ #define _X86SSE_H_ -#if defined(USE_X86_ASM) || defined(SLANG_X86) - -#include "glheader.h" +#if defined(__i386__) || defined(__386__) /* It is up to the caller to ensure that instructions issued are * suitable for the host cpu. There are no checks made in this module * for mmx/sse/sse2 support on the cpu. */ struct x86_reg { - GLuint file:3; - GLuint idx:3; - GLuint mod:2; /* mod_REG if this is just a register */ - GLint disp:24; /* only +/- 23bits of offset - should be enough... */ + unsigned file:3; + unsigned idx:3; + unsigned mod:2; /* mod_REG if this is just a register */ + int disp:24; /* only +/- 23bits of offset - should be enough... */ }; struct x86_function { - GLubyte *store; - GLubyte *csr; - GLuint stack_offset; - GLint need_emms; + unsigned size; + unsigned char *store; + unsigned char *csr; + unsigned stack_offset; + int need_emms; const char *fn; }; @@ -80,7 +79,8 @@ enum sse_cc { */ -GLboolean x86_init_func( struct x86_function *p, GLuint code_size ); +void x86_init_func( struct x86_function *p ); +void x86_init_func_size( struct x86_function *p, unsigned code_size ); void x86_release_func( struct x86_function *p ); void (*x86_get_func( struct x86_function *p ))( void ); @@ -92,7 +92,7 @@ struct x86_reg x86_make_reg( enum x86_reg_file file, enum x86_reg_name idx ); struct x86_reg x86_make_disp( struct x86_reg reg, - GLint disp ); + int disp ); struct x86_reg x86_deref( struct x86_reg reg ); @@ -101,31 +101,32 @@ struct x86_reg x86_get_base_reg( struct x86_reg reg ); /* Labels, jumps and fixup: */ -GLubyte *x86_get_label( struct x86_function *p ); +unsigned char *x86_get_label( struct x86_function *p ); void x86_jcc( struct x86_function *p, enum x86_cc cc, - GLubyte *label ); + unsigned char *label ); -GLubyte *x86_jcc_forward( struct x86_function *p, +unsigned char *x86_jcc_forward( struct x86_function *p, enum x86_cc cc ); -GLubyte *x86_jmp_forward( struct x86_function *p); +unsigned char *x86_jmp_forward( struct x86_function *p); -GLubyte *x86_call_forward( struct x86_function *p); +unsigned char *x86_call_forward( struct x86_function *p); void x86_fixup_fwd_jump( struct x86_function *p, - GLubyte *fixup ); + unsigned char *fixup ); -void x86_jmp( struct x86_function *p, GLubyte *label ); +void x86_jmp( struct x86_function *p, unsigned char *label ); -void x86_call( struct x86_function *p, GLubyte *label ); +/* void x86_call( struct x86_function *p, void (*label)() ); */ +void x86_call( struct x86_function *p, struct x86_reg reg); /* michal: * Temporary. As I need immediate operands, and dont want to mess with the codegen, * I load the immediate into general purpose register and use it. */ -void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, GLint imm ); +void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ); /* Macro for sse_shufps() and sse2_pshufd(): @@ -141,19 +142,24 @@ void mmx_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg sr void mmx_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_cvttps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packsswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, GLubyte shuf ); +void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, + unsigned char shuf ); +void sse2_rcpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_addps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_addss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_divss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_andnps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src, GLubyte cc ); +void sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src, + unsigned char cc ); void sse_maxps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_maxss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_minps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); @@ -166,9 +172,14 @@ void sse_movss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) void sse_movups( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_mulps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_mulss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_orps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_xorps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_subps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_rsqrtps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_rsqrtss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, GLubyte shuf ); +void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, + unsigned char shuf ); +void sse_pmovmskb( struct x86_function *p, struct x86_reg dest, struct x86_reg src ); void x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void x86_and( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); @@ -239,7 +250,7 @@ void x87_fucom( struct x86_function *p, struct x86_reg arg ); * account any push/pop activity. Note - doesn't track explict * manipulation of ESP by other instructions. */ -struct x86_reg x86_fn_arg( struct x86_function *p, GLuint arg ); +struct x86_reg x86_fn_arg( struct x86_function *p, unsigned arg ); #endif #endif -- cgit v1.2.3 From 363d8785192e299963df520d53c221f494c8026c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 18 Mar 2008 15:29:11 -0700 Subject: [945] Remove conditional in 945 3D mipmap layout checking for cube layout. --- src/mesa/drivers/dri/i915/i915_tex_layout.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index dfd02112ba..2211ffa677 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -287,17 +287,16 @@ i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) pack_x_nr = 1; for (level = mt->first_level; level <= mt->last_level; level++) { - GLuint nr_images = mt->target == GL_TEXTURE_3D ? depth : 6; GLint x = 0; GLint y = 0; GLint q, j; - intel_miptree_set_level_info(mt, level, nr_images, + intel_miptree_set_level_info(mt, level, depth, 0, mt->total_height, width, height, depth); - for (q = 0; q < nr_images;) { - for (j = 0; j < pack_x_nr && q < nr_images; j++, q++) { + for (q = 0; q < depth;) { + for (j = 0; j < pack_x_nr && q < depth; j++, q++) { intel_miptree_set_image_offset(mt, level, q, x, y); x += pack_x_pitch; } -- cgit v1.2.3 From e5f50f2fa32c50807da3a8f13733f0fbc7868f94 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 18 Mar 2008 16:20:44 -0700 Subject: [intel] Clarify miptree layout by using byte offsets to images. --- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 22 ++++++++++++++-------- src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 19 +++++++++++++++---- 2 files changed, 29 insertions(+), 12 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index ccb0fd53d0..55503f45ae 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -326,7 +326,7 @@ intel_miptree_set_image_offset(struct intel_mipmap_tree *mt, assert(img < mt->level[level].nr_images); - mt->level[level].image_offset[img] = (x + y * mt->pitch); + mt->level[level].image_offset[img] = (x + y * mt->pitch) * mt->cpp; DBG("%s level %d img %d pos %d,%d image_offset %x\n", __FUNCTION__, level, img, x, y, mt->level[level].image_offset[img]); @@ -357,7 +357,7 @@ intel_miptree_image_offset(struct intel_mipmap_tree *mt, { if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) return (mt->level[level].level_offset + - mt->level[level].image_offset[face] * mt->cpp); + mt->level[level].image_offset[face]); else return mt->level[level].level_offset; } @@ -368,6 +368,8 @@ intel_miptree_image_offset(struct intel_mipmap_tree *mt, * Map a teximage in a mipmap tree. * \param row_stride returns row stride in bytes * \param image_stride returns image stride in bytes (for 3D textures). + * \param image_offsets pointer to array of pixel offsets from the returned + * pointer to each depth image * \return address of mapping */ GLubyte * @@ -382,12 +384,16 @@ intel_miptree_image_map(struct intel_context * intel, if (row_stride) *row_stride = mt->pitch * mt->cpp; - if (image_offsets) { - if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) - memset(image_offsets, 0, mt->level[level].depth * sizeof(GLuint)); - else - memcpy(image_offsets, mt->level[level].image_offset, - mt->level[level].depth * sizeof(GLuint)); + if (mt->target == GL_TEXTURE_3D) { + int i; + + for (i = 0; i < mt->level[level].depth; i++) + image_offsets[i] = mt->level[level].image_offset[i] / mt->cpp; + } else { + assert(mt->level[level].depth == 1); + assert(mt->target == GL_TEXTURE_CUBE_MAP || + mt->level[level].image_offset[0] == 0); + image_offsets[0] = 0; } return (intel_region_map(intel, mt->region) + diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index 3c1a6ffa2a..c9537dbb9a 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -62,18 +62,29 @@ */ struct intel_mipmap_level { + /** + * Byte offset to the base of this level. + * + * This is used for mipmap levels of 1D/2D/3D textures. However, CUBE + * layouts spread images around the whole tree, so the level offset is + * always zero in that case. + */ GLuint level_offset; GLuint width; GLuint height; + /** Depth of the mipmap at this level: 1 for 1D/2D/CUBE, n for 3D. */ GLuint depth; + /** Number of images at this level: 1 for 1D/2D, 6 for CUBE, depth for 3D */ GLuint nr_images; - /* Explicitly store the offset of each image for each cube face or - * depth value. Pretty much have to accept that hardware formats + /** + * Byte offset from level_offset to the image for each cube face or depth + * level. + * + * Pretty much have to accept that hardware formats * are going to be so diverse that there is no unified way to * compute the offsets of depth/cube images within a mipmap level, - * so have to store them as a lookup table: - * NOTE level_offset is a byte offset, but the image_offsets are _pixel_ offsets!!! + * so have to store them as a lookup table. */ GLuint *image_offset; }; -- cgit v1.2.3 From 45adf29ed0bd47e21bed824ab9afcc7b9dcbb60d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 18 Mar 2008 16:06:41 -0700 Subject: [i915] Move miptree layout code into separate functions per target. Also clean up some other miscellaneous formatting nits while I'm at it. --- src/mesa/drivers/dri/i915/i915_tex_layout.c | 543 +++++++++++++++------------- 1 file changed, 285 insertions(+), 258 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index 2211ffa677..ef9ba951de 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -36,141 +36,162 @@ #define FILE_DEBUG_FLAG DEBUG_TEXTURE -static GLint initial_offsets[6][2] = { {0, 0}, -{0, 2}, -{1, 0}, -{1, 2}, -{1, 1}, -{1, 3} +static GLint initial_offsets[6][2] = { + {0, 0}, + {0, 2}, + {1, 0}, + {1, 2}, + {1, 1}, + {1, 3} }; -static GLint step_offsets[6][2] = { {0, 2}, -{0, 2}, -{-1, 2}, -{-1, 2}, -{-1, 1}, -{-1, 1} +static GLint step_offsets[6][2] = { + {0, 2}, + {0, 2}, + {-1, 2}, + {-1, 2}, + {-1, 1}, + {-1, 1} }; -GLboolean -i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) +static void +i915_miptree_layout_cube(struct intel_context *intel, + struct intel_mipmap_tree * mt) { + const GLuint dim = mt->width0; + GLuint face; + GLuint lvlWidth = mt->width0, lvlHeight = mt->height0; GLint level; - switch (mt->target) { - case GL_TEXTURE_CUBE_MAP:{ - const GLuint dim = mt->width0; - GLuint face; - GLuint lvlWidth = mt->width0, lvlHeight = mt->height0; - - assert(lvlWidth == lvlHeight); /* cubemap images are square */ - - /* double pitch for cube layouts */ - mt->pitch = intel_miptree_pitch_align (intel, mt, dim * 2); - mt->total_height = dim * 4; - - for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_level_info(mt, level, 6, - 0, 0, - /*OLD: mt->pitch, mt->total_height,*/ - lvlWidth, lvlHeight, - 1); - lvlWidth /= 2; - lvlHeight /= 2; - } - - for (face = 0; face < 6; face++) { - GLuint x = initial_offsets[face][0] * dim; - GLuint y = initial_offsets[face][1] * dim; - GLuint d = dim; - - for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_image_offset(mt, level, face, x, y); - - if (d == 0) - _mesa_printf("cube mipmap %d/%d (%d..%d) is 0x0\n", - face, level, mt->first_level, mt->last_level); - - d >>= 1; - x += step_offsets[face][0] * d; - y += step_offsets[face][1] * d; - } - } - break; - } - case GL_TEXTURE_3D:{ - GLuint width = mt->width0; - GLuint height = mt->height0; - GLuint depth = mt->depth0; - GLuint stack_height = 0; - - /* Calculate the size of a single slice. - */ - mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); - - /* XXX: hardware expects/requires 9 levels at minimum. - */ - for (level = mt->first_level; level <= MAX2(8, mt->last_level); - level++) { - intel_miptree_set_level_info(mt, level, depth, 0, mt->total_height, - width, height, depth); - - - stack_height += MAX2(2, height); - - width = minify(width); - height = minify(height); - depth = minify(depth); - } - - /* Fixup depth image_offsets: - */ - depth = mt->depth0; - for (level = mt->first_level; level <= mt->last_level; level++) { - GLuint i; - for (i = 0; i < depth; i++) - intel_miptree_set_image_offset(mt, level, i, - 0, i * stack_height); - - depth = minify(depth); - } - - - /* Multiply slice size by texture depth for total size. It's - * remarkable how wasteful of memory the i915 texture layouts - * are. They are largely fixed in the i945. - */ - mt->total_height = stack_height * mt->depth0; - break; + assert(lvlWidth == lvlHeight); /* cubemap images are square */ + + /* double pitch for cube layouts */ + mt->pitch = intel_miptree_pitch_align (intel, mt, dim * 2); + mt->total_height = dim * 4; + + for (level = mt->first_level; level <= mt->last_level; level++) { + intel_miptree_set_level_info(mt, level, 6, + 0, 0, + /*OLD: mt->pitch, mt->total_height,*/ + lvlWidth, lvlHeight, + 1); + lvlWidth /= 2; + lvlHeight /= 2; + } + + for (face = 0; face < 6; face++) { + GLuint x = initial_offsets[face][0] * dim; + GLuint y = initial_offsets[face][1] * dim; + GLuint d = dim; + + for (level = mt->first_level; level <= mt->last_level; level++) { + intel_miptree_set_image_offset(mt, level, face, x, y); + + if (d == 0) + _mesa_printf("cube mipmap %d/%d (%d..%d) is 0x0\n", + face, level, mt->first_level, mt->last_level); + + d >>= 1; + x += step_offsets[face][0] * d; + y += step_offsets[face][1] * d; } + } +} - default:{ - GLuint width = mt->width0; - GLuint height = mt->height0; - GLuint img_height; +static void +i915_miptree_layout_3d(struct intel_context *intel, + struct intel_mipmap_tree * mt) +{ + GLuint width = mt->width0; + GLuint height = mt->height0; + GLuint depth = mt->depth0; + GLuint stack_height = 0; + GLint level; - mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); - mt->total_height = 0; + /* Calculate the size of a single slice. */ + mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); - for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_level_info(mt, level, 1, - 0, mt->total_height, - width, height, 1); + /* XXX: hardware expects/requires 9 levels at minimum. */ + for (level = mt->first_level; level <= MAX2(8, mt->last_level); level++) { + intel_miptree_set_level_info(mt, level, depth, 0, mt->total_height, + width, height, depth); - if (mt->compressed) - img_height = MAX2(1, height / 4); - else - img_height = (MAX2(2, height) + 1) & ~1; + stack_height += MAX2(2, height); - mt->total_height += img_height; + width = minify(width); + height = minify(height); + depth = minify(depth); + } - width = minify(width); - height = minify(height); - } - break; + /* Fixup depth image_offsets: */ + depth = mt->depth0; + for (level = mt->first_level; level <= mt->last_level; level++) { + GLuint i; + for (i = 0; i < depth; i++) { + intel_miptree_set_image_offset(mt, level, i, + 0, i * stack_height); } + + depth = minify(depth); + } + + /* Multiply slice size by texture depth for total size. It's + * remarkable how wasteful of memory the i915 texture layouts + * are. They are largely fixed in the i945. + */ + mt->total_height = stack_height * mt->depth0; +} + +static void +i915_miptree_layout_2d(struct intel_context *intel, + struct intel_mipmap_tree * mt) +{ + GLuint width = mt->width0; + GLuint height = mt->height0; + GLuint img_height; + GLint level; + + mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); + mt->total_height = 0; + + for (level = mt->first_level; level <= mt->last_level; level++) { + intel_miptree_set_level_info(mt, level, 1, + 0, mt->total_height, + width, height, 1); + + if (mt->compressed) + img_height = MAX2(1, height / 4); + else + img_height = (MAX2(2, height) + 1) & ~1; + + mt->total_height += img_height; + + width = minify(width); + height = minify(height); + } +} + +GLboolean +i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) +{ + switch (mt->target) { + case GL_TEXTURE_CUBE_MAP: + i915_miptree_layout_cube(intel, mt); + break; + case GL_TEXTURE_3D: + i915_miptree_layout_3d(intel, mt); + break; + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_RECTANGLE_ARB: + i915_miptree_layout_2d(intel, mt); + break; + default: + _mesa_problem(NULL, "Unexpected tex target in i915_miptree_layout()"); + break; } + DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__, mt->pitch, mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp); @@ -178,160 +199,166 @@ i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) return GL_TRUE; } - -GLboolean -i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) +static void +i945_miptree_layout_cube(struct intel_context *intel, + struct intel_mipmap_tree * mt) { + const GLuint dim = mt->width0; + GLuint face; + GLuint lvlWidth = mt->width0, lvlHeight = mt->height0; GLint level; - switch (mt->target) { - case GL_TEXTURE_CUBE_MAP:{ - const GLuint dim = mt->width0; - GLuint face; - GLuint lvlWidth = mt->width0, lvlHeight = mt->height0; - - assert(lvlWidth == lvlHeight); /* cubemap images are square */ - - /* Depending on the size of the largest images, pitch can be - * determined either by the old-style packing of cubemap faces, - * or the final row of 4x4, 2x2 and 1x1 faces below this. - */ - if (dim > 32) - mt->pitch = intel_miptree_pitch_align (intel, mt, dim); - else - mt->pitch = 14 * 8; - - mt->total_height = dim * 4 + 4; - - /* Set all the levels to effectively occupy the whole rectangular region. - */ - for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_level_info(mt, level, 6, - 0, 0, - lvlWidth, lvlHeight, 1); - lvlWidth /= 2; - lvlHeight /= 2; + assert(lvlWidth == lvlHeight); /* cubemap images are square */ + + /* Depending on the size of the largest images, pitch can be + * determined either by the old-style packing of cubemap faces, + * or the final row of 4x4, 2x2 and 1x1 faces below this. + */ + if (dim > 32) + mt->pitch = intel_miptree_pitch_align (intel, mt, dim); + else + mt->pitch = 14 * 8; + + mt->total_height = dim * 4 + 4; + + /* Set all the levels to effectively occupy the whole rectangular region. */ + for (level = mt->first_level; level <= mt->last_level; level++) { + intel_miptree_set_level_info(mt, level, 6, + 0, 0, + lvlWidth, lvlHeight, 1); + lvlWidth /= 2; + lvlHeight /= 2; + } + + for (face = 0; face < 6; face++) { + GLuint x = initial_offsets[face][0] * dim; + GLuint y = initial_offsets[face][1] * dim; + GLuint d = dim; + + if (dim == 4 && face >= 4) { + y = mt->total_height - 4; + x = (face - 4) * 8; + } else if (dim < 4 && (face > 0 || mt->first_level > 0)) { + y = mt->total_height - 4; + x = face * 8; + } + + for (level = mt->first_level; level <= mt->last_level; level++) { + intel_miptree_set_image_offset(mt, level, face, x, y); + + d >>= 1; + + switch (d) { + case 4: + switch (face) { + case FACE_POS_X: + case FACE_NEG_X: + x += step_offsets[face][0] * d; + y += step_offsets[face][1] * d; + break; + case FACE_POS_Y: + case FACE_NEG_Y: + y += 12; + x -= 8; + break; + case FACE_POS_Z: + case FACE_NEG_Z: + y = mt->total_height - 4; + x = (face - 4) * 8; + break; + } + + case 2: + y = mt->total_height - 4; + x = 16 + face * 8; + break; + + case 1: + x += 48; + break; + + default: + x += step_offsets[face][0] * d; + y += step_offsets[face][1] * d; + break; } + } + } +} + +static void +i945_miptree_layout_3d(struct intel_context *intel, + struct intel_mipmap_tree * mt) +{ + GLuint width = mt->width0; + GLuint height = mt->height0; + GLuint depth = mt->depth0; + GLuint pack_x_pitch, pack_x_nr; + GLuint pack_y_pitch; + GLuint level; + + mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); + mt->total_height = 0; + + pack_y_pitch = MAX2(mt->height0, 2); + pack_x_pitch = mt->pitch; + pack_x_nr = 1; + + for (level = mt->first_level; level <= mt->last_level; level++) { + GLint x = 0; + GLint y = 0; + GLint q, j; + + intel_miptree_set_level_info(mt, level, depth, + 0, mt->total_height, + width, height, depth); + + for (q = 0; q < depth;) { + for (j = 0; j < pack_x_nr && q < depth; j++, q++) { + intel_miptree_set_image_offset(mt, level, q, x, y); + x += pack_x_pitch; + } + + x = 0; + y += pack_y_pitch; + } + mt->total_height += y; - for (face = 0; face < 6; face++) { - GLuint x = initial_offsets[face][0] * dim; - GLuint y = initial_offsets[face][1] * dim; - GLuint d = dim; - - if (dim == 4 && face >= 4) { - y = mt->total_height - 4; - x = (face - 4) * 8; - } - else if (dim < 4 && (face > 0 || mt->first_level > 0)) { - y = mt->total_height - 4; - x = face * 8; - } - - for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_image_offset(mt, level, face, x, y); - - d >>= 1; - - switch (d) { - case 4: - switch (face) { - case FACE_POS_X: - case FACE_NEG_X: - x += step_offsets[face][0] * d; - y += step_offsets[face][1] * d; - break; - case FACE_POS_Y: - case FACE_NEG_Y: - y += 12; - x -= 8; - break; - case FACE_POS_Z: - case FACE_NEG_Z: - y = mt->total_height - 4; - x = (face - 4) * 8; - break; - } - - case 2: - y = mt->total_height - 4; - x = 16 + face * 8; - break; - - case 1: - x += 48; - break; - - default: - x += step_offsets[face][0] * d; - y += step_offsets[face][1] * d; - break; - } - } - } - break; + if (pack_x_pitch > 4) { + pack_x_pitch >>= 1; + pack_x_nr <<= 1; + assert(pack_x_pitch * pack_x_nr <= mt->pitch); } - case GL_TEXTURE_3D:{ - GLuint width = mt->width0; - GLuint height = mt->height0; - GLuint depth = mt->depth0; - GLuint pack_x_pitch, pack_x_nr; - GLuint pack_y_pitch; - GLuint level; - - mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); - mt->total_height = 0; - - pack_y_pitch = MAX2(mt->height0, 2); - pack_x_pitch = mt->pitch; - pack_x_nr = 1; - - for (level = mt->first_level; level <= mt->last_level; level++) { - GLint x = 0; - GLint y = 0; - GLint q, j; - - intel_miptree_set_level_info(mt, level, depth, - 0, mt->total_height, - width, height, depth); - - for (q = 0; q < depth;) { - for (j = 0; j < pack_x_nr && q < depth; j++, q++) { - intel_miptree_set_image_offset(mt, level, q, x, y); - x += pack_x_pitch; - } - - x = 0; - y += pack_y_pitch; - } - - - mt->total_height += y; - - if (pack_x_pitch > 4) { - pack_x_pitch >>= 1; - pack_x_nr <<= 1; - assert(pack_x_pitch * pack_x_nr <= mt->pitch); - } - - if (pack_y_pitch > 2) { - pack_y_pitch >>= 1; - } - - width = minify(width); - height = minify(height); - depth = minify(depth); - } - break; + + if (pack_y_pitch > 2) { + pack_y_pitch >>= 1; } + width = minify(width); + height = minify(height); + depth = minify(depth); + } +} + +GLboolean +i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) +{ + switch (mt->target) { + case GL_TEXTURE_CUBE_MAP: + i945_miptree_layout_cube(intel, mt); + break; + case GL_TEXTURE_3D: + i945_miptree_layout_3d(intel, mt); + break; case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_RECTANGLE_ARB: - i945_miptree_layout_2d(intel, mt); - break; + i945_miptree_layout_2d(intel, mt); + break; default: _mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()"); + break; } DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__, -- cgit v1.2.3 From c2814f2a3fbfa0e4ba6c45347fcadd3722b005ff Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 18 Mar 2008 17:49:31 -0700 Subject: [i915] Add comments about how cube texture layout works. --- src/mesa/drivers/dri/i915/i915_tex_layout.c | 109 +++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index ef9ba951de..87daec6710 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -25,8 +25,8 @@ * **************************************************************************/ -/* Code to layout images in a mipmap tree for i915 and i945 - * respectively. +/** @file i915_tex_layout.c + * Code to layout images in a mipmap tree for i830M-GM915 and G945 and beyond. */ #include "intel_mipmap_tree.h" @@ -55,6 +55,50 @@ static GLint step_offsets[6][2] = { {-1, 1} }; +/** + * Cube texture map layout for i830M-GM915. + * + * Hardware layout looks like: + * + * +-------+-------+ + * | | | + * | | | + * | | | + * | +x | +y | + * | | | + * | | | + * | | | + * | | | + * +---+---+-------+ + * | | | | + * | +x| +y| | + * | | | | + * | | | | + * +-+-+---+ +z | + * | | | | | + * +-+-+ +z| | + * | | | | + * +-+-+---+-------+ + * | | | + * | | | + * | | | + * | -x | -y | + * | | | + * | | | + * | | | + * | | | + * +---+---+-------+ + * | | | | + * | -x| -y| | + * | | | | + * | | | | + * +-+-+---+ -z | + * | | | | | + * +-+-+ -z| | + * | | | | + * +-+---+-------+ + * + */ static void i915_miptree_layout_cube(struct intel_context *intel, struct intel_mipmap_tree * mt) @@ -199,6 +243,67 @@ i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) return GL_TRUE; } + +/** + * Cube texture map layout for GM945 and later. + * + * The hardware layout looks like the 830-915 layout, except for the small + * sizes. A zoomed in view of the layout for 945 is: + * + * +-------+-------+ + * | 8x8 | 8x8 | + * | | | + * | | | + * | +x | +y | + * | | | + * | | | + * | | | + * | | | + * +---+---+-------+ + * |4x4| | 8x8 | + * | +x| | | + * | | | | + * | | | | + * +---+ | +z | + * |4x4| | | + * | +y| | | + * | | | | + * +---+ +-------+ + * + * ... + * + * +-------+-------+ + * | 8x8 | 8x8 | + * | | | + * | | | + * | -x | -y | + * | | | + * | | | + * | | | + * | | | + * +---+---+-------+ + * |4x4| | 8x8 | + * | -x| | | + * | | | | + * | | | | + * +---+ | -z | + * |4x4| | | + * | -y| | | + * | | | | + * +---+ +---+---+---+---+---+---+---+---+---+ + * |4x4| |4x4| |2x2| |2x2| |2x2| |2x2| + * | +z| | -z| | +x| | +y| | +z| | -x| ... + * | | | | | | | | | | | | + * +---+ +---+ +---+ +---+ +---+ +---+ + * + * The bottom row continues with the remaining 2x2 then the 1x1 mip contents + * in order, with each of them aligned to a 4x4 block boundary. Thus, for + * 32x32 cube maps and smaller, the bottom row layout is going to dictate the + * pitch of the tree. For a tree with 4x4 images, the pitch is at least + * 14 * 8 = 112 texels, for 2x2 it is at least 12 * 8 texels, and for 1x1 + * it is 6 * 8 texels. + */ + static void i945_miptree_layout_cube(struct intel_context *intel, struct intel_mipmap_tree * mt) -- cgit v1.2.3 From b790b24ff9204eb6f305b14bd40bb903e65dd541 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 18 Mar 2008 19:45:30 -0700 Subject: [i915] Bug #13634: Fix bugs in 945 cube mipmap layout. The most egregious, and the one the bug report and failure in the cubemap demo were about was introduced with intel_mipmap_pitch_align(), where a "* 2" for the pitch calculation was lost. The base size < 32 case also failed to align, which may have caused problems with render to texture. Another bug would have broken 2x2/1x1 base mipmap levels by placing the data where the hardware wouldn't look for it. Other bugs remain with the layout of the small mipmap faces (hardware looks for them in X,Y,Z,-X,-Y,-Z order along the bottom row, but we lay them out X,-X,Y,-Y,Z,-Z). --- src/mesa/drivers/dri/i915/i915_tex_layout.c | 33 ++++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index 87daec6710..b5085f49d4 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -37,22 +37,22 @@ #define FILE_DEBUG_FLAG DEBUG_TEXTURE static GLint initial_offsets[6][2] = { - {0, 0}, - {0, 2}, - {1, 0}, - {1, 2}, - {1, 1}, - {1, 3} + [FACE_POS_X] = {0, 0}, + [FACE_POS_Y] = {1, 0}, + [FACE_POS_Z] = {1, 1}, + [FACE_NEG_X] = {0, 2}, + [FACE_NEG_Y] = {1, 2}, + [FACE_NEG_Z] = {1, 3}, }; static GLint step_offsets[6][2] = { - {0, 2}, - {0, 2}, - {-1, 2}, - {-1, 2}, - {-1, 1}, - {-1, 1} + [FACE_POS_X] = {0, 2}, + [FACE_POS_Y] = {-1, 2}, + [FACE_POS_Z] = {-1, 1}, + [FACE_NEG_X] = {0, 2}, + [FACE_NEG_Y] = {-1, 2}, + [FACE_NEG_Z] = {-1, 1}, }; /** @@ -320,11 +320,14 @@ i945_miptree_layout_cube(struct intel_context *intel, * or the final row of 4x4, 2x2 and 1x1 faces below this. */ if (dim > 32) - mt->pitch = intel_miptree_pitch_align (intel, mt, dim); + mt->pitch = intel_miptree_pitch_align (intel, mt, dim * 2); else - mt->pitch = 14 * 8; + mt->pitch = intel_miptree_pitch_align (intel, mt, 14 * 8); - mt->total_height = dim * 4 + 4; + if (dim >= 4) + mt->total_height = dim * 4 + 4; + else + mt->total_height = 4; /* Set all the levels to effectively occupy the whole rectangular region. */ for (level = mt->first_level; level <= mt->last_level; level++) { -- cgit v1.2.3 From c62f504eb6030097b679233a75f87cca1b0e617d Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Wed, 19 Mar 2008 16:29:47 +0800 Subject: [i915] fix fragment.position --- src/mesa/drivers/dri/i915/intel_tris.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index 29f0b51ba6..bbb4e0f3cd 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -311,10 +311,18 @@ intel_wpos_triangle(struct intel_context *intel, { GLuint offset = intel->wpos_offset; GLuint size = intel->wpos_size; + GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset); + GLfloat *v1_wpos = (GLfloat *)((char *)v1 + offset); + GLfloat *v2_wpos = (GLfloat *)((char *)v2 + offset); + + __memcpy(v0_wpos, v0, size); + __memcpy(v1_wpos, v1, size); + __memcpy(v2_wpos, v2, size); + + v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h; + v1_wpos[1] = -v1_wpos[1] + intel->driDrawable->h; + v2_wpos[1] = -v2_wpos[1] + intel->driDrawable->h; - __memcpy(((char *) v0) + offset, v0, size); - __memcpy(((char *) v1) + offset, v1, size); - __memcpy(((char *) v2) + offset, v2, size); intel_draw_triangle(intel, v0, v1, v2); } @@ -326,9 +334,14 @@ intel_wpos_line(struct intel_context *intel, { GLuint offset = intel->wpos_offset; GLuint size = intel->wpos_size; + GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset); + GLfloat *v1_wpos = (GLfloat *)((char *)v1 + offset); + + __memcpy(v0_wpos, v0, size); + __memcpy(v1_wpos, v1, size); - __memcpy(((char *) v0) + offset, v0, size); - __memcpy(((char *) v1) + offset, v1, size); + v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h; + v1_wpos[1] = -v1_wpos[1] + intel->driDrawable->h; intel_draw_line(intel, v0, v1); } @@ -339,8 +352,10 @@ intel_wpos_point(struct intel_context *intel, intelVertexPtr v0) { GLuint offset = intel->wpos_offset; GLuint size = intel->wpos_size; + GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset); - __memcpy(((char *) v0) + offset, v0, size); + __memcpy(v0_wpos, v0, size); + v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h; intel_draw_point(intel, v0); } -- cgit v1.2.3 From 947312e464edf4257c06e9889c976e268d43dd97 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Wed, 19 Mar 2008 16:32:29 +0800 Subject: [i915] arb point sprite only support in i965 --- src/mesa/drivers/dri/intel/intel_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 12300e9146..46c53ba4c2 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -205,7 +205,6 @@ static const struct dri_extension card_extensions[] = { {"GL_ARB_texture_rectangle", NULL}, {"GL_NV_texture_rectangle", NULL}, {"GL_EXT_texture_rectangle", NULL}, - {"GL_ARB_point_sprite", NULL}, {"GL_ARB_point_parameters", NULL}, {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, @@ -247,6 +246,7 @@ static const struct dri_extension brw_extensions[] = { { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions}, { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions}, { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions}, + { "GL_ARB_point_sprite", NULL}, { "GL_ARB_fragment_shader", NULL }, { "GL_ARB_draw_buffers", NULL }, { "GL_ARB_depth_texture", NULL }, -- cgit v1.2.3 From 29054676a094c59b70cfec8b05da11741e53722c Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 19 Mar 2008 08:38:28 -0600 Subject: s/x86_init_func/x86_init_func_size (fixes bug 15119) --- src/mesa/tnl/t_vertex_sse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/tnl/t_vertex_sse.c b/src/mesa/tnl/t_vertex_sse.c index 922737009a..f1c98fe2d1 100644 --- a/src/mesa/tnl/t_vertex_sse.c +++ b/src/mesa/tnl/t_vertex_sse.c @@ -653,7 +653,7 @@ void _tnl_generate_sse_emit( GLcontext *ctx ) p.identity = x86_make_reg(file_XMM, 6); p.chan0 = x86_make_reg(file_XMM, 7); - if (!x86_init_func(&p.func, MAX_SSE_CODE_SIZE)) { + if (!x86_init_func_size(&p.func, MAX_SSE_CODE_SIZE)) { vtx->emit = NULL; return; } -- cgit v1.2.3 From b5292b4d9967f3a3a35cd7f1909b46fab9179111 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 19 Mar 2008 09:52:08 -0600 Subject: x86_init_func_size() returns int to indicate success/fail (bug 15119) --- src/mesa/x86/rtasm/x86sse.c | 3 ++- src/mesa/x86/rtasm/x86sse.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c index 39c0e9b851..772471c723 100644 --- a/src/mesa/x86/rtasm/x86sse.c +++ b/src/mesa/x86/rtasm/x86sse.c @@ -1161,11 +1161,12 @@ void x86_init_func( struct x86_function *p ) p->csr = p->store; } -void x86_init_func_size( struct x86_function *p, unsigned code_size ) +int x86_init_func_size( struct x86_function *p, unsigned code_size ) { p->size = code_size; p->store = _mesa_exec_malloc(code_size); p->csr = p->store; + return p->store != NULL; } void x86_release_func( struct x86_function *p ) diff --git a/src/mesa/x86/rtasm/x86sse.h b/src/mesa/x86/rtasm/x86sse.h index c2aa416492..f6282f5bd4 100644 --- a/src/mesa/x86/rtasm/x86sse.h +++ b/src/mesa/x86/rtasm/x86sse.h @@ -80,7 +80,7 @@ enum sse_cc { void x86_init_func( struct x86_function *p ); -void x86_init_func_size( struct x86_function *p, unsigned code_size ); +int x86_init_func_size( struct x86_function *p, unsigned code_size ); void x86_release_func( struct x86_function *p ); void (*x86_get_func( struct x86_function *p ))( void ); -- cgit v1.2.3 From 65c4ced1ccea7ff88123296b7f0587faa6f23eef Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 19 Mar 2008 18:10:47 -0400 Subject: Radeon 9500 (0x4144) only has one pipe confirmed by Reid Linnemann --- src/mesa/drivers/dri/radeon/radeon_screen.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 93b239ae9f..d6caa2ac89 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -557,7 +557,11 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->chip_family = CHIP_FAMILY_RS300; break; + /* 9500 with 1 pipe verified by: Reid Linnemann */ case PCI_CHIP_R300_AD: + screen->chip_family = CHIP_FAMILY_RV350; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; case PCI_CHIP_R300_AE: case PCI_CHIP_R300_AF: case PCI_CHIP_R300_AG: -- cgit v1.2.3 From e03dd83209929ca0925172c962bc41cab8268164 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 19 Mar 2008 17:24:20 -0600 Subject: fix IEEE_ONE definition for ICC compiler (bug 15134) --- src/mesa/main/imports.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index ebdfc452a7..b0234a2b85 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -159,7 +159,7 @@ typedef union { GLfloat f; GLint i; } fi_type; ***/ #if defined(__i386__) || defined(__386__) || defined(__sparc__) || \ defined(__s390x__) || defined(__powerpc__) || \ - defined(__amd64__) || \ + defined(__amd64__) || defined(__x86_64__) || \ defined(ia64) || defined(__ia64__) || \ defined(__hppa__) || defined(hpux) || \ defined(__mips) || defined(_MIPS_ARCH) || \ -- cgit v1.2.3 From 7d5f713fa5c3d49425e984dc437926725ad4a8cc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 19 Mar 2008 16:14:48 -0700 Subject: [intel] Fix an uninitialized variable access in PRESUMED_OFFSET clearing. It was harmless, as the only time we need to clear PRESUMED_OFFSET, the variable had been initialized already. --- src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c index 13455e685d..f164b48963 100644 --- a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c @@ -354,8 +354,8 @@ intel_setup_reloc_list(dri_bo *bo) dri_bo_ttm *bo_ttm = (dri_bo_ttm *)bo; dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bo->bufmgr; - bo_ttm->relocs = malloc(sizeof(struct dri_ttm_reloc) * - bufmgr_ttm->max_relocs); + bo_ttm->relocs = calloc(bufmgr_ttm->max_relocs, + sizeof(struct dri_ttm_reloc)); bo_ttm->reloc_buf_data = calloc(1, RELOC_BUF_SIZE(bufmgr_ttm->max_relocs)); /* Initialize the relocation list with the header: -- cgit v1.2.3 From 7183ccaa9df1b5591e7aca926ce4ea5aab4ffc86 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 19 Mar 2008 17:53:21 -0700 Subject: [965] Initialize region surface key structure padding. Fixes valgrind warnings, and potential performance loss from cache misses. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 86566df388..c5c944f781 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -257,6 +257,8 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region, GLboolean tiled, color_blend; } key; + memset(&key, 0, sizeof(key)); + if (region != NULL) { region_bo = region->buffer; -- cgit v1.2.3 From bff94a91c6852157a8251652cb61dc699cd8e4f1 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Thu, 20 Mar 2008 11:22:46 +0800 Subject: mesa: The span array is only populated in single-pixel point drawing function. --- src/mesa/swrast/s_span.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index d404579279..864f77a417 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1183,8 +1183,10 @@ shade_texture_span(GLcontext *ctx, SWspan *span) if (span->primitive == GL_BITMAP && span->array->ChanType != GL_FLOAT) { convert_color_type(span, GL_FLOAT, 0); } - if (span->primitive != GL_POINT || ctx->Point.PointSprite) { - /* for points, we populated the arrays already */ + if (span->primitive != GL_POINT || + (span->interpMask & SPAN_RGBA) || + ctx->Point.PointSprite) { + /* for single-pixel points, we populated the arrays already */ interpolate_active_attribs(ctx, span, ~0); } span->array->ChanType = GL_FLOAT; -- cgit v1.2.3 From 7233eabaf0072b7c50e4f26ec33738b5b89aad20 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Thu, 20 Mar 2008 17:47:02 +0800 Subject: [i915] GL_DEPTH_TEXTURE_MODE fix --- src/mesa/drivers/dri/i915/i915_texstate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index ba42093287..133514d57d 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -38,7 +38,7 @@ static GLuint -translate_texture_format(GLuint mesa_format) +translate_texture_format(GLuint mesa_format, GLenum DepthMode) { switch (mesa_format) { case MESA_FORMAT_L8: @@ -65,7 +65,7 @@ translate_texture_format(GLuint mesa_format) case MESA_FORMAT_RGBA_FXT1: return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1); case MESA_FORMAT_Z16: - return (MAPSURF_16BIT | MT_16BIT_L16); + return (MAPSURF_16BIT | (DepthMode==GL_ALPHA?MT_16BIT_A16:MT_16BIT_L16)); case MESA_FORMAT_RGBA_DXT1: case MESA_FORMAT_RGB_DXT1: return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1); @@ -166,7 +166,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) 0, intelObj-> firstLevel); - format = translate_texture_format(firstImage->TexFormat->MesaFormat); + format = translate_texture_format(firstImage->TexFormat->MesaFormat, + tObj->DepthMode); pitch = intelObj->mt->pitch * intelObj->mt->cpp; } -- cgit v1.2.3 From 7936c614abc165270852bc5e7e316747a9cacdfb Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Fri, 21 Mar 2008 18:16:11 +0800 Subject: [i965] multiple rendering target fix --- src/mesa/drivers/dri/i965/brw_wm.h | 1 + src/mesa/drivers/dri/i965/brw_wm_fp.c | 38 ++++++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 10 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 5ca2a634c0..297617ee2d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -199,6 +199,7 @@ struct brw_wm_compile { GLuint nr_fp_insns; GLuint fp_temp; GLuint fp_interp_emitted; + GLuint fp_fragcolor_emitted; GLuint fp_deriv_emitted; struct prog_src_register pixel_xy; diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 621106f14d..e90a360538 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -863,25 +863,31 @@ static void emit_fb_write( struct brw_wm_compile *c ) struct prog_src_register outdepth = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DEPR); GLuint i; - struct prog_instruction *inst; + struct prog_instruction *inst, *last_inst; struct brw_context *brw = c->func.brw; /* inst->Sampler is not used by backend, use it for fb write target and eot */ - inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), - 0, 0, 0, outcolor, payload_r0_depth, outdepth); - inst->Sampler = (brw->state.nr_draw_regions > 1 ? 0: 1)|(0<<1); - if (brw->state.nr_draw_regions > 1) { for (i = 0 ; i < brw->state.nr_draw_regions; i++) { outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i); - inst = emit_op(c, + last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), 0, 0, 0, outcolor, payload_r0_depth, outdepth); - inst->Sampler = ((i == brw->state.nr_draw_regions - 1) ? 1: 0); - inst->Sampler |= (i<<1); + inst->Sampler = (i<<1); + if (c->fp_fragcolor_emitted) { + outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); + last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), + 0, 0, 0, outcolor, payload_r0_depth, outdepth); + inst->Sampler = (i<<1); + } } + last_inst->Sampler |= 1; //eot + }else { + inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), + 0, 0, 0, outcolor, payload_r0_depth, outdepth); + inst->Sampler = 1|(0<<1); } } @@ -908,7 +914,15 @@ static void validate_src_regs( struct brw_wm_compile *c, } } - +static void validate_dst_regs( struct brw_wm_compile *c, + const struct prog_instruction *inst ) +{ + if (inst->DstReg.File == PROGRAM_OUTPUT) { + GLuint idx = inst->DstReg.Index; + if (idx == FRAG_RESULT_COLR) + c->fp_fragcolor_emitted = 1; + } +} static void print_insns( const struct prog_instruction *insn, GLuint nr ) @@ -951,6 +965,11 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) */ + for (insn = 0; insn < fp->program.Base.NumInstructions; insn++) { + const struct prog_instruction *inst = &fp->program.Base.Instructions[insn]; + validate_src_regs(c, inst); + validate_dst_regs(c, inst); + } for (insn = 0; insn < fp->program.Base.NumInstructions; insn++) { const struct prog_instruction *inst = &fp->program.Base.Instructions[insn]; struct prog_instruction *out; @@ -958,7 +977,6 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) /* Check for INPUT values, emit INTERP instructions where * necessary: */ - validate_src_regs(c, inst); switch (inst->Opcode) { -- cgit v1.2.3 From 85ea7ff25cec703a00d79246df49a4ae6192c395 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 21 Mar 2008 12:31:21 -0600 Subject: Fix some PBO breakage. In _mesa_Bitmap, can't early return if bitmap ptr is NULL, it may be an offset into a PBO. Similarly for _mesa_GetTexImage. --- src/mesa/main/drawpix.c | 14 ++++++-------- src/mesa/main/teximage.c | 3 --- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index a001cf172c..d9b724bc06 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -340,12 +340,10 @@ _mesa_Bitmap( GLsizei width, GLsizei height, } if (ctx->RenderMode == GL_RENDER) { - if (bitmap) { - /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ - GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); - GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); - ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); - } + /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ + GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); + GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); + ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); } #if _HAVE_FULL_GL else if (ctx->RenderMode == GL_FEEDBACK) { diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 7241cf61be..adf3d37597 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2306,9 +2306,6 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, return; } - if (!pixels) - return; - _mesa_lock_texture(ctx, texObj); { texImage = _mesa_select_tex_image(ctx, texObj, target, level); -- cgit v1.2.3 From a429a25cd55b8c16356a60452de92228bb6c71b0 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 21 Mar 2008 13:41:00 -0600 Subject: add a number of PBO validate/map/unmap functions Helper functions for (some) drivers, including swrast. --- src/mesa/main/bufferobj.c | 187 +++++++++++++++++++++++++++++++++++++++++++- src/mesa/main/bufferobj.h | 39 ++++++++- src/mesa/swrast/s_bitmap.c | 32 ++------ src/mesa/swrast/s_drawpix.c | 32 ++------ src/mesa/swrast/s_readpix.c | 34 ++------ 5 files changed, 241 insertions(+), 83 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 9ad2dccc12..3023d8fec3 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -564,6 +564,189 @@ _mesa_validate_pbo_access(GLuint dimensions, } +/** + * If the source of glBitmap data is a PBO, check that we won't read out + * of buffer bounds, then map the buffer. + * If not sourcing from a PBO, just return the bitmap pointer. + * This is a helper function for (some) drivers. + * Return NULL if error. + * If non-null return, must call validate_and_map_bitmap_pbo() when done. + */ +const GLubyte * +_mesa_validate_and_map_bitmap_pbo(GLcontext *ctx, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap) +{ + const GLubyte *buf; + + if (unpack->BufferObj->Name) { + /* unpack from PBO */ + if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, + GL_COLOR_INDEX, GL_BITMAP, + (GLvoid *) bitmap)) { + _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); + return NULL; + } + + if (unpack->BufferObj->Pointer) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); + return NULL; + } + + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + unpack->BufferObj); + if (!buf) + return NULL; + + buf = ADD_POINTERS(buf, bitmap); + } + else { + /* unpack from normal memory */ + buf = bitmap; + } + + return buf; +} + + +/** + * Counterpart to validate_and_map_bitmap_pbo() + * This is a helper function for (some) drivers. + */ +void +_mesa_unmap_bitmap_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack) +{ + if (unpack->BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + unpack->BufferObj); + } +} + + +/** + * \sa _mesa_validate_and_map_bitmap_pbo + */ +const GLvoid * +_mesa_validate_and_map_drawpix_pbo(GLcontext *ctx, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels) +{ + const GLvoid *buf; + + if (unpack->BufferObj->Name) { + /* unpack from PBO */ + + if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels(invalid PBO access)"); + return NULL; + } + + if (unpack->BufferObj->Pointer) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); + return NULL; + } + + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + unpack->BufferObj); + if (!buf) + return NULL; + + buf = ADD_POINTERS(buf, pixels); + } + else { + /* unpack from normal memory */ + buf = pixels; + } + + return buf; +} + + +/** + * \sa _mesa_unmap_bitmap_pbo + */ +void +_mesa_unmap_drapix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack) +{ + if (unpack->BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + unpack->BufferObj); + } +} + + +/** + * When doing glReadPixels into a PBO, this function will check for errors + * and map the buffer. + * Call _mesa_unmap_readpix_pbo() when finished + * \return NULL if error + */ +void * +_mesa_validate_and_map_readpix_pbo(GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *pack, + GLvoid *dest) +{ + void *buf; + + if (pack->BufferObj->Name) { + /* pack into PBO */ + if (!_mesa_validate_pbo_access(2, pack, width, height, 1, + format, type, dest)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(invalid PBO access)"); + return NULL; + } + + if (pack->BufferObj->Pointer) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); + return NULL; + } + + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + pack->BufferObj); + if (!buf) + return NULL; + + buf = ADD_POINTERS(buf, dest); + } + else { + /* pack to normal memory */ + buf = dest; + } + + return buf; +} + + +/** + * Counterpart to validate_and_map_readpix_pbo() + */ +void +_mesa_unmap_readpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack) +{ + if (pack->BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, pack->BufferObj); + } +} + + /** * Return the gl_buffer_object for the given ID. * Always return NULL for ID 0. diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 1d2715da84..1b63e68433 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.3 + * Version: 7.1 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -89,6 +89,41 @@ _mesa_validate_pbo_access(GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *ptr); +extern const GLubyte * +_mesa_validate_and_map_bitmap_pbo(GLcontext *ctx, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap); + +extern void +_mesa_unmap_bitmap_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack); + +extern const GLvoid * +_mesa_validate_and_map_drawpix_pbo(GLcontext *ctx, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels); + +extern void +_mesa_unmap_drapix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack); + + +extern void * +_mesa_validate_and_map_readpix_pbo(GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *pack, + GLvoid *dest); + +extern void +_mesa_unmap_readpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack); + + extern void _mesa_unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 1e7f6c18e6..17f639fd55 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -57,24 +57,10 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, ASSERT(ctx->RenderMode == GL_RENDER); - if (unpack->BufferObj->Name) { - /* unpack from PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - GL_COLOR_INDEX, GL_BITMAP, - (GLvoid *) bitmap)) { - _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); - return; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, - unpack->BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); - return; - } - bitmap = ADD_POINTERS(buf, bitmap); + bitmap = _mesa_validate_and_map_bitmap_pbo(ctx, width, height, + unpack, bitmap); + if (!bitmap) { + return NULL; } RENDER_START(swrast,ctx); @@ -150,11 +136,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, RENDER_FINISH(swrast,ctx); - if (unpack->BufferObj->Name) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - unpack->BufferObj); - } + _mesa_unmap_bitmap_pbo(ctx, unpack); } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 4733d10bb5..09ff96fd32 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -817,7 +817,6 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y, } - /** * Execute software-based glDrawPixels. * By time we get here, all error checking will have been done. @@ -840,27 +839,10 @@ _swrast_DrawPixels( GLcontext *ctx, if (swrast->NewState) _swrast_validate_derived( ctx ); - if (unpack->BufferObj->Name) { - /* unpack from PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawPixels(invalid PBO access)"); - RENDER_FINISH(swrast, ctx); - return; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, - unpack->BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); - RENDER_FINISH(swrast, ctx); - return; - } - pixels = ADD_POINTERS(buf, pixels); - } + pixels = _mesa_validate_and_map_drawpix_pbo(ctx, width, height, + format, type, unpack, pixels); + if (!pixels) + return; switch (format) { case GL_STENCIL_INDEX: @@ -899,11 +881,7 @@ _swrast_DrawPixels( GLcontext *ctx, RENDER_FINISH(swrast,ctx); - if (unpack->BufferObj->Name) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - unpack->BufferObj); - } + _mesa_unmap_drapix_pbo(ctx, unpack); } diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 8df15c8704..050506b0d0 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -574,28 +574,12 @@ _swrast_ReadPixels( GLcontext *ctx, return; } - if (clippedPacking.BufferObj->Name) { - /* pack into PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(2, &clippedPacking, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glReadPixels(invalid PBO access)"); - RENDER_FINISH(swrast, ctx); - return; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - GL_WRITE_ONLY_ARB, - clippedPacking.BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); - RENDER_FINISH(swrast, ctx); - return; - } - pixels = ADD_POINTERS(buf, pixels); - } - + pixels = _mesa_validate_and_map_readpix_pbo(ctx, x, y, width, height, + format, type, + &clippedPacking, pixels); + if (!pixels) + return; + switch (format) { case GL_COLOR_INDEX: read_index_pixels(ctx, x, y, width, height, type, pixels, @@ -634,9 +618,5 @@ _swrast_ReadPixels( GLcontext *ctx, RENDER_FINISH(swrast, ctx); - if (clippedPacking.BufferObj->Name) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - clippedPacking.BufferObj); - } + _mesa_unmap_readpix_pbo(ctx, &clippedPacking); } -- cgit v1.2.3 From 3c9862d337244e305dc39bdd0a48e254c9766ec8 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 21 Mar 2008 13:42:36 -0600 Subject: include varray.h to silence warning --- src/mesa/main/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 80c989e564..c3c1f927fd 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -47,10 +47,10 @@ #include "stencil.h" #include "texobj.h" #include "texstate.h" +#include "varray.h" #include "mtypes.h" #include "math/m_xform.h" - /** * Special struct for saving/restoring texture state (GL_TEXTURE_BIT) */ -- cgit v1.2.3 From d933be6baf98624c609d422a9b083a08f67e8bdb Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 21 Mar 2008 14:19:28 -0600 Subject: Refactor PBO validate/map code. We always need to do PBO validation, so do that in core Mesa before calling driver routine. --- src/mesa/main/bufferobj.c | 76 +++++++++------------------------------------ src/mesa/main/bufferobj.h | 24 ++++++-------- src/mesa/main/drawpix.c | 50 +++++++++++++++++++++++++++++ src/mesa/swrast/s_bitmap.c | 8 ++--- src/mesa/swrast/s_drawpix.c | 3 +- src/mesa/swrast/s_readpix.c | 8 ++--- 6 files changed, 81 insertions(+), 88 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 3023d8fec3..eb418610a7 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -570,31 +570,17 @@ _mesa_validate_pbo_access(GLuint dimensions, * If not sourcing from a PBO, just return the bitmap pointer. * This is a helper function for (some) drivers. * Return NULL if error. - * If non-null return, must call validate_and_map_bitmap_pbo() when done. + * If non-null return, must call _mesa_unmap_bitmap_pbo() when done. */ const GLubyte * -_mesa_validate_and_map_bitmap_pbo(GLcontext *ctx, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap) +_mesa_map_bitmap_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap) { const GLubyte *buf; if (unpack->BufferObj->Name) { /* unpack from PBO */ - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - GL_COLOR_INDEX, GL_BITMAP, - (GLvoid *) bitmap)) { - _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); - return NULL; - } - - if (unpack->BufferObj->Pointer) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); - return NULL; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, unpack->BufferObj); @@ -613,7 +599,7 @@ _mesa_validate_and_map_bitmap_pbo(GLcontext *ctx, /** - * Counterpart to validate_and_map_bitmap_pbo() + * Counterpart to _mesa_map_bitmap_pbo() * This is a helper function for (some) drivers. */ void @@ -628,33 +614,17 @@ _mesa_unmap_bitmap_pbo(GLcontext *ctx, /** - * \sa _mesa_validate_and_map_bitmap_pbo + * \sa _mesa_map_bitmap_pbo */ const GLvoid * -_mesa_validate_and_map_drawpix_pbo(GLcontext *ctx, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels) +_mesa_map_drawpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels) { const GLvoid *buf; if (unpack->BufferObj->Name) { /* unpack from PBO */ - - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawPixels(invalid PBO access)"); - return NULL; - } - - if (unpack->BufferObj->Pointer) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); - return NULL; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, unpack->BufferObj); @@ -687,36 +657,19 @@ _mesa_unmap_drapix_pbo(GLcontext *ctx, /** - * When doing glReadPixels into a PBO, this function will check for errors - * and map the buffer. + * If PBO is bound, map the buffer, return dest pointer in mapped buffer. * Call _mesa_unmap_readpix_pbo() when finished * \return NULL if error */ void * -_mesa_validate_and_map_readpix_pbo(GLcontext *ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *pack, - GLvoid *dest) +_mesa_map_readpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack, + GLvoid *dest) { void *buf; if (pack->BufferObj->Name) { /* pack into PBO */ - if (!_mesa_validate_pbo_access(2, pack, width, height, 1, - format, type, dest)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glReadPixels(invalid PBO access)"); - return NULL; - } - - if (pack->BufferObj->Pointer) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); - return NULL; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, pack->BufferObj); @@ -735,7 +688,7 @@ _mesa_validate_and_map_readpix_pbo(GLcontext *ctx, /** - * Counterpart to validate_and_map_readpix_pbo() + * Counterpart to _mesa_map_readpix_pbo() */ void _mesa_unmap_readpix_pbo(GLcontext *ctx, @@ -747,6 +700,7 @@ _mesa_unmap_readpix_pbo(GLcontext *ctx, } + /** * Return the gl_buffer_object for the given ID. * Always return NULL for ID 0. diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 1b63e68433..8baa59d617 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -90,21 +90,18 @@ _mesa_validate_pbo_access(GLuint dimensions, GLenum format, GLenum type, const GLvoid *ptr); extern const GLubyte * -_mesa_validate_and_map_bitmap_pbo(GLcontext *ctx, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap); +_mesa_map_bitmap_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap); extern void _mesa_unmap_bitmap_pbo(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack); extern const GLvoid * -_mesa_validate_and_map_drawpix_pbo(GLcontext *ctx, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels); +_mesa_map_drawpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels); extern void _mesa_unmap_drapix_pbo(GLcontext *ctx, @@ -112,12 +109,9 @@ _mesa_unmap_drapix_pbo(GLcontext *ctx, extern void * -_mesa_validate_and_map_readpix_pbo(GLcontext *ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *pack, - GLvoid *dest); +_mesa_map_readpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack, + GLvoid *dest); extern void _mesa_unmap_readpix_pbo(GLcontext *ctx, diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index d9b724bc06..4f28766674 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -24,6 +24,7 @@ #include "glheader.h" #include "imports.h" +#include "bufferobj.h" #include "context.h" #include "drawpix.h" #include "feedback.h" @@ -182,6 +183,23 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ GLint x = IROUND(ctx->Current.RasterPos[0]); GLint y = IROUND(ctx->Current.RasterPos[1]); + + if (ctx->Unpack.BufferObj->Name) { + /* unpack from PBO */ + if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels(invalid PBO access)"); + return; + } + if (ctx->Unpack.BufferObj->Pointer) { + /* buffer is mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels(PBO is mapped)"); + return; + } + } + ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type, &ctx->Unpack, pixels); } @@ -300,6 +318,21 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, return; } + if (ctx->Pack.BufferObj->Name) { + if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(invalid PBO access)"); + return; + } + + if (ctx->Pack.BufferObj->Pointer) { + /* buffer is mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); + return; + } + } + ctx->Driver.ReadPixels(ctx, x, y, width, height, format, type, &ctx->Pack, pixels); } @@ -343,6 +376,23 @@ _mesa_Bitmap( GLsizei width, GLsizei height, /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); + + if (ctx->Unpack.BufferObj->Name) { + /* unpack from PBO */ + if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, + GL_COLOR_INDEX, GL_BITMAP, + (GLvoid *) bitmap)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBitmap(invalid PBO access)"); + return; + } + if (ctx->Unpack.BufferObj->Pointer) { + /* buffer is mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); + return; + } + } + ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); } #if _HAVE_FULL_GL diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 17f639fd55..f3dda12e25 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -57,11 +57,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, ASSERT(ctx->RenderMode == GL_RENDER); - bitmap = _mesa_validate_and_map_bitmap_pbo(ctx, width, height, - unpack, bitmap); - if (!bitmap) { - return NULL; - } + bitmap = _mesa_map_bitmap_pbo(ctx, unpack, bitmap); + if (!bitmap) + return; RENDER_START(swrast,ctx); diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 09ff96fd32..81f5caa270 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -839,8 +839,7 @@ _swrast_DrawPixels( GLcontext *ctx, if (swrast->NewState) _swrast_validate_derived( ctx ); - pixels = _mesa_validate_and_map_drawpix_pbo(ctx, width, height, - format, type, unpack, pixels); + pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels); if (!pixels) return; diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 050506b0d0..9140d12ea0 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -574,11 +574,9 @@ _swrast_ReadPixels( GLcontext *ctx, return; } - pixels = _mesa_validate_and_map_readpix_pbo(ctx, x, y, width, height, - format, type, - &clippedPacking, pixels); - if (!pixels) - return; + pixels = _mesa_map_readpix_pbo(ctx, &clippedPacking, pixels); + if (!pixels) + return; switch (format) { case GL_COLOR_INDEX: -- cgit v1.2.3 From 9f6e8e89c86d725fd0baa184af8a22f1f9032550 Mon Sep 17 00:00:00 2001 From: Michal Wajdeczko Date: Thu, 20 Mar 2008 17:38:12 -0700 Subject: intel: Use _mesa_ffs wrapper, and fix a use-after-free with INTEL_DEBUG=buf. --- src/mesa/drivers/dri/common/dri_bufmgr_fake.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c index 8f67798a08..9d94ca3b39 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c @@ -231,7 +231,7 @@ alloc_block(dri_bo *bo) dri_bo_fake *bo_fake = (dri_bo_fake *)bo; dri_bufmgr_fake *bufmgr_fake= (dri_bufmgr_fake *)bo->bufmgr; struct block *block = (struct block *)calloc(sizeof *block, 1); - unsigned int align_log2 = ffs(bo_fake->alignment); + unsigned int align_log2 = _mesa_ffs(bo_fake->alignment); GLuint sz; if (!block) @@ -660,10 +660,12 @@ dri_fake_bo_unreference(dri_bo *bo) for (i = 0; i < bo_fake->nr_relocs; i++) dri_bo_unreference(bo_fake->relocs[i].target_buf); - free(bo_fake->relocs); + DBG("drm_bo_unreference: free buf %d %s\n", bo_fake->id, bo_fake->name); + + free(bo_fake->relocs); free(bo); - DBG("drm_bo_unreference: free %s\n", bo_fake->name); + return; } } @@ -924,6 +926,8 @@ dri_fake_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, dri_bo_fake *reloc_fake = (dri_bo_fake *)reloc_buf; int i; + assert(reloc_buf); + assert(target_buf); if (reloc_fake->relocs == NULL) { reloc_fake->relocs = malloc(sizeof(struct fake_buffer_reloc) * MAX_RELOCS); -- cgit v1.2.3 From aa8a7ef823b2d8e43c4d0e37fdc457ad6930b737 Mon Sep 17 00:00:00 2001 From: Michal Wajdeczko Date: Fri, 21 Mar 2008 13:05:42 -0700 Subject: [965] Shuffle state flags to match the order we initialize them in. --- src/mesa/drivers/dri/i965/brw_context.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 4e6b471fdd..56021fa209 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -146,12 +146,12 @@ struct brw_context; struct brw_state_flags { /** State update flags signalled by mesa internals */ GLuint mesa; - /** State update flags signalled by brw_state_cache.c searches */ - GLuint cache; /** * State update flags signalled as the result of brw_tracked_state updates */ GLuint brw; + /** State update flags signalled by brw_state_cache.c searches */ + GLuint cache; }; struct brw_vertex_program { -- cgit v1.2.3 From 31fe7cf5e3ca38441acb25215420afa6944226f3 Mon Sep 17 00:00:00 2001 From: Michal Wajdeczko Date: Fri, 21 Mar 2008 13:11:07 -0700 Subject: [win32] Use native aligned memory allocation functions. --- src/mesa/main/imports.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 7d4b120099..1aebb25163 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -104,6 +104,8 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) (void) posix_memalign(& mem, alignment, bytes); return mem; +#elif defined(_WIN32) && defined(_MSC_VER) + return _aligned_malloc(bytes, alignment); #else uintptr_t ptr, buf; @@ -143,6 +145,15 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) (void) memset(mem, 0, bytes); } + return mem; +#elif defined(_WIN32) && defined(_MSC_VER) + void *mem; + + mem = _aligned_malloc(bytes, alignment); + if (mem != NULL) { + (void) memset(mem, 0, bytes); + } + return mem; #else uintptr_t ptr, buf; @@ -180,6 +191,8 @@ _mesa_align_free(void *ptr) { #if defined(HAVE_POSIX_MEMALIGN) free(ptr); +#elif defined(_WIN32) && defined(_MSC_VER) + _aligned_free(ptr); #else void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); void *realAddr = *cubbyHole; @@ -194,6 +207,10 @@ void * _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize, unsigned long alignment) { +#if defined(_WIN32) && defined(_MSC_VER) + (void) oldSize; + return _aligned_realloc(oldBuffer, newSize, alignment); +#else const size_t copySize = (oldSize < newSize) ? oldSize : newSize; void *newBuf = _mesa_align_malloc(newSize, alignment); if (newBuf && oldBuffer && copySize > 0) { @@ -202,6 +219,7 @@ _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize, if (oldBuffer) _mesa_align_free(oldBuffer); return newBuf; +#endif } -- cgit v1.2.3 From 5f10438f2d9c739964cf53f04fee3190991325a1 Mon Sep 17 00:00:00 2001 From: Michal Wajdeczko Date: Fri, 21 Mar 2008 13:41:12 -0700 Subject: [965] Add MVP code for position invariant vertex programs. This fixes the arbvptorus demo. --- src/mesa/drivers/dri/i965/brw_program.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 8e8fea48e9..f717b6f6c3 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -124,6 +124,9 @@ static void brwProgramStringNotify( GLcontext *ctx, struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program; if (p == vp) brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM; + if (p->program.IsPositionInvariant) { + _mesa_insert_mvp_code(ctx, &p->program); + } p->id = brw->program_id++; p->param_state = p->program.Base.Parameters->StateFlags; -- cgit v1.2.3 From 6c1a98e97affb2163e776551eb3a9e669ff99bbf Mon Sep 17 00:00:00 2001 From: Michal Wajdeczko Date: Fri, 21 Mar 2008 13:43:44 -0700 Subject: [965] Fix negating of unsigned value in emit_wpos_xy. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 83a0d12d90..0000edda84 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -137,7 +137,7 @@ static void emit_wpos_xy(struct brw_wm_compile *c, brw_ADD(p, dst[0], retype(arg0[0], BRW_REGISTER_TYPE_W), - brw_imm_d(- c->key.origin_x)); + brw_imm_d(0 - c->key.origin_x)); } if (mask & WRITEMASK_Y) { -- cgit v1.2.3 From bb419970ef465804c0e5369264314d9d92726c18 Mon Sep 17 00:00:00 2001 From: Michal Wajdeczko Date: Fri, 21 Mar 2008 13:48:12 -0700 Subject: [965] Improve pinterp performance by delaying reads of just-written regs. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 0000edda84..82ebd5c257 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -223,6 +223,10 @@ static void emit_pinterp( struct brw_compile *p, if (mask & (1< Date: Fri, 21 Mar 2008 14:18:26 -0700 Subject: [965] Avoid emitting dead code for DPx/math instructions. The pass1 optimization stage clears out writemasks and registers, but the instructions themselves are still being processed at this stage, and could have resulted in them still being emitted. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 82ebd5c257..a02f70a50c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -504,6 +504,9 @@ static void emit_dp3( struct brw_compile *p, const struct brw_reg *arg0, const struct brw_reg *arg1 ) { + if (!(mask & WRITEMASK_XYZW)) + return; /* Do not emit dead code*/ + assert((mask & WRITEMASK_XYZW) == WRITEMASK_X); brw_MUL(p, brw_null_reg(), arg0[0], arg1[0]); @@ -521,6 +524,9 @@ static void emit_dp4( struct brw_compile *p, const struct brw_reg *arg0, const struct brw_reg *arg1 ) { + if (!(mask & WRITEMASK_XYZW)) + return; /* Do not emit dead code*/ + assert((mask & WRITEMASK_XYZW) == WRITEMASK_X); brw_MUL(p, brw_null_reg(), arg0[0], arg1[0]); @@ -539,6 +545,9 @@ static void emit_dph( struct brw_compile *p, const struct brw_reg *arg0, const struct brw_reg *arg1 ) { + if (!(mask & WRITEMASK_XYZW)) + return; /* Do not emit dead code*/ + assert((mask & WRITEMASK_XYZW) == WRITEMASK_X); brw_MUL(p, brw_null_reg(), arg0[0], arg1[0]); @@ -582,6 +591,9 @@ static void emit_math1( struct brw_compile *p, GLuint mask, const struct brw_reg *arg0 ) { + if (!(mask & WRITEMASK_XYZW)) + return; /* Do not emit dead code*/ + //assert((mask & WRITEMASK_XYZW) == WRITEMASK_X || // function == BRW_MATH_FUNCTION_SINCOS); @@ -606,6 +618,9 @@ static void emit_math2( struct brw_compile *p, const struct brw_reg *arg0, const struct brw_reg *arg1) { + if (!(mask & WRITEMASK_XYZW)) + return; /* Do not emit dead code*/ + assert((mask & WRITEMASK_XYZW) == WRITEMASK_X); brw_push_insn_state(p); -- cgit v1.2.3 From 731dec1bd52abbaf77f21fa37c9c192611dcd1a5 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 22 Mar 2008 09:11:43 -0600 Subject: delete default programs with ctx->Driver.DeleteProgram() --- src/mesa/main/context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 63dc1379e9..62d592767d 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -706,10 +706,10 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->Programs); #endif #if FEATURE_ARB_vertex_program - _mesa_delete_program(ctx, ss->DefaultVertexProgram); + ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); #endif #if FEATURE_ARB_fragment_program - _mesa_delete_program(ctx, ss->DefaultFragmentProgram); + ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); #endif #if FEATURE_ATI_fragment_shader -- cgit v1.2.3 From dc6fab90b437ed7f03f5cb239d3251b5b4f2cd56 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 22 Mar 2008 10:27:03 -0600 Subject: use ctx->Driver.DeleteProgram() in a few more places --- src/mesa/shader/program.c | 2 +- src/mesa/shader/shader_api.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 2097c39591..d2c9183558 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -386,7 +386,7 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) clone->Format = prog->Format; clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions); if (!clone->Instructions) { - _mesa_delete_program(ctx, clone); + ctx->Driver.DeleteProgram(ctx, clone); return NULL; } _mesa_copy_instructions(clone->Instructions, prog->Instructions, diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index e9c35fce71..76da855a07 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -79,7 +79,7 @@ _mesa_clear_shader_program_data(GLcontext *ctx, /* to prevent a double-free in the next call */ shProg->VertexProgram->Base.Parameters = NULL; } - _mesa_delete_program(ctx, &shProg->VertexProgram->Base); + ctx->Driver.DeleteProgram(ctx, &shProg->VertexProgram->Base); shProg->VertexProgram = NULL; } @@ -88,7 +88,7 @@ _mesa_clear_shader_program_data(GLcontext *ctx, /* to prevent a double-free in the next call */ shProg->FragmentProgram->Base.Parameters = NULL; } - _mesa_delete_program(ctx, &shProg->FragmentProgram->Base); + ctx->Driver.DeleteProgram(ctx, &shProg->FragmentProgram->Base); shProg->FragmentProgram = NULL; } @@ -246,7 +246,7 @@ _mesa_free_shader(GLcontext *ctx, struct gl_shader *sh) _mesa_free(sh->InfoLog); for (i = 0; i < sh->NumPrograms; i++) { assert(sh->Programs[i]); - _mesa_delete_program(ctx, sh->Programs[i]); + ctx->Driver.DeleteProgram(ctx, sh->Programs[i]); } if (sh->Programs) _mesa_free(sh->Programs); -- cgit v1.2.3 From c75ffff84a2a98f0f027a262db904aedae3a5d06 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 24 Mar 2008 12:46:40 +0000 Subject: r300: Merged the Vector and Math Engine opcode macros. --- src/mesa/drivers/dri/r300/r300_state.c | 8 +- src/mesa/drivers/dri/r300/r300_vertprog.c | 358 ++++++++++++++++++------------ src/mesa/drivers/dri/r300/r300_vertprog.h | 12 +- 3 files changed, 225 insertions(+), 153 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index f4d10d8e17..062b229275 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1660,8 +1660,12 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { if (rmesa->state.sw_tcl_inputs[i] != -1) { prog->program.body.i[program_end + 0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY, o_reg++, - VSF_FLAG_ALL, PVS_DST_REG_OUT); + PVS_OPCODE(VE_MULTIPLY, + GL_FALSE, + GL_FALSE, + o_reg++, + VSF_FLAG_ALL, + PVS_DST_REG_OUT); prog->program.body.i[program_end + 1] = PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_X, diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index d7f8a85cc2..816f8f752b 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -305,10 +305,12 @@ static GLuint *t_opcode_abs(struct r300_vertex_program *vp, struct prog_instruct { //MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W - inst[0] = PVS_VECTOR_OPCODE(VE_MAXIMUM, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_MAXIMUM, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), @@ -324,10 +326,12 @@ static GLuint *t_opcode_abs(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_add(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_ADD, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_ADD, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -337,10 +341,12 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_arl(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_FLT2FIX_DX, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_FLT2FIX_DX, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -352,10 +358,12 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, struct prog_instruct { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO} - inst[0] = PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_DOT_PRODUCT, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), @@ -377,10 +385,12 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_DOT_PRODUCT, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -391,10 +401,12 @@ static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_dph(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W} - inst[0] = PVS_VECTOR_OPCODE(VE_DOT_PRODUCT, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_DOT_PRODUCT, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), @@ -410,10 +422,12 @@ static GLuint *t_opcode_dph(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_DISTANCE_VECTOR, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_DISTANCE_VECTOR, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -423,7 +437,12 @@ static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_MATH_OPCODE(ME_EXP_BASE2_FULL_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(ME_EXP_BASE2_FULL_DX, + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -433,7 +452,12 @@ static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_exp(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_MATH_OPCODE(ME_EXP_BASE2_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(ME_EXP_BASE2_DX, + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -446,28 +470,32 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, struct prog_instruct /* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W} ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */ - inst[0] = PVS_VECTOR_OPCODE(VE_FRACTION, - *u_temp_i, - t_dst_mask(vpi->DstReg.WriteMask), - PVS_DST_REG_TEMPORARY); + inst[0] = PVS_OPCODE(VE_FRACTION, + GL_FALSE, + GL_FALSE, + *u_temp_i, + t_dst_mask(vpi->DstReg.WriteMask), + PVS_DST_REG_TEMPORARY); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; inst += 4; - inst[0] = PVS_VECTOR_OPCODE(VE_ADD, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_ADD, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = PVS_SOURCE_OPCODE(*u_temp_i, PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, - PVS_SRC_SELECT_W, - PVS_SRC_REG_TEMPORARY, + PVS_SRC_SELECT_W, PVS_SRC_REG_TEMPORARY, /* Not 100% sure about this */ - (!src[0].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE + (!src[0]. + NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE /*VSF_FLAG_ALL */ ); inst[3] = ZERO_SRC_0; (*u_temp_i)--; @@ -477,10 +505,12 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_frc(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_FRACTION, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_FRACTION, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -492,10 +522,12 @@ static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, struct prog_instruct { // LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X} - inst[0] = PVS_MATH_OPCODE(ME_LOG_BASE2_FULL_DX, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(ME_LOG_BASE2_FULL_DX, + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), @@ -513,7 +545,12 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, struct prog_instruct { //LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W} - inst[0] = PVS_MATH_OPCODE(ME_LIGHT_COEFF_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(ME_LIGHT_COEFF_DX, + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); /* NOTE: Users swizzling might not work. */ inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X @@ -542,10 +579,12 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_log(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_MATH_OPCODE(ME_LOG_BASE2_DX, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(ME_LOG_BASE2_DX, + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -555,12 +594,12 @@ static GLuint *t_opcode_log(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_mad(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - /* FIXME */ - inst[0] = (((PVS_MACRO_OP_2CLK_MADD & PVS_DST_OPCODE_MASK) << PVS_DST_OPCODE_SHIFT) | - ((1 & PVS_DST_MACRO_INST_MASK) << PVS_DST_MACRO_INST_SHIFT) | - ((t_dst_index(vp, &vpi->DstReg) & PVS_DST_OFFSET_MASK) << PVS_DST_OFFSET_SHIFT) | - ((t_dst_mask(vpi->DstReg.WriteMask) & 0xf) << PVS_DST_WE_X_SHIFT) | - ((t_dst_class(vpi->DstReg.File) & PVS_DST_REG_TYPE_MASK) << PVS_DST_REG_TYPE_SHIFT)); + inst[0] = PVS_OPCODE(PVS_MACRO_OP_2CLK_MADD, + GL_FALSE, + GL_TRUE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = t_src(vp, &src[2]); @@ -570,10 +609,12 @@ static GLuint *t_opcode_mad(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_MAXIMUM, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_MAXIMUM, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -583,10 +624,12 @@ static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_min(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_MINIMUM, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_MINIMUM, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -598,10 +641,12 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, struct prog_instruct { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} - inst[0] = PVS_VECTOR_OPCODE(VE_ADD, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_ADD, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -611,10 +656,12 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_mul(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_MULTIPLY, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_MULTIPLY, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -624,10 +671,12 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_pow(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_MATH_OPCODE(ME_POWER_FUNC_FF, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(ME_POWER_FUNC_FF, + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = t_src_scalar(vp, &src[1]); @@ -637,10 +686,12 @@ static GLuint *t_opcode_pow(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_MATH_OPCODE(ME_RECIP_DX, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(ME_RECIP_DX, + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -650,10 +701,12 @@ static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_MATH_OPCODE(ME_RECIP_SQRT_DX, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(ME_RECIP_SQRT_DX, + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -663,10 +716,12 @@ static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_SET_GREATER_THAN_EQUAL, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_SET_GREATER_THAN_EQUAL, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -676,10 +731,12 @@ static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_slt(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_VECTOR_OPCODE(VE_SET_LESS_THAN, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_SET_LESS_THAN, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = ZERO_SRC_1; @@ -692,10 +749,12 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruct //ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W #if 0 - inst[0] = PVS_VECTOR_OPCODE(VE_ADD, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_ADD, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 0)), @@ -707,9 +766,11 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruct inst[3] = 0; #else inst[0] = - PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + PVS_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), + GL_FALSE, + GL_FALSE, + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = ONE_SRC_0; inst[3] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), @@ -718,7 +779,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruct t_swizzle(GET_SWZ(src[1].Swizzle, 2)), t_swizzle(GET_SWZ(src[1].Swizzle, 3)), t_src_class(src[1].File), - (!src[1]. NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); + (!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); #endif return inst; @@ -728,10 +789,12 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, struct prog_instruct { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} - inst[0] = PVS_VECTOR_OPCODE(VE_ADD, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_ADD, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; @@ -745,10 +808,12 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, struct prog_instruct mad r0, -r2.yzxw, r1.zxyw, r0 */ - inst[0] = PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, - *u_temp_i, - t_dst_mask(vpi->DstReg.WriteMask), - PVS_DST_REG_TEMPORARY); + inst[0] = PVS_OPCODE(VE_MULTIPLY_ADD, + GL_FALSE, + GL_FALSE, + *u_temp_i, + t_dst_mask(vpi->DstReg.WriteMask), + PVS_DST_REG_TEMPORARY); inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // Z @@ -766,10 +831,12 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, struct prog_instruct inst[3] = ZERO_SRC_1; inst += 4; - inst[0] = PVS_VECTOR_OPCODE(VE_MULTIPLY_ADD, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + inst[0] = PVS_OPCODE(VE_MULTIPLY_ADD, + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // Z @@ -888,17 +955,20 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro if (num_operands == 3) { /* TODO: scalars */ if (CMP_SRCS(src[1], src[2]) || CMP_SRCS(src[0], src[2])) { - inst[0] = PVS_VECTOR_OPCODE(VE_ADD, - u_temp_i, - VSF_FLAG_ALL, - PVS_DST_REG_TEMPORARY); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[2]), - SWIZZLE_X, - SWIZZLE_Y, - SWIZZLE_Z, - SWIZZLE_W, - t_src_class(src[2].File), - VSF_FLAG_NONE) | (src[2].RelAddr << 4); + inst[0] = PVS_OPCODE(VE_ADD, + GL_FALSE, + GL_FALSE, + u_temp_i, + VSF_FLAG_ALL, + PVS_DST_REG_TEMPORARY); + inst[1] = + PVS_SOURCE_OPCODE(t_src_index(vp, &src[2]), + SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_W, + t_src_class(src[2].File), + VSF_FLAG_NONE) | (src[2].RelAddr << 4); inst[2] = ZERO_SRC_2; inst[3] = ZERO_SRC_2; inst += 4; @@ -912,17 +982,20 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro if (num_operands >= 2) { if (CMP_SRCS(src[1], src[0])) { - inst[0] = PVS_VECTOR_OPCODE(VE_ADD, - u_temp_i, - VSF_FLAG_ALL, - PVS_DST_REG_TEMPORARY); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), - SWIZZLE_X, - SWIZZLE_Y, - SWIZZLE_Z, - SWIZZLE_W, - t_src_class(src[0].File), - VSF_FLAG_NONE) | (src[0].RelAddr << 4); + inst[0] = PVS_OPCODE(VE_ADD, + GL_FALSE, + GL_FALSE, + u_temp_i, + VSF_FLAG_ALL, + PVS_DST_REG_TEMPORARY); + inst[1] = + PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_W, + t_src_class(src[0].File), + VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; inst += 4; @@ -1028,10 +1101,11 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro of the fragment program. Blank the outputs here. */ for (i = 0; i < VERT_RESULT_MAX; i++) { if (vp->key.OutputsAdded & (1 << i)) { - inst[0] = PVS_VECTOR_OPCODE(VE_ADD, - vp->outputs[i], - VSF_FLAG_ALL, - PVS_DST_REG_OUT); + inst[0] = PVS_OPCODE(VE_ADD, + GL_FALSE, + GL_FALSE, + vp->outputs[i], + VSF_FLAG_ALL, PVS_DST_REG_OUT); inst[1] = ZERO_SRC_0; inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 984233e2ea..77cb1c0892 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -3,20 +3,14 @@ #include "r300_reg.h" -#define PVS_VECTOR_OPCODE(opcode, reg_index, reg_writemask, reg_class) \ +#define PVS_OPCODE(opcode, math_inst, macro_inst, reg_index, reg_writemask, reg_class) \ (((opcode & PVS_DST_OPCODE_MASK) << PVS_DST_OPCODE_SHIFT) \ + | ((math_inst & PVS_DST_MATH_INST_MASK) << PVS_DST_MATH_INST_SHIFT) \ + | ((macro_inst & PVS_DST_MACRO_INST_MASK) << PVS_DST_MACRO_INST_SHIFT) \ | ((reg_index & PVS_DST_OFFSET_MASK) << PVS_DST_OFFSET_SHIFT) \ | ((reg_writemask & 0xf) << PVS_DST_WE_X_SHIFT) /* X Y Z W */ \ | ((reg_class & PVS_DST_REG_TYPE_MASK) << PVS_DST_REG_TYPE_SHIFT)) -#define PVS_MATH_OPCODE(opcode, reg_index, reg_writemask, reg_class) \ - (((opcode & PVS_DST_OPCODE_MASK) << PVS_DST_OPCODE_SHIFT) \ - | ((1 & PVS_DST_MATH_INST_MASK) << PVS_DST_MATH_INST_SHIFT) \ - | ((reg_index & PVS_DST_OFFSET_MASK) << PVS_DST_OFFSET_SHIFT) \ - | ((reg_writemask & 0xf) << PVS_DST_WE_X_SHIFT) /* X Y Z W */ \ - | ((reg_class & PVS_DST_REG_TYPE_MASK) << PVS_DST_REG_TYPE_SHIFT)) - - #define PVS_SOURCE_OPCODE(in_reg_index, comp_x, comp_y, comp_z, comp_w, reg_class, negate) \ (((in_reg_index & PVS_SRC_OFFSET_MASK) << PVS_SRC_OFFSET_SHIFT) \ | ((comp_x & PVS_SRC_SWIZZLE_X_MASK) << PVS_SRC_SWIZZLE_X_SHIFT) \ -- cgit v1.2.3 From 74aee365e32defc910fd43301b6fcb651ad0568a Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Mon, 24 Mar 2008 12:46:56 +0000 Subject: r300: Merged the constant zero/one source macros. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 127 +++++++++++++----------------- 1 file changed, 55 insertions(+), 72 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 816f8f752b..d634f1e0d9 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -57,35 +57,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. (t_src_class(a.File) == PVS_SRC_REG_INPUT && \ t_src_class(b.File) == PVS_SRC_REG_INPUT)))) \ -#define ZERO_SRC_0 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), \ - SWIZZLE_ZERO, SWIZZLE_ZERO, \ - SWIZZLE_ZERO, SWIZZLE_ZERO, \ - t_src_class(src[0].File), VSF_FLAG_NONE) | (src[0].RelAddr << 4)) - -#define ZERO_SRC_1 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), \ - SWIZZLE_ZERO, SWIZZLE_ZERO, \ - SWIZZLE_ZERO, SWIZZLE_ZERO, \ - t_src_class(src[1].File), VSF_FLAG_NONE) | (src[1].RelAddr << 4)) - -#define ZERO_SRC_2 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[2]), \ - SWIZZLE_ZERO, SWIZZLE_ZERO, \ - SWIZZLE_ZERO, SWIZZLE_ZERO, \ - t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4)) - -#define ONE_SRC_0 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), \ - SWIZZLE_ONE, SWIZZLE_ONE, \ - SWIZZLE_ONE, SWIZZLE_ONE, \ - t_src_class(src[0].File), VSF_FLAG_NONE) | (src[0].RelAddr << 4)) - -#define ONE_SRC_1 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), \ - SWIZZLE_ONE, SWIZZLE_ONE, \ - SWIZZLE_ONE, SWIZZLE_ONE, \ - t_src_class(src[1].File), VSF_FLAG_NONE) | (src[1].RelAddr << 4)) - -#define ONE_SRC_2 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[2]), \ - SWIZZLE_ONE, SWIZZLE_ONE, \ - SWIZZLE_ONE, SWIZZLE_ONE, \ - t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4)) +/* + * Take an already-setup and valid source then swizzle it appropriately to + * obtain a constant ZERO or ONE source. + */ +#define PVS_SOURCE_CONSTANT(x, y) \ + (PVS_SOURCE_OPCODE(t_src_index(vp, &src[x]), \ + t_swizzle(y), \ + t_swizzle(y), \ + t_swizzle(y), \ + t_swizzle(y), \ + t_src_class(src[x].File), \ + VSF_FLAG_NONE) | (src[x].RelAddr << 4)) #define FREE_TEMPS() \ do { \ @@ -334,7 +317,7 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); return inst; } @@ -348,8 +331,8 @@ static GLuint *t_opcode_arl(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); return inst; } @@ -378,7 +361,7 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, struct prog_instruct SWIZZLE_ZERO, t_src_class(src[1].File), src[1].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); return inst; } @@ -393,7 +376,7 @@ static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); return inst; } @@ -415,7 +398,7 @@ static GLuint *t_opcode_dph(struct r300_vertex_program *vp, struct prog_instruct t_src_class(src[0].File), src[0].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = t_src(vp, &src[1]); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); return inst; } @@ -430,7 +413,7 @@ static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); return inst; } @@ -444,8 +427,8 @@ static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); return inst; } @@ -459,8 +442,8 @@ static GLuint *t_opcode_exp(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); return inst; } @@ -477,8 +460,8 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); inst[1] = t_src(vp, &src[0]); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); inst += 4; inst[0] = PVS_OPCODE(VE_ADD, @@ -497,7 +480,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, struct prog_instruct (!src[0]. NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE /*VSF_FLAG_ALL */ ); - inst[3] = ZERO_SRC_0; + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); (*u_temp_i)--; return inst; @@ -512,8 +495,8 @@ static GLuint *t_opcode_frc(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); return inst; } @@ -535,8 +518,8 @@ static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, struct prog_instruct t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_src_class(src[0].File), src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); return inst; } @@ -586,8 +569,8 @@ static GLuint *t_opcode_log(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); return inst; } @@ -617,7 +600,7 @@ static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); return inst; } @@ -632,7 +615,7 @@ static GLuint *t_opcode_min(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); return inst; } @@ -648,8 +631,8 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); return inst; } @@ -664,7 +647,7 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); return inst; } @@ -678,7 +661,7 @@ static GLuint *t_opcode_pow(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); inst[3] = t_src_scalar(vp, &src[1]); return inst; @@ -693,8 +676,8 @@ static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); return inst; } @@ -708,8 +691,8 @@ static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); return inst; } @@ -724,7 +707,7 @@ static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); return inst; } @@ -739,7 +722,7 @@ static GLuint *t_opcode_slt(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); return inst; } @@ -772,7 +755,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = ONE_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ONE); inst[3] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 0)), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), @@ -796,8 +779,8 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, struct prog_instruct t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); return inst; } @@ -828,7 +811,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, struct prog_instruct t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W t_src_class(src[1].File), src[1].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[3] = ZERO_SRC_1; + inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); inst += 4; inst[0] = PVS_OPCODE(VE_MULTIPLY_ADD, @@ -969,8 +952,8 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro SWIZZLE_W, t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4); - inst[2] = ZERO_SRC_2; - inst[3] = ZERO_SRC_2; + inst[2] = PVS_SOURCE_CONSTANT(2, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(2, SWIZZLE_ZERO); inst += 4; src[2].File = PROGRAM_TEMPORARY; @@ -996,8 +979,8 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro SWIZZLE_W, t_src_class(src[0].File), VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); inst += 4; src[0].File = PROGRAM_TEMPORARY; @@ -1106,9 +1089,9 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro GL_FALSE, vp->outputs[i], VSF_FLAG_ALL, PVS_DST_REG_OUT); - inst[1] = ZERO_SRC_0; - inst[2] = ZERO_SRC_0; - inst[3] = ZERO_SRC_0; + inst[1] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); inst += 4; } } -- cgit v1.2.3 From b469e9e93cfa3e11aab78dd8676635f976fe2ac1 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 24 Mar 2008 14:49:43 -0400 Subject: R300: fix typo r300 fog reg Noticed by pzad on IRC --- src/mesa/drivers/dri/r300/r300_reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 0d78fb8e84..ac6b0e63b5 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -1890,7 +1890,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Fog: Green Component of Fog Color */ #define FG_FOG_COLOR_G 0x4bcc /* Fog: Blue Component of Fog Color */ -#define FG_FOG_COLOR_B 0x4db0 +#define FG_FOG_COLOR_B 0x4bd0 # define FG_FOG_COLOR_MASK 0x000001ff /* Fog: Constant Factor for Fog Blending */ -- cgit v1.2.3 From 816fbeaa813e5cdca314a39677c74c8dc700d35a Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 24 Mar 2008 19:55:41 -0600 Subject: add GL_READ_FRAMEBUFFER_BINDING_EXT case, regenerate get.c file --- src/mesa/main/get.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/get_gen.py | 5 ++++ 2 files changed, 65 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index eb81ee4a52..9d8f2002c9 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -870,6 +870,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_TEXTURE_3D: params[0] = _mesa_IsEnabled(GL_TEXTURE_3D); break; + case GL_TEXTURE_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetBooleanv"); + params[0] = _mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT); + break; + case GL_TEXTURE_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetBooleanv"); + params[0] = _mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT); + break; case GL_TEXTURE_BINDING_1D: params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name); break; @@ -879,6 +887,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_TEXTURE_BINDING_3D: params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name); break; + case GL_TEXTURE_BINDING_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name); + break; + case GL_TEXTURE_BINDING_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name); + break; case GL_TEXTURE_ENV_COLOR: { const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; @@ -1864,6 +1880,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) CHECK_EXT1(EXT_framebuffer_object, "GetBooleanv"); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxRenderbufferSize); break; + case GL_READ_FRAMEBUFFER_BINDING_EXT: + CHECK_EXT1(EXT_framebuffer_blit, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->ReadBuffer->Name); + break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetBooleanv"); params[0] = INT_TO_BOOLEAN(ctx->Const.FragmentProgram.MaxUniformComponents); @@ -2701,6 +2721,14 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_TEXTURE_3D: params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_3D)); break; + case GL_TEXTURE_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetFloatv"); + params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)); + break; + case GL_TEXTURE_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetFloatv"); + params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); + break; case GL_TEXTURE_BINDING_1D: params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name); break; @@ -2710,6 +2738,14 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_TEXTURE_BINDING_3D: params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name); break; + case GL_TEXTURE_BINDING_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetFloatv"); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name); + break; + case GL_TEXTURE_BINDING_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetFloatv"); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name); + break; case GL_TEXTURE_ENV_COLOR: { const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; @@ -3695,6 +3731,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) CHECK_EXT1(EXT_framebuffer_object, "GetFloatv"); params[0] = (GLfloat)(ctx->Const.MaxRenderbufferSize); break; + case GL_READ_FRAMEBUFFER_BINDING_EXT: + CHECK_EXT1(EXT_framebuffer_blit, "GetFloatv"); + params[0] = (GLfloat)(ctx->ReadBuffer->Name); + break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetFloatv"); params[0] = (GLfloat)(ctx->Const.FragmentProgram.MaxUniformComponents); @@ -4532,6 +4572,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_TEXTURE_3D: params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_3D)); break; + case GL_TEXTURE_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetIntegerv"); + params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)); + break; + case GL_TEXTURE_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetIntegerv"); + params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); + break; case GL_TEXTURE_BINDING_1D: params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name; break; @@ -4541,6 +4589,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_TEXTURE_BINDING_3D: params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name; break; + case GL_TEXTURE_BINDING_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetIntegerv"); + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name; + break; + case GL_TEXTURE_BINDING_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetIntegerv"); + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name; + break; case GL_TEXTURE_ENV_COLOR: { const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; @@ -5526,6 +5582,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) CHECK_EXT1(EXT_framebuffer_object, "GetIntegerv"); params[0] = ctx->Const.MaxRenderbufferSize; break; + case GL_READ_FRAMEBUFFER_BINDING_EXT: + CHECK_EXT1(EXT_framebuffer_blit, "GetIntegerv"); + params[0] = ctx->ReadBuffer->Name; + break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetIntegerv"); params[0] = ctx->Const.FragmentProgram.MaxUniformComponents; diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 9055433281..819a7cc5d7 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -983,6 +983,11 @@ StateVars = [ ["ctx->Const.MaxRenderbufferSize"], "", ["EXT_framebuffer_object"] ), + # GL_EXT_framebuffer_blit + # NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT + ( "GL_READ_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->ReadBuffer->Name"], "", + ["EXT_framebuffer_blit"] ), + # GL_ARB_fragment_shader ( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint, ["ctx->Const.FragmentProgram.MaxUniformComponents"], "", -- cgit v1.2.3 From 0e34dcc6dfb466537f0e74d6c267d2f8bf795b66 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Tue, 25 Mar 2008 17:29:08 +0800 Subject: intel: fix the issue "VBO: Cannot allocate memory for a BO" on 965 after merging intel_context.c from i915 and i965. fix bug# 15152. --- src/mesa/drivers/dri/i915/i830_vtbl.c | 6 ++++++ src/mesa/drivers/dri/i915/i915_vtbl.c | 7 +++++++ src/mesa/drivers/dri/intel/intel_context.c | 1 + 3 files changed, 14 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 1f4bc91d77..d1b07c5a2f 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -666,6 +666,11 @@ i830_assert_not_dirty( struct intel_context *intel ) assert(!get_dirty(state)); } +static void +i830_note_unlock( struct intel_context *intel ) +{ + /* nothing */ +} void i830InitVtbl(struct i830_context *i830) @@ -681,4 +686,5 @@ i830InitVtbl(struct i830_context *i830) i830->intel.vtbl.render_start = i830_render_start; i830->intel.vtbl.render_prevalidate = i830_render_prevalidate; i830->intel.vtbl.assert_not_dirty = i830_assert_not_dirty; + i830->intel.vtbl.note_unlock = i830_note_unlock; } diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 40c5de26c6..94d70be441 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -572,6 +572,12 @@ i915_assert_not_dirty( struct intel_context *intel ) assert(!dirty); } +static void +i915_note_unlock( struct intel_context *intel ) +{ + /* nothing */ +} + void i915InitVtbl(struct i915_context *i915) @@ -587,4 +593,5 @@ i915InitVtbl(struct i915_context *i915) i915->intel.vtbl.update_texture_state = i915UpdateTextureState; i915->intel.vtbl.flush_cmd = i915_flush_cmd; i915->intel.vtbl.assert_not_dirty = i915_assert_not_dirty; + i915->intel.vtbl.note_unlock = i915_note_unlock; } diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 46c53ba4c2..e2388dbb09 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -993,6 +993,7 @@ void LOCK_HARDWARE( struct intel_context *intel ) */ void UNLOCK_HARDWARE( struct intel_context *intel ) { + intel->vtbl.note_unlock( intel ); intel->locked = 0; DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext); -- cgit v1.2.3 From d3ebaa41f548d0123106e35b5fab0f62ea6c286c Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 25 Mar 2008 14:03:52 -0600 Subject: implement glGet/BindAttribLocationARB() for display lists More such shader functions are needed... --- src/mesa/main/dlist.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index a421d04957..8d10d8a750 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -5578,6 +5578,27 @@ save_VertexAttrib4fvARB(GLuint index, const GLfloat * v) } +/* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ + +static void GLAPIENTRY +exec_BindAttribLocationARB(GLuint program, GLuint index, const GLchar *name) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + CALL_BindAttribLocationARB(ctx->Exec, (program, index, name)); +} + +static GLint GLAPIENTRY +exec_GetAttribLocationARB(GLuint program, const GLchar *name) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return CALL_GetAttribLocationARB(ctx->Exec, (program, name)); +} +/* XXX more shader functions needed here */ + + + #if FEATURE_EXT_framebuffer_blit static void GLAPIENTRY save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, @@ -8111,6 +8132,11 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT); #endif + /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ + SET_BindAttribLocationARB(table, exec_BindAttribLocationARB); + SET_GetAttribLocationARB(table, exec_GetAttribLocationARB); + /* XXX additional functions need to be implemented here! */ + /* 299. GL_EXT_blend_equation_separate */ SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT); -- cgit v1.2.3 From 2ac29115542d81366a7d78571cc568976baf0251 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Wed, 26 Mar 2008 06:24:48 +0000 Subject: r300: Renamed the destination-and-opcode/source macros to more appropriate names. --- src/mesa/drivers/dri/r300/r300_state.c | 8 +- src/mesa/drivers/dri/r300/r300_vertprog.c | 196 +++++++++++++++--------------- src/mesa/drivers/dri/r300/r300_vertprog.h | 4 +- 3 files changed, 104 insertions(+), 104 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 062b229275..f39245b247 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1660,28 +1660,28 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { if (rmesa->state.sw_tcl_inputs[i] != -1) { prog->program.body.i[program_end + 0] = - PVS_OPCODE(VE_MULTIPLY, + PVS_OP_DST_OPERAND(VE_MULTIPLY, GL_FALSE, GL_FALSE, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); prog->program.body.i[program_end + 1] = - PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], + PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); prog->program.body.i[program_end + 2] = - PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], + PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); prog->program.body.i[program_end + 3] = - PVS_SOURCE_OPCODE(rmesa->state.sw_tcl_inputs[i], + PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index d634f1e0d9..66765654d0 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -61,8 +61,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Take an already-setup and valid source then swizzle it appropriately to * obtain a constant ZERO or ONE source. */ -#define PVS_SOURCE_CONSTANT(x, y) \ - (PVS_SOURCE_OPCODE(t_src_index(vp, &src[x]), \ +#define __CONST(x, y) \ + (PVS_SRC_OPERAND(t_src_index(vp, &src[x]), \ t_swizzle(y), \ t_swizzle(y), \ t_swizzle(y), \ @@ -250,7 +250,7 @@ static unsigned long t_src(struct r300_vertex_program *vp, struct prog_src_regis /* src->NegateBase uses the NEGATE_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ - return PVS_SOURCE_OPCODE(t_src_index(vp, src), + return PVS_SRC_OPERAND(t_src_index(vp, src), t_swizzle(GET_SWZ(src->Swizzle, 0)), t_swizzle(GET_SWZ(src->Swizzle, 1)), t_swizzle(GET_SWZ(src->Swizzle, 2)), @@ -264,7 +264,7 @@ static unsigned long t_src_scalar(struct r300_vertex_program *vp, struct prog_sr /* src->NegateBase uses the NEGATE_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ - return PVS_SOURCE_OPCODE(t_src_index(vp, src), + return PVS_SRC_OPERAND(t_src_index(vp, src), t_swizzle(GET_SWZ(src->Swizzle, 0)), t_swizzle(GET_SWZ(src->Swizzle, 0)), t_swizzle(GET_SWZ(src->Swizzle, 0)), @@ -288,14 +288,14 @@ static GLuint *t_opcode_abs(struct r300_vertex_program *vp, struct prog_instruct { //MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W - inst[0] = PVS_OPCODE(VE_MAXIMUM, + inst[0] = PVS_OP_DST_OPERAND(VE_MAXIMUM, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), @@ -309,7 +309,7 @@ static GLuint *t_opcode_abs(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_add(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(VE_ADD, + inst[0] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), @@ -317,22 +317,22 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_arl(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(VE_FLT2FIX_DX, + inst[0] = PVS_OP_DST_OPERAND(VE_FLT2FIX_DX, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } @@ -341,34 +341,34 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, struct prog_instruct { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO} - inst[0] = PVS_OPCODE(VE_DOT_PRODUCT, + inst[0] = PVS_OP_DST_OPERAND(VE_DOT_PRODUCT, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), SWIZZLE_ZERO, t_src_class(src[0].File), src[0].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), + inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 0)), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), SWIZZLE_ZERO, t_src_class(src[1].File), src[1].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(VE_DOT_PRODUCT, + inst[0] = PVS_OP_DST_OPERAND(VE_DOT_PRODUCT, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), @@ -376,7 +376,7 @@ static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } @@ -384,13 +384,13 @@ static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_dph(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W} - inst[0] = PVS_OPCODE(VE_DOT_PRODUCT, + inst[0] = PVS_OP_DST_OPERAND(VE_DOT_PRODUCT, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), @@ -398,14 +398,14 @@ static GLuint *t_opcode_dph(struct r300_vertex_program *vp, struct prog_instruct t_src_class(src[0].File), src[0].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = t_src(vp, &src[1]); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(VE_DISTANCE_VECTOR, + inst[0] = PVS_OP_DST_OPERAND(VE_DISTANCE_VECTOR, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), @@ -413,37 +413,37 @@ static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(ME_EXP_BASE2_FULL_DX, + inst[0] = PVS_OP_DST_OPERAND(ME_EXP_BASE2_FULL_DX, GL_TRUE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_exp(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(ME_EXP_BASE2_DX, + inst[0] = PVS_OP_DST_OPERAND(ME_EXP_BASE2_DX, GL_TRUE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } @@ -453,25 +453,25 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, struct prog_instruct /* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W} ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */ - inst[0] = PVS_OPCODE(VE_FRACTION, + inst[0] = PVS_OP_DST_OPERAND(VE_FRACTION, GL_FALSE, GL_FALSE, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); inst[1] = t_src(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); inst += 4; - inst[0] = PVS_OPCODE(VE_ADD, + inst[0] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = PVS_SOURCE_OPCODE(*u_temp_i, + inst[2] = PVS_SRC_OPERAND(*u_temp_i, PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, @@ -480,7 +480,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, struct prog_instruct (!src[0]. NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE /*VSF_FLAG_ALL */ ); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); (*u_temp_i)--; return inst; @@ -488,15 +488,15 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_frc(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(VE_FRACTION, + inst[0] = PVS_OP_DST_OPERAND(VE_FRACTION, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } @@ -505,21 +505,21 @@ static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, struct prog_instruct { // LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X} - inst[0] = PVS_OPCODE(ME_LOG_BASE2_FULL_DX, + inst[0] = PVS_OP_DST_OPERAND(ME_LOG_BASE2_FULL_DX, GL_TRUE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_src_class(src[0].File), src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } @@ -528,28 +528,28 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, struct prog_instruct { //LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W} - inst[0] = PVS_OPCODE(ME_LIGHT_COEFF_DX, + inst[0] = PVS_OP_DST_OPERAND(ME_LIGHT_COEFF_DX, GL_TRUE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); /* NOTE: Users swizzling might not work. */ - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W PVS_SRC_SELECT_FORCE_0, // Z t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y t_src_class(src[0].File), src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W PVS_SRC_SELECT_FORCE_0, // Z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X t_src_class(src[0].File), src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[3] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + inst[3] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X PVS_SRC_SELECT_FORCE_0, // Z @@ -562,22 +562,22 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_log(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(ME_LOG_BASE2_DX, + inst[0] = PVS_OP_DST_OPERAND(ME_LOG_BASE2_DX, GL_TRUE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_mad(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(PVS_MACRO_OP_2CLK_MADD, + inst[0] = PVS_OP_DST_OPERAND(PVS_MACRO_OP_2CLK_MADD, GL_FALSE, GL_TRUE, t_dst_index(vp, &vpi->DstReg), @@ -592,7 +592,7 @@ static GLuint *t_opcode_mad(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(VE_MAXIMUM, + inst[0] = PVS_OP_DST_OPERAND(VE_MAXIMUM, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), @@ -600,14 +600,14 @@ static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_min(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(VE_MINIMUM, + inst[0] = PVS_OP_DST_OPERAND(VE_MINIMUM, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), @@ -615,7 +615,7 @@ static GLuint *t_opcode_min(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } @@ -624,22 +624,22 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, struct prog_instruct { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} - inst[0] = PVS_OPCODE(VE_ADD, + inst[0] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_mul(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(VE_MULTIPLY, + inst[0] = PVS_OP_DST_OPERAND(VE_MULTIPLY, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), @@ -647,21 +647,21 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_pow(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(ME_POWER_FUNC_FF, + inst[0] = PVS_OP_DST_OPERAND(ME_POWER_FUNC_FF, GL_TRUE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = t_src_scalar(vp, &src[1]); return inst; @@ -669,37 +669,37 @@ static GLuint *t_opcode_pow(struct r300_vertex_program *vp, struct prog_instruct static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(ME_RECIP_DX, + inst[0] = PVS_OP_DST_OPERAND(ME_RECIP_DX, GL_TRUE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(ME_RECIP_SQRT_DX, + inst[0] = PVS_OP_DST_OPERAND(ME_RECIP_SQRT_DX, GL_TRUE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(VE_SET_GREATER_THAN_EQUAL, + inst[0] = PVS_OP_DST_OPERAND(VE_SET_GREATER_THAN_EQUAL, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), @@ -707,14 +707,14 @@ static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } static GLuint *t_opcode_slt(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { - inst[0] = PVS_OPCODE(VE_SET_LESS_THAN, + inst[0] = PVS_OP_DST_OPERAND(VE_SET_LESS_THAN, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), @@ -722,7 +722,7 @@ static GLuint *t_opcode_slt(struct r300_vertex_program *vp, struct prog_instruct t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } @@ -732,14 +732,14 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruct //ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W #if 0 - inst[0] = PVS_OPCODE(VE_ADD, + inst[0] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), + inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 0)), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), @@ -749,14 +749,14 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruct inst[3] = 0; #else inst[0] = - PVS_OPCODE(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), + PVS_OP_DST_OPERAND(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), GL_FALSE, GL_FALSE, t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ONE); - inst[3] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), + inst[2] = __CONST(0, SWIZZLE_ONE); + inst[3] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 0)), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), @@ -772,15 +772,15 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, struct prog_instruct { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} - inst[0] = PVS_OPCODE(VE_ADD, + inst[0] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } @@ -791,50 +791,50 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, struct prog_instruct mad r0, -r2.yzxw, r1.zxyw, r0 */ - inst[0] = PVS_OPCODE(VE_MULTIPLY_ADD, + inst[0] = PVS_OP_DST_OPERAND(VE_MULTIPLY_ADD, GL_FALSE, GL_FALSE, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // Z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W t_src_class(src[0].File), src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), + inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // Z t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // X t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W t_src_class(src[1].File), src[1].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, SWIZZLE_ZERO); inst += 4; - inst[0] = PVS_OPCODE(VE_MULTIPLY_ADD, + inst[0] = PVS_OP_DST_OPERAND(VE_MULTIPLY_ADD, GL_FALSE, GL_FALSE, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); - inst[1] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), + inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // Z t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // X t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W t_src_class(src[1].File), (!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[2] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // Z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W t_src_class(src[0].File), src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[3] = PVS_SOURCE_OPCODE(*u_temp_i, + inst[3] = PVS_SRC_OPERAND(*u_temp_i, PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, @@ -938,22 +938,22 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro if (num_operands == 3) { /* TODO: scalars */ if (CMP_SRCS(src[1], src[2]) || CMP_SRCS(src[0], src[2])) { - inst[0] = PVS_OPCODE(VE_ADD, + inst[0] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, u_temp_i, VSF_FLAG_ALL, PVS_DST_REG_TEMPORARY); inst[1] = - PVS_SOURCE_OPCODE(t_src_index(vp, &src[2]), + PVS_SRC_OPERAND(t_src_index(vp, &src[2]), SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4); - inst[2] = PVS_SOURCE_CONSTANT(2, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(2, SWIZZLE_ZERO); + inst[2] = __CONST(2, SWIZZLE_ZERO); + inst[3] = __CONST(2, SWIZZLE_ZERO); inst += 4; src[2].File = PROGRAM_TEMPORARY; @@ -965,22 +965,22 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro if (num_operands >= 2) { if (CMP_SRCS(src[1], src[0])) { - inst[0] = PVS_OPCODE(VE_ADD, + inst[0] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, u_temp_i, VSF_FLAG_ALL, PVS_DST_REG_TEMPORARY); inst[1] = - PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), + PVS_SRC_OPERAND(t_src_index(vp, &src[0]), SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, t_src_class(src[0].File), VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); inst += 4; src[0].File = PROGRAM_TEMPORARY; @@ -1084,14 +1084,14 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro of the fragment program. Blank the outputs here. */ for (i = 0; i < VERT_RESULT_MAX; i++) { if (vp->key.OutputsAdded & (1 << i)) { - inst[0] = PVS_OPCODE(VE_ADD, + inst[0] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, vp->outputs[i], VSF_FLAG_ALL, PVS_DST_REG_OUT); - inst[1] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); - inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO); + inst[1] = __CONST(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[3] = __CONST(0, SWIZZLE_ZERO); inst += 4; } } diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 77cb1c0892..c08f214d3f 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -3,7 +3,7 @@ #include "r300_reg.h" -#define PVS_OPCODE(opcode, math_inst, macro_inst, reg_index, reg_writemask, reg_class) \ +#define PVS_OP_DST_OPERAND(opcode, math_inst, macro_inst, reg_index, reg_writemask, reg_class) \ (((opcode & PVS_DST_OPCODE_MASK) << PVS_DST_OPCODE_SHIFT) \ | ((math_inst & PVS_DST_MATH_INST_MASK) << PVS_DST_MATH_INST_SHIFT) \ | ((macro_inst & PVS_DST_MACRO_INST_MASK) << PVS_DST_MACRO_INST_SHIFT) \ @@ -11,7 +11,7 @@ | ((reg_writemask & 0xf) << PVS_DST_WE_X_SHIFT) /* X Y Z W */ \ | ((reg_class & PVS_DST_REG_TYPE_MASK) << PVS_DST_REG_TYPE_SHIFT)) -#define PVS_SOURCE_OPCODE(in_reg_index, comp_x, comp_y, comp_z, comp_w, reg_class, negate) \ +#define PVS_SRC_OPERAND(in_reg_index, comp_x, comp_y, comp_z, comp_w, reg_class, negate) \ (((in_reg_index & PVS_SRC_OFFSET_MASK) << PVS_SRC_OFFSET_SHIFT) \ | ((comp_x & PVS_SRC_SWIZZLE_X_MASK) << PVS_SRC_SWIZZLE_X_SHIFT) \ | ((comp_y & PVS_SRC_SWIZZLE_Y_MASK) << PVS_SRC_SWIZZLE_Y_SHIFT) \ -- cgit v1.2.3 From 42a04ada10e894212ecc02dcca1c4e050275a368 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Wed, 26 Mar 2008 06:31:33 +0000 Subject: r300: Renamed the Mesa opcode translation functions. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 108 +++++++++++++++--------------- 1 file changed, 54 insertions(+), 54 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 66765654d0..5c5fd7c387 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -284,7 +284,7 @@ static GLboolean valid_dst(struct r300_vertex_program *vp, struct prog_dst_regis return GL_TRUE; } -static GLuint *t_opcode_abs(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeABS(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W @@ -307,7 +307,7 @@ static GLuint *t_opcode_abs(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_add(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeADD(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, @@ -322,7 +322,7 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_arl(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeARL(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_FLT2FIX_DX, GL_FALSE, @@ -337,7 +337,7 @@ static GLuint *t_opcode_arl(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeDP3(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO} @@ -366,7 +366,7 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeDP4(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_DOT_PRODUCT, GL_FALSE, @@ -381,7 +381,7 @@ static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_dph(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeDPH(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W} inst[0] = PVS_OP_DST_OPERAND(VE_DOT_PRODUCT, @@ -403,7 +403,7 @@ static GLuint *t_opcode_dph(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeDST(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_DISTANCE_VECTOR, GL_FALSE, @@ -418,7 +418,7 @@ static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeEX2(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_EXP_BASE2_FULL_DX, GL_TRUE, @@ -433,7 +433,7 @@ static GLuint *t_opcode_ex2(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_exp(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeEXP(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_EXP_BASE2_DX, GL_TRUE, @@ -448,7 +448,7 @@ static GLuint *t_opcode_exp(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_flr(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3], int *u_temp_i) +static GLuint *r300TranslateOpcodeFLR(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3], int *u_temp_i) { /* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W} ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */ @@ -486,7 +486,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_frc(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeFRC(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_FRACTION, GL_FALSE, @@ -501,7 +501,7 @@ static GLuint *t_opcode_frc(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeLG2(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { // LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X} @@ -524,7 +524,7 @@ static GLuint *t_opcode_lg2(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_lit(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeLIT(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W} @@ -560,7 +560,7 @@ static GLuint *t_opcode_lit(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_log(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeLOG(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_LOG_BASE2_DX, GL_TRUE, @@ -575,7 +575,7 @@ static GLuint *t_opcode_log(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_mad(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeMAD(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(PVS_MACRO_OP_2CLK_MADD, GL_FALSE, @@ -590,7 +590,7 @@ static GLuint *t_opcode_mad(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeMAX(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_MAXIMUM, GL_FALSE, @@ -605,7 +605,7 @@ static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_min(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeMIN(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_MINIMUM, GL_FALSE, @@ -620,7 +620,7 @@ static GLuint *t_opcode_min(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_mov(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeMOV(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} @@ -637,7 +637,7 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_mul(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeMUL(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_MULTIPLY, GL_FALSE, @@ -652,7 +652,7 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_pow(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodePOW(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_POWER_FUNC_FF, GL_TRUE, @@ -667,7 +667,7 @@ static GLuint *t_opcode_pow(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeRCP(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_RECIP_DX, GL_TRUE, @@ -682,7 +682,7 @@ static GLuint *t_opcode_rcp(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeRSQ(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_RECIP_SQRT_DX, GL_TRUE, @@ -697,7 +697,7 @@ static GLuint *t_opcode_rsq(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeSGE(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_SET_GREATER_THAN_EQUAL, GL_FALSE, @@ -712,7 +712,7 @@ static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_slt(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeSLT(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_SET_LESS_THAN, GL_FALSE, @@ -727,7 +727,7 @@ static GLuint *t_opcode_slt(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeSUB(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W @@ -768,7 +768,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_swz(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeSWZ(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} @@ -785,7 +785,7 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, struct prog_instruct return inst; } -static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3], int *u_temp_i) +static GLuint *r300TranslateOpcodeXPD(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3], int *u_temp_i) { /* mul r0, r1.yzxw, r2.zxyw mad r0, -r2.yzxw, r1.zxyw, r0 @@ -992,86 +992,86 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro switch (vpi->Opcode) { case OPCODE_ABS: - inst = t_opcode_abs(vp, vpi, inst, src); + inst = r300TranslateOpcodeABS(vp, vpi, inst, src); break; case OPCODE_ADD: - inst = t_opcode_add(vp, vpi, inst, src); + inst = r300TranslateOpcodeADD(vp, vpi, inst, src); break; case OPCODE_ARL: - inst = t_opcode_arl(vp, vpi, inst, src); + inst = r300TranslateOpcodeARL(vp, vpi, inst, src); break; case OPCODE_DP3: - inst = t_opcode_dp3(vp, vpi, inst, src); + inst = r300TranslateOpcodeDP3(vp, vpi, inst, src); break; case OPCODE_DP4: - inst = t_opcode_dp4(vp, vpi, inst, src); + inst = r300TranslateOpcodeDP4(vp, vpi, inst, src); break; case OPCODE_DPH: - inst = t_opcode_dph(vp, vpi, inst, src); + inst = r300TranslateOpcodeDPH(vp, vpi, inst, src); break; case OPCODE_DST: - inst = t_opcode_dst(vp, vpi, inst, src); + inst = r300TranslateOpcodeDST(vp, vpi, inst, src); break; case OPCODE_EX2: - inst = t_opcode_ex2(vp, vpi, inst, src); + inst = r300TranslateOpcodeEX2(vp, vpi, inst, src); break; case OPCODE_EXP: - inst = t_opcode_exp(vp, vpi, inst, src); + inst = r300TranslateOpcodeEXP(vp, vpi, inst, src); break; case OPCODE_FLR: - inst = t_opcode_flr(vp, vpi, inst, src, /* FIXME */ + inst = r300TranslateOpcodeFLR(vp, vpi, inst, src, /* FIXME */ &u_temp_i); break; case OPCODE_FRC: - inst = t_opcode_frc(vp, vpi, inst, src); + inst = r300TranslateOpcodeFRC(vp, vpi, inst, src); break; case OPCODE_LG2: - inst = t_opcode_lg2(vp, vpi, inst, src); + inst = r300TranslateOpcodeLG2(vp, vpi, inst, src); break; case OPCODE_LIT: - inst = t_opcode_lit(vp, vpi, inst, src); + inst = r300TranslateOpcodeLIT(vp, vpi, inst, src); break; case OPCODE_LOG: - inst = t_opcode_log(vp, vpi, inst, src); + inst = r300TranslateOpcodeLOG(vp, vpi, inst, src); break; case OPCODE_MAD: - inst = t_opcode_mad(vp, vpi, inst, src); + inst = r300TranslateOpcodeMAD(vp, vpi, inst, src); break; case OPCODE_MAX: - inst = t_opcode_max(vp, vpi, inst, src); + inst = r300TranslateOpcodeMAX(vp, vpi, inst, src); break; case OPCODE_MIN: - inst = t_opcode_min(vp, vpi, inst, src); + inst = r300TranslateOpcodeMIN(vp, vpi, inst, src); break; case OPCODE_MOV: - inst = t_opcode_mov(vp, vpi, inst, src); + inst = r300TranslateOpcodeMOV(vp, vpi, inst, src); break; case OPCODE_MUL: - inst = t_opcode_mul(vp, vpi, inst, src); + inst = r300TranslateOpcodeMUL(vp, vpi, inst, src); break; case OPCODE_POW: - inst = t_opcode_pow(vp, vpi, inst, src); + inst = r300TranslateOpcodePOW(vp, vpi, inst, src); break; case OPCODE_RCP: - inst = t_opcode_rcp(vp, vpi, inst, src); + inst = r300TranslateOpcodeRCP(vp, vpi, inst, src); break; case OPCODE_RSQ: - inst = t_opcode_rsq(vp, vpi, inst, src); + inst = r300TranslateOpcodeRSQ(vp, vpi, inst, src); break; case OPCODE_SGE: - inst = t_opcode_sge(vp, vpi, inst, src); + inst = r300TranslateOpcodeSGE(vp, vpi, inst, src); break; case OPCODE_SLT: - inst = t_opcode_slt(vp, vpi, inst, src); + inst = r300TranslateOpcodeSLT(vp, vpi, inst, src); break; case OPCODE_SUB: - inst = t_opcode_sub(vp, vpi, inst, src); + inst = r300TranslateOpcodeSUB(vp, vpi, inst, src); break; case OPCODE_SWZ: - inst = t_opcode_swz(vp, vpi, inst, src); + inst = r300TranslateOpcodeSWZ(vp, vpi, inst, src); break; case OPCODE_XPD: - inst = t_opcode_xpd(vp, vpi, inst, src, /* FIXME */ + inst = r300TranslateOpcodeXPD(vp, vpi, inst, src, /* FIXME */ &u_temp_i); break; default: -- cgit v1.2.3 From d24a5254c2d4062017cad173eca15398cf4115bf Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Wed, 26 Mar 2008 14:40:30 +0800 Subject: [i915] don't use 4x4 filter for 1D shadowmap --- src/mesa/drivers/dri/i915/i915_texstate.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 133514d57d..e489d25ae8 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -249,8 +249,13 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) (SS2_SHADOW_ENABLE | intel_translate_shadow_compare_func(tObj->CompareFunc)); - minFilt = FILTER_4X4_FLAT; - magFilt = FILTER_4X4_FLAT; + if (tObj->Target == GL_TEXTURE_1D) { + minFilt = FILTER_NEAREST; + magFilt = FILTER_NEAREST; + } else { + minFilt = FILTER_4X4_FLAT; + magFilt = FILTER_4X4_FLAT; + } } state[I915_TEXREG_SS2] |= ((minFilt << SS2_MIN_FILTER_SHIFT) | -- cgit v1.2.3 From 863ab98ac758355fa80f70f84bbd69c066713554 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Wed, 26 Mar 2008 07:09:21 +0000 Subject: r300: Added Copyright lines to the vertex program code. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 5c5fd7c387..23cc411346 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -1,6 +1,7 @@ /************************************************************************** -Copyright (C) 2005 Aapo Tahkola. +Copyright (C) 2005 Aapo Tahkola +Copyright (C) 2008 Oliver McFadden All Rights Reserved. @@ -25,19 +26,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/** - * \file - * - * \author Aapo Tahkola - * - * \author Oliver McFadden - * - * \todo A VE_MULTIPLY_ADD or VE_MULTIPLYX2_ADD opcode with all 3 source - * operands using unique PVS_REG_TEMPORARY vector addresses requires special - * handling, which is currently not implemented! - * - * For a description of the vertex program instruction set see r300_reg.h. - */ +/* Radeon R5xx Acceleration, Revision 1.2 */ #include "main/glheader.h" #include "main/macros.h" -- cgit v1.2.3 From a2c1aad27d2f9c88ba384f9861143c42c3c3eee7 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Wed, 26 Mar 2008 07:28:29 +0000 Subject: r300: Removed the last of the duplicate vertex program macros. --- src/mesa/drivers/dri/r300/r300_ioctl.c | 14 +++++----- src/mesa/drivers/dri/r300/r300_vertprog.h | 45 ------------------------------- 2 files changed, 8 insertions(+), 51 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index ae2dcffe38..3501ba2d09 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -318,6 +318,7 @@ static void r300EmitClearState(GLcontext * ctx) if (has_tcl) { R300_STATECHANGE(r300, pvs); reg_start(R300_VAP_PVS_CNTL_1, 2); + e32((0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) | (0 << R300_PVS_CNTL_1_POS_END_SHIFT) | (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT)); @@ -326,14 +327,15 @@ static void r300EmitClearState(GLcontext * ctx) R300_STATECHANGE(r300, vpi); vsf_start_fragment(0x0, 8); - e32(VP_OUT(ADD, OUT, 0, XYZW)); - e32(VP_IN(INPUT, 0)); - e32(VP_ZERO()); + + e32(PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, 0, 0xf, PVS_DST_REG_OUT)); + e32(PVS_SRC_OPERAND(0, PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, VSF_FLAG_NONE)); + e32(PVS_SRC_OPERAND(0, PVS_SRC_SELECT_FORCE_0, PVS_SRC_SELECT_FORCE_0, PVS_SRC_SELECT_FORCE_0, PVS_SRC_SELECT_FORCE_0, PVS_SRC_REG_INPUT, VSF_FLAG_NONE)); e32(0x0); - e32(VP_OUT(ADD, OUT, 1, XYZW)); - e32(VP_IN(INPUT, 1)); - e32(VP_ZERO()); + e32(PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, 1, 0xf, PVS_DST_REG_OUT)); + e32(PVS_SRC_OPERAND(1, PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, VSF_FLAG_NONE)); + e32(PVS_SRC_OPERAND(1, PVS_SRC_SELECT_FORCE_0, PVS_SRC_SELECT_FORCE_0, PVS_SRC_SELECT_FORCE_0, PVS_SRC_SELECT_FORCE_0, PVS_SRC_REG_INPUT, VSF_FLAG_NONE)); e32(0x0); } } diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index c08f214d3f..2f35f02bc8 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -30,51 +30,6 @@ #define VSF_FLAG_ALL 0xf #define VSF_FLAG_NONE 0 -#define R300_VPI_OUT_WRITE_X (1 << 20) -#define R300_VPI_OUT_WRITE_Y (1 << 21) -#define R300_VPI_OUT_WRITE_Z (1 << 22) -#define R300_VPI_OUT_WRITE_W (1 << 23) - -#define VP_OUTMASK_X R300_VPI_OUT_WRITE_X -#define VP_OUTMASK_Y R300_VPI_OUT_WRITE_Y -#define VP_OUTMASK_Z R300_VPI_OUT_WRITE_Z -#define VP_OUTMASK_W R300_VPI_OUT_WRITE_W -#define VP_OUTMASK_XY (VP_OUTMASK_X|VP_OUTMASK_Y) -#define VP_OUTMASK_XZ (VP_OUTMASK_X|VP_OUTMASK_Z) -#define VP_OUTMASK_XW (VP_OUTMASK_X|VP_OUTMASK_W) -#define VP_OUTMASK_XYZ (VP_OUTMASK_XY|VP_OUTMASK_Z) -#define VP_OUTMASK_XYW (VP_OUTMASK_XY|VP_OUTMASK_W) -#define VP_OUTMASK_XZW (VP_OUTMASK_XZ|VP_OUTMASK_W) -#define VP_OUTMASK_XYZW (VP_OUTMASK_XYZ|VP_OUTMASK_W) -#define VP_OUTMASK_YZ (VP_OUTMASK_Y|VP_OUTMASK_Z) -#define VP_OUTMASK_YW (VP_OUTMASK_Y|VP_OUTMASK_W) -#define VP_OUTMASK_YZW (VP_OUTMASK_YZ|VP_OUTMASK_W) -#define VP_OUTMASK_ZW (VP_OUTMASK_Z|VP_OUTMASK_W) - -#define VP_OUT(instr,outclass,outidx,outmask) \ - (VE_##instr | \ - ((outidx & PVS_DST_OFFSET_MASK) << PVS_DST_OFFSET_SHIFT) | \ - ((PVS_DST_REG_##outclass & PVS_DST_REG_TYPE_MASK) << PVS_DST_REG_TYPE_SHIFT) | \ - VP_OUTMASK_##outmask) - -#define VP_IN(inclass,inidx) \ - (((inidx & PVS_SRC_OFFSET_MASK) << PVS_SRC_OFFSET_SHIFT) | \ - ((PVS_SRC_REG_##inclass & PVS_SRC_REG_TYPE_MASK) << PVS_SRC_REG_TYPE_SHIFT) | \ - ((PVS_SRC_SELECT_X & PVS_SRC_SWIZZLE_X_MASK) << PVS_SRC_SWIZZLE_X_SHIFT) | \ - ((PVS_SRC_SELECT_Y & PVS_SRC_SWIZZLE_Y_MASK) << PVS_SRC_SWIZZLE_Y_SHIFT) | \ - ((PVS_SRC_SELECT_Z & PVS_SRC_SWIZZLE_Z_MASK) << PVS_SRC_SWIZZLE_Z_SHIFT) | \ - ((PVS_SRC_SELECT_W & PVS_SRC_SWIZZLE_W_MASK) << PVS_SRC_SWIZZLE_W_SHIFT)) -#define VP_ZERO() \ - (((PVS_SRC_SELECT_FORCE_0 & PVS_SRC_SWIZZLE_X_MASK) << PVS_SRC_SWIZZLE_X_SHIFT) | \ - ((PVS_SRC_SELECT_FORCE_0 & PVS_SRC_SWIZZLE_Y_MASK) << PVS_SRC_SWIZZLE_Y_SHIFT) | \ - ((PVS_SRC_SELECT_FORCE_0 & PVS_SRC_SWIZZLE_Z_MASK) << PVS_SRC_SWIZZLE_Z_SHIFT) | \ - ((PVS_SRC_SELECT_FORCE_0 & PVS_SRC_SWIZZLE_W_MASK) << PVS_SRC_SWIZZLE_W_SHIFT)) -#define VP_ONE() \ - (((PVS_SRC_SELECT_FORCE_1 & PVS_SRC_SWIZZLE_X_MASK) << PVS_SRC_SWIZZLE_X_SHIFT) | \ - ((PVS_SRC_SELECT_FORCE_1 & PVS_SRC_SWIZZLE_Y_MASK) << PVS_SRC_SWIZZLE_Y_SHIFT) | \ - ((PVS_SRC_SELECT_FORCE_1 & PVS_SRC_SWIZZLE_Z_MASK) << PVS_SRC_SWIZZLE_Z_SHIFT) | \ - ((PVS_SRC_SELECT_FORCE_1 & PVS_SRC_SWIZZLE_W_MASK) << PVS_SRC_SWIZZLE_W_SHIFT)) - #endif #endif -- cgit v1.2.3 From 82770b8c835812dd04d93083a0ac6cc2b6250e46 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Wed, 26 Mar 2008 07:53:16 +0000 Subject: r300: Cleaned up the default vertex program code with longer lines. --- src/mesa/drivers/dri/r300/r300_state.c | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index f39245b247..c4de022d84 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1659,34 +1659,10 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { if (rmesa->state.sw_tcl_inputs[i] != -1) { - prog->program.body.i[program_end + 0] = - PVS_OP_DST_OPERAND(VE_MULTIPLY, - GL_FALSE, - GL_FALSE, - o_reg++, - VSF_FLAG_ALL, - PVS_DST_REG_OUT); - prog->program.body.i[program_end + 1] = - PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], - PVS_SRC_SELECT_X, - PVS_SRC_SELECT_Y, - PVS_SRC_SELECT_Z, - PVS_SRC_SELECT_W, - PVS_SRC_REG_INPUT, VSF_FLAG_NONE); - prog->program.body.i[program_end + 2] = - PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], - PVS_SRC_SELECT_FORCE_1, - PVS_SRC_SELECT_FORCE_1, - PVS_SRC_SELECT_FORCE_1, - PVS_SRC_SELECT_FORCE_1, - PVS_SRC_REG_INPUT, VSF_FLAG_NONE); - prog->program.body.i[program_end + 3] = - PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], - PVS_SRC_SELECT_FORCE_1, - PVS_SRC_SELECT_FORCE_1, - PVS_SRC_SELECT_FORCE_1, - PVS_SRC_SELECT_FORCE_1, - /* FIXME */ 0, VSF_FLAG_NONE); + prog->program.body.i[program_end + 0] = PVS_OP_DST_OPERAND(VE_MULTIPLY, GL_FALSE, GL_FALSE, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); + prog->program.body.i[program_end + 1] = PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); + prog->program.body.i[program_end + 2] = PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); + prog->program.body.i[program_end + 3] = PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); program_end += 4; } } -- cgit v1.2.3 From e49ec6e2a4b5002ac9766c828807fb0a10d975f2 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Wed, 26 Mar 2008 08:01:13 +0000 Subject: r300: Indented the vertex program code... --- src/mesa/drivers/dri/r300/r300_vertprog.c | 818 +++++++++++++++++------------- 1 file changed, 474 insertions(+), 344 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 23cc411346..e741eb9b19 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -69,7 +69,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. u_temp_i=VSF_MAX_FRAGMENT_TEMPS-1; \ } while (0) -int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_program_cont *vp, float *dst) +int r300VertexProgUpdateParams(GLcontext * ctx, + struct r300_vertex_program_cont *vp, float *dst) { int pi; struct gl_vertex_program *mesa_vp = &vp->mesa_program; @@ -91,7 +92,8 @@ int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_program_cont assert(mesa_vp->Base.Parameters); _mesa_load_state_parameters(ctx, mesa_vp->Base.Parameters); - if (mesa_vp->Base.Parameters->NumParameters * 4 > VSF_MAX_FRAGMENT_LENGTH) { + if (mesa_vp->Base.Parameters->NumParameters * 4 > + VSF_MAX_FRAGMENT_LENGTH) { fprintf(stderr, "%s:Params exhausted\n", __FUNCTION__); _mesa_exit(-1); } @@ -109,7 +111,8 @@ int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_program_cont *dst++ = paramList->ParameterValues[pi][3]; break; default: - _mesa_problem(NULL, "Bad param type in %s", __FUNCTION__); + _mesa_problem(NULL, "Bad param type in %s", + __FUNCTION__); } } @@ -149,7 +152,8 @@ static unsigned long t_dst_class(enum register_file file) } } -static unsigned long t_dst_index(struct r300_vertex_program *vp, struct prog_dst_register *dst) +static unsigned long t_dst_index(struct r300_vertex_program *vp, + struct prog_dst_register *dst) { if (dst->File == PROGRAM_OUTPUT) return vp->outputs[dst->Index]; @@ -193,7 +197,8 @@ static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller) int i; if (vp == NULL) { - fprintf(stderr, "vp null in call to %s from %s\n", __FUNCTION__, caller); + fprintf(stderr, "vp null in call to %s from %s\n", __FUNCTION__, + caller); return; } @@ -205,7 +210,8 @@ static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller) } #endif -static unsigned long t_src_index(struct r300_vertex_program *vp, struct prog_src_register *src) +static unsigned long t_src_index(struct r300_vertex_program *vp, + struct prog_src_register *src) { int i; int max_reg = -1; @@ -225,7 +231,8 @@ static unsigned long t_src_index(struct r300_vertex_program *vp, struct prog_src return vp->inputs[src->Index]; } else { if (src->Index < 0) { - fprintf(stderr, "negative offsets for indirect addressing do not work.\n"); + fprintf(stderr, + "negative offsets for indirect addressing do not work.\n"); return 0; } return src->Index; @@ -234,35 +241,40 @@ static unsigned long t_src_index(struct r300_vertex_program *vp, struct prog_src /* these two functions should probably be merged... */ -static unsigned long t_src(struct r300_vertex_program *vp, struct prog_src_register *src) +static unsigned long t_src(struct r300_vertex_program *vp, + struct prog_src_register *src) { /* src->NegateBase uses the NEGATE_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ return PVS_SRC_OPERAND(t_src_index(vp, src), - t_swizzle(GET_SWZ(src->Swizzle, 0)), - t_swizzle(GET_SWZ(src->Swizzle, 1)), - t_swizzle(GET_SWZ(src->Swizzle, 2)), - t_swizzle(GET_SWZ(src->Swizzle, 3)), - t_src_class(src->File), - src->NegateBase) | (src->RelAddr << 4); + t_swizzle(GET_SWZ(src->Swizzle, 0)), + t_swizzle(GET_SWZ(src->Swizzle, 1)), + t_swizzle(GET_SWZ(src->Swizzle, 2)), + t_swizzle(GET_SWZ(src->Swizzle, 3)), + t_src_class(src->File), + src->NegateBase) | (src->RelAddr << 4); } -static unsigned long t_src_scalar(struct r300_vertex_program *vp, struct prog_src_register *src) +static unsigned long t_src_scalar(struct r300_vertex_program *vp, + struct prog_src_register *src) { /* src->NegateBase uses the NEGATE_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ return PVS_SRC_OPERAND(t_src_index(vp, src), - t_swizzle(GET_SWZ(src->Swizzle, 0)), - t_swizzle(GET_SWZ(src->Swizzle, 0)), - t_swizzle(GET_SWZ(src->Swizzle, 0)), - t_swizzle(GET_SWZ(src->Swizzle, 0)), - t_src_class(src->File), - src->NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src->RelAddr << 4); + t_swizzle(GET_SWZ(src->Swizzle, 0)), + t_swizzle(GET_SWZ(src->Swizzle, 0)), + t_swizzle(GET_SWZ(src->Swizzle, 0)), + t_swizzle(GET_SWZ(src->Swizzle, 0)), + t_src_class(src->File), + src-> + NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src->RelAddr << 4); } -static GLboolean valid_dst(struct r300_vertex_program *vp, struct prog_dst_register *dst) +static GLboolean valid_dst(struct r300_vertex_program *vp, + struct prog_dst_register *dst) { if (dst->File == PROGRAM_OUTPUT && vp->outputs[dst->Index] == -1) { return GL_FALSE; @@ -273,37 +285,45 @@ static GLboolean valid_dst(struct r300_vertex_program *vp, struct prog_dst_regis return GL_TRUE; } -static GLuint *r300TranslateOpcodeABS(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeABS(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { //MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W inst[0] = PVS_OP_DST_OPERAND(VE_MAXIMUM, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), - t_swizzle(GET_SWZ(src[0].Swizzle, 2)), - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), - t_src_class(src[0].File), - (!src[0].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), + t_swizzle(GET_SWZ(src[0].Swizzle, 2)), + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), + t_src_class(src[0].File), + (!src[0]. + NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[0].RelAddr << 4); inst[3] = 0; return inst; } -static GLuint *r300TranslateOpcodeADD(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeADD(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_ADD, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = __CONST(1, SWIZZLE_ZERO); @@ -311,14 +331,17 @@ static GLuint *r300TranslateOpcodeADD(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeARL(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeARL(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_FLT2FIX_DX, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -326,43 +349,53 @@ static GLuint *r300TranslateOpcodeARL(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeDP3(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeDP3(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO} inst[0] = PVS_OP_DST_OPERAND(VE_DOT_PRODUCT, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), - t_swizzle(GET_SWZ(src[0].Swizzle, 2)), - SWIZZLE_ZERO, - t_src_class(src[0].File), - src[0].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), - t_swizzle(GET_SWZ(src[1].Swizzle, 0)), - t_swizzle(GET_SWZ(src[1].Swizzle, 1)), - t_swizzle(GET_SWZ(src[1].Swizzle, 2)), - SWIZZLE_ZERO, - t_src_class(src[1].File), - src[1].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[1].RelAddr << 4); + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), + t_swizzle(GET_SWZ(src[0].Swizzle, 2)), + SWIZZLE_ZERO, + t_src_class(src[0].File), + src[0]. + NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | + (src[0].RelAddr << 4); + inst[2] = + PVS_SRC_OPERAND(t_src_index(vp, &src[1]), + t_swizzle(GET_SWZ(src[1].Swizzle, 0)), + t_swizzle(GET_SWZ(src[1].Swizzle, 1)), + t_swizzle(GET_SWZ(src[1].Swizzle, 2)), SWIZZLE_ZERO, + t_src_class(src[1].File), + src[1]. + NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | + (src[1].RelAddr << 4); inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } -static GLuint *r300TranslateOpcodeDP4(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeDP4(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_DOT_PRODUCT, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = __CONST(1, SWIZZLE_ZERO); @@ -370,36 +403,44 @@ static GLuint *r300TranslateOpcodeDP4(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeDPH(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeDPH(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W} inst[0] = PVS_OP_DST_OPERAND(VE_DOT_PRODUCT, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), - t_swizzle(GET_SWZ(src[0].Swizzle, 2)), - PVS_SRC_SELECT_FORCE_1, - t_src_class(src[0].File), - src[0].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), + t_swizzle(GET_SWZ(src[0].Swizzle, 2)), + PVS_SRC_SELECT_FORCE_1, + t_src_class(src[0].File), + src[0]. + NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | + (src[0].RelAddr << 4); inst[2] = t_src(vp, &src[1]); inst[3] = __CONST(1, SWIZZLE_ZERO); return inst; } -static GLuint *r300TranslateOpcodeDST(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeDST(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_DISTANCE_VECTOR, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = __CONST(1, SWIZZLE_ZERO); @@ -407,14 +448,17 @@ static GLuint *r300TranslateOpcodeDST(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeEX2(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeEX2(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_EXP_BASE2_FULL_DX, - GL_TRUE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -422,14 +466,17 @@ static GLuint *r300TranslateOpcodeEX2(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeEXP(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeEXP(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_EXP_BASE2_DX, - GL_TRUE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -437,52 +484,59 @@ static GLuint *r300TranslateOpcodeEXP(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeFLR(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3], int *u_temp_i) +static GLuint *r300TranslateOpcodeFLR(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3], + int *u_temp_i) { /* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W} ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */ inst[0] = PVS_OP_DST_OPERAND(VE_FRACTION, - GL_FALSE, - GL_FALSE, - *u_temp_i, - t_dst_mask(vpi->DstReg.WriteMask), - PVS_DST_REG_TEMPORARY); + GL_FALSE, + GL_FALSE, + *u_temp_i, + t_dst_mask(vpi->DstReg.WriteMask), + PVS_DST_REG_TEMPORARY); inst[1] = t_src(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); inst += 4; inst[0] = PVS_OP_DST_OPERAND(VE_ADD, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = PVS_SRC_OPERAND(*u_temp_i, - PVS_SRC_SELECT_X, - PVS_SRC_SELECT_Y, - PVS_SRC_SELECT_Z, - PVS_SRC_SELECT_W, PVS_SRC_REG_TEMPORARY, - /* Not 100% sure about this */ - (!src[0]. - NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE - /*VSF_FLAG_ALL */ ); + PVS_SRC_SELECT_X, + PVS_SRC_SELECT_Y, + PVS_SRC_SELECT_Z, + PVS_SRC_SELECT_W, PVS_SRC_REG_TEMPORARY, + /* Not 100% sure about this */ + (!src[0]. + NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE + /*VSF_FLAG_ALL */ ); inst[3] = __CONST(0, SWIZZLE_ZERO); (*u_temp_i)--; return inst; } -static GLuint *r300TranslateOpcodeFRC(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeFRC(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_FRACTION, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -490,73 +544,87 @@ static GLuint *r300TranslateOpcodeFRC(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeLG2(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeLG2(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { // LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X} inst[0] = PVS_OP_DST_OPERAND(ME_LOG_BASE2_FULL_DX, - GL_TRUE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), - t_src_class(src[0].File), - src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), + t_src_class(src[0].File), + src[0]. + NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[0].RelAddr << 4); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); return inst; } -static GLuint *r300TranslateOpcodeLIT(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeLIT(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { //LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W} inst[0] = PVS_OP_DST_OPERAND(ME_LIGHT_COEFF_DX, - GL_TRUE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); /* NOTE: Users swizzling might not work. */ - inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W - PVS_SRC_SELECT_FORCE_0, // Z - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y - t_src_class(src[0].File), - src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W - PVS_SRC_SELECT_FORCE_0, // Z - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X - t_src_class(src[0].File), - src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[3] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X - PVS_SRC_SELECT_FORCE_0, // Z - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W - t_src_class(src[0].File), - src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W + PVS_SRC_SELECT_FORCE_0, // Z + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y + t_src_class(src[0].File), + src[0]. + NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[0].RelAddr << 4); + inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W + PVS_SRC_SELECT_FORCE_0, // Z + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X + t_src_class(src[0].File), + src[0]. + NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[0].RelAddr << 4); + inst[3] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X + PVS_SRC_SELECT_FORCE_0, // Z + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W + t_src_class(src[0].File), + src[0]. + NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[0].RelAddr << 4); return inst; } -static GLuint *r300TranslateOpcodeLOG(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeLOG(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_LOG_BASE2_DX, - GL_TRUE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -564,14 +632,17 @@ static GLuint *r300TranslateOpcodeLOG(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeMAD(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeMAD(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(PVS_MACRO_OP_2CLK_MADD, - GL_FALSE, - GL_TRUE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_TRUE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = t_src(vp, &src[2]); @@ -579,14 +650,17 @@ static GLuint *r300TranslateOpcodeMAD(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeMAX(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeMAX(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_MAXIMUM, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = __CONST(1, SWIZZLE_ZERO); @@ -594,14 +668,17 @@ static GLuint *r300TranslateOpcodeMAX(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeMIN(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeMIN(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_MINIMUM, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = __CONST(1, SWIZZLE_ZERO); @@ -609,16 +686,19 @@ static GLuint *r300TranslateOpcodeMIN(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeMOV(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeMOV(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} inst[0] = PVS_OP_DST_OPERAND(VE_ADD, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -626,14 +706,17 @@ static GLuint *r300TranslateOpcodeMOV(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeMUL(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeMUL(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_MULTIPLY, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = __CONST(1, SWIZZLE_ZERO); @@ -641,14 +724,17 @@ static GLuint *r300TranslateOpcodeMUL(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodePOW(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodePOW(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_POWER_FUNC_FF, - GL_TRUE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = t_src_scalar(vp, &src[1]); @@ -656,14 +742,17 @@ static GLuint *r300TranslateOpcodePOW(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeRCP(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeRCP(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_RECIP_DX, - GL_TRUE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -671,14 +760,17 @@ static GLuint *r300TranslateOpcodeRCP(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeRSQ(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeRSQ(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(ME_RECIP_SQRT_DX, - GL_TRUE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_TRUE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -686,14 +778,17 @@ static GLuint *r300TranslateOpcodeRSQ(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeSGE(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeSGE(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_SET_GREATER_THAN_EQUAL, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = __CONST(1, SWIZZLE_ZERO); @@ -701,14 +796,17 @@ static GLuint *r300TranslateOpcodeSGE(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeSLT(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeSLT(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { inst[0] = PVS_OP_DST_OPERAND(VE_SET_LESS_THAN, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = t_src(vp, &src[1]); inst[3] = __CONST(1, SWIZZLE_ZERO); @@ -716,57 +814,67 @@ static GLuint *r300TranslateOpcodeSLT(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeSUB(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeSUB(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { //ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W #if 0 inst[0] = PVS_OP_DST_OPERAND(VE_ADD, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), - t_swizzle(GET_SWZ(src[1].Swizzle, 0)), - t_swizzle(GET_SWZ(src[1].Swizzle, 1)), - t_swizzle(GET_SWZ(src[1].Swizzle, 2)), - t_swizzle(GET_SWZ(src[1].Swizzle, 3)), - t_src_class(src[1].File), - (!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); + t_swizzle(GET_SWZ(src[1].Swizzle, 0)), + t_swizzle(GET_SWZ(src[1].Swizzle, 1)), + t_swizzle(GET_SWZ(src[1].Swizzle, 2)), + t_swizzle(GET_SWZ(src[1].Swizzle, 3)), + t_src_class(src[1].File), + (!src[1]. + NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[1].RelAddr << 4); inst[3] = 0; #else inst[0] = PVS_OP_DST_OPERAND(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), - GL_FALSE, - GL_FALSE, - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ONE); inst[3] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), - t_swizzle(GET_SWZ(src[1].Swizzle, 0)), - t_swizzle(GET_SWZ(src[1].Swizzle, 1)), - t_swizzle(GET_SWZ(src[1].Swizzle, 2)), - t_swizzle(GET_SWZ(src[1].Swizzle, 3)), - t_src_class(src[1].File), - (!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); + t_swizzle(GET_SWZ(src[1].Swizzle, 0)), + t_swizzle(GET_SWZ(src[1].Swizzle, 1)), + t_swizzle(GET_SWZ(src[1].Swizzle, 2)), + t_swizzle(GET_SWZ(src[1].Swizzle, 3)), + t_src_class(src[1].File), + (!src[1]. + NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[1].RelAddr << 4); #endif return inst; } -static GLuint *r300TranslateOpcodeSWZ(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3]) +static GLuint *r300TranslateOpcodeSWZ(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3]) { //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} inst[0] = PVS_OP_DST_OPERAND(VE_ADD, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -774,62 +882,67 @@ static GLuint *r300TranslateOpcodeSWZ(struct r300_vertex_program *vp, struct pro return inst; } -static GLuint *r300TranslateOpcodeXPD(struct r300_vertex_program *vp, struct prog_instruction *vpi, GLuint * inst, struct prog_src_register src[3], int *u_temp_i) +static GLuint *r300TranslateOpcodeXPD(struct r300_vertex_program *vp, + struct prog_instruction *vpi, + GLuint * inst, + struct prog_src_register src[3], + int *u_temp_i) { /* mul r0, r1.yzxw, r2.zxyw mad r0, -r2.yzxw, r1.zxyw, r0 */ inst[0] = PVS_OP_DST_OPERAND(VE_MULTIPLY_ADD, - GL_FALSE, - GL_FALSE, - *u_temp_i, - t_dst_mask(vpi->DstReg.WriteMask), - PVS_DST_REG_TEMPORARY); - inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y - t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // Z - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W - t_src_class(src[0].File), - src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), - t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // Z - t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // X - t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // Y - t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W - t_src_class(src[1].File), - src[1].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); + GL_FALSE, + GL_FALSE, + *u_temp_i, + t_dst_mask(vpi->DstReg.WriteMask), + PVS_DST_REG_TEMPORARY); + inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // Z + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W + t_src_class(src[0].File), + src[0]. + NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[0].RelAddr << 4); + inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // Z + t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // X + t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W + t_src_class(src[1].File), + src[1]. + NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[1].RelAddr << 4); inst[3] = __CONST(1, SWIZZLE_ZERO); inst += 4; inst[0] = PVS_OP_DST_OPERAND(VE_MULTIPLY_ADD, - GL_FALSE, - GL_FALSE, - t_dst_index(vp, &vpi->DstReg), - t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); - inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), - t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // Y - t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // Z - t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // X - t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W - t_src_class(src[1].File), - (!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); - inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), - t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // Z - t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X - t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y - t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W - t_src_class(src[0].File), - src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); - inst[3] = PVS_SRC_OPERAND(*u_temp_i, - PVS_SRC_SELECT_X, - PVS_SRC_SELECT_Y, - PVS_SRC_SELECT_Z, - PVS_SRC_SELECT_W, - PVS_SRC_REG_TEMPORARY, - VSF_FLAG_NONE); + GL_FALSE, + GL_FALSE, + t_dst_index(vp, &vpi->DstReg), + t_dst_mask(vpi->DstReg.WriteMask), + t_dst_class(vpi->DstReg.File)); + inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // Z + t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // X + t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W + t_src_class(src[1].File), + (!src[1]. + NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[1].RelAddr << 4); + inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // Z + t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X + t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y + t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W + t_src_class(src[0].File), + src[0]. + NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + (src[0].RelAddr << 4); + inst[3] = + PVS_SRC_OPERAND(*u_temp_i, PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, + PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, + PVS_SRC_REG_TEMPORARY, VSF_FLAG_NONE); (*u_temp_i)--; @@ -862,17 +975,20 @@ static void t_inputs_outputs(struct r300_vertex_program *vp) } if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL1)) { - vp->outputs[VERT_RESULT_COL1] = vp->outputs[VERT_RESULT_COL0] + 1; + vp->outputs[VERT_RESULT_COL1] = + vp->outputs[VERT_RESULT_COL0] + 1; cur_reg = vp->outputs[VERT_RESULT_COL1] + 1; } if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0)) { - vp->outputs[VERT_RESULT_BFC0] = vp->outputs[VERT_RESULT_COL0] + 2; + vp->outputs[VERT_RESULT_BFC0] = + vp->outputs[VERT_RESULT_COL0] + 2; cur_reg = vp->outputs[VERT_RESULT_BFC0] + 2; } if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) { - vp->outputs[VERT_RESULT_BFC1] = vp->outputs[VERT_RESULT_COL0] + 3; + vp->outputs[VERT_RESULT_BFC1] = + vp->outputs[VERT_RESULT_COL0] + 3; cur_reg = vp->outputs[VERT_RESULT_BFC1] + 1; } #if 0 @@ -888,7 +1004,8 @@ static void t_inputs_outputs(struct r300_vertex_program *vp) } } -static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct prog_instruction *vpi) +static void r300TranslateVertexShader(struct r300_vertex_program *vp, + struct prog_instruction *vpi) { int i; GLuint *inst; @@ -907,7 +1024,8 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro t_inputs_outputs(vp); - for (inst = vp->program.body.i; vpi->Opcode != OPCODE_END; vpi++, inst += 4) { + for (inst = vp->program.body.i; vpi->Opcode != OPCODE_END; + vpi++, inst += 4) { FREE_TEMPS(); @@ -928,19 +1046,21 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro if (CMP_SRCS(src[1], src[2]) || CMP_SRCS(src[0], src[2])) { inst[0] = PVS_OP_DST_OPERAND(VE_ADD, - GL_FALSE, - GL_FALSE, - u_temp_i, - VSF_FLAG_ALL, - PVS_DST_REG_TEMPORARY); + GL_FALSE, + GL_FALSE, + u_temp_i, + VSF_FLAG_ALL, + PVS_DST_REG_TEMPORARY); inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[2]), - SWIZZLE_X, - SWIZZLE_Y, - SWIZZLE_Z, - SWIZZLE_W, - t_src_class(src[2].File), - VSF_FLAG_NONE) | (src[2].RelAddr << 4); + SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_W, + t_src_class(src[2].File), + VSF_FLAG_NONE) | (src[2]. + RelAddr << + 4); inst[2] = __CONST(2, SWIZZLE_ZERO); inst[3] = __CONST(2, SWIZZLE_ZERO); inst += 4; @@ -955,19 +1075,21 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro if (num_operands >= 2) { if (CMP_SRCS(src[1], src[0])) { inst[0] = PVS_OP_DST_OPERAND(VE_ADD, - GL_FALSE, - GL_FALSE, - u_temp_i, - VSF_FLAG_ALL, - PVS_DST_REG_TEMPORARY); + GL_FALSE, + GL_FALSE, + u_temp_i, + VSF_FLAG_ALL, + PVS_DST_REG_TEMPORARY); inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), - SWIZZLE_X, - SWIZZLE_Y, - SWIZZLE_Z, - SWIZZLE_W, - t_src_class(src[0].File), - VSF_FLAG_NONE) | (src[0].RelAddr << 4); + SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_W, + t_src_class(src[0].File), + VSF_FLAG_NONE) | (src[0]. + RelAddr << + 4); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); inst += 4; @@ -1009,7 +1131,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro break; case OPCODE_FLR: inst = r300TranslateOpcodeFLR(vp, vpi, inst, src, /* FIXME */ - &u_temp_i); + &u_temp_i); break; case OPCODE_FRC: inst = r300TranslateOpcodeFRC(vp, vpi, inst, src); @@ -1061,7 +1183,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro break; case OPCODE_XPD: inst = r300TranslateOpcodeXPD(vp, vpi, inst, src, /* FIXME */ - &u_temp_i); + &u_temp_i); break; default: assert(0); @@ -1074,10 +1196,11 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct pro for (i = 0; i < VERT_RESULT_MAX; i++) { if (vp->key.OutputsAdded & (1 << i)) { inst[0] = PVS_OP_DST_OPERAND(VE_ADD, - GL_FALSE, - GL_FALSE, - vp->outputs[i], - VSF_FLAG_ALL, PVS_DST_REG_OUT); + GL_FALSE, + GL_FALSE, + vp->outputs[i], + VSF_FLAG_ALL, + PVS_DST_REG_OUT); inst[1] = __CONST(0, SWIZZLE_ZERO); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -1173,7 +1296,8 @@ static void position_invariant(struct gl_program *prog) #endif } - _mesa_copy_instructions(&vpi[i], prog->Instructions, prog->NumInstructions); + _mesa_copy_instructions(&vpi[i], prog->Instructions, + prog->NumInstructions); free(prog->Instructions); @@ -1185,7 +1309,8 @@ static void position_invariant(struct gl_program *prog) assert(vpi->Opcode == OPCODE_END); } -static void insert_wpos(struct r300_vertex_program *vp, struct gl_program *prog, GLuint temp_index) +static void insert_wpos(struct r300_vertex_program *vp, struct gl_program *prog, + GLuint temp_index) { struct prog_instruction *vpi; struct prog_instruction *vpi_insert; @@ -1194,9 +1319,12 @@ static void insert_wpos(struct r300_vertex_program *vp, struct gl_program *prog, vpi = _mesa_alloc_instructions(prog->NumInstructions + 2); _mesa_init_instructions(vpi, prog->NumInstructions + 2); /* all but END */ - _mesa_copy_instructions(vpi, prog->Instructions, prog->NumInstructions - 1); + _mesa_copy_instructions(vpi, prog->Instructions, + prog->NumInstructions - 1); /* END */ - _mesa_copy_instructions(&vpi[prog->NumInstructions + 1], &prog->Instructions[prog->NumInstructions - 1], 1); + _mesa_copy_instructions(&vpi[prog->NumInstructions + 1], + &prog->Instructions[prog->NumInstructions - 1], + 1); vpi_insert = &vpi[prog->NumInstructions - 1]; vpi_insert[i].Opcode = OPCODE_MOV; @@ -1233,7 +1361,8 @@ static void insert_wpos(struct r300_vertex_program *vp, struct gl_program *prog, assert(vpi->Opcode == OPCODE_END); } -static void pos_as_texcoord(struct r300_vertex_program *vp, struct gl_program *prog) +static void pos_as_texcoord(struct r300_vertex_program *vp, + struct gl_program *prog) { struct prog_instruction *vpi; GLuint tempregi = prog->NumTemporaries; @@ -1241,7 +1370,8 @@ static void pos_as_texcoord(struct r300_vertex_program *vp, struct gl_program *p prog->NumTemporaries++; for (vpi = prog->Instructions; vpi->Opcode != OPCODE_END; vpi++) { - if (vpi->DstReg.File == PROGRAM_OUTPUT && vpi->DstReg.Index == VERT_RESULT_HPOS) { + if (vpi->DstReg.File == PROGRAM_OUTPUT + && vpi->DstReg.Index == VERT_RESULT_HPOS) { vpi->DstReg.File = PROGRAM_TEMPORARY; vpi->DstReg.Index = tempregi; } -- cgit v1.2.3 From 5cc56cbad89d8d1b15d0dc67d41732a8883ae7bc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 25 Mar 2008 10:22:50 -0700 Subject: [965] Clean up whitespace and dead code from do_unfilled change. --- src/mesa/drivers/dri/i965/brw_clip.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c index 24b0288f88..ce34da165c 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.c +++ b/src/mesa/drivers/dri/i965/brw_clip.c @@ -168,12 +168,10 @@ static void upload_clip_prog( struct brw_context *brw ) offset_front = 0; break; case GL_LINE: - key.do_unfilled = 1; fill_front = CLIP_LINE; offset_front = brw->attribs.Polygon->OffsetLine; break; case GL_POINT: - key.do_unfilled = 1; fill_front = CLIP_POINT; offset_front = brw->attribs.Polygon->OffsetPoint; break; @@ -188,26 +186,23 @@ static void upload_clip_prog( struct brw_context *brw ) offset_back = 0; break; case GL_LINE: - key.do_unfilled = 1; fill_back = CLIP_LINE; offset_back = brw->attribs.Polygon->OffsetLine; break; case GL_POINT: - key.do_unfilled = 1; fill_back = CLIP_POINT; offset_back = brw->attribs.Polygon->OffsetPoint; break; } } - if (brw->attribs.Polygon->BackMode != GL_FILL || - brw->attribs.Polygon->FrontMode != GL_FILL) - key.do_unfilled = 1; + if (brw->attribs.Polygon->BackMode != GL_FILL || + brw->attribs.Polygon->FrontMode != GL_FILL) { + key.do_unfilled = 1; - /* Most cases the fixed function units will handle. Cases where - * one or more polygon faces are unfilled will require help: - */ - if (key.do_unfilled) { + /* Most cases the fixed function units will handle. Cases where + * one or more polygon faces are unfilled will require help: + */ key.clip_mode = BRW_CLIPMODE_CLIP_NON_REJECTED; if (offset_back || offset_front) { -- cgit v1.2.3 From 13a6f73a64e23bad71d5e94d446e133b3cf634f7 Mon Sep 17 00:00:00 2001 From: Michal Wajdeczko Date: Wed, 26 Mar 2008 12:51:20 -0700 Subject: [965] Correctly set read mask for OPCODE_SWZ in pass1. While OPCODE_SWZ has usually been optimized away in pass0, it may still exist if a SWZ with dst saturate was emitted in pass_fp. Fixes an error in oglconform fpalu.c. --- src/mesa/drivers/dri/i965/brw_wm_pass1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass1.c b/src/mesa/drivers/dri/i965/brw_wm_pass1.c index 26c044d400..f6f3a38e9e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass1.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass1.c @@ -150,6 +150,7 @@ void brw_wm_pass1( struct brw_wm_compile *c ) case OPCODE_FLR: case OPCODE_FRC: case OPCODE_MOV: + case OPCODE_SWZ: read0 = writemask; break; @@ -257,7 +258,6 @@ void brw_wm_pass1( struct brw_wm_compile *c ) read0 = WRITEMASK_XYW; break; - case OPCODE_SWZ: case OPCODE_DST: case OPCODE_TXP: default: -- cgit v1.2.3 From b4cbf6983e0e6d6502c1260f60c463841ab74590 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 26 Mar 2008 13:23:43 -0700 Subject: [965] Don't let the negate flags of src0 affect 1 constants in precalc_dst/lit This patch is a variant of a submission by Michal Wajdeczko to fix oglconform fpalu failures. --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index e90a360538..7e80724130 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -494,17 +494,20 @@ static void precalc_dst( struct brw_wm_compile *c, if (dst.WriteMask & WRITEMASK_XZ) { + struct prog_instruction *swz; GLuint z = GET_SWZ(src0.Swizzle, Z); /* dst.xz = swz src0.1zzz */ - emit_op(c, - OPCODE_SWZ, - dst_mask(dst, WRITEMASK_XZ), - inst->SaturateMode, 0, 0, - src_swizzle(src0, SWIZZLE_ONE, z, z, z), - src_undef(), - src_undef()); + swz = emit_op(c, + OPCODE_SWZ, + dst_mask(dst, WRITEMASK_XZ), + inst->SaturateMode, 0, 0, + src_swizzle(src0, SWIZZLE_ONE, z, z, z), + src_undef(), + src_undef()); + /* Avoid letting negation flag of src0 affect our 1 constant. */ + swz->SrcReg[0].NegateBase &= ~NEGATE_X; } if (dst.WriteMask & WRITEMASK_W) { /* dst.w = mov src1.w @@ -527,15 +530,19 @@ static void precalc_lit( struct brw_wm_compile *c, struct prog_dst_register dst = inst->DstReg; if (dst.WriteMask & WRITEMASK_XW) { + struct prog_instruction *swz; + /* dst.xw = swz src0.1111 */ - emit_op(c, - OPCODE_SWZ, - dst_mask(dst, WRITEMASK_XW), - 0, 0, 0, - src_swizzle1(src0, SWIZZLE_ONE), - src_undef(), - src_undef()); + swz = emit_op(c, + OPCODE_SWZ, + dst_mask(dst, WRITEMASK_XW), + 0, 0, 0, + src_swizzle1(src0, SWIZZLE_ONE), + src_undef(), + src_undef()); + /* Avoid letting the negation flag of src0 affect our 1 constant. */ + swz->SrcReg[0].NegateBase = 0; } -- cgit v1.2.3 From 76430815a73559c55e2061ceb2634406d1284f03 Mon Sep 17 00:00:00 2001 From: Michal Wajdeczko Date: Wed, 26 Mar 2008 13:33:34 -0700 Subject: [intel] Use mesa texmemory functions to allocate teximage Data. Failure to consistently do so resulted in mismatched aligned versus unaligned alloc/free. --- src/mesa/drivers/dri/intel/intel_tex.c | 3 ++- src/mesa/drivers/dri/intel/intel_tex_image.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index c110df478f..329af0d1b0 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -1,5 +1,6 @@ #include "swrast/swrast.h" #include "texobj.h" +#include "teximage.h" #include "mipmap.h" #include "intel_context.h" #include "intel_mipmap_tree.h" @@ -71,7 +72,7 @@ intelFreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage) } if (texImage->Data) { - free(texImage->Data); + _mesa_free_texmemory(texImage->Data); texImage->Data = NULL; } } diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 3d2fc24357..dd8fbeaa91 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -360,7 +360,8 @@ intelTexImage(GLcontext * ctx, assert(!texImage->Data); } else if (texImage->Data) { - _mesa_align_free(texImage->Data); + _mesa_free_texmemory(texImage->Data); + texImage->Data = NULL; } /* If this is the only texture image in the tree, could call @@ -481,7 +482,7 @@ intelTexImage(GLcontext * ctx, sizeInBytes = depth * dstRowStride * postConvHeight; } - texImage->Data = malloc(sizeInBytes); + texImage->Data = _mesa_alloc_texmemory(sizeInBytes); } DBG("Upload image %dx%dx%d row_len %d " -- cgit v1.2.3 From 05004670448e1edd9166b8da614606e6f49c1fcf Mon Sep 17 00:00:00 2001 From: Michal Wajdeczko Date: Wed, 26 Mar 2008 13:43:16 -0700 Subject: [965] Fix massively broken state cache dirty flagging. It was flagging a last_bo update even when last_bo didn't change, but another part was failing to update last_bo when it should have. --- src/mesa/drivers/dri/i965/brw_state_cache.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index 7b5eff4f2d..d617650fad 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -85,7 +85,7 @@ static GLuint hash_key( const void *key, GLuint key_size, } /* Include the BO pointers as key data as well */ - ikey = (void *)reloc_bufs; + ikey = (GLuint *)reloc_bufs; key_size = nr_reloc_bufs * sizeof(dri_bo *); for (i = 0; i < key_size/4; i++) { hash ^= ikey[i]; @@ -102,6 +102,9 @@ static void update_cache_last(struct brw_cache *cache, enum brw_cache_id cache_id, dri_bo *bo) { + if (bo == cache->last_bo[cache_id]) + return; /* no change */ + dri_bo_unreference(cache->last_bo[cache_id]); cache->last_bo[cache_id] = bo; dri_bo_reference(cache->last_bo[cache_id]); @@ -255,7 +258,7 @@ brw_upload_cache( struct brw_cache *cache, if (INTEL_DEBUG & DEBUG_STATE) _mesa_printf("upload %s: %d bytes to cache id %d\n", cache->name[cache_id], - data_size); + data_size, cache_id); /* Copy data to the buffer */ dri_bo_subdata(bo, 0, data_size, data); @@ -282,6 +285,7 @@ brw_cache_data_sz(struct brw_cache *cache, item = search_cache(cache, cache_id, hash, data, data_size, reloc_bufs, nr_reloc_bufs); if (item) { + update_cache_last(cache, cache_id, item->bo); dri_bo_reference(item->bo); return item->bo; } -- cgit v1.2.3 From 978145a075255ae153ee05c2a037400e61558079 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 27 Mar 2008 16:00:15 -0600 Subject: Set param_var->param_binding_type = PROGRAM_CONSTANT cherry-picked from gallium-0.1 --- src/mesa/shader/arbprogparse.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 8803658c1e..1a3d232e0f 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1860,12 +1860,14 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, break; case PARAM_CONSTANT: + /* parsing something like {1.0, 2.0, 3.0, 4.0} */ parse_constant (inst, const_values, Program, use); idx = _mesa_add_named_constant(Program->Base.Parameters, (char *) param_var->name, const_values, 4); if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; + param_var->param_binding_type = PROGRAM_CONSTANT; param_var->param_binding_length++; Program->Base.NumParameters++; break; -- cgit v1.2.3 From 21454f86369e3290a4667037263399b1217d74b6 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 27 Mar 2008 16:01:53 -0600 Subject: when negating scalar src args, use NEGATE_XYZW, not NEGATE_X This makes things easier on the back-end when generating GPU code. cherry-picked from gallium-0.1 --- src/mesa/shader/arbprogparse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 1a3d232e0f..c55f2aaa9b 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -2598,7 +2598,7 @@ parse_fp_vector_src_reg(GLcontext * ctx, const GLubyte ** inst, GLboolean isRelOffset; /* Grab the sign */ - negate = (parse_sign (inst) == -1) ? 0xf : 0x0; + negate = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; /* And the src reg */ if (parse_src_reg(ctx, inst, vc_head, program, &file, &index, &isRelOffset)) @@ -2655,7 +2655,7 @@ parse_fp_scalar_src_reg (GLcontext * ctx, const GLubyte ** inst, GLboolean IsRelOffset; /* Grab the sign */ - Negate = (parse_sign (inst) == -1) ? 0x1 : 0x0; + Negate = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; /* And the src reg */ if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) @@ -3143,7 +3143,7 @@ parse_vp_vector_src_reg(GLcontext * ctx, const GLubyte ** inst, GLboolean isRelOffset; /* Grab the sign */ - negateMask = (parse_sign (inst) == -1) ? 0xf : 0x0; + negateMask = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; /* And the src reg */ if (parse_src_reg (ctx, inst, vc_head, program, &file, &index, &isRelOffset)) @@ -3170,12 +3170,12 @@ parse_vp_scalar_src_reg (GLcontext * ctx, const GLubyte ** inst, { enum register_file File; GLint Index; - GLubyte Negate; + GLubyte negateMask; GLubyte Swizzle[4]; GLboolean IsRelOffset; /* Grab the sign */ - Negate = (parse_sign (inst) == -1) ? 0x1 : 0x0; + negateMask = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; /* And the src reg */ if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) @@ -3187,7 +3187,7 @@ parse_vp_scalar_src_reg (GLcontext * ctx, const GLubyte ** inst, reg->File = File; reg->Index = Index; reg->Swizzle = (Swizzle[0] << 0); - reg->NegateBase = Negate; + reg->NegateBase = negateMask; reg->RelAddr = IsRelOffset; return 0; } -- cgit v1.2.3 From 7d2b6a0466038ebefa4ac4d139cec4987f60d585 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 27 Mar 2008 16:17:37 -0600 Subject: consolidate some parsing functions that were pretty much identical for vertex/fragment programs --- src/mesa/shader/arbprogparse.c | 223 +++++++++++++---------------------------- 1 file changed, 71 insertions(+), 152 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index c55f2aaa9b..74004e9b13 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -2,7 +2,7 @@ * Mesa 3-D graphics library * Version: 7.1 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -2582,23 +2582,24 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, return 0; } + /** - * Parse fragment program vector source register. + * Parse vertex/fragment program vector source register. */ static GLuint -parse_fp_vector_src_reg(GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, - struct arb_program *program, - struct prog_src_register *reg) +parse_vector_src_reg(GLcontext *ctx, const GLubyte **inst, + struct var_cache **vc_head, + struct arb_program *program, + struct prog_src_register *reg) { enum register_file file; GLint index; - GLboolean negate; + GLubyte negateMask; GLubyte swizzle[4]; GLboolean isRelOffset; /* Grab the sign */ - negate = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; + negateMask = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; /* And the src reg */ if (parse_src_reg(ctx, inst, vc_head, program, &file, &index, &isRelOffset)) @@ -2609,66 +2610,66 @@ parse_fp_vector_src_reg(GLcontext * ctx, const GLubyte ** inst, reg->File = file; reg->Index = index; - reg->NegateBase = negate; reg->Swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], swizzle[3]); + reg->NegateBase = negateMask; + reg->RelAddr = isRelOffset; return 0; } /** - * Parse fragment program destination register. - * \return 1 if error, 0 if no error. + * Parse vertex/fragment program scalar source register. */ -static GLuint -parse_fp_dst_reg(GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, struct arb_program *Program, - struct prog_dst_register *reg ) +static GLuint +parse_scalar_src_reg(GLcontext *ctx, const GLubyte **inst, + struct var_cache **vc_head, + struct arb_program *program, + struct prog_src_register *reg) { - GLint mask; - GLuint idx; enum register_file file; + GLint index; + GLubyte negateMask; + GLubyte swizzle[4]; + GLboolean isRelOffset; + + /* Grab the sign */ + negateMask = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; - if (parse_masked_dst_reg (ctx, inst, vc_head, Program, &file, &idx, &mask)) + /* And the src reg */ + if (parse_src_reg(ctx, inst, vc_head, program, &file, &index, &isRelOffset)) return 1; + /* finally, the swizzle */ + parse_swizzle_mask(inst, swizzle, 1); + reg->File = file; - reg->Index = idx; - reg->WriteMask = mask; + reg->Index = index; + reg->Swizzle = (swizzle[0] << 0); + reg->NegateBase = negateMask; + reg->RelAddr = isRelOffset; return 0; } /** - * Parse fragment program scalar src register. + * Parse vertex/fragment program destination register. * \return 1 if error, 0 if no error. */ -static GLuint -parse_fp_scalar_src_reg (GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, - struct arb_program *Program, - struct prog_src_register *reg ) +static GLuint +parse_dst_reg(GLcontext * ctx, const GLubyte ** inst, + struct var_cache **vc_head, struct arb_program *program, + struct prog_dst_register *reg ) { - enum register_file File; - GLint Index; - GLubyte Negate; - GLubyte Swizzle[4]; - GLboolean IsRelOffset; - - /* Grab the sign */ - Negate = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; + GLint mask; + GLuint idx; + enum register_file file; - /* And the src reg */ - if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) + if (parse_masked_dst_reg (ctx, inst, vc_head, program, &file, &idx, &mask)) return 1; - /* finally, the swizzle */ - parse_swizzle_mask(inst, Swizzle, 1); - - reg->File = File; - reg->Index = Index; - reg->NegateBase = Negate; - reg->Swizzle = (Swizzle[0] << 0); - + reg->File = file; + reg->Index = idx; + reg->WriteMask = mask; return 0; } @@ -2749,10 +2750,10 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, break; } - if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; - if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) + if (parse_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) return 1; break; @@ -2802,10 +2803,10 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, break; } - if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; - if (parse_fp_scalar_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) + if (parse_scalar_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) return 1; break; @@ -2818,11 +2819,11 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, break; } - if (parse_fp_dst_reg(ctx, inst, vc_head, Program, &fp->DstReg)) + if (parse_dst_reg(ctx, inst, vc_head, Program, &fp->DstReg)) return 1; for (a = 0; a < 2; a++) { - if (parse_fp_scalar_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) + if (parse_scalar_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) return 1; } break; @@ -2903,10 +2904,10 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, break; } - if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; for (a = 0; a < 2; a++) { - if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) + if (parse_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) return 1; } break; @@ -2932,11 +2933,11 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, break; } - if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; for (a = 0; a < 3; a++) { - if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) + if (parse_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) return 1; } break; @@ -2949,7 +2950,7 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, fp->Opcode = OPCODE_SWZ; break; } - if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; { @@ -2992,10 +2993,10 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, break; } - if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; - if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) + if (parse_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) return 1; /* texImageUnit */ @@ -3067,7 +3068,7 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, case OP_TEX_KIL: Program->UsesKill = 1; - if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) + if (parse_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) return 1; fp->Opcode = OPCODE_KIL; break; @@ -3079,23 +3080,6 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, return 0; } -static GLuint -parse_vp_dst_reg(GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, struct arb_program *Program, - struct prog_dst_register *reg ) -{ - GLint mask; - GLuint idx; - enum register_file file; - - if (parse_masked_dst_reg(ctx, inst, vc_head, Program, &file, &idx, &mask)) - return 1; - - reg->File = file; - reg->Index = idx; - reg->WriteMask = mask; - return 0; -} /** * Handle the parsing out of a masked address register @@ -3127,71 +3111,6 @@ parse_vp_address_reg (GLcontext * ctx, const GLubyte ** inst, return 0; } -/** - * Parse vertex program vector source register. - */ -static GLuint -parse_vp_vector_src_reg(GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, - struct arb_program *program, - struct prog_src_register *reg ) -{ - enum register_file file; - GLint index; - GLubyte negateMask; - GLubyte swizzle[4]; - GLboolean isRelOffset; - - /* Grab the sign */ - negateMask = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; - - /* And the src reg */ - if (parse_src_reg (ctx, inst, vc_head, program, &file, &index, &isRelOffset)) - return 1; - - /* finally, the swizzle */ - parse_swizzle_mask(inst, swizzle, 4); - - reg->File = file; - reg->Index = index; - reg->Swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], - swizzle[2], swizzle[3]); - reg->NegateBase = negateMask; - reg->RelAddr = isRelOffset; - return 0; -} - - -static GLuint -parse_vp_scalar_src_reg (GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, - struct arb_program *Program, - struct prog_src_register *reg ) -{ - enum register_file File; - GLint Index; - GLubyte negateMask; - GLubyte Swizzle[4]; - GLboolean IsRelOffset; - - /* Grab the sign */ - negateMask = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; - - /* And the src reg */ - if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) - return 1; - - /* finally, the swizzle */ - parse_swizzle_mask(inst, Swizzle, 1); - - reg->File = File; - reg->Index = Index; - reg->Swizzle = (Swizzle[0] << 0); - reg->NegateBase = negateMask; - reg->RelAddr = IsRelOffset; - return 0; -} - /** * This is a big mother that handles getting opcodes into the instruction @@ -3229,7 +3148,7 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, vp->DstReg.File = PROGRAM_ADDRESS; /* Get a scalar src register */ - if (parse_vp_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) + if (parse_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) return 1; break; @@ -3253,10 +3172,10 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, break; } - if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; - if (parse_vp_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) + if (parse_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) return 1; break; @@ -3281,10 +3200,10 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, vp->Opcode = OPCODE_RSQ; break; } - if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; - if (parse_vp_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) + if (parse_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) return 1; break; @@ -3294,11 +3213,11 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, vp->Opcode = OPCODE_POW; break; } - if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; for (a = 0; a < 2; a++) { - if (parse_vp_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) + if (parse_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) return 1; } break; @@ -3342,11 +3261,11 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, vp->Opcode = OPCODE_XPD; break; } - if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; for (a = 0; a < 2; a++) { - if (parse_vp_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) + if (parse_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) return 1; } break; @@ -3358,11 +3277,11 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, break; } - if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; for (a = 0; a < 3; a++) { - if (parse_vp_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) + if (parse_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) return 1; } break; @@ -3380,7 +3299,7 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, enum register_file file; GLint index; - if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; if (parse_src_reg(ctx, inst, vc_head, Program, &file, &index, &relAddr)) -- cgit v1.2.3 From a9802328cdb3042cc7504823f8bb910abab2c78e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 28 Mar 2008 13:06:28 +1100 Subject: r300: move to using RS_INST names --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 2 +- src/mesa/drivers/dri/r300/r300_context.h | 16 +++++++-------- src/mesa/drivers/dri/r300/r300_ioctl.c | 2 +- src/mesa/drivers/dri/r300/r300_reg.h | 34 ++++++++++++++------------------ src/mesa/drivers/dri/r300/r300_state.c | 16 +++++++-------- 5 files changed, 33 insertions(+), 37 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 1abc92ec49..3497738eac 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -377,7 +377,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE(ri, always, R300_RI_CMDSIZE, 0); r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R300_RS_IP_0, 8); ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0); - r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, 1); + r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_INST_0, 1); ALLOC_STATE(sc_hyperz, always, 3, 0); r300->hw.sc_hyperz.cmd[0] = cmdpacket0(R300_SC_HYPERZ, 2); ALLOC_STATE(sc_screendoor, always, 2, 0); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 993aa51990..780d9aa5d2 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -331,14 +331,14 @@ struct r300_state_atom { #define R300_RI_CMDSIZE 9 #define R300_RR_CMD_0 0 /* rr is variable size (at least 1) */ -#define R300_RR_ROUTE_0 1 -#define R300_RR_ROUTE_1 2 -#define R300_RR_ROUTE_2 3 -#define R300_RR_ROUTE_3 4 -#define R300_RR_ROUTE_4 5 -#define R300_RR_ROUTE_5 6 -#define R300_RR_ROUTE_6 7 -#define R300_RR_ROUTE_7 8 +#define R300_RR_INST_0 1 +#define R300_RR_INST_1 2 +#define R300_RR_INST_2 3 +#define R300_RR_INST_3 4 +#define R300_RR_INST_4 5 +#define R300_RR_INST_5 6 +#define R300_RR_INST_6 7 +#define R300_RR_INST_7 8 #define R300_RR_CMDSIZE 9 #define R300_FP_CMD_0 0 diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 02c67e8ef9..a678922ae2 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -284,7 +284,7 @@ static void r300EmitClearState(GLcontext * ctx) e32(0x0); R300_STATECHANGE(r300, rr); - reg_start(R300_RS_ROUTE_0, 0); + reg_start(R300_RS_INST_0, 0); e32(R300_RS_ROUTE_0_COLOR); R300_STATECHANGE(r300, fp); diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index ac6b0e63b5..3c52f16c30 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -1182,25 +1182,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* These DWORDs control how vertex data is routed into fragment program * registers, after interpolators. */ -#define R300_RS_ROUTE_0 0x4330 -#define R300_RS_ROUTE_1 0x4334 -#define R300_RS_ROUTE_2 0x4338 -#define R300_RS_ROUTE_3 0x433C /* GUESS */ -#define R300_RS_ROUTE_4 0x4340 /* GUESS */ -#define R300_RS_ROUTE_5 0x4344 /* GUESS */ -#define R300_RS_ROUTE_6 0x4348 /* GUESS */ -#define R300_RS_ROUTE_7 0x434C /* GUESS */ -# define R300_RS_ROUTE_SOURCE_INTERP_0 0 -# define R300_RS_ROUTE_SOURCE_INTERP_1 1 -# define R300_RS_ROUTE_SOURCE_INTERP_2 2 -# define R300_RS_ROUTE_SOURCE_INTERP_3 3 -# define R300_RS_ROUTE_SOURCE_INTERP_4 4 -# define R300_RS_ROUTE_SOURCE_INTERP_5 5 /* GUESS */ -# define R300_RS_ROUTE_SOURCE_INTERP_6 6 /* GUESS */ -# define R300_RS_ROUTE_SOURCE_INTERP_7 7 /* GUESS */ -# define R300_RS_ROUTE_ENABLE (1 << 3) /* GUESS */ -# define R300_RS_ROUTE_DEST_SHIFT 6 -# define R300_RS_ROUTE_DEST_MASK (31 << 6) /* GUESS */ +#define R300_RS_INST_0 0x4330 +#define R300_RS_INST_1 0x4334 +#define R300_RS_INST_2 0x4338 +#define R300_RS_INST_3 0x433C /* GUESS */ +#define R300_RS_INST_4 0x4340 /* GUESS */ +#define R300_RS_INST_5 0x4344 /* GUESS */ +#define R300_RS_INST_6 0x4348 /* GUESS */ +#define R300_RS_INST_7 0x434C /* GUESS */ +# define R300_RS_INST_TEX_ID(x) ((x) << 0) +# define R300_RS_INST_TEX_CN_WRITE (1 << 3) +# define R300_RS_INST_TEX_ADDR_SHIFT 6 +# define R300_RS_INST_COL_ID(x) ((x) << 11) +# define R300_RS_INST_COL_ADDR_SHIFT 17 +# define R300_RS_INST_TEX_ADJ (1 << 22) +# define R300_RS_COL_BIAS_UNUSED_SHIFT 23 /* Special handling for color: When the fragment program uses color, * the ROUTE_0_COLOR bit is set and ROUTE_0_COLOR_DEST contains the diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index ec9bf25bab..4f87772d92 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1522,7 +1522,7 @@ static void r300SetupRSUnit(GLcontext * ctx) fp_reg = in_texcoords = col_interp_nr = high_rr = 0; - r300->hw.rr.cmd[R300_RR_ROUTE_1] = 0; + r300->hw.rr.cmd[R300_RR_INST_1] = 0; if (InputsRead & FRAG_BIT_WPOS) { for (i = 0; i < ctx->Const.MaxTextureUnits; i++) @@ -1542,11 +1542,11 @@ static void r300SetupRSUnit(GLcontext * ctx) r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = 0 | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3) | (in_texcoords << R300_RS_INTERP_SRC_SHIFT) | interp_magic[i]; - r300->hw.rr.cmd[R300_RR_ROUTE_0 + fp_reg] = 0; + r300->hw.rr.cmd[R300_RR_INST_0 + fp_reg] = 0; if (InputsRead & (FRAG_BIT_TEX0 << i)) { //assert(r300->state.texture.tc_count != 0); - r300->hw.rr.cmd[R300_RR_ROUTE_0 + fp_reg] |= R300_RS_ROUTE_ENABLE | i /* source INTERP */ - | (fp_reg << R300_RS_ROUTE_DEST_SHIFT); + r300->hw.rr.cmd[R300_RR_INST_0 + fp_reg] |= R300_RS_INST_TEX_CN_WRITE | i /* source INTERP */ + | (fp_reg << R300_RS_INST_TEX_ADDR_SHIFT); high_rr = fp_reg; /* Passing invalid data here can lock the GPU. */ @@ -1565,7 +1565,7 @@ static void r300SetupRSUnit(GLcontext * ctx) if (InputsRead & FRAG_BIT_COL0) { if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) { - r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0 | R300_RS_ROUTE_0_COLOR | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT); + r300->hw.rr.cmd[R300_RR_INST_0] |= 0 | R300_RS_ROUTE_0_COLOR | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT); InputsRead &= ~FRAG_BIT_COL0; col_interp_nr++; } else { @@ -1575,7 +1575,7 @@ static void r300SetupRSUnit(GLcontext * ctx) if (InputsRead & FRAG_BIT_COL1) { if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) { - r300->hw.rr.cmd[R300_RR_ROUTE_1] |= R300_RS_ROUTE_1_UNKNOWN11 | R300_RS_ROUTE_1_COLOR1 | (fp_reg++ << R300_RS_ROUTE_1_COLOR1_DEST_SHIFT); + r300->hw.rr.cmd[R300_RR_INST_1] |= R300_RS_ROUTE_1_UNKNOWN11 | R300_RS_ROUTE_1_COLOR1 | (fp_reg++ << R300_RS_ROUTE_1_COLOR1_DEST_SHIFT); InputsRead &= ~FRAG_BIT_COL1; if (high_rr < 1) high_rr = 1; @@ -1587,7 +1587,7 @@ static void r300SetupRSUnit(GLcontext * ctx) /* Need at least one. This might still lock as the values are undefined... */ if (in_texcoords == 0 && col_interp_nr == 0) { - r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0 | R300_RS_ROUTE_0_COLOR | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT); + r300->hw.rr.cmd[R300_RR_INST_0] |= 0 | R300_RS_ROUTE_0_COLOR | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT); col_interp_nr++; } @@ -1596,7 +1596,7 @@ static void r300SetupRSUnit(GLcontext * ctx) | R300_HIRES_EN; assert(high_rr >= 0); - r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, high_rr + 1); + r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_INST_0, high_rr + 1); r300->hw.rc.cmd[2] = 0xC0 | high_rr; if (InputsRead) -- cgit v1.2.3 From 6054788f3620b4fc8ba386b38546ae2cc9dd24d2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 28 Mar 2008 13:16:33 +1100 Subject: r300: finish conversion of RS_INST regs --- src/mesa/drivers/dri/r300/r300_ioctl.c | 2 +- src/mesa/drivers/dri/r300/r300_reg.h | 20 ++------------------ src/mesa/drivers/dri/r300/r300_state.c | 6 +++--- 3 files changed, 6 insertions(+), 22 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index a678922ae2..bc2c509180 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -285,7 +285,7 @@ static void r300EmitClearState(GLcontext * ctx) R300_STATECHANGE(r300, rr); reg_start(R300_RS_INST_0, 0); - e32(R300_RS_ROUTE_0_COLOR); + e32(R300_RS_INST_COL_CN_WRITE); R300_STATECHANGE(r300, fp); reg_start(R300_PFS_CNTL_0, 2); diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 3c52f16c30..6fddc8fcf5 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -1175,7 +1175,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R500_RS_INST_COL_CN_WRITE (1 << 16) #define R500_RS_INST_COL_CN_WRITE_FBUFFER (2 << 16) #define R500_RS_INST_COL_CN_WRITE_BACKFACE (3 << 16) -#define R500_RS_INST_COL_COL_ADDR_SHIFT 18 +#define R500_RS_INST_COL_ADDR_SHIFT 18 #define R500_RS_INST_TEX_ADJ (1 << 25) #define R500_RS_INST_W_CN (1 << 26) @@ -1194,27 +1194,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_RS_INST_TEX_CN_WRITE (1 << 3) # define R300_RS_INST_TEX_ADDR_SHIFT 6 # define R300_RS_INST_COL_ID(x) ((x) << 11) +# define R300_RS_INST_COL_CN_WRITE (1 << 14) # define R300_RS_INST_COL_ADDR_SHIFT 17 # define R300_RS_INST_TEX_ADJ (1 << 22) # define R300_RS_COL_BIAS_UNUSED_SHIFT 23 -/* Special handling for color: When the fragment program uses color, - * the ROUTE_0_COLOR bit is set and ROUTE_0_COLOR_DEST contains the - * color register index. - * - * Apperently you may set the R300_RS_ROUTE_0_COLOR bit, but not provide any - * R300_RS_ROUTE_0_COLOR_DEST value; this setup is used for clearing the state. - * See r300_ioctl.c:r300EmitClearState. I'm not sure if this setup is strictly - * correct or not. - Oliver. - */ -# define R300_RS_ROUTE_0_COLOR (1 << 14) -# define R300_RS_ROUTE_0_COLOR_DEST_SHIFT 17 -# define R300_RS_ROUTE_0_COLOR_DEST_MASK (31 << 17) /* GUESS */ -/* As above, but for secondary color */ -# define R300_RS_ROUTE_1_COLOR1 (1 << 14) -# define R300_RS_ROUTE_1_COLOR1_DEST_SHIFT 17 -# define R300_RS_ROUTE_1_COLOR1_DEST_MASK (31 << 17) -# define R300_RS_ROUTE_1_UNKNOWN11 (1 << 11) /* END: Rasterization / Interpolators - many guesses */ /* Hierarchical Z Enable */ diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 4f87772d92..ff96a3b49b 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1565,7 +1565,7 @@ static void r300SetupRSUnit(GLcontext * ctx) if (InputsRead & FRAG_BIT_COL0) { if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) { - r300->hw.rr.cmd[R300_RR_INST_0] |= 0 | R300_RS_ROUTE_0_COLOR | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT); + r300->hw.rr.cmd[R300_RR_INST_0] |= R300_RS_INST_COL_ID(0) | R300_RS_INST_COL_CN_WRITE | (fp_reg++ << R300_RS_INST_COL_ADDR_SHIFT); InputsRead &= ~FRAG_BIT_COL0; col_interp_nr++; } else { @@ -1575,7 +1575,7 @@ static void r300SetupRSUnit(GLcontext * ctx) if (InputsRead & FRAG_BIT_COL1) { if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) { - r300->hw.rr.cmd[R300_RR_INST_1] |= R300_RS_ROUTE_1_UNKNOWN11 | R300_RS_ROUTE_1_COLOR1 | (fp_reg++ << R300_RS_ROUTE_1_COLOR1_DEST_SHIFT); + r300->hw.rr.cmd[R300_RR_INST_1] |= R300_RS_INST_COL_ID(1) | R300_RS_INST_COL_CN_WRITE | (fp_reg++ << R300_RS_INST_COL_ADDR_SHIFT); InputsRead &= ~FRAG_BIT_COL1; if (high_rr < 1) high_rr = 1; @@ -1587,7 +1587,7 @@ static void r300SetupRSUnit(GLcontext * ctx) /* Need at least one. This might still lock as the values are undefined... */ if (in_texcoords == 0 && col_interp_nr == 0) { - r300->hw.rr.cmd[R300_RR_INST_0] |= 0 | R300_RS_ROUTE_0_COLOR | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT); + r300->hw.rr.cmd[R300_RR_INST_0] |= R300_RS_INST_COL_ID(0) | R300_RS_INST_COL_CN_WRITE | (fp_reg++ << R300_RS_INST_COL_ADDR_SHIFT); col_interp_nr++; } -- cgit v1.2.3 From 184cf464f4183a664fa0358fe118735e6fd98afe Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Fri, 28 Mar 2008 17:32:45 +0800 Subject: i965: depth offset on glPolygonMode(GL_LINE/GL_POINT) --- src/mesa/drivers/dri/i965/brw_clip_unfilled.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c index 918e000187..57ebf388f5 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c +++ b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c @@ -220,8 +220,8 @@ static void apply_one_offset( struct brw_clip_compile *c, struct brw_indirect vert ) { struct brw_compile *p = &c->func; - struct brw_reg pos = deref_4f(vert, c->offset[VERT_RESULT_HPOS]); - struct brw_reg z = get_element(pos, 2); + struct brw_reg z = deref_1f(vert, c->header_position_offset + + 2 * type_sz(BRW_REGISTER_TYPE_F)); brw_ADD(p, z, z, vec1(c->reg.offset)); } -- cgit v1.2.3 From 635e96471218d5ada3fa7930fc1a746ec2aa4423 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 28 Mar 2008 13:24:12 -0600 Subject: fix texture/renderbuffer mix-up in test_attachment_completeness() --- src/mesa/main/fbobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 671f80c7a4..9b60c73294 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -303,7 +303,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, /* OK */ } else if (ctx->Extensions.EXT_packed_depth_stencil && - att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) { + texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) { /* OK */ } else { -- cgit v1.2.3 From 85e816882d8cd136e041c915698314ed1110e2f2 Mon Sep 17 00:00:00 2001 From: Markus Amsler Date: Sun, 30 Mar 2008 16:10:47 +0000 Subject: r300: Take PROGRAM_CONSTANT into account. This bug was introduced by commit 978145a075255ae153ee05c2a037400e61558079. --- src/mesa/drivers/dri/r300/r300_fragprog.c | 1 + src/mesa/drivers/dri/r300/r300_vertprog.c | 1 + 2 files changed, 2 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 78ed44b09c..c664fb6562 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -736,6 +736,7 @@ static GLuint t_src(struct r300_fragment_program *fp, break; case PROGRAM_STATE_VAR: case PROGRAM_NAMED_PARAM: + case PROGRAM_CONSTANT: r = emit_const4fv(fp, fp->mesa_program.Base.Parameters-> ParameterValues[fpsrc.Index]); diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index e741eb9b19..89ccca7dae 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -171,6 +171,7 @@ static unsigned long t_src_class(enum register_file file) case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_NAMED_PARAM: + case PROGRAM_CONSTANT: case PROGRAM_STATE_VAR: return PVS_SRC_REG_CONSTANT; /* -- cgit v1.2.3 From d9367842e54a234ee00ea100de45480527de5693 Mon Sep 17 00:00:00 2001 From: Markus Amsler Date: Sun, 30 Mar 2008 16:12:47 +0000 Subject: r300: Copy-and-paste error from the vertex program branch. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 89ccca7dae..e91d96852d 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -842,9 +842,10 @@ static GLuint *r300TranslateOpcodeSUB(struct r300_vertex_program *vp, inst[3] = 0; #else inst[0] = - PVS_OP_DST_OPERAND(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), + PVS_OP_DST_OPERAND(VE_MULTIPLY_ADD, GL_FALSE, GL_FALSE, + t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); -- cgit v1.2.3 From d30d9e42b758db452bfdb482b619a5f4c6d01037 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Mon, 31 Mar 2008 13:45:06 +0800 Subject: i915: texture object's lod bias. fix bug #15192 --- src/mesa/drivers/dri/i915/i830_tex.c | 2 ++ src/mesa/drivers/dri/i915/i830_texstate.c | 14 +++++++++++--- src/mesa/drivers/dri/i915/i915_tex.c | 2 ++ src/mesa/drivers/dri/i915/i915_texstate.c | 12 ++++++++++-- 4 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i830_tex.c b/src/mesa/drivers/dri/i915/i830_tex.c index fed464d1aa..79b0fcf596 100644 --- a/src/mesa/drivers/dri/i915/i830_tex.c +++ b/src/mesa/drivers/dri/i915/i830_tex.c @@ -96,5 +96,7 @@ i830TexEnv(GLcontext * ctx, GLenum target, void i830InitTextureFuncs(struct dd_function_table *functions) { +/* functions->TexEnv = i830TexEnv; +*/ } diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 7613b9d2a6..4e9b022eae 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -114,10 +114,12 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) { GLcontext *ctx = &intel->ctx; struct i830_context *i830 = i830_context(ctx); - struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current; + struct gl_texture_unit *tUnit = &ctx->Texture.Unit[unit]; + struct gl_texture_object *tObj = tUnit->_Current; struct intel_texture_object *intelObj = intel_texture_object(tObj); struct gl_texture_image *firstImage; GLuint *state = i830->state.Tex[unit], format, pitch; + GLint lodbias; memset(state, 0, sizeof(state)); @@ -243,8 +245,14 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } } - state[I830_TEXREG_TM0S3] = i830->lodbias_tm0s3[unit]; - + lodbias = (int) ((tUnit->LodBias + tObj->LodBias) * 16.0); + if (lodbias < -64) + lodbias = -64; + if (lodbias > 63) + lodbias = 63; + + state[I830_TEXREG_TM0S3] = ((lodbias << TM0S3_LOD_BIAS_SHIFT) & + TM0S3_LOD_BIAS_MASK); #if 0 /* YUV conversion: */ diff --git a/src/mesa/drivers/dri/i915/i915_tex.c b/src/mesa/drivers/dri/i915/i915_tex.c index 59e148ca04..386617a1ff 100644 --- a/src/mesa/drivers/dri/i915/i915_tex.c +++ b/src/mesa/drivers/dri/i915/i915_tex.c @@ -74,5 +74,7 @@ i915TexEnv(GLcontext * ctx, GLenum target, void i915InitTextureFuncs(struct dd_function_table *functions) { +/* functions->TexEnv = i915TexEnv; +*/ } diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index e489d25ae8..987c6c0454 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -119,10 +119,12 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) { GLcontext *ctx = &intel->ctx; struct i915_context *i915 = i915_context(ctx); - struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current; + struct gl_texture_unit *tUnit = &ctx->Texture.Unit[unit]; + struct gl_texture_object *tObj = tUnit->_Current; struct intel_texture_object *intelObj = intel_texture_object(tObj); struct gl_texture_image *firstImage; GLuint *state = i915->state.Tex[unit], format, pitch; + GLint lodbias; memset(state, 0, sizeof(state)); @@ -232,7 +234,13 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } } - state[I915_TEXREG_SS2] = i915->lodbias_ss2[unit]; + lodbias = (int) ((tUnit->LodBias + tObj->LodBias) * 16.0); + if (lodbias < -256) + lodbias = -256; + if (lodbias > 255) + lodbias = 255; + state[I915_TEXREG_SS2] = ((lodbias << SS2_LOD_BIAS_SHIFT) & + SS2_LOD_BIAS_MASK); /* YUV conversion: */ -- cgit v1.2.3 From aef47c4dc87075fd63002b50c4b32b1049e5e4d1 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Mon, 31 Mar 2008 16:27:47 +0800 Subject: Revert "mesa: separate shader program object from shader object." (bug#15244) This reverts commit 3ffd11f71d021f672b9bc15b3c39c155a0e2fecb. --- src/mesa/main/context.c | 24 ++++++++---------------- src/mesa/main/mtypes.h | 2 +- src/mesa/shader/shader_api.c | 8 ++++---- 3 files changed, 13 insertions(+), 21 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 62d592767d..087e18fb53 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -444,7 +444,6 @@ alloc_shared_state( GLcontext *ctx ) ss->ArrayObjects = _mesa_NewHashTable(); #if FEATURE_ARB_shader_objects - ss->ShaderProgramObjects = _mesa_NewHashTable(); ss->ShaderObjects = _mesa_NewHashTable(); #endif @@ -524,8 +523,6 @@ cleanup: _mesa_DeleteHashTable (ss->ArrayObjects); #if FEATURE_ARB_shader_objects - if (ss->ShaderProgramObjects) - _mesa_DeleteHashTable (ss->ShaderProgramObjects); if (ss->ShaderObjects) _mesa_DeleteHashTable (ss->ShaderObjects); #endif @@ -634,17 +631,14 @@ delete_shader_cb(GLuint id, void *data, void *userData) { GLcontext *ctx = (GLcontext *) userData; struct gl_shader *sh = (struct gl_shader *) data; - assert(sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER); - _mesa_free_shader(ctx, sh); -} - -static void -delete_shader_program_cb(GLuint id, void *data, void *userData) -{ - GLcontext *ctx = (GLcontext *) userData; - struct gl_shader_program *shProg = (struct gl_shader_program *) data; - assert(shProg->Type == GL_SHADER_PROGRAM_MESA); - _mesa_free_shader_program(ctx, shProg); + if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER) { + _mesa_free_shader(ctx, sh); + } + else { + struct gl_shader_program *shProg = (struct gl_shader_program *) data; + ASSERT(shProg->Type == GL_SHADER_PROGRAM_MESA); + _mesa_free_shader_program(ctx, shProg); + } } /** @@ -727,8 +721,6 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->ArrayObjects); #if FEATURE_ARB_shader_objects - _mesa_HashDeleteAll(ss->ShaderProgramObjects, delete_shader_program_cb, ctx); - _mesa_DeleteHashTable(ss->ShaderProgramObjects); _mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx); _mesa_DeleteHashTable(ss->ShaderObjects); #endif diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index da60a469a4..c8718a7f63 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2202,8 +2202,8 @@ struct gl_shared_state #endif #if FEATURE_ARB_shader_objects + /** Table of both gl_shader and gl_shader_program objects */ struct _mesa_HashTable *ShaderObjects; - struct _mesa_HashTable *ShaderProgramObjects; #endif #if FEATURE_EXT_framebuffer_object diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 76da855a07..df2f9dcec8 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -178,7 +178,7 @@ _mesa_reference_shader_program(GLcontext *ctx, deleteFlag = (old->RefCount == 0); if (deleteFlag) { - _mesa_HashRemove(ctx->Shared->ShaderProgramObjects, old->Name); + _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name); _mesa_free_shader_program(ctx, old); } @@ -204,7 +204,7 @@ _mesa_lookup_shader_program(GLcontext *ctx, GLuint name) struct gl_shader_program *shProg; if (name) { shProg = (struct gl_shader_program *) - _mesa_HashLookup(ctx->Shared->ShaderProgramObjects, name); + _mesa_HashLookup(ctx->Shared->ShaderObjects, name); /* Note that both gl_shader and gl_shader_program objects are kept * in the same hash table. Check the object's type to be sure it's * what we're expecting. @@ -536,10 +536,10 @@ _mesa_create_program(GLcontext *ctx) GLuint name; struct gl_shader_program *shProg; - name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderProgramObjects, 1); + name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1); shProg = _mesa_new_shader_program(ctx, name); - _mesa_HashInsert(ctx->Shared->ShaderProgramObjects, name, shProg); + _mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg); assert(shProg->RefCount == 1); -- cgit v1.2.3 From 63d8a8417d68365cd10c11178516378411c09f87 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Mon, 31 Mar 2008 17:02:47 +0800 Subject: mesa: Free all shader program data before deleting all shader/shader program objects to avoid memory access error. --- src/mesa/main/context.c | 16 ++++++++++++++++ src/mesa/shader/shader_api.c | 2 ++ 2 files changed, 18 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 087e18fb53..d94876e70b 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -622,6 +622,21 @@ delete_arrayobj_cb(GLuint id, void *data, void *userData) _mesa_delete_array_object(ctx, arrayObj); } +/** + * Callback for freeing shader program data. Call it before delete_shader_cb + * to avoid memory access error. + */ +static void +free_shader_program_data_cb(GLuint id, void *data, void *userData) +{ + GLcontext *ctx = (GLcontext *) userData; + struct gl_shader_program *shProg = (struct gl_shader_program *) data; + + if (shProg->Type == GL_SHADER_PROGRAM_MESA) { + _mesa_free_shader_program_data(ctx, shProg); + } +} + /** * Callback for deleting shader and shader programs objects. * Called by _mesa_HashDeleteAll(). @@ -721,6 +736,7 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->ArrayObjects); #if FEATURE_ARB_shader_objects + _mesa_HashWalk(ss->ShaderObjects, free_shader_program_data_cb, ctx); _mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx); _mesa_DeleteHashTable(ss->ShaderObjects); #endif diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index df2f9dcec8..01a237c525 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -127,6 +127,8 @@ _mesa_free_shader_program_data(GLcontext *ctx, for (i = 0; i < shProg->NumShaders; i++) { _mesa_reference_shader(ctx, &shProg->Shaders[i], NULL); } + shProg->NumShaders = 0; + if (shProg->Shaders) { _mesa_free(shProg->Shaders); shProg->Shaders = NULL; -- cgit v1.2.3 From e82dd8c6e1fa2fff5b960de26961080ba5e9651d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 26 Mar 2008 19:26:59 -0400 Subject: DRI interface changes and DRI2 direct rendering support. Add DRI2 direct rendering support to libGL and add DRI2 client side protocol code. Extend the GLX 1.3 create drawable functions in glx_pbuffer.c to call into the DRI driver when possible. Introduce __DRIconfig, opaque struct that represents a DRI driver configuration. Get's rid of the open coded __GLcontextModes in the DRI driver interface and the context modes create and destroy functions that the loader was requires to provide. glcore.h is no longer part of the DRI driver interface. The DRI config is GL binding agnostic, that is, not specific to GLX, EGL or other bindings. The core API is now also an extension, and the driver exports a list of extensions as the symbol __driDriverExtensions, which the loader must dlsym() for. The list of extension will always include the DRI core extension, which allows creating and manipulating DRI screens, drawables and contexts. The DRI legacy extension, when available, provides alternative entry points for creating the DRI objects that work with the XF86DRI infrastructure. Change DRI2 client code to not use drm drawables or contexts. We never used drm_drawable_t's and the only use for drm_context_t was as a unique identifier when taking the lock. We now just allocate a unique lock ID out of the DRILock sarea block. Once we get rid of the lock entirely, we can drop this hack. Change the interface between dri_util.c and the drivers, so that the drivers now export the DriverAPI struct as driDriverAPI instead of the InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2 init screen function to see if DRI2 is supported by the driver. --- src/mesa/drivers/dri/common/dri_util.c | 501 ++++++++++++++++--------- src/mesa/drivers/dri/common/dri_util.h | 122 +++--- src/mesa/drivers/dri/common/utils.c | 75 +++- src/mesa/drivers/dri/common/utils.h | 12 +- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 85 ++--- src/mesa/drivers/dri/gamma/gamma_xmesa.c | 2 +- src/mesa/drivers/dri/i810/i810screen.c | 167 ++------- src/mesa/drivers/dri/intel/intel_context.c | 86 ++--- src/mesa/drivers/dri/intel/intel_screen.c | 111 +++--- src/mesa/drivers/dri/intel/intel_tex_image.c | 11 +- src/mesa/drivers/dri/mach64/mach64_screen.c | 165 +++----- src/mesa/drivers/dri/mga/mga_xmesa.c | 89 ++--- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 123 +++--- src/mesa/drivers/dri/r128/r128_screen.c | 93 ++--- src/mesa/drivers/dri/r200/r200_texstate.c | 4 +- src/mesa/drivers/dri/r300/r300_texstate.c | 4 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 120 +++--- src/mesa/drivers/dri/s3v/s3v_xmesa.c | 48 +-- src/mesa/drivers/dri/savage/savage_xmesa.c | 102 ++--- src/mesa/drivers/dri/sis/sis_screen.c | 93 ++--- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 62 +-- src/mesa/drivers/dri/trident/trident_context.c | 28 +- src/mesa/drivers/dri/unichrome/via_screen.c | 80 ++-- 23 files changed, 983 insertions(+), 1200 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 1f5d65265c..daf1d56feb 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -21,7 +21,6 @@ #include #include #include -#include #ifndef MAP_FAILED #define MAP_FAILED ((void *)-1) @@ -45,16 +44,6 @@ const __DRIextension driReadDrawableExtension = { __DRI_READ_DRAWABLE, __DRI_READ_DRAWABLE_VERSION }; -static void *driCreateNewDrawable(__DRIscreen *screen, - const __GLcontextModes *modes, - __DRIdrawable *pdraw, - drm_drawable_t hwDrawable, - unsigned int head, - int renderType, const int *attrs); - -static void driDestroyDrawable(__DRIdrawable *drawable); - - /** * Print message to \c stderr if the \c LIBGL_DEBUG environment variable * is set. @@ -99,25 +88,23 @@ __driUtilMessage(const char *f, ...) * While casting the opaque private pointers associated with the parameters * into their respective real types it also assures they are not \c NULL. */ -static GLboolean driUnbindContext(__DRIcontext *ctx) +static int driUnbindContext(__DRIcontext *pcp) { - __DRIcontextPrivate *pcp; - __DRIscreenPrivate *psp; - __DRIdrawablePrivate *pdp; - __DRIdrawablePrivate *prp; + __DRIscreen *psp; + __DRIdrawable *pdp; + __DRIdrawable *prp; /* ** Assume error checking is done properly in glXMakeCurrent before ** calling driUnbindContext. */ - if (ctx == NULL) + if (pcp == NULL) return GL_FALSE; - pcp = (__DRIcontextPrivate *)ctx->private; - psp = (__DRIscreenPrivate *)pcp->driScreenPriv; - pdp = (__DRIdrawablePrivate *)pcp->driDrawablePriv; - prp = (__DRIdrawablePrivate *)pcp->driReadablePriv; + psp = pcp->driScreenPriv; + pdp = pcp->driDrawablePriv; + prp = pcp->driReadablePriv; /* Let driver unbind drawable from context */ (*psp->DriverAPI.UnbindContext)(pcp); @@ -158,13 +145,10 @@ static GLboolean driUnbindContext(__DRIcontext *ctx) * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. */ -static GLboolean driBindContext(__DRIcontext * ctx, - __DRIdrawable *pdraw, - __DRIdrawable *pread) +static int driBindContext(__DRIcontext *pcp, + __DRIdrawable *pdp, + __DRIdrawable *prp) { - __DRIdrawablePrivate *pdp; - __DRIdrawablePrivate *prp; - __DRIcontextPrivate * const pcp = ctx->private; __DRIscreenPrivate *psp = pcp->driScreenPriv; /* @@ -172,12 +156,9 @@ static GLboolean driBindContext(__DRIcontext * ctx, ** calling driBindContext. */ - if (ctx == NULL || pdraw == None || pread == None) + if (pcp == NULL || pdp == None || prp == None) return GL_FALSE; - pdp = (__DRIdrawablePrivate *) pdraw->private; - prp = (__DRIdrawablePrivate *) pread->private; - /* Bind the drawable to the context */ pcp->driDrawablePriv = pdp; pcp->driReadablePriv = prp; @@ -261,14 +242,15 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); - if (! (*psp->getDrawableInfo->getDrawableInfo)(pdp->pdraw, + if (! (*psp->getDrawableInfo->getDrawableInfo)(pdp, &pdp->index, &pdp->lastStamp, &pdp->x, &pdp->y, &pdp->w, &pdp->h, &pdp->numClipRects, &pdp->pClipRects, &pdp->backX, &pdp->backY, &pdp->numBackClipRects, - &pdp->pBackClipRects )) { + &pdp->pBackClipRects, + pdp->loaderPrivate)) { /* Error -- eg the window may have been destroyed. Keep going * with no cliprects. */ @@ -301,7 +283,8 @@ __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp) * server overwrote it and we have to reset our tail * pointer. */ DRM_UNLOCK(psp->fd, psp->lock, pcp->hHWContext); - (*psp->dri2.core->reemitDrawableInfo)(pdp->pdraw, &pdp->dri2.tail); + (*psp->dri2.loader->reemitDrawableInfo)(pdp, &pdp->dri2.tail, + pdp->loaderPrivate); DRM_LIGHT_LOCK(psp->fd, psp->lock, pcp->hHWContext); } @@ -326,13 +309,13 @@ __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp) switch (DRI2_EVENT_TYPE(*p)) { case DRI2_EVENT_DRAWABLE_CONFIG: dc = (__DRIDrawableConfigEvent *) p; - if (dc->drawable == pdp->hHWDrawable) + if (dc->drawable == pdp->dri2.drawable_id) last_dc = dc; break; case DRI2_EVENT_BUFFER_ATTACH: ba = (__DRIBufferAttachEvent *) p; - if (ba->drawable == pdp->hHWDrawable && + if (ba->drawable == pdp->dri2.drawable_id && ba->buffer.attachment == DRI_DRAWABLE_BUFFER_FRONT_LEFT) last_ba = ba; break; @@ -361,11 +344,12 @@ __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp) rect_size = last_dc->num_rects * sizeof last_dc->rects[0]; pdp->pClipRects = _mesa_malloc(rect_size); memcpy(pdp->pClipRects, last_dc->rects, rect_size); - - if (changed) - (*psp->DriverAPI.HandleDrawableConfig)(pdp, pcp, last_dc); } + /* We only care about the most recent drawable config. */ + if (last_dc && changed) + (*psp->DriverAPI.HandleDrawableConfig)(pdp, pcp, last_dc); + /* Front buffer attachments are special, they typically mean that * we're rendering to a redirected window (or a child window of a * redirected window) and that it got resized. Resizing the root @@ -382,11 +366,6 @@ __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp) if (last_ba) (*psp->DriverAPI.HandleBufferAttach)(pdp, pcp, last_ba); - /* Like for buffer attachments, we only care about the most recent - * drawable config. */ - if (last_dc) - (*psp->DriverAPI.HandleDrawableConfig)(pdp, pcp, last_dc); - /* If there was a drawable config event in the buffer and it * changed the size of the window, all buffer auxillary buffer * attachments prior to that are invalid (as opposed to the front @@ -406,21 +385,18 @@ __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp) if (DRI2_EVENT_TYPE(ba->event_header) != DRI2_EVENT_BUFFER_ATTACH) continue; - if (ba->drawable != pdp->hHWDrawable) + if (ba->drawable != pdp->dri2.drawable_id) continue; if (last_ba == ba) continue; (*psp->DriverAPI.HandleBufferAttach)(pdp, pcp, ba); + changed = 1; } pdp->dri2.tail = tail; - /* FIXME: Return whether we changed anything. This check always - * returns true if we received events, but we could refine the - * check to only return TRUE if the drawable actually changed. */ - - return total > 0; + return changed || last_ba; } /*@}*/ @@ -430,6 +406,30 @@ __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp) /*****************************************************************/ /*@{*/ +static void driReportDamage(__DRIdrawable *pdp, + struct drm_clip_rect *pClipRects, int numClipRects) +{ + __DRIscreen *psp = pdp->driScreenPriv; + + /* Check that we actually have the new damage report method */ + if (psp->dri2.enabled) { + (*psp->dri2.loader->postDamage)(pdp, + pClipRects, + numClipRects, + pdp->loaderPrivate); + } else if (psp->damage) { + /* Report the damage. Currently, all our drivers draw + * directly to the front buffer, so we report the damage there + * rather than to the backing storein (if any). + */ + (*psp->damage->reportDamage)(pdp, + pdp->x, pdp->y, + pClipRects, numClipRects, + GL_TRUE, pdp->loaderPrivate); + } +} + + /** * Swap buffers. * @@ -440,49 +440,28 @@ __driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp) * * Is called directly from glXSwapBuffers(). */ -static void driSwapBuffers(__DRIdrawable *drawable) +static void driSwapBuffers(__DRIdrawable *dPriv) { - __DRIdrawablePrivate *dPriv = drawable->private; - __DRIscreenPrivate *psp = dPriv->driScreenPriv; - drm_clip_rect_t rect; + __DRIscreen *psp = dPriv->driScreenPriv; if (!dPriv->numClipRects) return; - dPriv->swapBuffers(dPriv); + psp->DriverAPI.SwapBuffers(dPriv); - /* Check that we actually have the new damage report method */ - if (psp->damage == NULL) - return; - - /* Assume it's affecting the whole drawable for now */ - rect.x1 = 0; - rect.y1 = 0; - rect.x2 = rect.x1 + dPriv->w; - rect.y2 = rect.y1 + dPriv->h; - - /* Report the damage. Currently, all our drivers draw directly to the - * front buffer, so we report the damage there rather than to the backing - * store (if any). - */ - (*psp->damage->reportDamage)(dPriv->pdraw, - dPriv->x, dPriv->y, &rect, 1, GL_TRUE); + driReportDamage(dPriv, dPriv->pClipRects, dPriv->numClipRects); } -static int driDrawableGetMSC( __DRIscreen *screen, __DRIdrawable *drawable, +static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv, int64_t *msc ) { - __DRIscreenPrivate *sPriv = screen->private; - __DRIdrawablePrivate *dPriv = drawable->private; - return sPriv->DriverAPI.GetDrawableMSC(sPriv, dPriv, msc); } -static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, +static int driWaitForMSC(__DRIdrawable *dPriv, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc, int64_t * sbc) { - __DRIdrawablePrivate *dPriv = drawable->private; __DRIswapInfo sInfo; int status; @@ -510,11 +489,18 @@ const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = { driDrawableGetMSC, }; -static void driCopySubBuffer(__DRIdrawable *drawable, +static void driCopySubBuffer(__DRIdrawable *dPriv, int x, int y, int w, int h) { - __DRIdrawablePrivate *dPriv = drawable->private; + drm_clip_rect_t rect; + dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); + + rect.x1 = x; + rect.y1 = y; + rect.x2 = x + w; + rect.y2 = y + w; + driReportDamage(dPriv, &rect, 1); } const __DRIcopySubBufferExtension driCopySubBufferExtension = { @@ -522,18 +508,14 @@ const __DRIcopySubBufferExtension driCopySubBufferExtension = { driCopySubBuffer }; -static void driSetSwapInterval(__DRIdrawable *drawable, unsigned int interval) +static void driSetSwapInterval(__DRIdrawable *dPriv, unsigned int interval) { - __DRIdrawablePrivate *dpriv = drawable->private; - - dpriv->swap_interval = interval; + dPriv->swap_interval = interval; } -static unsigned int driGetSwapInterval(__DRIdrawable *drawable) +static unsigned int driGetSwapInterval(__DRIdrawable *dPriv) { - __DRIdrawablePrivate *dpriv = drawable->private; - - return dpriv->swap_interval; + return dPriv->swap_interval; } const __DRIswapControlExtension driSwapControlExtension = { @@ -546,31 +528,25 @@ const __DRIswapControlExtension driSwapControlExtension = { /** * This is called via __DRIscreenRec's createNewDrawable pointer. */ -static void *driCreateNewDrawable(__DRIscreen *screen, - const __GLcontextModes *modes, - __DRIdrawable *pdraw, - drm_drawable_t hwDrawable, - unsigned int head, - int renderType, - const int *attrs) +static __DRIdrawable * +driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, + drm_drawable_t hwDrawable, int renderType, + const int *attrs, void *data) { - __DRIscreenPrivate *psp; - __DRIdrawablePrivate *pdp; - - pdraw->private = NULL; + __DRIdrawable *pdp; /* Since pbuffers are not yet supported, no drawable attributes are * supported either. */ (void) attrs; - pdp = (__DRIdrawablePrivate *)_mesa_malloc(sizeof(__DRIdrawablePrivate)); + pdp = _mesa_malloc(sizeof *pdp); if (!pdp) { return NULL; } + pdp->loaderPrivate = data; pdp->hHWDrawable = hwDrawable; - pdp->pdraw = pdraw; pdp->refcount = 0; pdp->pStamp = NULL; pdp->lastStamp = 0; @@ -586,19 +562,15 @@ static void *driCreateNewDrawable(__DRIscreen *screen, pdp->vblSeq = 0; pdp->vblFlags = 0; - psp = (__DRIscreenPrivate *)screen->private; pdp->driScreenPriv = psp; pdp->driContextPriv = &psp->dummyContextPriv; - if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, modes, + if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes, renderType == GLX_PIXMAP_BIT)) { _mesa_free(pdp); return NULL; } - pdraw->private = pdp; - pdraw->destroyDrawable = driDestroyDrawable; - pdraw->swapBuffers = driSwapBuffers; /* called by glXSwapBuffers() */ pdp->msc_base = 0; /* This special default value is replaced with the configured @@ -607,20 +579,28 @@ static void *driCreateNewDrawable(__DRIscreen *screen, */ pdp->swap_interval = (unsigned)-1; - pdp->swapBuffers = psp->DriverAPI.SwapBuffers; + return pdp; +} - if (psp->dri2.enabled) { - pdp->dri2.tail = head; - pdp->pBackClipRects = _mesa_malloc(sizeof *pdp->pBackClipRects); - } +static __DRIdrawable * +dri2CreateNewDrawable(__DRIscreen *screen, const __DRIconfig *config, + unsigned int drawable_id, unsigned int head, void *data) +{ + __DRIdrawable *pdraw; - return (void *) pdp; + pdraw = driCreateNewDrawable(screen, config, 0, 0, NULL, data); + + pdraw->dri2.drawable_id = drawable_id; + pdraw->dri2.tail = head; + pdraw->pBackClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); + + return pdraw; } + static void -driDestroyDrawable(__DRIdrawable *drawable) +driDestroyDrawable(__DRIdrawable *pdp) { - __DRIdrawablePrivate *pdp = drawable->private; __DRIscreenPrivate *psp; if (pdp) { @@ -656,10 +636,8 @@ driDestroyDrawable(__DRIdrawable *drawable) * drmDestroyContext(), and finally frees \p contextPrivate. */ static void -driDestroyContext(__DRIcontext *context) +driDestroyContext(__DRIcontext *pcp) { - __DRIcontextPrivate *pcp = context->private; - if (pcp) { (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); _mesa_free(pcp); @@ -688,24 +666,18 @@ driDestroyContext(__DRIcontext *context) * context. * */ -static void * -driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, +static __DRIcontext * +driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, int render_type, __DRIcontext *shared, - drm_context_t hwContext, __DRIcontext *pctx) + drm_context_t hwContext, void *data) { - __DRIcontextPrivate *pcp; - __DRIcontextPrivate *pshare = (shared != NULL) ? shared->private : NULL; - __DRIscreenPrivate *psp; - void * const shareCtx = (pshare != NULL) ? pshare->driverPrivate : NULL; - - psp = (__DRIscreenPrivate *)screen->private; + __DRIcontext *pcp; + void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; - pcp = (__DRIcontextPrivate *)_mesa_malloc(sizeof(__DRIcontextPrivate)); - if (!pcp) { + pcp = _mesa_malloc(sizeof *pcp); + if (!pcp) return NULL; - } - pcp->hHWContext = hwContext; pcp->driScreenPriv = psp; pcp->driDrawablePriv = NULL; @@ -721,28 +693,43 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, /* No other fields should be used! */ } - pctx->destroyContext = driDestroyContext; - pctx->bindContext = driBindContext; - pctx->unbindContext = driUnbindContext; + pcp->hHWContext = hwContext; - if ( !(*psp->DriverAPI.CreateContext)(modes, pcp, shareCtx) ) { + if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) { _mesa_free(pcp); return NULL; } return pcp; } -/*@}*/ - -static const __DRIextension ** -driGetExtensions(__DRIscreen *screen) +static __DRIcontext * +dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config, + __DRIcontext *shared, void *data) { - __DRIscreenPrivate *psp = screen->private; + drm_context_t hwContext; + DRM_CAS_RESULT(ret); - return psp->extensions; + /* DRI2 doesn't use kernel with context IDs, we just need an ID that's + * different from the kernel context ID to make drmLock() happy. */ + + do { + hwContext = screen->dri2.lock->next_id; + DRM_CAS(&screen->dri2.lock->next_id, hwContext, hwContext + 1, ret); + } while (ret); + + return driCreateNewContext(screen, config, 0, shared, hwContext, data); } +static int +driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask) +{ + return GL_FALSE; +} + +/*@}*/ + + /*****************************************************************/ /** \name Screen handling functions */ /*****************************************************************/ @@ -759,10 +746,8 @@ driGetExtensions(__DRIscreen *screen) * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls * drmClose(), and finally frees \p screenPrivate. */ -static void driDestroyScreen(__DRIscreen *screen) +static void driDestroyScreen(__DRIscreen *psp) { - __DRIscreenPrivate *psp = screen->private; - if (psp) { /* No interaction with the X-server is possible at this point. This * routine is called after XCloseDisplay, so there is no protocol @@ -786,22 +771,20 @@ static void driDestroyScreen(__DRIscreen *screen) } static void -setupLoaderExtensions(__DRIscreenPrivate *psp, +setupLoaderExtensions(__DRIscreen *psp, const __DRIextension **extensions) { int i; for (i = 0; extensions[i]; i++) { - if (strcmp(extensions[i]->name, __DRI_CONTEXT_MODES) == 0) - psp->contextModes = (__DRIcontextModesExtension *) extensions[i]; if (strcmp(extensions[i]->name, __DRI_GET_DRAWABLE_INFO) == 0) psp->getDrawableInfo = (__DRIgetDrawableInfoExtension *) extensions[i]; if (strcmp(extensions[i]->name, __DRI_DAMAGE) == 0) psp->damage = (__DRIdamageExtension *) extensions[i]; if (strcmp(extensions[i]->name, __DRI_SYSTEM_TIME) == 0) psp->systemTime = (__DRIsystemTimeExtension *) extensions[i]; - if (strcmp(extensions[i]->name, __DRI_CORE_DRI2) == 0) - psp->dri2.core = (__DRIcoreDRI2Extension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_LOADER) == 0) + psp->dri2.loader = (__DRIloaderExtension *) extensions[i]; } } @@ -836,26 +819,24 @@ setupLoaderExtensions(__DRIscreenPrivate *psp, * function. Since the name of this function is versioned, it is * impossible for a loader that is too old to even load this driver. */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - const __DRIextension ** extensions, - __GLcontextModes ** driver_modes ) - +static __DRIscreen * +driCreateNewScreen(int scrn, + const __DRIversion *ddx_version, + const __DRIversion *dri_version, + const __DRIversion *drm_version, + const __DRIframebuffer *frame_buffer, + drmAddress pSAREA, int fd, + const __DRIextension **extensions, + const __DRIconfig ***driver_modes, + void *loaderPrivate) { - __DRIscreenPrivate *psp; static const __DRIextension *emptyExtensionList[] = { NULL }; + __DRIscreen *psp; - psp = _mesa_malloc(sizeof(*psp)); + psp = _mesa_malloc(sizeof *psp); if (!psp) return NULL; - psp->psc = psc; - setupLoaderExtensions(psp, extensions); /* @@ -893,12 +874,9 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, */ psp->dummyContextPriv.driScreenPriv = NULL; - psc->destroyScreen = driDestroyScreen; - psc->getExtensions = driGetExtensions; - psc->createNewDrawable = driCreateNewDrawable; - psc->createNewContext = driCreateNewContext; + psp->DriverAPI = driDriverAPI; - *driver_modes = __driDriverInitScreen(psp); + *driver_modes = driDriverAPI.InitScreen(psp); if (*driver_modes == NULL) { _mesa_free(psp); return NULL; @@ -907,20 +885,18 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, return psp; } -PUBLIC void * -__DRI2_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - int fd, unsigned int sarea_handle, - const __DRIextension **extensions, - __GLcontextModes **driver_modes) + +static __DRIscreen * +dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle, + const __DRIextension **extensions, + const __DRIconfig ***driver_configs, void *data) { - __DRIscreenPrivate *psp; static const __DRIextension *emptyExtensionList[] = { NULL }; + __DRIscreen *psp; unsigned int *p; drmVersionPtr version; - __GLcontextModes *(*initScreen)(__DRIscreenPrivate *psc); - initScreen = dlsym(NULL, "__dri2DriverInitScreen"); - if (initScreen == NULL) + if (driDriverAPI.InitScreen2 == NULL) return NULL; psp = _mesa_malloc(sizeof(*psp)); @@ -929,8 +905,6 @@ __DRI2_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, setupLoaderExtensions(psp, extensions); - psp->psc = psc; - version = drmGetVersion(fd); if (version) { psp->drm_version.major = version->version_major; @@ -972,22 +946,176 @@ __DRI2_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, psp->lock = (drmLock *) &psp->dri2.lock->lock; - psc->destroyScreen = driDestroyScreen; - psc->getExtensions = driGetExtensions; - psc->createNewDrawable = driCreateNewDrawable; - psc->createNewContext = driCreateNewContext; - - *driver_modes = initScreen(psp); - if (*driver_modes == NULL) { + psp->DriverAPI = driDriverAPI; + *driver_configs = driDriverAPI.InitScreen2(psp); + if (*driver_configs == NULL) { drmBOUnmap(psp->fd, &psp->dri2.sareaBO); drmBOUnreference(psp->fd, &psp->dri2.sareaBO); _mesa_free(psp); return NULL; } + psp->DriverAPI = driDriverAPI; + return psp; } +static const __DRIextension **driGetExtensions(__DRIscreen *psp) +{ + return psp->extensions; +} + +#define __ATTRIB(attrib, field) \ + { attrib, offsetof(__GLcontextModes, field) } + +static const struct { unsigned int attrib, offset; } attribMap[] = { + __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits), + __ATTRIB(__DRI_ATTRIB_LEVEL, level), + __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits), + __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits), + __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits), + __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits), + __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits), + __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits), + __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers), + __ATTRIB(__DRI_ATTRIB_SAMPLES, samples), + __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode), + __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode), + __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha), + __ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode), + __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask), + __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask), + __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask), + __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels), + __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth), + __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight), + __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba), + __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture), + __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted), + + /* The struct field doesn't matter here, these are handled by the + * switch in driGetConfigAttribIndex. We need them in the array + * so the iterator includes them though.*/ + __ATTRIB(__DRI_ATTRIB_RENDER_TYPE, level), + __ATTRIB(__DRI_ATTRIB_CONFIG_CAVEAT, level), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS, level), + __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, level) +}; + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + +static int +driGetConfigAttribIndex(const __DRIconfig *config, + unsigned int index, unsigned int *value) +{ + switch (attribMap[index].attrib) { + case __DRI_ATTRIB_RENDER_TYPE: + if (config->modes.rgbMode) + *value = __DRI_ATTRIB_RGBA_BIT; + else + *value = __DRI_ATTRIB_COLOR_INDEX_BIT; + break; + case __DRI_ATTRIB_CONFIG_CAVEAT: + if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG) + *value = __DRI_ATTRIB_NON_CONFORMANT_CONFIG; + else if (config->modes.visualRating == GLX_SLOW_CONFIG) + *value = __DRI_ATTRIB_SLOW_BIT; + else + *value = 0; + break; + case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS: + *value = 0; + if (config->modes.bindToTextureTargets & GLX_TEXTURE_1D_BIT_EXT) + *value |= __DRI_ATTRIB_TEXTURE_1D_BIT; + if (config->modes.bindToTextureTargets & GLX_TEXTURE_2D_BIT_EXT) + *value |= __DRI_ATTRIB_TEXTURE_2D_BIT; + if (config->modes.bindToTextureTargets & GLX_TEXTURE_RECTANGLE_BIT_EXT) + *value |= __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT; + break; + case __DRI_ATTRIB_SWAP_METHOD: + break; + + default: + *value = *(unsigned int *) + ((char *) &config->modes + attribMap[index].offset); + + break; + } + + return GL_TRUE; +} + +static int +driGetConfigAttrib(const __DRIconfig *config, + unsigned int attrib, unsigned int *value) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(attribMap); i++) + if (attribMap[i].attrib == attrib) + return driGetConfigAttribIndex(config, i, value); + + return GL_FALSE; +} + +static int +driIndexConfigAttrib(const __DRIconfig *config, int index, + unsigned int *attrib, unsigned int *value) +{ + if (index >= 0 && index < ARRAY_SIZE(attribMap)) { + *attrib = attribMap[index].attrib; + return driGetConfigAttribIndex(config, index, value); + } + + return GL_FALSE; +} + +const __DRIlegacyExtension driLegacyExtension = { + { __DRI_LEGACY, __DRI_LEGACY_VERSION }, + driCreateNewScreen, + driCreateNewDrawable, + driCreateNewContext +}; + +const __DRIcoreExtension driCoreExtension = { + { __DRI_CORE, __DRI_CORE_VERSION }, + dri2CreateNewScreen, + driDestroyScreen, + driGetExtensions, + driGetConfigAttrib, + driIndexConfigAttrib, + dri2CreateNewDrawable, + driDestroyDrawable, + driSwapBuffers, + dri2CreateNewContext, + driCopyContext, + driDestroyContext, + driBindContext, + driUnbindContext +}; + +/* This is the table of extensions that the loader will dlsym() for. */ +PUBLIC const __DRIextension *__driDriverExtensions[] = { + &driCoreExtension.base, + &driLegacyExtension.base, + NULL +}; + static int driFrameTracking(__DRIdrawable *drawable, GLboolean enable) { @@ -995,14 +1123,13 @@ driFrameTracking(__DRIdrawable *drawable, GLboolean enable) } static int -driQueryFrameTracking(__DRIdrawable *drawable, +driQueryFrameTracking(__DRIdrawable *dpriv, int64_t * sbc, int64_t * missedFrames, float * lastMissedUsage, float * usage) { __DRIswapInfo sInfo; int status; int64_t ust; - __DRIdrawablePrivate * dpriv = drawable->private; __DRIscreenPrivate *psp = dpriv->driScreenPriv; status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo ); @@ -1062,7 +1189,7 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, float usage = 1.0; __DRIscreenPrivate *psp = dPriv->driScreenPriv; - if ( (*psp->systemTime->getMSCRate)(dPriv->pdraw, &n, &d) ) { + if ( (*psp->systemTime->getMSCRate)(dPriv, &n, &d, dPriv->loaderPrivate) ) { interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 59c64e4adf..d4401b407e 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -59,27 +59,19 @@ #define GLX_BAD_CONTEXT 5 -typedef struct __DRIdisplayPrivateRec __DRIdisplayPrivate; -typedef struct __DRIscreenPrivateRec __DRIscreenPrivate; -typedef struct __DRIcontextPrivateRec __DRIcontextPrivate; -typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate; typedef struct __DRIswapInfoRec __DRIswapInfo; typedef struct __DRIutilversionRec2 __DRIutilversion2; - -/** - * Driver specific entry point. Implemented by the driver. Called - * from the top level createNewScreen entry point to initialize the - * __DRIscreenPrivate struct. - */ -extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); - -/** Ditto for DRI2 capable drivers. */ -extern __GLcontextModes *__dri2DriverInitScreen(__DRIscreenPrivate *psp); +/* Typedefs to avoid rewriting the world. */ +typedef struct __DRIscreenRec __DRIscreenPrivate; +typedef struct __DRIdrawableRec __DRIdrawablePrivate; +typedef struct __DRIcontextRec __DRIcontextPrivate; /** * Extensions. */ +extern const __DRIlegacyExtension driLegacyExtension; +extern const __DRIcoreExtension driCoreExtension; extern const __DRIextension driReadDrawableExtension; extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIswapControlExtension driSwapControlExtension; @@ -100,7 +92,7 @@ extern const __DRImediaStreamCounterExtension driMediaStreamCounterExtension; /** * Utility macro to validate the drawable information. * - * See __DRIdrawablePrivate::pStamp and __DRIdrawablePrivate::lastStamp. + * See __DRIdrawable::pStamp and __DRIdrawable::lastStamp. */ #define DRI_VALIDATE_DRAWABLE_INFO(psp, pdp) \ do { \ @@ -129,74 +121,76 @@ do { \ * this structure. */ struct __DriverAPIRec { + const __DRIconfig **(*InitScreen) (__DRIscreen * priv); + /** * Screen destruction callback */ - void (*DestroyScreen)(__DRIscreenPrivate *driScrnPriv); + void (*DestroyScreen)(__DRIscreen *driScrnPriv); /** * Context creation callback */ GLboolean (*CreateContext)(const __GLcontextModes *glVis, - __DRIcontextPrivate *driContextPriv, + __DRIcontext *driContextPriv, void *sharedContextPrivate); /** * Context destruction callback */ - void (*DestroyContext)(__DRIcontextPrivate *driContextPriv); + void (*DestroyContext)(__DRIcontext *driContextPriv); /** * Buffer (drawable) creation callback */ - GLboolean (*CreateBuffer)(__DRIscreenPrivate *driScrnPriv, - __DRIdrawablePrivate *driDrawPriv, + GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, + __DRIdrawable *driDrawPriv, const __GLcontextModes *glVis, GLboolean pixmapBuffer); /** * Buffer (drawable) destruction callback */ - void (*DestroyBuffer)(__DRIdrawablePrivate *driDrawPriv); + void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); /** * Buffer swapping callback */ - void (*SwapBuffers)(__DRIdrawablePrivate *driDrawPriv); + void (*SwapBuffers)(__DRIdrawable *driDrawPriv); /** * Context activation callback */ - GLboolean (*MakeCurrent)(__DRIcontextPrivate *driContextPriv, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv); + GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv, + __DRIdrawable *driDrawPriv, + __DRIdrawable *driReadPriv); /** * Context unbinding callback */ - GLboolean (*UnbindContext)(__DRIcontextPrivate *driContextPriv); + GLboolean (*UnbindContext)(__DRIcontext *driContextPriv); /** * Retrieves statistics about buffer swap operations. Required if * GLX_OML_sync_control or GLX_MESA_swap_frame_usage is supported. */ - int (*GetSwapInfo)( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ); + int (*GetSwapInfo)( __DRIdrawable *dPriv, __DRIswapInfo * sInfo ); /** * These are required if GLX_OML_sync_control is supported. */ /*@{*/ - int (*WaitForMSC)( __DRIdrawablePrivate *priv, int64_t target_msc, + int (*WaitForMSC)( __DRIdrawable *priv, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc ); - int (*WaitForSBC)( __DRIdrawablePrivate *priv, int64_t target_sbc, + int (*WaitForSBC)( __DRIdrawable *priv, int64_t target_sbc, int64_t * msc, int64_t * sbc ); - int64_t (*SwapBuffersMSC)( __DRIdrawablePrivate *priv, int64_t target_msc, + int64_t (*SwapBuffersMSC)( __DRIdrawable *priv, int64_t target_msc, int64_t divisor, int64_t remainder ); /*@}*/ - void (*CopySubBuffer)(__DRIdrawablePrivate *driDrawPriv, + void (*CopySubBuffer)(__DRIdrawable *driDrawPriv, int x, int y, int w, int h); /** @@ -204,21 +198,26 @@ struct __DriverAPIRec { * level DRM driver (e.g. pipe info). Required if * GLX_SGI_video_sync or GLX_OML_sync_control is supported. */ - int (*GetDrawableMSC) ( __DRIscreenPrivate * priv, - __DRIdrawablePrivate *drawablePrivate, + int (*GetDrawableMSC) ( __DRIscreen * priv, + __DRIdrawable *drawablePrivate, int64_t *count); + + /* DRI2 Entry points */ - void (*HandleDrawableConfig)(__DRIdrawablePrivate *dPriv, - __DRIcontextPrivate *pcp, + const __DRIconfig **(*InitScreen2) (__DRIscreen * priv); + void (*HandleDrawableConfig)(__DRIdrawable *dPriv, + __DRIcontext *pcp, __DRIDrawableConfigEvent *event); - void (*HandleBufferAttach)(__DRIdrawablePrivate *dPriv, - __DRIcontextPrivate *pcp, + void (*HandleBufferAttach)(__DRIdrawable *dPriv, + __DRIcontext *pcp, __DRIBufferAttachEvent *ba); }; +extern const struct __DriverAPIRec driDriverAPI; + struct __DRIswapInfoRec { /** @@ -254,7 +253,7 @@ struct __DRIswapInfoRec { /** * Per-drawable private DRI driver information. */ -struct __DRIdrawablePrivateRec { +struct __DRIdrawableRec { /** * Kernel drawable handle */ @@ -268,9 +267,10 @@ struct __DRIdrawablePrivateRec { void *driverPrivate; /** - * X's drawable ID associated with this private drawable. + * Private data from the loader. We just hold on to it and pass + * it back when calling into loader provided functions. */ - __DRIdrawable *pdraw; + void *loaderPrivate; /** * Reference count for number of context's currently bound to this @@ -295,7 +295,7 @@ struct __DRIdrawablePrivateRec { /** * Last value of the stamp. * - * If this differs from the value stored at __DRIdrawablePrivate::pStamp, + * If this differs from the value stored at __DRIdrawable::pStamp, * then the drawable information has been modified by the X server, and the * drawable information (below) should be retrieved from the X server. */ @@ -357,17 +357,12 @@ struct __DRIdrawablePrivateRec { /** * Pointer to context to which this drawable is currently bound. */ - __DRIcontextPrivate *driContextPriv; + __DRIcontext *driContextPriv; /** * Pointer to screen on which this drawable was created. */ - __DRIscreenPrivate *driScreenPriv; - - /** - * Called via glXSwapBuffers(). - */ - void (*swapBuffers)( __DRIdrawablePrivate *dPriv ); + __DRIscreen *driScreenPriv; /** * Controls swap interval as used by GLX_SGI_swap_control and @@ -376,13 +371,14 @@ struct __DRIdrawablePrivateRec { unsigned int swap_interval; struct { unsigned int tail; + unsigned int drawable_id; } dri2; }; /** * Per-context private driver information. */ -struct __DRIcontextPrivateRec { +struct __DRIcontextRec { /** * Kernel context handle used to access the device lock. */ @@ -401,23 +397,23 @@ struct __DRIcontextPrivateRec { /** * Pointer to drawable currently bound to this context for drawing. */ - __DRIdrawablePrivate *driDrawablePriv; + __DRIdrawable *driDrawablePriv; /** * Pointer to drawable currently bound to this context for reading. */ - __DRIdrawablePrivate *driReadablePriv; + __DRIdrawable *driReadablePriv; /** * Pointer to screen on which this context was created. */ - __DRIscreenPrivate *driScreenPriv; + __DRIscreen *driScreenPriv; }; /** * Per-screen private driver information. */ -struct __DRIscreenPrivateRec { +struct __DRIscreenRec { /** * Current screen's number */ @@ -428,6 +424,7 @@ struct __DRIscreenPrivateRec { */ struct __DriverAPIRec DriverAPI; + const __DRIextension **extensions; /** * DDX / 2D driver version information. */ @@ -504,7 +501,7 @@ struct __DRIscreenPrivateRec { * context is created when the first "real" context is created on this * screen. */ - __DRIcontextPrivate dummyContextPriv; + __DRIcontext dummyContextPriv; /** * Device-dependent private information (not stored in the SAREA). @@ -518,13 +515,7 @@ struct __DRIscreenPrivateRec { */ __DRIscreen *psc; - /** - * Extensions provided by this driver. - */ - const __DRIextension **extensions; - /* Extensions provided by the loader. */ - const __DRIcontextModesExtension *contextModes; const __DRIgetDrawableInfoExtension *getDrawableInfo; const __DRIsystemTimeExtension *systemTime; const __DRIdamageExtension *damage; @@ -537,13 +528,16 @@ struct __DRIscreenPrivateRec { void *sarea; __DRIEventBuffer *buffer; __DRILock *lock; - __DRIcoreDRI2Extension *core; + __DRIloaderExtension *loader; } dri2; /* The lock actually in use, old sarea or DRI2 */ drmLock *lock; }; +struct __DRIconfigRec { + __GLcontextModes modes; +}; /** * Used to store a version which includes a major range instead of a single @@ -562,13 +556,13 @@ __driUtilMessage(const char *f, ...); extern void -__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp); +__driUtilUpdateDrawableInfo(__DRIdrawable *pdp); extern int -__driParseEvents(__DRIcontextPrivate *psp, __DRIdrawablePrivate *pdp); +__driParseEvents(__DRIcontext *psp, __DRIdrawable *pdp); extern float -driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, +driCalculateSwapUsage( __DRIdrawable *dPriv, int64_t last_swap_ust, int64_t current_ust ); #endif /* _DRI_UTIL_H_ */ diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 6a189e7285..1839ef935a 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -467,8 +467,6 @@ GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, return GL_TRUE; } - - /** * Creates a set of \c __GLcontextModes that a driver will expose. * @@ -536,13 +534,11 @@ GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32, * \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it. */ -GLboolean -driFillInModes( __GLcontextModes ** ptr_to_modes, - GLenum fb_format, GLenum fb_type, - const u_int8_t * depth_bits, const u_int8_t * stencil_bits, - unsigned num_depth_stencil_bits, - const GLenum * db_modes, unsigned num_db_modes, - int visType ) +__DRIconfig ** +driCreateConfigs(GLenum fb_format, GLenum fb_type, + const u_int8_t * depth_bits, const u_int8_t * stencil_bits, + unsigned num_depth_stencil_bits, + const GLenum * db_modes, unsigned num_db_modes) { static const u_int8_t bits_table[3][4] = { /* R G B A */ @@ -606,16 +602,18 @@ driFillInModes( __GLcontextModes ** ptr_to_modes, const u_int8_t * bits; const u_int32_t * masks; const int index = fb_type & 0x07; - __GLcontextModes * modes = *ptr_to_modes; + __DRIconfig **configs, **c; + __GLcontextModes *modes; unsigned i; unsigned j; unsigned k; - + unsigned num_modes; + unsigned num_accum_bits = 2; if ( bytes_per_pixel[ index ] == 0 ) { fprintf( stderr, "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.\n", __FUNCTION__, __LINE__, fb_type ); - return GL_FALSE; + return NULL; } @@ -653,14 +651,23 @@ driFillInModes( __GLcontextModes ** ptr_to_modes, default: fprintf( stderr, "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.\n", __FUNCTION__, __LINE__, fb_format ); - return GL_FALSE; + return NULL; } + num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits; + configs = _mesa_calloc((num_modes + 1) * sizeof *configs); + if (configs == NULL) + return NULL; + c = configs; for ( k = 0 ; k < num_depth_stencil_bits ; k++ ) { for ( i = 0 ; i < num_db_modes ; i++ ) { - for ( j = 0 ; j < 2 ; j++ ) { + for ( j = 0 ; j < num_accum_bits ; j++ ) { + *c = _mesa_malloc (sizeof **c); + modes = &(*c)->modes; + c++; + memset(modes, 0, sizeof *modes); modes->redBits = bits[0]; modes->greenBits = bits[1]; modes->blueBits = bits[2]; @@ -681,7 +688,13 @@ driFillInModes( __GLcontextModes ** ptr_to_modes, modes->stencilBits = stencil_bits[k]; modes->depthBits = depth_bits[k]; - modes->visualType = visType; + modes->transparentPixel = GLX_NONE; + modes->transparentRed = GLX_DONT_CARE; + modes->transparentGreen = GLX_DONT_CARE; + modes->transparentBlue = GLX_DONT_CARE; + modes->transparentAlpha = GLX_DONT_CARE; + modes->transparentIndex = GLX_DONT_CARE; + modes->visualType = GLX_DONT_CARE; modes->renderType = GLX_RGBA_BIT; modes->drawableType = GLX_WINDOW_BIT; modes->rgbMode = GL_TRUE; @@ -700,12 +713,36 @@ driFillInModes( __GLcontextModes ** ptr_to_modes, modes->accumAlphaBits) > 0); modes->haveDepthBuffer = (modes->depthBits > 0); modes->haveStencilBuffer = (modes->stencilBits > 0); - - modes = modes->next; } } } + *c = NULL; + + return configs; +} - *ptr_to_modes = modes; - return GL_TRUE; +const __DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b) +{ + const __DRIconfig **all; + int i, j, index; + + i = 0; + while (a[i] != NULL) + i++; + j = 0; + while (b[j] != NULL) + j++; + + all = _mesa_malloc((i + j + 1) * sizeof *all); + index = 0; + for (i = 0; a[i] != NULL; i++) + all[index++] = a[i]; + for (j = 0; b[j] != NULL; j++) + all[index++] = b[j]; + all[index++] = NULL; + + _mesa_free(a); + _mesa_free(b); + + return all; } diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index b2bab86e66..45a78e5ca5 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -112,10 +112,12 @@ extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height ); -extern GLboolean driFillInModes( __GLcontextModes ** modes, - GLenum fb_format, GLenum fb_type, - const u_int8_t * depth_bits, const u_int8_t * stencil_bits, - unsigned num_depth_stencil_bits, - const GLenum * db_modes, unsigned num_db_modes, int visType ); +extern __DRIconfig ** +driCreateConfigs(GLenum fb_format, GLenum fb_type, + const u_int8_t * depth_bits, const u_int8_t * stencil_bits, + unsigned num_depth_stencil_bits, + const GLenum * db_modes, unsigned num_db_modes); + +const __DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b); #endif /* DRI_DEBUG_H */ diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index d54c65cda4..7fd4e570d3 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -604,35 +604,18 @@ void ffbXMesaUpdateState(ffbContextPtr fmesa) } } -static const struct __DriverAPIRec ffbAPI = { - .DestroyScreen = ffbDestroyScreen, - .CreateContext = ffbCreateContext, - .DestroyContext = ffbDestroyContext, - .CreateBuffer = ffbCreateBuffer, - .DestroyBuffer = ffbDestroyBuffer, - .SwapBuffers = ffbSwapBuffers, - .MakeCurrent = ffbMakeCurrent, - .UnbindContext = ffbUnbindContext, - .GetSwapInfo = NULL, - .GetDrawableMSC = NULL, - .WaitForMSC = NULL, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL -}; - - -static __GLcontextModes * +static const __DRIconfig ** ffbFillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { - __GLcontextModes * modes; - __GLcontextModes * m; - unsigned num_modes; + __DRIconfig **configs; + __GLcontextModes *m; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; GLenum fb_type; + int i; /* GLX_SWAP_COPY_OML is only supported because the FFB driver doesn't * support pageflipping at all. @@ -644,7 +627,6 @@ ffbFillInModes( __DRIscreenPrivate *psp, u_int8_t depth_bits_array[3]; u_int8_t stencil_bits_array[3]; - depth_bits_array[0] = 0; depth_bits_array[1] = depth_bits; depth_bits_array[2] = depth_bits; @@ -660,8 +642,6 @@ ffbFillInModes( __DRIscreenPrivate *psp, depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1; back_buffer_factor = (have_back_buffer) ? 3 : 1; - num_modes = depth_buffer_factor * back_buffer_factor * 4; - if ( pixel_bits == 16 ) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; @@ -671,35 +651,26 @@ ffbFillInModes( __DRIscreenPrivate *psp, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); - m = modes; - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; + configs = driCreateConfigs(fb_format, fb_type, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, + back_buffer_factor); + if (configs == NULL) { + fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, + __LINE__); + return NULL; } - /* Mark the visual as slow if there are "fake" stencil bits. */ - for ( m = modes ; m != NULL ; m = m->next ) { - if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) { - m->visualRating = GLX_SLOW_CONFIG; + for (i = 0; configs[i]; i++) { + m = &configs[i]->modes; + if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { + m->visualRating = GLX_SLOW_CONFIG; } } - return modes; + return (const __DRIconfig **) configs; } @@ -710,7 +681,8 @@ ffbFillInModes( __DRIscreenPrivate *psp, * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +ffbInitScreen(__DRIscreen *psp) { static const __DRIversion ddx_expected = { 0, 1, 1 }; static const __DRIversion dri_expected = { 4, 0, 0 }; @@ -722,10 +694,25 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, & drm_expected ) ) return NULL; - psp->DriverAPI = ffbAPI; - if (!ffbInitDriver(psp)) return NULL; return ffbFillInModes( psp, 32, 16, 0, GL_TRUE ); } + +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = ffbInitScreen, + .DestroyScreen = ffbDestroyScreen, + .CreateContext = ffbCreateContext, + .DestroyContext = ffbDestroyContext, + .CreateBuffer = ffbCreateBuffer, + .DestroyBuffer = ffbDestroyBuffer, + .SwapBuffers = ffbSwapBuffers, + .MakeCurrent = ffbMakeCurrent, + .UnbindContext = ffbUnbindContext, + .GetSwapInfo = NULL, + .GetDrawableMSC = NULL, + .WaitForMSC = NULL, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL +}; diff --git a/src/mesa/drivers/dri/gamma/gamma_xmesa.c b/src/mesa/drivers/dri/gamma/gamma_xmesa.c index f41682cea7..62f0bb578c 100644 --- a/src/mesa/drivers/dri/gamma/gamma_xmesa.c +++ b/src/mesa/drivers/dri/gamma/gamma_xmesa.c @@ -238,7 +238,7 @@ gammaUnbindContext( __DRIcontextPrivate *driContextPriv ) return GL_TRUE; } -static struct __DriverAPIRec gammaAPI = { +const struct __DriverAPIRec driDriverAPI = { gammaInitDriver, gammaDestroyScreen, gammaCreateContext, diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index c5c2a0d6fb..4bfe6f264f 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -56,78 +56,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern const struct dri_extension card_extensions[]; -static __GLcontextModes *fill_in_modes( __GLcontextModes *modes, - unsigned pixel_bits, - unsigned depth_bits, - unsigned stencil_bits, - const GLenum * db_modes, - unsigned num_db_modes, - int visType ) -{ - static const u_int8_t bits[1][4] = { - { 5, 6, 5, 0 } - }; - - static const u_int32_t masks[1][4] = { - { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 } - }; - - unsigned i; - unsigned j; - const unsigned index = 0; - - for ( i = 0 ; i < num_db_modes ; i++ ) { - for ( j = 0 ; j < 2 ; j++ ) { - - modes->redBits = bits[index][0]; - modes->greenBits = bits[index][1]; - modes->blueBits = bits[index][2]; - modes->alphaBits = bits[index][3]; - modes->redMask = masks[index][0]; - modes->greenMask = masks[index][1]; - modes->blueMask = masks[index][2]; - modes->alphaMask = masks[index][3]; - modes->rgbBits = modes->redBits + modes->greenBits - + modes->blueBits + modes->alphaBits; - - modes->accumRedBits = 16 * j; - modes->accumGreenBits = 16 * j; - modes->accumBlueBits = 16 * j; - modes->accumAlphaBits = (masks[index][3] != 0) ? 16 * j : 0; - modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; - - modes->stencilBits = stencil_bits; - modes->depthBits = depth_bits; - - modes->visualType = visType; - modes->renderType = GLX_RGBA_BIT; - modes->drawableType = GLX_WINDOW_BIT; - modes->rgbMode = GL_TRUE; - - if ( db_modes[i] == GLX_NONE ) { - modes->doubleBufferMode = GL_FALSE; - } - else { - modes->doubleBufferMode = GL_TRUE; - modes->swapMethod = db_modes[i]; - } - - modes = modes->next; - } - } - - return modes; - -} - - -static __GLcontextModes * +static const __DRIconfig ** i810FillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) -{ __GLcontextModes * modes; +{ + __DRIconfig **configs; __GLcontextModes * m; - unsigned num_modes; unsigned depth_buffer_factor; unsigned back_buffer_factor; unsigned i; @@ -141,50 +76,42 @@ i810FillInModes( __DRIscreenPrivate *psp, GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */ }; - int depth_buffer_modes[2][2]; - + u_int8_t depth_bits_array[2]; + u_int8_t stencil_bits_array[2]; - depth_buffer_modes[0][0] = depth_bits; - depth_buffer_modes[1][0] = depth_bits; + depth_bits_array[0] = depth_bits; + depth_bits_array[1] = depth_bits; /* Just like with the accumulation buffer, always provide some modes * with a stencil buffer. It will be a sw fallback, but some apps won't * care about that. */ - depth_buffer_modes[0][1] = 0; - depth_buffer_modes[1][1] = (stencil_bits == 0) ? 8 : stencil_bits; + stencil_bits_array[0] = 0; + stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; - num_modes = depth_buffer_factor * back_buffer_factor * 4; - - modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); - m = modes; - for ( i = 0 ; i < depth_buffer_factor ; i++ ) { - m = fill_in_modes( m, pixel_bits, - depth_buffer_modes[i][0], depth_buffer_modes[i][1], - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR ); - } - - for ( i = 0 ; i < depth_buffer_factor ; i++ ) { - m = fill_in_modes( m, pixel_bits, - depth_buffer_modes[i][0], depth_buffer_modes[i][1], - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR ); + configs = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, + back_buffer_modes, back_buffer_factor); + if (configs == NULL) { + fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", + __func__, __LINE__ ); + return NULL; } /* Mark the visual as slow if there are "fake" stencil bits. */ - for ( m = modes ; m != NULL ; m = m->next ) { - if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) { + for (i = 0; configs[i]; i++) { + m = &configs[i]->modes; + if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { m->visualRating = GLX_SLOW_CONFIG; } } - return modes; - + return (const __DRIconfig **) configs; } @@ -220,12 +147,24 @@ static drmBufMapPtr i810_create_empty_buffers(void) } -static GLboolean -i810InitDriver(__DRIscreenPrivate *sPriv) +static const __DRIconfig ** +i810InitScreen(__DRIscreen *sPriv) { + static const __DRIversion ddx_expected = { 1, 0, 0 }; + static const __DRIversion dri_expected = { 4, 0, 0 }; + static const __DRIversion drm_expected = { 1, 2, 0 }; i810ScreenPrivate *i810Screen; I810DRIPtr gDRIPriv = (I810DRIPtr)sPriv->pDevPriv; + if ( ! driCheckDriDdxDrmVersions2( "i810", + &sPriv->dri_version, & dri_expected, + &sPriv->ddx_version, & ddx_expected, + &sPriv->drm_version, & drm_expected ) ) { + return NULL; + } + + driInitExtensions( NULL, card_extensions, GL_TRUE ); + if (sPriv->devPrivSize != sizeof(I810DRIRec)) { fprintf(stderr,"\nERROR! sizeof(I810DRIRec) does not match passed size from device driver\n"); return GL_FALSE; @@ -313,7 +252,7 @@ i810InitDriver(__DRIscreenPrivate *sPriv) i810Screen->sarea_priv_offset = gDRIPriv->sarea_priv_offset; - return GL_TRUE; + return i810FillInModes(sPriv, 16, 16, 0, 1); } static void @@ -402,8 +341,8 @@ i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv) _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } - -static const struct __DriverAPIRec i810API = { +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = i810InitScreen, .DestroyScreen = i810DestroyScreen, .CreateContext = i810CreateContext, .DestroyContext = i810DestroyContext, @@ -418,33 +357,3 @@ static const struct __DriverAPIRec i810API = { .WaitForSBC = NULL, .SwapBuffersMSC = NULL }; - - -/** - * This is the driver specific part of the createNewScreen entry point. - * - * \todo maybe fold this into intelInitDriver - * - * \return the __GLcontextModes supported by this driver - */ -PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) -{ - static const __DRIversion ddx_expected = { 1, 0, 0 }; - static const __DRIversion dri_expected = { 4, 0, 0 }; - static const __DRIversion drm_expected = { 1, 2, 0 }; - - if ( ! driCheckDriDdxDrmVersions2( "i810", - &psp->dri_version, & dri_expected, - &psp->ddx_version, & ddx_expected, - &psp->drm_version, & drm_expected ) ) { - return NULL; - } - - psp->DriverAPI = i810API; - driInitExtensions( NULL, card_extensions, GL_TRUE ); - - if (!i810InitDriver(psp)) - return NULL; - - return i810FillInModes(psp, 16, 16, 0, 1); -} diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index e2388dbb09..47e7d1afc2 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -848,7 +848,6 @@ intelContendedLock(struct intel_context *intel, GLuint flags) __DRIdrawablePrivate *dPriv = intel->driDrawable; __DRIscreenPrivate *sPriv = intel->driScreen; volatile struct drm_i915_sarea *sarea = intel->sarea; - int drawable_changed = 0; int me = intel->hHWContext; drmGetLock(intel->driFd, intel->hHWContext, flags); @@ -862,12 +861,8 @@ intelContendedLock(struct intel_context *intel, GLuint flags) * NOTE: This releases and regains the hw lock, so all state * checking must be done *after* this call: */ - if (dPriv) { - if (sPriv->dri2.enabled) - drawable_changed = __driParseEvents(dPriv->driContextPriv, dPriv); - else - DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv); - } + if (dPriv) + DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv); if (sarea && sarea->ctxOwner != me) { if (INTEL_DEBUG & DEBUG_BUFMGR) { @@ -892,48 +887,43 @@ intelContendedLock(struct intel_context *intel, GLuint flags) sarea->ctxOwner, intel->hHWContext); } - if (!sPriv->dri2.enabled) { - if (sarea->width != intel->width || sarea->height != intel->height) { - int numClipRects = intel->numClipRects; + if (sarea->width != intel->width || sarea->height != intel->height) { + int numClipRects = intel->numClipRects; - /* - * FIXME: Really only need to do this when drawing to a - * common back- or front buffer. - */ + /* + * FIXME: Really only need to do this when drawing to a + * common back- or front buffer. + */ - /* - * This will essentially drop the outstanding batchbuffer on - * the floor. - */ - intel->numClipRects = 0; + /* + * This will essentially drop the outstanding batchbuffer on + * the floor. + */ + intel->numClipRects = 0; - if (intel->Fallback) - _swrast_flush(&intel->ctx); + if (intel->Fallback) + _swrast_flush(&intel->ctx); - if (!IS_965(intel->intelScreen->deviceID)) - INTEL_FIREVERTICES(intel); + if (!IS_965(intel->intelScreen->deviceID)) + INTEL_FIREVERTICES(intel); - if (intel->batch->map != intel->batch->ptr) - intel_batchbuffer_flush(intel->batch); + if (intel->batch->map != intel->batch->ptr) + intel_batchbuffer_flush(intel->batch); - intel->numClipRects = numClipRects; + intel->numClipRects = numClipRects; - /* force window update */ - intel->lastStamp = 0; + /* force window update */ + intel->lastStamp = 0; - intel->width = sarea->width; - intel->height = sarea->height; - } + intel->width = sarea->width; + intel->height = sarea->height; + } - /* Drawable changed? - */ - if (dPriv && intel->lastStamp != dPriv->lastStamp) { - intelWindowMoved(intel); - intel->lastStamp = dPriv->lastStamp; - } - } else if (drawable_changed) { - intelWindowMoved(intel); - intel_draw_buffer(&intel->ctx, intel->ctx.DrawBuffer); + /* Drawable changed? + */ + if (dPriv && intel->lastStamp != dPriv->lastStamp) { + intelWindowMoved(intel); + intel->lastStamp = dPriv->lastStamp; } } @@ -944,13 +934,15 @@ _glthread_DECLARE_STATIC_MUTEX(lockMutex); */ void LOCK_HARDWARE( struct intel_context *intel ) { - __DRIdrawablePrivate *dPriv = intel->driDrawable; + __DRIdrawable *dPriv = intel->driDrawable; + __DRIscreen *sPriv = intel->driScreen; char __ret = 0; struct intel_framebuffer *intel_fb = NULL; struct intel_renderbuffer *intel_rb = NULL; _glthread_LOCK_MUTEX(lockMutex); assert(!intel->locked); + intel->locked = 1; if (intel->driDrawable) { intel_fb = intel->driDrawable->driverPrivate; @@ -980,10 +972,18 @@ void LOCK_HARDWARE( struct intel_context *intel ) DRM_CAS(intel->driHwLock, intel->hHWContext, (DRM_LOCK_HELD|intel->hHWContext), __ret); - if (__ret) + if (sPriv->dri2.enabled) { + if (__ret) + drmGetLock(intel->driFd, intel->hHWContext, 0); + if (__driParseEvents(dPriv->driContextPriv, dPriv)) { + intelWindowMoved(intel); + intel_draw_buffer(&intel->ctx, intel->ctx.DrawBuffer); + } + } else if (__ret) { intelContendedLock( intel, 0 ); + } + - intel->locked = 1; if (INTEL_DEBUG & DEBUG_LOCK) _mesa_printf("%s - locked\n", __progname); } diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 3d46073daa..5aeb2a18f4 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -394,7 +394,7 @@ static const __DRItexBufferExtension intelTexBufferExtension = { intelSetTexBuffer, }; -static const __DRIextension *intelExtensions[] = { +static const __DRIextension *intelScreenExtensions[] = { &driReadDrawableExtension, &driCopySubBufferExtension.base, &driSwapControlExtension.base, @@ -479,7 +479,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) &intelScreen->allow_batchbuffer)) return GL_FALSE; - sPriv->extensions = intelExtensions; + sPriv->extensions = intelScreenExtensions; return GL_TRUE; } @@ -653,39 +653,18 @@ intelCreateContext(const __GLcontextModes * mesaVis, } -static const struct __DriverAPIRec intelAPI = { - .DestroyScreen = intelDestroyScreen, - .CreateContext = intelCreateContext, - .DestroyContext = intelDestroyContext, - .CreateBuffer = intelCreateBuffer, - .DestroyBuffer = intelDestroyBuffer, - .SwapBuffers = intelSwapBuffers, - .MakeCurrent = intelMakeCurrent, - .UnbindContext = intelUnbindContext, - .GetSwapInfo = intelGetSwapInfo, - .GetDrawableMSC = driDrawableGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL, - .CopySubBuffer = intelCopySubBuffer, - - .HandleDrawableConfig = intelHandleDrawableConfig, - .HandleBufferAttach = intelHandleBufferAttach, -}; - - -static __GLcontextModes * +static __DRIconfig ** intelFillInModes(__DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer) { - __GLcontextModes *modes; + __DRIconfig **configs; __GLcontextModes *m; - unsigned num_modes; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; GLenum fb_type; + int i; /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't * support pageflipping at all. @@ -697,7 +676,6 @@ intelFillInModes(__DRIscreenPrivate *psp, u_int8_t depth_bits_array[3]; u_int8_t stencil_bits_array[3]; - depth_bits_array[0] = 0; depth_bits_array[1] = depth_bits; depth_bits_array[2] = depth_bits; @@ -716,8 +694,6 @@ intelFillInModes(__DRIscreenPrivate *psp, depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1; back_buffer_factor = (have_back_buffer) ? 3 : 1; - num_modes = depth_buffer_factor * back_buffer_factor * 4; - if (pixel_bits == 16) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; @@ -727,36 +703,26 @@ intelFillInModes(__DRIscreenPrivate *psp, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = - (*psp->contextModes->createContextModes) (num_modes, - sizeof(__GLcontextModes)); - m = modes; - if (!driFillInModes(&m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, - depth_buffer_factor, back_buffer_modes, - back_buffer_factor, GLX_TRUE_COLOR)) { - fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, - __LINE__); - return NULL; - } - if (!driFillInModes(&m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, - depth_buffer_factor, back_buffer_modes, - back_buffer_factor, GLX_DIRECT_COLOR)) { - fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, + configs = driCreateConfigs(fb_format, fb_type, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, + back_buffer_factor); + if (configs == NULL) { + fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); return NULL; } /* Mark the visual as slow if there are "fake" stencil bits. */ - for (m = modes; m != NULL; m = m->next) { + for (i = 0; configs[i]; i++) { + m = &configs[i]->modes; if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { m->visualRating = GLX_SLOW_CONFIG; } } - return modes; + return configs; } @@ -767,7 +733,7 @@ intelFillInModes(__DRIscreenPrivate *psp, * * \return the __GLcontextModes supported by this driver */ -PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig **intelInitScreen(__DRIscreenPrivate *psp) { #ifdef I915 static const __DRIversion ddx_expected = { 1, 5, 0 }; @@ -778,8 +744,6 @@ PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) static const __DRIversion drm_expected = { 1, 5, 0 }; I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - psp->DriverAPI = intelAPI; - if (!driCheckDriDdxDrmVersions2("i915", &psp->dri_version, &dri_expected, &psp->ddx_version, &ddx_expected, @@ -802,9 +766,12 @@ PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!intelInitDriver(psp)) return NULL; - return intelFillInModes(psp, dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, 1); + psp->extensions = intelScreenExtensions; + + return (const __DRIconfig **) + intelFillInModes(psp, dri_priv->cpp * 8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, 1); } struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen) @@ -827,12 +794,10 @@ struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen) * * \return the __GLcontextModes supported by this driver */ -PUBLIC __GLcontextModes *__dri2DriverInitScreen(__DRIscreenPrivate *psp) +static const +__DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) { intelScreenPrivate *intelScreen; - __GLcontextModes *modes, *m; - - psp->DriverAPI = intelAPI; /* Calling driInitExtensions here, with a NULL context pointer, * does not actually enable the extensions. It just makes sure @@ -881,12 +846,28 @@ PUBLIC __GLcontextModes *__dri2DriverInitScreen(__DRIscreenPrivate *psp) return GL_FALSE; } - psp->extensions = intelExtensions; + psp->extensions = intelScreenExtensions; - modes = intelFillInModes(psp, 16, 16, 0, 1); - for (m = modes; m->next != NULL; m = m->next) - ; - m->next = intelFillInModes(psp, 32, 24, 8, 1); - - return modes; + return driConcatConfigs(intelFillInModes(psp, 16, 16, 0, 1), + intelFillInModes(psp, 32, 24, 8, 1)); } + +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = intelInitScreen, + .DestroyScreen = intelDestroyScreen, + .CreateContext = intelCreateContext, + .DestroyContext = intelDestroyContext, + .CreateBuffer = intelCreateBuffer, + .DestroyBuffer = intelDestroyBuffer, + .SwapBuffers = intelSwapBuffers, + .MakeCurrent = intelMakeCurrent, + .UnbindContext = intelUnbindContext, + .GetSwapInfo = intelGetSwapInfo, + .GetDrawableMSC = driDrawableGetMSC32, + .WaitForMSC = driWaitForMSC32, + .CopySubBuffer = intelCopySubBuffer, + + .InitScreen2 = intelInitScreen2, + .HandleDrawableConfig = intelHandleDrawableConfig, + .HandleBufferAttach = intelHandleBufferAttach, +}; diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index dd8fbeaa91..a56a395646 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -676,8 +676,7 @@ void intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch) { - struct intel_context *intel = (struct intel_context*) - ((__DRIcontextPrivate*)pDRICtx->private)->driverPrivate; + struct intel_context *intel = pDRICtx->driverPrivate; struct gl_texture_object *tObj = _mesa_lookup_texture(&intel->ctx, texname); struct intel_texture_object *intelObj = intel_texture_object(tObj); @@ -696,12 +695,10 @@ intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname, } void -intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *pDraw) +intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) { - __DRIcontextPrivate *driContext = pDRICtx->private; - __DRIdrawablePrivate *dPriv = pDraw->private; struct intel_framebuffer *intel_fb = dPriv->driverPrivate; - struct intel_context *intel = driContext->driverPrivate; + struct intel_context *intel = pDRICtx->driverPrivate; struct intel_texture_object *intelObj; struct intel_texture_image *intelImage; struct intel_mipmap_tree *mt; @@ -718,7 +715,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *pDraw) if (!intelObj) return; - __driParseEvents(driContext, dPriv); + __driParseEvents(pDRICtx, dPriv); rb = intel_fb->color_rb[0]; type = GL_BGRA; diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 63b9d8077d..2dba50fc1f 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -69,80 +69,15 @@ static const GLuint __driNConfigOptions = 2; extern const struct dri_extension card_extensions[]; -static __GLcontextModes * fill_in_modes( __GLcontextModes * modes, - unsigned pixel_bits, - unsigned depth_bits, - unsigned stencil_bits, - const GLenum * db_modes, - unsigned num_db_modes, - int visType ) -{ - static const u_int8_t bits[2][4] = { - { 5, 6, 5, 0 }, - { 8, 8, 8, 0 } - }; - - static const u_int32_t masks[2][4] = { - { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, - { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 } - }; - - unsigned i; - unsigned j; - const unsigned index = ((pixel_bits + 15) / 16) - 1; - - for ( i = 0 ; i < num_db_modes ; i++ ) { - for ( j = 0 ; j < 2 ; j++ ) { - - modes->redBits = bits[index][0]; - modes->greenBits = bits[index][1]; - modes->blueBits = bits[index][2]; - modes->alphaBits = bits[index][3]; - modes->redMask = masks[index][0]; - modes->greenMask = masks[index][1]; - modes->blueMask = masks[index][2]; - modes->alphaMask = masks[index][3]; - modes->rgbBits = modes->redBits + modes->greenBits - + modes->blueBits + modes->alphaBits; - - modes->accumRedBits = 16 * j; - modes->accumGreenBits = 16 * j; - modes->accumBlueBits = 16 * j; - modes->accumAlphaBits = 0; - modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; - modes->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT; - modes->stencilBits = stencil_bits; - modes->depthBits = depth_bits; - - modes->visualType = visType; - modes->renderType = GLX_RGBA_BIT; - modes->rgbMode = GL_TRUE; - - if ( db_modes[i] == GLX_NONE ) { - - modes->doubleBufferMode = GL_FALSE; - } - else { - modes->doubleBufferMode = GL_TRUE; - modes->swapMethod = db_modes[i]; - } - - modes = modes->next; - } - } - - return modes; -} - - -static __GLcontextModes * +static const __DRIconfig ** mach64FillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { - __GLcontextModes * modes; + __DRIconfig **configs; __GLcontextModes * m; - unsigned num_modes; + GLenum fb_format; + GLenum fb_type; unsigned depth_buffer_factor; unsigned back_buffer_factor; unsigned i; @@ -156,49 +91,51 @@ mach64FillInModes( __DRIscreenPrivate *psp, GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */ }; - int depth_buffer_modes[2][2]; - + u_int8_t depth_bits_array[2]; + u_int8_t stencil_bits_array[2]; - depth_buffer_modes[0][0] = depth_bits; - depth_buffer_modes[1][0] = depth_bits; + depth_bits_array[0] = depth_bits; + depth_bits_array[1] = depth_bits; /* Just like with the accumulation buffer, always provide some modes * with a stencil buffer. It will be a sw fallback, but some apps won't * care about that. */ - depth_buffer_modes[0][1] = 0; - depth_buffer_modes[1][1] = (stencil_bits == 0) ? 8 : stencil_bits; + stencil_bits_array[0] = 0; + stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; - num_modes = depth_buffer_factor * back_buffer_factor * 4; - - modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); - m = modes; - for ( i = 0 ; i < depth_buffer_factor ; i++ ) { - m = fill_in_modes( m, pixel_bits, - depth_buffer_modes[i][0], depth_buffer_modes[i][1], - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR ); + if (pixel_bits == 16) { + fb_format = GL_RGB; + fb_type = GL_UNSIGNED_SHORT_5_6_5; + } + else { + fb_format = GL_BGRA; + fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - for ( i = 0 ; i < depth_buffer_factor ; i++ ) { - m = fill_in_modes( m, pixel_bits, - depth_buffer_modes[i][0], depth_buffer_modes[i][1], - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR ); + configs = driCreateConfigs(fb_format, fb_type, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, + back_buffer_factor); + if (configs == NULL) { + fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", + __func__, __LINE__); + return NULL; } /* Mark the visual as slow if there are "fake" stencil bits. */ - for ( m = modes ; m != NULL ; m = m->next ) { - if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ){ - m->visualRating = GLX_SLOW_CONFIG; - } + for (i = 0; configs[i]; i++) { + m = &configs[i]->modes; + if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { + m->visualRating = GLX_SLOW_CONFIG; + } } - return modes; + return (const __DRIconfig **) configs; } @@ -473,24 +410,6 @@ mach64InitDriver( __DRIscreenPrivate *driScreen ) return GL_TRUE; } - -static struct __DriverAPIRec mach64API = { - .DestroyScreen = mach64DestroyScreen, - .CreateContext = mach64CreateContext, - .DestroyContext = mach64DestroyContext, - .CreateBuffer = mach64CreateBuffer, - .DestroyBuffer = mach64DestroyBuffer, - .SwapBuffers = mach64SwapBuffers, - .MakeCurrent = mach64MakeCurrent, - .UnbindContext = mach64UnbindContext, - .GetSwapInfo = NULL, - .GetDrawableMSC = driDrawableGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL -}; - - /** * This is the driver specific part of the createNewScreen entry point. * @@ -498,14 +417,14 @@ static struct __DriverAPIRec mach64API = { * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +mach64InitScreen(__DRIscreenPrivate *psp) { static const __DRIversion ddx_expected = { 6, 4, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 0, 0 }; ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv; - psp->DriverAPI = mach64API; if ( ! driCheckDriDdxDrmVersions2( "Mach64", &psp->dri_version, & dri_expected, &psp->ddx_version, & ddx_expected, @@ -530,3 +449,21 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) return mach64FillInModes( psp, dri_priv->cpp * 8, 16, 0, 1); } + +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = mach64InitScreen, + .DestroyScreen = mach64DestroyScreen, + .CreateContext = mach64CreateContext, + .DestroyContext = mach64DestroyContext, + .CreateBuffer = mach64CreateBuffer, + .DestroyBuffer = mach64DestroyBuffer, + .SwapBuffers = mach64SwapBuffers, + .MakeCurrent = mach64MakeCurrent, + .UnbindContext = mach64UnbindContext, + .GetSwapInfo = NULL, + .GetDrawableMSC = driDrawableGetMSC32, + .WaitForMSC = driWaitForMSC32, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL +}; + diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 7f2f71d309..c271c8ef59 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -112,20 +112,18 @@ static const GLuint __driNConfigOptions = 6; int MGA_DEBUG = 0; #endif -static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ); - -static __GLcontextModes * +static const __DRIconfig ** mgaFillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { - __GLcontextModes * modes; + __DRIconfig **configs; __GLcontextModes * m; - unsigned num_modes; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; GLenum fb_type; + int i; /* GLX_SWAP_COPY_OML is only supported because the MGA driver doesn't * support pageflipping at all. @@ -153,8 +151,6 @@ mgaFillInModes( __DRIscreenPrivate *psp, depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; - num_modes = depth_buffer_factor * back_buffer_factor * 4; - if ( pixel_bits == 16 ) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; @@ -164,39 +160,29 @@ mgaFillInModes( __DRIscreenPrivate *psp, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); - m = modes; - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR ) ) { + configs = driCreateConfigs(fb_format, fb_type, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, + back_buffer_modes, back_buffer_factor); + if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__ ); return NULL; } - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - - /* Mark the visual as slow if there are "fake" stencil bits. - */ - for ( m = modes ; m != NULL ; m = m->next ) { - if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) { - m->visualRating = GLX_SLOW_CONFIG; - } - } + /* Mark the visual as slow if there are "fake" stencil bits. + */ + for (i = 0; configs[i]; i++) { + m = &configs[i]->modes; + if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { + m->visualRating = GLX_SLOW_CONFIG; + } + } - return modes; + return (const __DRIconfig **) configs; } - -static const __DRIextension *mgaExtensions[] = { +const __DRIextension *mgaScreenExtensions[] = { &driReadDrawableExtension, &driSwapControlExtension.base, &driFrameTrackingExtension.base, @@ -243,7 +229,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) } } - sPriv->extensions = mgaExtensions; + sPriv->extensions = mgaScreenExtensions; if (serverInfo->chipset != MGA_CARD_TYPE_G200 && serverInfo->chipset != MGA_CARD_TYPE_G400) { @@ -941,23 +927,6 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags ) } -static const struct __DriverAPIRec mgaAPI = { - .DestroyScreen = mgaDestroyScreen, - .CreateContext = mgaCreateContext, - .DestroyContext = mgaDestroyContext, - .CreateBuffer = mgaCreateBuffer, - .DestroyBuffer = mgaDestroyBuffer, - .SwapBuffers = mgaSwapBuffers, - .MakeCurrent = mgaMakeCurrent, - .UnbindContext = mgaUnbindContext, - .GetSwapInfo = getSwapInfo, - .GetDrawableMSC = driDrawableGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL -}; - - /** * This is the driver specific part of the createNewScreen entry point. * @@ -965,14 +934,13 @@ static const struct __DriverAPIRec mgaAPI = { * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig **mgaInitScreen(__DRIscreen *psp) { static const __DRIversion ddx_expected = { 1, 2, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 3, 0, 0 }; MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv; - psp->DriverAPI = mgaAPI; if ( ! driCheckDriDdxDrmVersions2( "MGA", &psp->dri_version, & dri_expected, &psp->ddx_version, & ddx_expected, @@ -1032,3 +1000,20 @@ getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ) return 0; } + +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = mgaInitScreen, + .DestroyScreen = mgaDestroyScreen, + .CreateContext = mgaCreateContext, + .DestroyContext = mgaDestroyContext, + .CreateBuffer = mgaCreateBuffer, + .DestroyBuffer = mgaDestroyBuffer, + .SwapBuffers = mgaSwapBuffers, + .MakeCurrent = mgaMakeCurrent, + .UnbindContext = mgaUnbindContext, + .GetSwapInfo = getSwapInfo, + .GetDrawableMSC = driDrawableGetMSC32, + .WaitForMSC = driWaitForMSC32, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL +}; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 53d00e17a1..e4463fb31a 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -195,44 +195,13 @@ nouveauGetSwapInfo(__DRIdrawablePrivate *dpriv, __DRIswapInfo *sInfo) return -1; } -static const struct __DriverAPIRec nouveauAPI = { - .DestroyScreen = nouveauDestroyScreen, - .CreateContext = nouveauCreateContext, - .DestroyContext = nouveauDestroyContext, - .CreateBuffer = nouveauCreateBuffer, - .DestroyBuffer = nouveauDestroyBuffer, - .SwapBuffers = nouveauSwapBuffers, - .MakeCurrent = nouveauMakeCurrent, - .UnbindContext = nouveauUnbindContext, - .GetSwapInfo = nouveauGetSwapInfo, - .GetDrawableMSC = driDrawableGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL, - .CopySubBuffer = nouveauCopySubBuffer -}; - - -static __GLcontextModes * +static __DRIconfig ** nouveauFillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { - __GLcontextModes * modes; - __GLcontextModes * m; - unsigned num_modes; unsigned depth_buffer_factor; unsigned back_buffer_factor; - int i; - - static const struct { - GLenum format; - GLenum type; - } fb_format_array[] = { - { GL_RGB , GL_UNSIGNED_SHORT_5_6_5 }, - { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV }, - { GL_BGR , GL_UNSIGNED_INT_8_8_8_8_REV }, - }; /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't * support pageflipping at all. @@ -247,41 +216,22 @@ nouveauFillInModes( __DRIscreenPrivate *psp, depth_buffer_factor = 4; back_buffer_factor = (have_back_buffer) ? 3 : 1; - num_modes = ((pixel_bits==16) ? 1 : 2) * - depth_buffer_factor * back_buffer_factor * 4; - modes = (*psp->contextModes->createContextModes)(num_modes, - sizeof(__GLcontextModes)); - m = modes; - - for (i=((pixel_bits==16)?0:1);i<((pixel_bits==16)?1:3);i++) { - if (!driFillInModes(&m, fb_format_array[i].format, - fb_format_array[i].type, - depth_bits_array, - stencil_bits_array, - depth_buffer_factor, - back_buffer_modes, - back_buffer_factor, - GLX_TRUE_COLOR)) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - - if (!driFillInModes(&m, fb_format_array[i].format, - fb_format_array[i].type, - depth_bits_array, - stencil_bits_array, - depth_buffer_factor, - back_buffer_modes, - back_buffer_factor, - GLX_DIRECT_COLOR)) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - } - - return modes; + if (pixel_bits == 16) + return driCreateConfigs(GL_RGB, + GL_UNSIGNED_SHORT_5_6_5, + depth_bits_array, + stencil_bits_array, + depth_buffer_factor, + back_buffer_modes, + back_buffer_factor); + else + return driCreateConfigs(GL_RGBA, + GL_UNSIGNED_INT_8_8_8_8_REV, + depth_bits_array, + stencil_bits_array, + depth_buffer_factor, + back_buffer_modes, + back_buffer_factor); } @@ -292,7 +242,8 @@ nouveauFillInModes( __DRIscreenPrivate *psp, * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +nouveauInitScreen(__DRIscreenPrivate *psp) { static const __DRIversion ddx_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL }; static const __DRIversion dri_expected = { 4, 0, 0 }; @@ -321,8 +272,6 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) return NULL; } - psp->DriverAPI = nouveauAPI; - /* Calling driInitExtensions here, with a NULL context * pointer, does not actually enable the extensions. It just * makes sure that all the dispatch offsets for all the @@ -343,10 +292,34 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!nouveauInitDriver(psp)) return NULL; - return nouveauFillInModes(psp, - dri_priv->bpp, - (dri_priv->bpp == 16) ? 16 : 24, - (dri_priv->bpp == 16) ? 0 : 8, - 1); + return (const __DRIconfig **) + nouveauFillInModes(psp, + dri_priv->bpp, + (dri_priv->bpp == 16) ? 16 : 24, + (dri_priv->bpp == 16) ? 0 : 8, + 1); } +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = nouveauInitScreen, + .DestroyScreen = nouveauDestroyScreen, + .CreateContext = nouveauCreateContext, + .DestroyContext = nouveauDestroyContext, + .CreateBuffer = nouveauCreateBuffer, + .DestroyBuffer = nouveauDestroyBuffer, + .SwapBuffers = nouveauSwapBuffers, + .MakeCurrent = nouveauMakeCurrent, + .UnbindContext = nouveauUnbindContext, + .GetSwapInfo = nouveauGetSwapInfo, + .GetDrawableMSC = driDrawableGetMSC32, + .WaitForMSC = driWaitForMSC32, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL, + .CopySubBuffer = nouveauCopySubBuffer +}; + +const __DRIextension *__driDriverExtensions[] = { + &driCoreExtension.base, + &driLegacyExtension.base, + NULL +}; diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 335af974cf..7b544acf3b 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -399,37 +399,18 @@ r128InitDriver( __DRIscreenPrivate *sPriv ) return GL_TRUE; } - -static struct __DriverAPIRec r128API = { - .DestroyScreen = r128DestroyScreen, - .CreateContext = r128CreateContext, - .DestroyContext = r128DestroyContext, - .CreateBuffer = r128CreateBuffer, - .DestroyBuffer = r128DestroyBuffer, - .SwapBuffers = r128SwapBuffers, - .MakeCurrent = r128MakeCurrent, - .UnbindContext = r128UnbindContext, - .GetSwapInfo = NULL, - .GetDrawableMSC = driDrawableGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL - -}; - - -static __GLcontextModes * +static const __DRIconfig ** r128FillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { - __GLcontextModes * modes; + __DRIconfig **configs; __GLcontextModes * m; - unsigned num_modes; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; GLenum fb_type; + int i; /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy * enough to add support. Basically, if a context is created with an @@ -457,8 +438,6 @@ r128FillInModes( __DRIscreenPrivate *psp, depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; - num_modes = depth_buffer_factor * back_buffer_factor * 4; - if ( pixel_bits == 16 ) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; @@ -468,35 +447,26 @@ r128FillInModes( __DRIscreenPrivate *psp, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); - m = modes; - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } + configs = driCreateConfigs(fb_format, fb_type, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, + back_buffer_factor); + if (configs == NULL) { + fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, + __LINE__); + return NULL; + } - /* Mark the visual as slow if there are "fake" stencil bits. - */ - for ( m = modes ; m != NULL ; m = m->next ) { - if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) { - m->visualRating = GLX_SLOW_CONFIG; - } - } + /* Mark the visual as slow if there are "fake" stencil bits. + */ + for (i = 0; configs[i]; i++) { + m = &configs[i]->modes; + if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { + m->visualRating = GLX_SLOW_CONFIG; + } + } - return modes; + return (const __DRIconfig **) configs; } @@ -507,14 +477,14 @@ r128FillInModes( __DRIscreenPrivate *psp, * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +r128InitScreen(__DRIscreenPrivate *psp) { static const __DRIversion ddx_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 2, 0 }; R128DRIPtr dri_priv = (R128DRIPtr) psp->pDevPriv; - psp->DriverAPI = r128API; if ( ! driCheckDriDdxDrmVersions2( "Rage128", &psp->dri_version, & dri_expected, &psp->ddx_version, & ddx_expected, @@ -542,3 +512,20 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) (dri_priv->bpp == 16) ? 0 : 8, (dri_priv->backOffset != dri_priv->depthOffset) ); } + +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = r128InitScreen, + .DestroyScreen = r128DestroyScreen, + .CreateContext = r128CreateContext, + .DestroyContext = r128DestroyContext, + .CreateBuffer = r128CreateBuffer, + .DestroyBuffer = r128DestroyBuffer, + .SwapBuffers = r128SwapBuffers, + .MakeCurrent = r128MakeCurrent, + .UnbindContext = r128UnbindContext, + .GetSwapInfo = NULL, + .GetDrawableMSC = driDrawableGetMSC32, + .WaitForMSC = driWaitForMSC32, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL +}; diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 94701ef1ca..05ff5952f3 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -979,9 +979,7 @@ static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit, int slot, GLuin void r200SetTexOffset(__DRIcontext * pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch) { - r200ContextPtr rmesa = - (r200ContextPtr) ((__DRIcontextPrivate *) pDRICtx->private)-> - driverPrivate; + r200ContextPtr rmesa = pDRICtx->driverPrivate; struct gl_texture_object *tObj = _mesa_lookup_texture(rmesa->glCtx, texname); r200TexObjPtr t; diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index efa201a52d..43d1406da3 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -569,9 +569,7 @@ static GLboolean r300UpdateTexture(GLcontext * ctx, int unit) void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch) { - r300ContextPtr rmesa = - (r300ContextPtr) ((__DRIcontextPrivate *) pDRICtx->private)-> - driverPrivate; + r300ContextPtr rmesa = pDRICtx->driverPrivate; struct gl_texture_object *tObj = _mesa_lookup_texture(rmesa->radeon.glCtx, texname); r300TexObjPtr t; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index d6caa2ac89..27d233cc42 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -252,18 +252,18 @@ radeonGetParam(int fd, int param, void *value) return ret; } -static __GLcontextModes * +static const __DRIconfig ** radeonFillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { - __GLcontextModes * modes; - __GLcontextModes * m; - unsigned num_modes; + __DRIconfig **configs; + __GLcontextModes *m; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; GLenum fb_type; + int i; /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy * enough to add support. Basically, if a context is created with an @@ -291,8 +291,6 @@ radeonFillInModes( __DRIscreenPrivate *psp, depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; - num_modes = depth_buffer_factor * back_buffer_factor * 4; - if ( pixel_bits == 16 ) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; @@ -302,21 +300,11 @@ radeonFillInModes( __DRIscreenPrivate *psp, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); - m = modes; - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR ) ) { + configs = driCreateConfigs(fb_format, fb_type, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, + back_buffer_modes, back_buffer_factor); + if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__ ); return NULL; @@ -324,13 +312,14 @@ radeonFillInModes( __DRIscreenPrivate *psp, /* Mark the visual as slow if there are "fake" stencil bits. */ - for ( m = modes ; m != NULL ; m = m->next ) { - if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) { + for (i = 0; configs[i]; i++) { + m = &configs[i]->modes; + if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { m->visualRating = GLX_SLOW_CONFIG; } } - return modes; + return (const __DRIconfig **) configs; } #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) @@ -989,43 +978,6 @@ static void radeonDestroyContext(__DRIcontextPrivate * driContextPriv) #endif -#if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) -static struct __DriverAPIRec radeonAPI = { - .DestroyScreen = radeonDestroyScreen, - .CreateContext = radeonCreateContext, - .DestroyContext = radeonDestroyContext, - .CreateBuffer = radeonCreateBuffer, - .DestroyBuffer = radeonDestroyBuffer, - .SwapBuffers = radeonSwapBuffers, - .MakeCurrent = radeonMakeCurrent, - .UnbindContext = radeonUnbindContext, - .GetSwapInfo = getSwapInfo, - .GetDrawableMSC = driDrawableGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL, - .CopySubBuffer = radeonCopySubBuffer, -}; -#else -static const struct __DriverAPIRec r200API = { - .DestroyScreen = radeonDestroyScreen, - .CreateContext = r200CreateContext, - .DestroyContext = r200DestroyContext, - .CreateBuffer = radeonCreateBuffer, - .DestroyBuffer = radeonDestroyBuffer, - .SwapBuffers = r200SwapBuffers, - .MakeCurrent = r200MakeCurrent, - .UnbindContext = r200UnbindContext, - .GetSwapInfo = getSwapInfo, - .GetDrawableMSC = driDrawableGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL, - .CopySubBuffer = r200CopySubBuffer, -}; -#endif - - /** * This is the driver specific part of the createNewScreen entry point. * @@ -1033,7 +985,8 @@ static const struct __DriverAPIRec r200API = { * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +radeonInitScreen(__DRIscreenPrivate *psp) { #if !RADEON_COMMON static const char *driver_name = "Radeon"; @@ -1059,11 +1012,6 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, & drm_expected ) ) { return NULL; } -#if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) - psp->DriverAPI = radeonAPI; -#elif RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - psp->DriverAPI = r200API; -#endif /* Calling driInitExtensions here, with a NULL context pointer, * does not actually enable the extensions. It just makes sure @@ -1124,3 +1072,41 @@ getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ) return 0; } + +#if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = radeonInitScreen, + .DestroyScreen = radeonDestroyScreen, + .CreateContext = radeonCreateContext, + .DestroyContext = radeonDestroyContext, + .CreateBuffer = radeonCreateBuffer, + .DestroyBuffer = radeonDestroyBuffer, + .SwapBuffers = radeonSwapBuffers, + .MakeCurrent = radeonMakeCurrent, + .UnbindContext = radeonUnbindContext, + .GetSwapInfo = getSwapInfo, + .GetDrawableMSC = driDrawableGetMSC32, + .WaitForMSC = driWaitForMSC32, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL, + .CopySubBuffer = radeonCopySubBuffer, +}; +#else +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = radeonInitScreen, + .DestroyScreen = radeonDestroyScreen, + .CreateContext = r200CreateContext, + .DestroyContext = r200DestroyContext, + .CreateBuffer = radeonCreateBuffer, + .DestroyBuffer = radeonDestroyBuffer, + .SwapBuffers = r200SwapBuffers, + .MakeCurrent = r200MakeCurrent, + .UnbindContext = r200UnbindContext, + .GetSwapInfo = getSwapInfo, + .GetDrawableMSC = driDrawableGetMSC32, + .WaitForMSC = driWaitForMSC32, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL, + .CopySubBuffer = r200CopySubBuffer, +}; +#endif diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c index 7b0b006b69..663dabdb91 100644 --- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c +++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c @@ -17,8 +17,8 @@ /* #define DEBUG(str) printf str */ -static GLboolean -s3vInitDriver(__DRIscreenPrivate *sPriv) +static const __DRIconfig ** +s3vInitScreen(__DRIscreen *sPriv) { sPriv->private = (void *) s3vCreateScreen( sPriv ); @@ -27,7 +27,7 @@ s3vInitDriver(__DRIscreenPrivate *sPriv) return GL_FALSE; } - return GL_TRUE; + return NULL; } static void @@ -327,36 +327,14 @@ s3vUnbindContext( __DRIcontextPrivate *driContextPriv ) return GL_TRUE; } - -static struct __DriverAPIRec s3vAPI = { - s3vDestroyScreen, - s3vCreateContext, - s3vDestroyContext, - s3vCreateBuffer, - s3vDestroyBuffer, - s3vSwapBuffers, - s3vMakeCurrent, - s3vUnbindContext, +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = s3vInitScreen, + .DestroyScreen = s3vDestroyScreen, + .CreateContext = s3vCreateContext, + .DestroyContext = s3vDestroyContext, + .CreateBuffer = s3vCreateBuffer, + .DestroyBuffer = s3vDestroyBuffer, + .SwapBuffers = s3vSwapBuffers, + .MakeCurrent = s3vMakeCurrent, + .UnbindContext = s3vUnbindContext, }; - - -#if 0 -/* - * This is the bootstrap function for the driver. - * The __driCreateScreen name is the symbol that libGL.so fetches. - * Return: pointer to a __DRIscreenPrivate. - */ -void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, - int numConfigs, __GLXvisualConfig *config) -{ - __DRIscreenPrivate *psp=NULL; - - DEBUG(("__driCreateScreen: psp = %p\n", psp)); - psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &s3vAPI); - DEBUG(("__driCreateScreen: psp = %p\n", psp)); - if (!s3vInitDriver(psp)) - return NULLL - - return (void *) psp; -} -#endif diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 0773fa893a..6f1cbd6951 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -168,12 +168,12 @@ static const struct tnl_pipeline_stage *savage_pipeline[] = { }; -static const __DRIextension *savageExtensions[] = { +PUBLIC const __DRIextension *savageScreenExtensions[] = { + &driCoreExtension.base, + &driLegacyExtension.base, &driReadDrawableExtension, }; -/* this is first function called in dirver*/ - static GLboolean savageInitDriver(__DRIscreenPrivate *sPriv) { @@ -266,7 +266,7 @@ savageInitDriver(__DRIscreenPrivate *sPriv) driParseOptionInfo (&savageScreen->optionCache, __driConfigOptions, __driNConfigOptions); - sPriv->extensions = savageExtensions; + sPriv->extensions = savageScreenExtensions; #if 0 savageDDFastPathInit(); @@ -293,34 +293,6 @@ savageDestroyScreen(__DRIscreenPrivate *sPriv) sPriv->private = NULL; } -#if 0 -GLvisual *XMesaCreateVisual(Display *dpy, - __DRIscreenPrivate *driScrnPriv, - const XVisualInfo *visinfo, - const __GLXvisualConfig *config) -{ - /* Drivers may change the args to _mesa_create_visual() in order to - * setup special visuals. - */ - return _mesa_create_visual( config->rgba, - config->doubleBuffer, - config->stereo, - _mesa_bitcount(visinfo->red_mask), - _mesa_bitcount(visinfo->green_mask), - _mesa_bitcount(visinfo->blue_mask), - config->alphaSize, - 0, /* index bits */ - config->depthSize, - config->stencilSize, - config->accumRedSize, - config->accumGreenSize, - config->accumBlueSize, - config->accumAlphaSize, - 0 /* num samples */ ); -} -#endif - - static GLboolean savageCreateContext( const __GLcontextModes *mesaVis, __DRIcontextPrivate *driContextPriv, @@ -915,32 +887,18 @@ void savageGetLock( savageContextPtr imesa, GLuint flags ) } } - - -static const struct __DriverAPIRec savageAPI = { - savageDestroyScreen, - savageCreateContext, - savageDestroyContext, - savageCreateBuffer, - savageDestroyBuffer, - savageSwapBuffers, - savageMakeCurrent, - savageUnbindContext -}; - - -static __GLcontextModes * +static const __DRIconfig ** savageFillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { - __GLcontextModes * modes; + __DRIconfig **configs; __GLcontextModes * m; - unsigned num_modes; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; GLenum fb_type; + int i; /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy * enough to add support. Basically, if a context is created with an @@ -971,8 +929,6 @@ savageFillInModes( __DRIscreenPrivate *psp, depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; - num_modes = depth_buffer_factor * back_buffer_factor * 4; - if ( pixel_bits == 16 ) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; @@ -982,21 +938,11 @@ savageFillInModes( __DRIscreenPrivate *psp, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); - m = modes; - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR ) ) { + configs = driCreateConfigs(fb_format, fb_type, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, + back_buffer_modes, back_buffer_factor); + if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__ ); return NULL; @@ -1004,13 +950,14 @@ savageFillInModes( __DRIscreenPrivate *psp, /* Mark the visual as slow if there are "fake" stencil bits. */ - for ( m = modes ; m != NULL ; m = m->next ) { - if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) { + for (i = 0; configs[i]; i++) { + m = &configs[i]->modes; + if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { m->visualRating = GLX_SLOW_CONFIG; } } - return modes; + return (const __DRIconfig **) configs; } @@ -1021,7 +968,8 @@ savageFillInModes( __DRIscreenPrivate *psp, * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +savageInitScreen(__DRIscreenPrivate *psp) { static const __DRIversion ddx_expected = { 2, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; @@ -1034,8 +982,6 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, & drm_expected ) ) return NULL; - psp->DriverAPI = savageAPI; - /* Calling driInitExtensions here, with a NULL context pointer, * does not actually enable the extensions. It just makes sure * that all the dispatch offsets for all the extensions that @@ -1057,3 +1003,15 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) (dri_priv->cpp == 2) ? 0 : 8, (dri_priv->backOffset != dri_priv->depthOffset) ); } + +const struct __DriverAPIRec driDriverAPI = { + savageInitScreen, + savageDestroyScreen, + savageCreateContext, + savageDestroyContext, + savageCreateBuffer, + savageDestroyBuffer, + savageSwapBuffers, + savageMakeCurrent, + savageUnbindContext +}; diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index ad2fe51e44..bf0b1ce276 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -65,12 +65,10 @@ static const GLuint __driNConfigOptions = 3; extern const struct dri_extension card_extensions[]; -static __GLcontextModes * +static const __DRIconfig ** sisFillInModes(__DRIscreenPrivate *psp, int bpp) { - __GLcontextModes *modes; - __GLcontextModes *m; - unsigned num_modes; + __DRIconfig **configs; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; @@ -93,9 +91,6 @@ sisFillInModes(__DRIscreenPrivate *psp, int bpp) depth_buffer_factor = 4; back_buffer_factor = 2; - /* Last 4 is for GLX_TRUE_COLOR & GLX_DIRECT_COLOR, with/without accum */ - num_modes = depth_buffer_factor * back_buffer_factor * 4; - if (bpp == 16) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; @@ -104,25 +99,15 @@ sisFillInModes(__DRIscreenPrivate *psp, int bpp) fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*psp->contextModes->createContextModes)(num_modes, sizeof(__GLcontextModes)); - m = modes; - if (!driFillInModes(&m, fb_format, fb_type, depth_bits_array, - stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR)) { + configs = driCreateConfigs(fb_format, fb_type, depth_bits_array, + stencil_bits_array, depth_buffer_factor, + back_buffer_modes, back_buffer_factor); + if (configs == NULL) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); return NULL; } - if (!driFillInModes(&m, fb_format, fb_type, depth_bits_array, - stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR)) { - fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); - return NULL; - } - - return modes; + return (const __DRIconfig **) configs; } @@ -288,39 +273,6 @@ sisSwapBuffers(__DRIdrawablePrivate *dPriv) } -/* Initialize the driver specific screen private data. - */ -static GLboolean -sisInitDriver( __DRIscreenPrivate *sPriv ) -{ - sPriv->private = (void *) sisCreateScreen( sPriv ); - - if ( !sPriv->private ) { - sisDestroyScreen( sPriv ); - return GL_FALSE; - } - - return GL_TRUE; -} - -static struct __DriverAPIRec sisAPI = { - .DestroyScreen = sisDestroyScreen, - .CreateContext = sisCreateContext, - .DestroyContext = sisDestroyContext, - .CreateBuffer = sisCreateBuffer, - .DestroyBuffer = sisDestroyBuffer, - .SwapBuffers = sisSwapBuffers, - .MakeCurrent = sisMakeCurrent, - .UnbindContext = sisUnbindContext, - .GetSwapInfo = NULL, - .GetDrawableMSC = NULL, - .WaitForMSC = NULL, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL - -}; - - /** * This is the driver specific part of the createNewScreen entry point. * @@ -328,7 +280,8 @@ static struct __DriverAPIRec sisAPI = { * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +sisInitScreen(__DRIscreenPrivate *psp) { static const __DRIversion ddx_expected = {0, 8, 0}; static const __DRIversion dri_expected = {4, 0, 0}; @@ -342,8 +295,6 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, &drm_expected)) return NULL; - psp->DriverAPI = sisAPI; - /* Calling driInitExtensions here, with a NULL context pointer, * does not actually enable the extensions. It just makes sure * that all the dispatch offsets for all the extensions that @@ -356,8 +307,30 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) */ driInitExtensions( NULL, card_extensions, GL_FALSE ); - if (!sisInitDriver(psp)) - return NULL; + psp->private = sisCreateScreen(psp); + + if (!psp->private) { + sisDestroyScreen(psp); + return NULL; + } return sisFillInModes(psp, dri_priv->bytesPerPixel * 8); } + +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = sisInitScreen, + .DestroyScreen = sisDestroyScreen, + .CreateContext = sisCreateContext, + .DestroyContext = sisDestroyContext, + .CreateBuffer = sisCreateBuffer, + .DestroyBuffer = sisDestroyBuffer, + .SwapBuffers = sisSwapBuffers, + .MakeCurrent = sisMakeCurrent, + .UnbindContext = sisUnbindContext, + .GetSwapInfo = NULL, + .GetDrawableMSC = NULL, + .WaitForMSC = NULL, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL + +}; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 9c7ded0180..fd21d8d51b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -343,31 +343,14 @@ tdfxSwapBuffers( __DRIdrawablePrivate *driDrawPriv ) } } - -static const struct __DriverAPIRec tdfxAPI = { - .DestroyScreen = tdfxDestroyScreen, - .CreateContext = tdfxCreateContext, - .DestroyContext = tdfxDestroyContext, - .CreateBuffer = tdfxCreateBuffer, - .DestroyBuffer = tdfxDestroyBuffer, - .SwapBuffers = tdfxSwapBuffers, - .MakeCurrent = tdfxMakeCurrent, - .UnbindContext = tdfxUnbindContext, - .GetSwapInfo = NULL, - .GetDrawableMSC = NULL, - .WaitForMSC = NULL, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL -}; - - -static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, - unsigned pixel_bits, - unsigned depth_bits, - unsigned stencil_bits, - GLboolean have_back_buffer) +static const __DRIconfig ** +tdfxFillInModes(__DRIscreenPrivate *psp, + unsigned pixel_bits, + unsigned depth_bits, + unsigned stencil_bits, + GLboolean have_back_buffer) { - __GLcontextModes *modes; + __DRIconfig **configs, **c; __GLcontextModes *m; unsigned num_modes; unsigned vis[2] = { GLX_TRUE_COLOR, GLX_DIRECT_COLOR }; @@ -382,14 +365,16 @@ static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, num_modes = (depth_bits == 16) ? 32 : 16; - modes = (*psp->contextModes->createContextModes)(num_modes, sizeof(__GLcontextModes)); - m = modes; + configs = _mesa_malloc(num_modes * sizeof *configs); + c = configs; for (i = 0; i <= 1; i++) { for (db = 0; db <= 1; db++) { for (depth = 0; depth <= 1; depth++) { for (accum = 0; accum <= 1; accum++) { for (stencil = 0; stencil <= !deep; stencil++) { + *c = _mesa_malloc(sizeof **c); + m = &(*c++)->modes; if (deep) stencil = depth; m->redBits = deep ? 8 : 5; m->greenBits = deep ? 8 : 6; @@ -419,7 +404,6 @@ static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, m->visualRating = ((stencil && !deep) || accum) ? GLX_SLOW_CONFIG : GLX_NONE; - m = m->next; if (deep) stencil = 0; } } @@ -427,7 +411,7 @@ static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, } } - return modes; + return (const __DRIconfig **) configs; } /** @@ -437,7 +421,8 @@ static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +tdfxInitScreen(__DRIscreen *psp) { static const __DRIversion ddx_expected = { 1, 1, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; @@ -456,8 +441,6 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, & drm_expected ) ) return NULL; - psp->DriverAPI = tdfxAPI; - /* Calling driInitExtensions here, with a NULL context pointer, * does not actually enable the extensions. It just makes sure * that all the dispatch offsets for all the extensions that @@ -479,3 +462,20 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) (bpp == 16) ? 0 : 8, (dri_priv->backOffset!=dri_priv->depthOffset)); } + +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = tdfxInitScreen, + .DestroyScreen = tdfxDestroyScreen, + .CreateContext = tdfxCreateContext, + .DestroyContext = tdfxDestroyContext, + .CreateBuffer = tdfxCreateBuffer, + .DestroyBuffer = tdfxDestroyBuffer, + .SwapBuffers = tdfxSwapBuffers, + .MakeCurrent = tdfxMakeCurrent, + .UnbindContext = tdfxUnbindContext, + .GetSwapInfo = NULL, + .GetDrawableMSC = NULL, + .WaitForMSC = NULL, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL +}; diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index 81098bc9cd..2b6d19c4a5 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -417,18 +417,6 @@ tridentInitDriver(__DRIscreenPrivate *sPriv) return GL_TRUE; } -static struct __DriverAPIRec tridentAPI = { - tridentDestroyScreen, - tridentCreateContext, - tridentDestroyContext, - tridentCreateBuffer, - tridentDestroyBuffer, - tridentSwapBuffers, - tridentMakeCurrent, - tridentUnbindContext, -}; - - /** * This is the driver specific part of the createNewScreen entry point. * @@ -436,7 +424,7 @@ static struct __DriverAPIRec tridentAPI = { * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +const __DRIconfig **tridentInitScreen(__DRIscreenPrivate *psp) { static const __DRIversion ddx_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 3, 1, 0 }; @@ -448,8 +436,6 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, & drm_expected ) ) return NULL; - psp->DriverAPI = tridentAPI; - if (!tridentInitDriver(psp)) return NULL; @@ -462,3 +448,15 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) return NULL; } + +const struct __DriverAPIRec driDriverAPI = { + tridentInitScreen, + tridentDestroyScreen, + tridentCreateContext, + tridentDestroyContext, + tridentCreateBuffer, + tridentDestroyBuffer, + tridentSwapBuffers, + tridentMakeCurrent, + tridentUnbindContext, +}; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index faf6505bfd..ca193bfa53 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -64,8 +64,6 @@ static const GLuint __driNConfigOptions = 3; extern const struct dri_extension card_extensions[]; -static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ); - static drmBufMapPtr via_create_empty_buffers(void) { drmBufMapPtr retval; @@ -321,32 +319,11 @@ viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } - - -static struct __DriverAPIRec viaAPI = { - .DestroyScreen = viaDestroyScreen, - .CreateContext = viaCreateContext, - .DestroyContext = viaDestroyContext, - .CreateBuffer = viaCreateBuffer, - .DestroyBuffer = viaDestroyBuffer, - .SwapBuffers = viaSwapBuffers, - .MakeCurrent = viaMakeCurrent, - .UnbindContext = viaUnbindContext, - .GetSwapInfo = getSwapInfo, - .GetDrawableMSC = driDrawableGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL -}; - - -static __GLcontextModes * +static const __DRIconfig ** viaFillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, GLboolean have_back_buffer ) { - __GLcontextModes * modes; - __GLcontextModes * m; - unsigned num_modes; + __DRIconfig **configs; const unsigned back_buffer_factor = (have_back_buffer) ? 2 : 1; GLenum fb_format; GLenum fb_type; @@ -367,9 +344,6 @@ viaFillInModes( __DRIscreenPrivate *psp, static const u_int8_t stencil_bits_array[4] = { 0, 0, 8, 0 }; const unsigned depth_buffer_factor = 3; - - num_modes = depth_buffer_factor * back_buffer_factor * 4; - if ( pixel_bits == 16 ) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; @@ -379,29 +353,17 @@ viaFillInModes( __DRIscreenPrivate *psp, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); - m = modes; - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, - depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); + configs = driCreateConfigs(fb_format, fb_type, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, + back_buffer_factor); + if (configs == NULL) { + fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, + __LINE__); return NULL; } - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, - depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - - return modes; + return (const __DRIconfig **) configs; } @@ -412,7 +374,8 @@ viaFillInModes( __DRIscreenPrivate *psp, * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +viaInitScreen(__DRIscreenPrivate *psp) { static const __DRIversion ddx_expected = { VIA_DRIDDX_VERSION_MAJOR, VIA_DRIDDX_VERSION_MINOR, @@ -428,8 +391,6 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, & drm_expected) ) return NULL; - psp->DriverAPI = viaAPI; - /* Calling driInitExtensions here, with a NULL context pointer, * does not actually enable the extensions. It just makes sure * that all the dispatch offsets for all the extensions that @@ -475,3 +436,20 @@ getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ) return 0; } + +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = viaInitScreen, + .DestroyScreen = viaDestroyScreen, + .CreateContext = viaCreateContext, + .DestroyContext = viaDestroyContext, + .CreateBuffer = viaCreateBuffer, + .DestroyBuffer = viaDestroyBuffer, + .SwapBuffers = viaSwapBuffers, + .MakeCurrent = viaMakeCurrent, + .UnbindContext = viaUnbindContext, + .GetSwapInfo = getSwapInfo, + .GetDrawableMSC = driDrawableGetMSC32, + .WaitForMSC = driWaitForMSC32, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL +}; -- cgit v1.2.3 From 3ea80c1128344a06b5d5c9cd45615a597047e402 Mon Sep 17 00:00:00 2001 From: Markus Amsler Date: Mon, 31 Mar 2008 14:58:28 -0600 Subject: fix parsing bug involving comments at the end of ARB v/f programs --- src/mesa/shader/arbprogram.syn | 6 +++--- src/mesa/shader/arbprogram_syn.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/arbprogram.syn b/src/mesa/shader/arbprogram.syn index f3aa1ad724..b12c6a0eda 100644 --- a/src/mesa/shader/arbprogram.syn +++ b/src/mesa/shader/arbprogram.syn @@ -2643,14 +2643,14 @@ white_char ' ' .or '\t' .or '\n' .or '\r'; comment_block - '#' .and .loop comment_char .and new_line; + '#' .and .loop comment_char .and optional_new_line; /* All ASCII characters except '\r', '\n' and '\0' */ comment_char '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C'; -new_line - '\n' .or crlf .or '\0'; +optional_new_line + '\n' .or crlf .or .true; crlf '\r' .and '\n'; diff --git a/src/mesa/shader/arbprogram_syn.h b/src/mesa/shader/arbprogram_syn.h index 3f3ab073cf..d95a5dede4 100644 --- a/src/mesa/shader/arbprogram_syn.h +++ b/src/mesa/shader/arbprogram_syn.h @@ -1244,11 +1244,11 @@ "white_char\n" " ' ' .or '\\t' .or '\\n' .or '\\r';\n" "comment_block\n" -" '#' .and .loop comment_char .and new_line;\n" +" '#' .and .loop comment_char .and optional_new_line;\n" "comment_char\n" " '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" -"new_line\n" -" '\\n' .or crlf .or '\\0';\n" +"optional_new_line\n" +" '\\n' .or crlf .or .true;\n" "crlf\n" " '\\r' .and '\\n';\n" "semicolon\n" -- cgit v1.2.3 From 5c4ca968fab1b0b993fabeb73e3a5d92cbaadaf1 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 1 Apr 2008 08:41:08 -0600 Subject: added some missing calls to _mesa_enable_x_y_extensions() --- src/mesa/drivers/fbdev/glfbdev.c | 5 +++++ src/mesa/drivers/osmesa/osmesa.c | 2 ++ src/mesa/drivers/x11/xm_api.c | 1 + 3 files changed, 8 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c index e95a424698..f3da4a5ba2 100644 --- a/src/mesa/drivers/fbdev/glfbdev.c +++ b/src/mesa/drivers/fbdev/glfbdev.c @@ -790,6 +790,11 @@ glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share ) } _mesa_enable_sw_extensions(glctx); + _mesa_enable_1_3_extensions(glctx); + _mesa_enable_1_4_extensions(glctx); + _mesa_enable_1_5_extensions(glctx); + _mesa_enable_2_0_extensions(glctx); + _mesa_enable_2_1_extensions(glctx); return ctx; } diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index ad8b20283c..29a6c1f4aa 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1226,6 +1226,8 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, _mesa_enable_1_3_extensions(&(osmesa->mesa)); _mesa_enable_1_4_extensions(&(osmesa->mesa)); _mesa_enable_1_5_extensions(&(osmesa->mesa)); + _mesa_enable_2_0_extensions(&(osmesa->mesa)); + _mesa_enable_2_1_extensions(&(osmesa->mesa)); osmesa->gl_buffer = _mesa_create_framebuffer(osmesa->gl_visual); if (!osmesa->gl_buffer) { diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index eaa277db4a..e606bb1191 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1523,6 +1523,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) _mesa_enable_1_4_extensions(mesaCtx); _mesa_enable_1_5_extensions(mesaCtx); _mesa_enable_2_0_extensions(mesaCtx); + _mesa_enable_2_1_extensions(mesaCtx); #if ENABLE_EXT_texure_compression_s3tc if (c->Mesa_DXTn) { _mesa_enable_extension(mesaCtx, "GL_EXT_texture_compression_s3tc"); -- cgit v1.2.3 From 28dfb0613b51c51d5f09010ea38d050a9ec817d7 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 1 Apr 2008 23:24:11 +0200 Subject: fix mistakenly set ATIFragmentShader._Enabled bit (bug 15269) --- src/mesa/main/state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index a42c4fd805..5ff67b654e 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -965,7 +965,7 @@ update_program(GLcontext *ctx) ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current->Base.Instructions; ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled - && ctx->ATIFragmentShader.Current->Instructions; + && ctx->ATIFragmentShader.Current->Instructions[0]; /* * Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current -- cgit v1.2.3 From dc836edf49a08a7fd77fc1f127818b0550558581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 2 Apr 2008 19:04:57 -0400 Subject: Initialize GLX_EXT_texture_from_pixmap attributes correctly. --- src/mesa/drivers/dri/common/dri_util.c | 11 +---------- src/mesa/drivers/dri/common/utils.c | 9 +++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index daf1d56feb..b7718f50fd 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -1006,6 +1006,7 @@ static const struct { unsigned int attrib, offset; } attribMap[] = { __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb), __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba), __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS, bindToTextureTargets), __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted), /* The struct field doesn't matter here, these are handled by the @@ -1013,7 +1014,6 @@ static const struct { unsigned int attrib, offset; } attribMap[] = { * so the iterator includes them though.*/ __ATTRIB(__DRI_ATTRIB_RENDER_TYPE, level), __ATTRIB(__DRI_ATTRIB_CONFIG_CAVEAT, level), - __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS, level), __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, level) }; @@ -1038,15 +1038,6 @@ driGetConfigAttribIndex(const __DRIconfig *config, else *value = 0; break; - case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS: - *value = 0; - if (config->modes.bindToTextureTargets & GLX_TEXTURE_1D_BIT_EXT) - *value |= __DRI_ATTRIB_TEXTURE_1D_BIT; - if (config->modes.bindToTextureTargets & GLX_TEXTURE_2D_BIT_EXT) - *value |= __DRI_ATTRIB_TEXTURE_2D_BIT; - if (config->modes.bindToTextureTargets & GLX_TEXTURE_RECTANGLE_BIT_EXT) - *value |= __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT; - break; case __DRI_ATTRIB_SWAP_METHOD: break; diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 1839ef935a..237d51cf22 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -713,6 +713,15 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, modes->accumAlphaBits) > 0); modes->haveDepthBuffer = (modes->depthBits > 0); modes->haveStencilBuffer = (modes->stencilBits > 0); + + modes->bindToTextureRgb = GL_TRUE; + modes->bindToTextureRgba = GL_TRUE; + modes->bindToMipmapTexture = GL_FALSE; + modes->bindToTextureTargets = modes->rgbMode ? + __DRI_ATTRIB_TEXTURE_1D_BIT | + __DRI_ATTRIB_TEXTURE_2D_BIT | + __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT : + 0; } } } -- cgit v1.2.3 From 1757acc293b936f0196e983ddea281c346952c45 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 3 Apr 2008 21:51:31 -0600 Subject: rewrite some of the mat*mat, mat*vec intrinsics Also, remove obsolete matrix codegen code. --- src/mesa/shader/slang/library/slang_core.gc | 162 +----- src/mesa/shader/slang/library/slang_core_gc.h | 697 ++++++++++++-------------- src/mesa/shader/slang/slang_codegen.c | 44 -- 3 files changed, 336 insertions(+), 567 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/slang/library/slang_core.gc b/src/mesa/shader/slang/library/slang_core.gc index 2e7ebc347a..ffa57f74c2 100644 --- a/src/mesa/shader/slang/library/slang_core.gc +++ b/src/mesa/shader/slang/library/slang_core.gc @@ -1545,15 +1545,8 @@ mat2 __operator - (const mat2 m, const mat2 n) mat2 __operator * (const mat2 m, const mat2 n) { - vec2 mRow0, mRow1; - mRow0.x = m[0].x; - mRow0.y = m[1].x; - mRow1.x = m[0].y; - mRow1.y = m[1].y; - __retVal[0].x = dot(mRow0, n[0]); - __retVal[1].x = dot(mRow0, n[1]); - __retVal[0].y = dot(mRow1, n[0]); - __retVal[1].y = dot(mRow1, n[1]); + __retVal[0] = m[0] * n[0].xx + m[1] * n[0].yy; + __retVal[1] = m[0] * n[1].xx + m[1] * n[1].yy; } mat2 __operator / (const mat2 m, const mat2 n) @@ -1581,34 +1574,9 @@ mat3 __operator - (const mat3 m, const mat3 n) mat3 __operator * (const mat3 m, const mat3 n) { - // sub-blocks to reduce register usage - { - vec3 mRow0; - mRow0.x = m[0].x; - mRow0.y = m[1].x; - mRow0.z = m[2].x; - __retVal[0].x = dot(mRow0, n[0]); - __retVal[1].x = dot(mRow0, n[1]); - __retVal[2].x = dot(mRow0, n[2]); - } - { - vec3 mRow1; - mRow1.x = m[0].y; - mRow1.y = m[1].y; - mRow1.z = m[2].y; - __retVal[0].y = dot(mRow1, n[0]); - __retVal[1].y = dot(mRow1, n[1]); - __retVal[2].y = dot(mRow1, n[2]); - } - { - vec3 mRow2; - mRow2.x = m[0].z; - mRow2.y = m[1].z; - mRow2.z = m[2].z; - __retVal[0].z = dot(mRow2, n[0]); - __retVal[1].z = dot(mRow2, n[1]); - __retVal[2].z = dot(mRow2, n[2]); - } + __retVal[0] = m[0] * n[0].xxx + m[1] * n[0].yyy + m[2] * n[0].zzz; + __retVal[1] = m[0] * n[1].xxx + m[1] * n[1].yyy + m[2] * n[1].zzz; + __retVal[2] = m[0] * n[2].xxx + m[1] * n[2].yyy + m[2] * n[2].zzz; } mat3 __operator / (const mat3 m, const mat3 n) @@ -1639,51 +1607,10 @@ mat4 __operator - (const mat4 m, const mat4 n) mat4 __operator * (const mat4 m, const mat4 n) { - // sub-blocks to reduce temporary usage - { - vec4 mRow0; - mRow0.x = m[0].x; - mRow0.y = m[1].x; - mRow0.z = m[2].x; - mRow0.w = m[3].x; - __retVal[0].x = dot(mRow0, n[0]); - __retVal[1].x = dot(mRow0, n[1]); - __retVal[2].x = dot(mRow0, n[2]); - __retVal[3].x = dot(mRow0, n[3]); - } - { - vec4 mRow1; - mRow1.x = m[0].y; - mRow1.y = m[1].y; - mRow1.z = m[2].y; - mRow1.w = m[3].y; - __retVal[0].y = dot(mRow1, n[0]); - __retVal[1].y = dot(mRow1, n[1]); - __retVal[2].y = dot(mRow1, n[2]); - __retVal[3].y = dot(mRow1, n[3]); - } - { - vec4 mRow2; - mRow2.x = m[0].z; - mRow2.y = m[1].z; - mRow2.z = m[2].z; - mRow2.w = m[3].z; - __retVal[0].z = dot(mRow2, n[0]); - __retVal[1].z = dot(mRow2, n[1]); - __retVal[2].z = dot(mRow2, n[2]); - __retVal[3].z = dot(mRow2, n[3]); - } - { - vec4 mRow3; - mRow3.x = m[0].w; - mRow3.y = m[1].w; - mRow3.z = m[2].w; - mRow3.w = m[3].w; - __retVal[0].w = dot(mRow3, n[0]); - __retVal[1].w = dot(mRow3, n[1]); - __retVal[2].w = dot(mRow3, n[2]); - __retVal[3].w = dot(mRow3, n[3]); - } + __retVal[0] = m[0] * n[0].xxxx + m[1] * n[0].yyyy + m[2] * n[0].zzzz + m[3] * n[0].wwww; + __retVal[1] = m[0] * n[1].xxxx + m[1] * n[1].yyyy + m[2] * n[1].zzzz + m[3] * n[1].wwww; + __retVal[2] = m[0] * n[2].xxxx + m[1] * n[2].yyyy + m[2] * n[2].zzzz + m[3] * n[2].wwww; + __retVal[3] = m[0] * n[3].xxxx + m[1] * n[3].yyyy + m[2] * n[3].zzzz + m[3] * n[3].wwww; } mat4 __operator / (const mat4 m, const mat4 n) @@ -1877,13 +1804,8 @@ mat4 __operator / (const mat4 m, const float b) vec2 __operator * (const mat2 m, const vec2 v) { - vec2 r0, r1; - r0.x = m[0].x; - r0.y = m[1].x; - r1.x = m[0].y; - r1.y = m[1].y; - __retVal.x = dot(r0, v); - __retVal.y = dot(r1, v); + __retVal = m[0] * v.xx + + m[1] * v.yy; } vec2 __operator * (const vec2 v, const mat2 m) @@ -1894,27 +1816,9 @@ vec2 __operator * (const vec2 v, const mat2 m) vec3 __operator * (const mat3 m, const vec3 v) { - { - vec3 r0; - r0.x = m[0].x; - r0.y = m[1].x; - r0.z = m[2].x; - __asm vec3_dot __retVal.x, r0, v; - } - { - vec3 r1; - r1.x = m[0].y; - r1.y = m[1].y; - r1.z = m[2].y; - __asm vec3_dot __retVal.y, r1, v; - } - { - vec3 r2; - r2.x = m[0].z; - r2.y = m[1].z; - r2.z = m[2].z; - __asm vec3_dot __retVal.z, r2, v; - } + __retVal = m[0] * v.xxx + + m[1] * v.yyy + + m[2] * v.zzz; } vec3 __operator * (const vec3 v, const mat3 m) @@ -1926,44 +1830,14 @@ vec3 __operator * (const vec3 v, const mat3 m) vec4 __operator * (const mat4 m, const vec4 v) { - // extract rows, then do dot product - { - vec4 r0; - r0.x = m[0].x; - r0.y = m[1].x; - r0.z = m[2].x; - r0.w = m[3].x; - __asm vec4_dot __retVal.x, r0, v; - } - { - vec4 r1; - r1.x = m[0].y; - r1.y = m[1].y; - r1.z = m[2].y; - r1.w = m[3].y; - __asm vec4_dot __retVal.y, r1, v; - } - { - vec4 r2; - r2.x = m[0].z; - r2.y = m[1].z; - r2.z = m[2].z; - r2.w = m[3].z; - __asm vec4_dot __retVal.z, r2, v; - } - { - vec4 r3; - r3.x = m[0].w; - r3.y = m[1].w; - r3.z = m[2].w; - r3.w = m[3].w; - __asm vec4_dot __retVal.w, r3, v; - } + __retVal = m[0] * v.xxxx + + m[1] * v.yyyy + + m[2] * v.zzzz + + m[3] * v.wwww; } vec4 __operator * (const vec4 v, const mat4 m) { - //mm __retVal.x = dot(v, m[0]); __retVal.y = dot(v, m[1]); __retVal.z = dot(v, m[2]); diff --git a/src/mesa/shader/slang/library/slang_core_gc.h b/src/mesa/shader/slang/library/slang_core_gc.h index f2b4fd6464..1604d5a034 100644 --- a/src/mesa/shader/slang/library/slang_core_gc.h +++ b/src/mesa/shader/slang/library/slang_core_gc.h @@ -453,151 +453,113 @@ 97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,46,20,0,0,1,0,13,2,27,1,1,0, 13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0, 57,18,110,0,16,8,48,0,57,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10, -49,0,57,18,110,0,16,10,49,0,57,47,20,0,0,1,0,13,2,21,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,3,2,0, -10,1,109,82,111,119,48,0,0,1,1,109,82,111,119,49,0,0,0,9,18,109,82,111,119,48,0,59,120,0,18,109,0, -16,8,48,0,57,59,120,0,20,0,9,18,109,82,111,119,48,0,59,121,0,18,109,0,16,10,49,0,57,59,120,0,20,0, -9,18,109,82,111,119,49,0,59,120,0,18,109,0,16,8,48,0,57,59,121,0,20,0,9,18,109,82,111,119,49,0,59, -121,0,18,109,0,16,10,49,0,57,59,121,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,120, -0,58,100,111,116,0,18,109,82,111,119,48,0,0,18,110,0,16,8,48,0,57,0,0,20,0,9,18,95,95,114,101,116, -86,97,108,0,16,10,49,0,57,59,120,0,58,100,111,116,0,18,109,82,111,119,48,0,0,18,110,0,16,10,49,0, -57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,121,0,58,100,111,116,0,18,109,82, -111,119,49,0,0,18,110,0,16,8,48,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59, -121,0,58,100,111,116,0,18,109,82,111,119,49,0,0,18,110,0,16,10,49,0,57,0,0,20,0,0,1,0,13,2,22,1,1, -0,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48, +49,0,57,18,110,0,16,10,49,0,57,47,20,0,0,1,0,13,2,21,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,95, +95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,59,120,120,0, +48,18,109,0,16,10,49,0,57,18,110,0,16,8,48,0,57,59,121,121,0,48,46,20,0,9,18,95,95,114,101,116,86, +97,108,0,16,10,49,0,57,18,109,0,16,8,48,0,57,18,110,0,16,10,49,0,57,59,120,120,0,48,18,109,0,16,10, +49,0,57,18,110,0,16,10,49,0,57,59,121,121,0,48,46,20,0,0,1,0,13,2,22,1,1,0,13,109,0,0,1,1,0,13,110, +0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0, +57,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10, +49,0,57,49,20,0,0,1,0,14,2,26,1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97, +108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,46,20,0,9,18,95,95,114,101,116,86, +97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,46,20,0,9,18,95,95,114,101, +116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,46,20,0,0,1,0,14,2,27, +1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16, +8,48,0,57,18,110,0,16,8,48,0,57,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0, +16,10,49,0,57,18,110,0,16,10,49,0,57,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18, +109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,47,20,0,0,1,0,14,2,21,1,1,0,14,109,0,0,1,1,0,14,110,0,0, +0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,59, +120,120,120,0,48,18,109,0,16,10,49,0,57,18,110,0,16,8,48,0,57,59,121,121,121,0,48,46,18,109,0,16, +10,50,0,57,18,110,0,16,8,48,0,57,59,122,122,122,0,48,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16, +10,49,0,57,18,109,0,16,8,48,0,57,18,110,0,16,10,49,0,57,59,120,120,120,0,48,18,109,0,16,10,49,0,57, +18,110,0,16,10,49,0,57,59,121,121,121,0,48,46,18,109,0,16,10,50,0,57,18,110,0,16,10,49,0,57,59,122, +122,122,0,48,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,8,48,0,57,18,110, +0,16,10,50,0,57,59,120,120,120,0,48,18,109,0,16,10,49,0,57,18,110,0,16,10,50,0,57,59,121,121,121,0, +48,46,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,59,122,122,122,0,48,46,20,0,0,1,0,14,2,22,1,1, +0,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48, 0,57,18,110,0,16,8,48,0,57,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10, -49,0,57,18,110,0,16,10,49,0,57,49,20,0,0,1,0,14,2,26,1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,95, -95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,46,20,0,9,18, -95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,46,20,0, -9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,46, -20,0,0,1,0,14,2,27,1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8, -48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16, -10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,20,0,9,18,95,95,114,101,116,86,97,108, -0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,47,20,0,0,1,0,14,2,21,1,1,0,14,109,0, -0,1,1,0,14,110,0,0,0,1,2,3,2,0,11,1,109,82,111,119,48,0,0,0,9,18,109,82,111,119,48,0,59,120,0,18, -109,0,16,8,48,0,57,59,120,0,20,0,9,18,109,82,111,119,48,0,59,121,0,18,109,0,16,10,49,0,57,59,120,0, -20,0,9,18,109,82,111,119,48,0,59,122,0,18,109,0,16,10,50,0,57,59,120,0,20,0,9,18,95,95,114,101,116, -86,97,108,0,16,8,48,0,57,59,120,0,58,100,111,116,0,18,109,82,111,119,48,0,0,18,110,0,16,8,48,0,57, -0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,120,0,58,100,111,116,0,18,109,82,111, -119,48,0,0,18,110,0,16,10,49,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,120, -0,58,100,111,116,0,18,109,82,111,119,48,0,0,18,110,0,16,10,50,0,57,0,0,20,0,0,2,3,2,0,11,1,109,82, -111,119,49,0,0,0,9,18,109,82,111,119,49,0,59,120,0,18,109,0,16,8,48,0,57,59,121,0,20,0,9,18,109,82, -111,119,49,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,20,0,9,18,109,82,111,119,49,0,59,122,0,18, -109,0,16,10,50,0,57,59,121,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,121,0,58,100, -111,116,0,18,109,82,111,119,49,0,0,18,110,0,16,8,48,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108, -0,16,10,49,0,57,59,121,0,58,100,111,116,0,18,109,82,111,119,49,0,0,18,110,0,16,10,49,0,57,0,0,20,0, -9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,121,0,58,100,111,116,0,18,109,82,111,119,49,0, -0,18,110,0,16,10,50,0,57,0,0,20,0,0,2,3,2,0,11,1,109,82,111,119,50,0,0,0,9,18,109,82,111,119,50,0, -59,120,0,18,109,0,16,8,48,0,57,59,122,0,20,0,9,18,109,82,111,119,50,0,59,121,0,18,109,0,16,10,49,0, -57,59,122,0,20,0,9,18,109,82,111,119,50,0,59,122,0,18,109,0,16,10,50,0,57,59,122,0,20,0,9,18,95,95, -114,101,116,86,97,108,0,16,8,48,0,57,59,122,0,58,100,111,116,0,18,109,82,111,119,50,0,0,18,110,0, -16,8,48,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,122,0,58,100,111,116,0, -18,109,82,111,119,50,0,0,18,110,0,16,10,49,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10, -50,0,57,59,122,0,58,100,111,116,0,18,109,82,111,119,50,0,0,18,110,0,16,10,50,0,57,0,0,20,0,0,0,1,0, -14,2,22,1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18, -109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57, -18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50, -0,57,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,49,20,0,0,1,0,15,2,26,1,1,0,15,109,0,0,1,1,0,15, -110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48, -0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16, -10,49,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,110, -0,16,10,50,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,109,0,16,10,51,0,57,18, -110,0,16,10,51,0,57,46,20,0,0,1,0,15,2,27,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,95,95,114,101, -116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,47,20,0,9,18,95,95,114, -101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,20,0,9,18,95,95, -114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,47,20,0,9,18, -95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,47,20,0, -0,1,0,15,2,21,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,2,3,2,0,12,1,109,82,111,119,48,0,0,0,9,18,109, -82,111,119,48,0,59,120,0,18,109,0,16,8,48,0,57,59,120,0,20,0,9,18,109,82,111,119,48,0,59,121,0,18, -109,0,16,10,49,0,57,59,120,0,20,0,9,18,109,82,111,119,48,0,59,122,0,18,109,0,16,10,50,0,57,59,120, -0,20,0,9,18,109,82,111,119,48,0,59,119,0,18,109,0,16,10,51,0,57,59,120,0,20,0,9,18,95,95,114,101, -116,86,97,108,0,16,8,48,0,57,59,120,0,58,100,111,116,0,18,109,82,111,119,48,0,0,18,110,0,16,8,48,0, -57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,120,0,58,100,111,116,0,18,109,82, -111,119,48,0,0,18,110,0,16,10,49,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59, -120,0,58,100,111,116,0,18,109,82,111,119,48,0,0,18,110,0,16,10,50,0,57,0,0,20,0,9,18,95,95,114,101, -116,86,97,108,0,16,10,51,0,57,59,120,0,58,100,111,116,0,18,109,82,111,119,48,0,0,18,110,0,16,10,51, -0,57,0,0,20,0,0,2,3,2,0,12,1,109,82,111,119,49,0,0,0,9,18,109,82,111,119,49,0,59,120,0,18,109,0,16, -8,48,0,57,59,121,0,20,0,9,18,109,82,111,119,49,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,20,0,9, -18,109,82,111,119,49,0,59,122,0,18,109,0,16,10,50,0,57,59,121,0,20,0,9,18,109,82,111,119,49,0,59, -119,0,18,109,0,16,10,51,0,57,59,121,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,121, -0,58,100,111,116,0,18,109,82,111,119,49,0,0,18,110,0,16,8,48,0,57,0,0,20,0,9,18,95,95,114,101,116, -86,97,108,0,16,10,49,0,57,59,121,0,58,100,111,116,0,18,109,82,111,119,49,0,0,18,110,0,16,10,49,0, -57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,121,0,58,100,111,116,0,18,109,82, -111,119,49,0,0,18,110,0,16,10,50,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,59, -121,0,58,100,111,116,0,18,109,82,111,119,49,0,0,18,110,0,16,10,51,0,57,0,0,20,0,0,2,3,2,0,12,1,109, -82,111,119,50,0,0,0,9,18,109,82,111,119,50,0,59,120,0,18,109,0,16,8,48,0,57,59,122,0,20,0,9,18,109, -82,111,119,50,0,59,121,0,18,109,0,16,10,49,0,57,59,122,0,20,0,9,18,109,82,111,119,50,0,59,122,0,18, -109,0,16,10,50,0,57,59,122,0,20,0,9,18,109,82,111,119,50,0,59,119,0,18,109,0,16,10,51,0,57,59,122, -0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,122,0,58,100,111,116,0,18,109,82,111,119, -50,0,0,18,110,0,16,8,48,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,122,0,58, -100,111,116,0,18,109,82,111,119,50,0,0,18,110,0,16,10,49,0,57,0,0,20,0,9,18,95,95,114,101,116,86, -97,108,0,16,10,50,0,57,59,122,0,58,100,111,116,0,18,109,82,111,119,50,0,0,18,110,0,16,10,50,0,57,0, -0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,59,122,0,58,100,111,116,0,18,109,82,111, -119,50,0,0,18,110,0,16,10,51,0,57,0,0,20,0,0,2,3,2,0,12,1,109,82,111,119,51,0,0,0,9,18,109,82,111, -119,51,0,59,120,0,18,109,0,16,8,48,0,57,59,119,0,20,0,9,18,109,82,111,119,51,0,59,121,0,18,109,0, -16,10,49,0,57,59,119,0,20,0,9,18,109,82,111,119,51,0,59,122,0,18,109,0,16,10,50,0,57,59,119,0,20,0, -9,18,109,82,111,119,51,0,59,119,0,18,109,0,16,10,51,0,57,59,119,0,20,0,9,18,95,95,114,101,116,86, -97,108,0,16,8,48,0,57,59,119,0,58,100,111,116,0,18,109,82,111,119,51,0,0,18,110,0,16,8,48,0,57,0,0, -20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,119,0,58,100,111,116,0,18,109,82,111,119, -51,0,0,18,110,0,16,10,49,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,119,0, -58,100,111,116,0,18,109,82,111,119,51,0,0,18,110,0,16,10,50,0,57,0,0,20,0,9,18,95,95,114,101,116, -86,97,108,0,16,10,51,0,57,59,119,0,58,100,111,116,0,18,109,82,111,119,51,0,0,18,110,0,16,10,51,0, -57,0,0,20,0,0,0,1,0,15,2,22,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108, -0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,49,20,0,9,18,95,95,114,101,116,86,97, -108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,20,0,9,18,95,95,114,101,116, -86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,49,20,0,9,18,95,95,114,101, -116,86,97,108,0,16,10,51,0,57,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,49,20,0,0,1,0,13,2,26, -1,1,0,9,97,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18,110, -0,16,8,48,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49, -0,57,46,20,0,0,1,0,13,2,26,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0, -16,8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0, -57,18,109,0,16,10,49,0,57,18,98,0,46,20,0,0,1,0,13,2,27,1,1,0,9,97,0,0,1,1,0,13,110,0,0,0,1,9,18, -95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57,47,20,0,9,18,95,95,114, -101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,47,20,0,0,1,0,13,2,27,1,1,0,13, -109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57, -18,98,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,47, -20,0,0,1,0,13,2,21,1,1,0,9,97,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48, +49,0,57,18,110,0,16,10,49,0,57,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0, +16,10,50,0,57,18,110,0,16,10,50,0,57,49,20,0,0,1,0,15,2,26,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,9, +18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,46,20,0, +9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,46, +20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0, +57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,109,0,16,10,51,0,57,18,110,0,16,10, +51,0,57,46,20,0,0,1,0,15,2,27,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,95,95,114,101,116,86,97, +108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,47,20,0,9,18,95,95,114,101,116,86, +97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,20,0,9,18,95,95,114,101, +116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,47,20,0,9,18,95,95,114, +101,116,86,97,108,0,16,10,51,0,57,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,47,20,0,0,1,0,15,2, +21,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0, +16,8,48,0,57,18,110,0,16,8,48,0,57,59,120,120,120,120,0,48,18,109,0,16,10,49,0,57,18,110,0,16,8,48, +0,57,59,121,121,121,121,0,48,46,18,109,0,16,10,50,0,57,18,110,0,16,8,48,0,57,59,122,122,122,122,0, +48,46,18,109,0,16,10,51,0,57,18,110,0,16,8,48,0,57,59,119,119,119,119,0,48,46,20,0,9,18,95,95,114, +101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,8,48,0,57,18,110,0,16,10,49,0,57,59,120,120,120,120, +0,48,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,59,121,121,121,121,0,48,46,18,109,0,16,10,50,0, +57,18,110,0,16,10,49,0,57,59,122,122,122,122,0,48,46,18,109,0,16,10,51,0,57,18,110,0,16,10,49,0,57, +59,119,119,119,119,0,48,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,8,48, +0,57,18,110,0,16,10,50,0,57,59,120,120,120,120,0,48,18,109,0,16,10,49,0,57,18,110,0,16,10,50,0,57, +59,121,121,121,121,0,48,46,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,59,122,122,122,122,0,48, +46,18,109,0,16,10,51,0,57,18,110,0,16,10,50,0,57,59,119,119,119,119,0,48,46,20,0,9,18,95,95,114, +101,116,86,97,108,0,16,10,51,0,57,18,109,0,16,8,48,0,57,18,110,0,16,10,51,0,57,59,120,120,120,120, +0,48,18,109,0,16,10,49,0,57,18,110,0,16,10,51,0,57,59,121,121,121,121,0,48,46,18,109,0,16,10,50,0, +57,18,110,0,16,10,51,0,57,59,122,122,122,122,0,48,46,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57, +59,119,119,119,119,0,48,46,20,0,0,1,0,15,2,22,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,95,95,114, +101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,49,20,0,9,18,95,95, +114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,20,0,9,18, +95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,49,20,0, +9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,49, +20,0,0,1,0,13,2,26,1,1,0,9,97,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48, +0,57,18,97,0,18,110,0,16,8,48,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97, +0,18,110,0,16,10,49,0,57,46,20,0,0,1,0,13,2,26,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114, +101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,46,20,0,9,18,95,95,114,101,116,86, +97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,46,20,0,0,1,0,13,2,27,1,1,0,9,97,0,0,1,1,0, +13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57,47,20, +0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,47,20,0,0,1,0,13, +2,27,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0, +16,8,48,0,57,18,98,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0, +57,18,98,0,47,20,0,0,1,0,13,2,21,1,1,0,9,97,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97, +108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57,48,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10, +49,0,57,18,97,0,18,110,0,16,10,49,0,57,48,20,0,0,1,0,13,2,21,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,9, +18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,48,20,0,9,18,95,95,114, +101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,48,20,0,0,1,0,13,2,22,1,1,0,9,97, +0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48, +0,57,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,49,20, +0,0,1,0,13,2,22,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0, +57,18,109,0,16,8,48,0,57,18,98,0,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0, +16,10,49,0,57,18,98,0,49,20,0,0,1,0,14,2,26,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101, +116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57,46,20,0,9,18,95,95,114,101,116,86,97, +108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16, +10,50,0,57,18,97,0,18,110,0,16,10,50,0,57,46,20,0,0,1,0,14,2,26,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0, +1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,46,20,0,9,18,95,95, +114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,46,20,0,9,18,95,95,114,101, +116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,98,0,46,20,0,0,1,0,14,2,27,1,1,0,9,97,0,0, +1,1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57, +47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,47,20,0,9, +18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,97,0,18,110,0,16,10,50,0,57,47,20,0,0,1,0,14,2, +27,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16, +8,48,0,57,18,98,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57, +18,98,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,98,0,47, +20,0,0,1,0,14,2,21,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48, 0,57,18,97,0,18,110,0,16,8,48,0,57,48,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97, -0,18,110,0,16,10,49,0,57,48,20,0,0,1,0,13,2,21,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114, -101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,48,20,0,9,18,95,95,114,101,116,86, -97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,48,20,0,0,1,0,13,2,22,1,1,0,9,97,0,0,1,1,0, -13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57,49,20, -0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,49,20,0,0,1,0,13, -2,22,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0, -16,8,48,0,57,18,98,0,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0, -57,18,98,0,49,20,0,0,1,0,14,2,26,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97, -108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10, -49,0,57,18,97,0,18,110,0,16,10,49,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18, -97,0,18,110,0,16,10,50,0,57,46,20,0,0,1,0,14,2,26,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95, -114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,46,20,0,9,18,95,95,114,101,116, -86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,46,20,0,9,18,95,95,114,101,116,86,97,108, -0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,98,0,46,20,0,0,1,0,14,2,27,1,1,0,9,97,0,0,1,1,0,14,110,0, -0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57,47,20,0,9,18, -95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,47,20,0,9,18,95,95,114, -101,116,86,97,108,0,16,10,50,0,57,18,97,0,18,110,0,16,10,50,0,57,47,20,0,0,1,0,14,2,27,1,1,0,14, -109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57, -18,98,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,47, -20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,98,0,47,20,0,0,1,0, -14,2,21,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97, -0,18,110,0,16,8,48,0,57,48,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0, -16,10,49,0,57,48,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,97,0,18,110,0,16,10,50,0, -57,48,20,0,0,1,0,14,2,21,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16, -8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,48,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57, -18,109,0,16,10,49,0,57,18,98,0,48,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0, -16,10,50,0,57,18,98,0,48,20,0,0,1,0,14,2,22,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101, -116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57,49,20,0,9,18,95,95,114,101,116,86,97, -108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16, -10,50,0,57,18,97,0,18,110,0,16,10,50,0,57,49,20,0,0,1,0,14,2,22,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0, -1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,49,20,0,9,18,95,95, -114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,49,20,0,9,18,95,95,114,101, -116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,98,0,49,20,0,0,1,0,15,2,26,1,1,0,9,97,0,0, -1,1,0,15,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57, -46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,46,20,0,9, -18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,97,0,18,110,0,16,10,50,0,57,46,20,0,9,18,95,95, -114,101,116,86,97,108,0,16,10,51,0,57,18,97,0,18,110,0,16,10,51,0,57,46,20,0,0,1,0,15,2,26,1,1,0, -15,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0, -57,18,98,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98,0, -46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,98,0,46,20,0,9, -18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,109,0,16,10,51,0,57,18,98,0,46,20,0,0,1,0,15,2, +0,18,110,0,16,10,49,0,57,48,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,97,0,18,110,0, +16,10,50,0,57,48,20,0,0,1,0,14,2,21,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86, +97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,48,20,0,9,18,95,95,114,101,116,86,97,108,0,16, +10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,48,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57, +18,109,0,16,10,50,0,57,18,98,0,48,20,0,0,1,0,14,2,22,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,9,18,95, +95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8,48,0,57,49,20,0,9,18,95,95,114,101, +116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,49,20,0,9,18,95,95,114,101,116,86,97, +108,0,16,10,50,0,57,18,97,0,18,110,0,16,10,50,0,57,49,20,0,0,1,0,14,2,22,1,1,0,14,109,0,0,1,1,0,9, +98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,49,20,0,9, +18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,49,20,0,9,18,95,95, +114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,98,0,49,20,0,0,1,0,15,2,26,1,1,0,9, +97,0,0,1,1,0,15,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18,110,0,16,8, +48,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10,49,0,57,46, +20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,97,0,18,110,0,16,10,50,0,57,46,20,0,9,18, +95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,97,0,18,110,0,16,10,51,0,57,46,20,0,0,1,0,15,2,26,1, +1,0,15,109,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48, +0,57,18,98,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,98, +0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,98,0,46,20,0, +9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,109,0,16,10,51,0,57,18,98,0,46,20,0,0,1,0,15,2, 27,1,1,0,9,97,0,0,1,1,0,15,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,97,0,18, 110,0,16,8,48,0,57,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,97,0,18,110,0,16,10, 49,0,57,47,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,97,0,18,110,0,16,10,50,0,57,47, @@ -622,244 +584,221 @@ 97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,98,0,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16, 10,49,0,57,18,109,0,16,10,49,0,57,18,98,0,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57, 18,109,0,16,10,50,0,57,18,98,0,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,109,0, -16,10,51,0,57,18,98,0,49,20,0,0,1,0,10,2,21,1,1,0,13,109,0,0,1,1,0,10,118,0,0,0,1,3,2,0,10,1,114, -48,0,0,1,1,114,49,0,0,0,9,18,114,48,0,59,120,0,18,109,0,16,8,48,0,57,59,120,0,20,0,9,18,114,48,0, -59,121,0,18,109,0,16,10,49,0,57,59,120,0,20,0,9,18,114,49,0,59,120,0,18,109,0,16,8,48,0,57,59,121, -0,20,0,9,18,114,49,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,20,0,9,18,95,95,114,101,116,86,97, -108,0,59,120,0,58,100,111,116,0,18,114,48,0,0,18,118,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0, -59,121,0,58,100,111,116,0,18,114,49,0,0,18,118,0,0,0,20,0,0,1,0,10,2,21,1,1,0,10,118,0,0,1,1,0,13, -109,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,100,111,116,0,18,118,0,0,18,109,0,16,8, -48,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,100,111,116,0,18,118,0,0,18,109,0, -16,10,49,0,57,0,0,20,0,0,1,0,11,2,21,1,1,0,14,109,0,0,1,1,0,11,118,0,0,0,1,2,3,2,0,11,1,114,48,0,0, -0,9,18,114,48,0,59,120,0,18,109,0,16,8,48,0,57,59,120,0,20,0,9,18,114,48,0,59,121,0,18,109,0,16,10, -49,0,57,59,120,0,20,0,9,18,114,48,0,59,122,0,18,109,0,16,10,50,0,57,59,120,0,20,0,4,118,101,99,51, -95,100,111,116,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,48,0,0,18,118,0,0,0,0,2,3,2,0, -11,1,114,49,0,0,0,9,18,114,49,0,59,120,0,18,109,0,16,8,48,0,57,59,121,0,20,0,9,18,114,49,0,59,121, -0,18,109,0,16,10,49,0,57,59,121,0,20,0,9,18,114,49,0,59,122,0,18,109,0,16,10,50,0,57,59,121,0,20,0, -4,118,101,99,51,95,100,111,116,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,114,49,0,0,18,118, -0,0,0,0,2,3,2,0,11,1,114,50,0,0,0,9,18,114,50,0,59,120,0,18,109,0,16,8,48,0,57,59,122,0,20,0,9,18, -114,50,0,59,121,0,18,109,0,16,10,49,0,57,59,122,0,20,0,9,18,114,50,0,59,122,0,18,109,0,16,10,50,0, -57,59,122,0,20,0,4,118,101,99,51,95,100,111,116,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18, -114,50,0,0,18,118,0,0,0,0,0,1,0,11,2,21,1,1,0,11,118,0,0,1,1,0,14,109,0,0,0,1,9,18,95,95,114,101, -116,86,97,108,0,59,120,0,58,100,111,116,0,18,118,0,0,18,109,0,16,8,48,0,57,0,0,20,0,9,18,95,95,114, -101,116,86,97,108,0,59,121,0,58,100,111,116,0,18,118,0,0,18,109,0,16,10,49,0,57,0,0,20,0,9,18,95, -95,114,101,116,86,97,108,0,59,122,0,58,100,111,116,0,18,118,0,0,18,109,0,16,10,50,0,57,0,0,20,0,0, -1,0,12,2,21,1,1,0,15,109,0,0,1,1,0,12,118,0,0,0,1,2,3,2,0,12,1,114,48,0,0,0,9,18,114,48,0,59,120,0, -18,109,0,16,8,48,0,57,59,120,0,20,0,9,18,114,48,0,59,121,0,18,109,0,16,10,49,0,57,59,120,0,20,0,9, -18,114,48,0,59,122,0,18,109,0,16,10,50,0,57,59,120,0,20,0,9,18,114,48,0,59,119,0,18,109,0,16,10,51, -0,57,59,120,0,20,0,4,118,101,99,52,95,100,111,116,0,18,95,95,114,101,116,86,97,108,0,59,115,0,0,18, -114,48,0,0,18,118,0,0,0,0,2,3,2,0,12,1,114,49,0,0,0,9,18,114,49,0,59,120,0,18,109,0,16,8,48,0,57, -59,121,0,20,0,9,18,114,49,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,20,0,9,18,114,49,0,59,122,0, -18,109,0,16,10,50,0,57,59,121,0,20,0,9,18,114,49,0,59,119,0,18,109,0,16,10,51,0,57,59,121,0,20,0,4, -118,101,99,52,95,100,111,116,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,114,49,0,0,18,118,0, -0,0,0,2,3,2,0,12,1,114,50,0,0,0,9,18,114,50,0,59,120,0,18,109,0,16,8,48,0,57,59,122,0,20,0,9,18, -114,50,0,59,121,0,18,109,0,16,10,49,0,57,59,122,0,20,0,9,18,114,50,0,59,122,0,18,109,0,16,10,50,0, -57,59,122,0,20,0,9,18,114,50,0,59,119,0,18,109,0,16,10,51,0,57,59,122,0,20,0,4,118,101,99,52,95, -100,111,116,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,114,50,0,0,18,118,0,0,0,0,2,3,2,0,12, -1,114,51,0,0,0,9,18,114,51,0,59,120,0,18,109,0,16,8,48,0,57,59,119,0,20,0,9,18,114,51,0,59,121,0, -18,109,0,16,10,49,0,57,59,119,0,20,0,9,18,114,51,0,59,122,0,18,109,0,16,10,50,0,57,59,119,0,20,0,9, -18,114,51,0,59,119,0,18,109,0,16,10,51,0,57,59,119,0,20,0,4,118,101,99,52,95,100,111,116,0,18,95, -95,114,101,116,86,97,108,0,59,119,0,0,18,114,51,0,0,18,118,0,0,0,0,0,1,0,12,2,21,1,1,0,12,118,0,0, -1,1,0,15,109,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,100,111,116,0,18,118,0,0,18, -109,0,16,8,48,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,100,111,116,0,18,118,0, -0,18,109,0,16,10,49,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,100,111,116,0,18, -118,0,0,18,109,0,16,10,50,0,57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,100,111,116, -0,18,118,0,0,18,109,0,16,10,51,0,57,0,0,20,0,0,1,0,0,2,1,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9, -18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,21,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57, -21,0,0,1,0,0,2,2,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0, -57,22,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,22,0,0,1,0,0,2,3,1,0,2,13,109,0,0,1,1,0,13, -110,0,0,0,1,9,18,109,0,18,109,0,18,110,0,48,20,0,0,1,0,0,2,4,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1, -9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,24,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57, -24,0,0,1,0,0,2,1,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0, -57,21,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,21,0,9,18,109,0,16,10,50,0,57,18,110,0,16, -10,50,0,57,21,0,0,1,0,0,2,2,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0, -16,8,48,0,57,22,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,22,0,9,18,109,0,16,10,50,0,57,18, -110,0,16,10,50,0,57,22,0,0,1,0,0,2,3,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,18,109,0,18, -110,0,48,20,0,0,1,0,0,2,4,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0, -16,8,48,0,57,24,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,24,0,9,18,109,0,16,10,50,0,57,18, -110,0,16,10,50,0,57,24,0,0,1,0,0,2,1,1,0,2,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,16,8,48,0,57, -18,110,0,16,8,48,0,57,21,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,21,0,9,18,109,0,16,10, -50,0,57,18,110,0,16,10,50,0,57,21,0,9,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,21,0,0,1,0,0,2, -2,1,0,2,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,22,0,9,18, +16,10,51,0,57,18,98,0,49,20,0,0,1,0,10,2,21,1,1,0,13,109,0,0,1,1,0,10,118,0,0,0,1,9,18,95,95,114, +101,116,86,97,108,0,18,109,0,16,8,48,0,57,18,118,0,59,120,120,0,48,18,109,0,16,10,49,0,57,18,118,0, +59,121,121,0,48,46,20,0,0,1,0,10,2,21,1,1,0,10,118,0,0,1,1,0,13,109,0,0,0,1,9,18,95,95,114,101,116, +86,97,108,0,59,120,0,58,100,111,116,0,18,118,0,0,18,109,0,16,8,48,0,57,0,0,20,0,9,18,95,95,114,101, +116,86,97,108,0,59,121,0,58,100,111,116,0,18,118,0,0,18,109,0,16,10,49,0,57,0,0,20,0,0,1,0,11,2,21, +1,1,0,14,109,0,0,1,1,0,11,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,109,0,16,8,48,0,57,18, +118,0,59,120,120,120,0,48,18,109,0,16,10,49,0,57,18,118,0,59,121,121,121,0,48,46,18,109,0,16,10,50, +0,57,18,118,0,59,122,122,122,0,48,46,20,0,0,1,0,11,2,21,1,1,0,11,118,0,0,1,1,0,14,109,0,0,0,1,9,18, +95,95,114,101,116,86,97,108,0,59,120,0,58,100,111,116,0,18,118,0,0,18,109,0,16,8,48,0,57,0,0,20,0, +9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,100,111,116,0,18,118,0,0,18,109,0,16,10,49,0,57,0,0, +20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,100,111,116,0,18,118,0,0,18,109,0,16,10,50,0, +57,0,0,20,0,0,1,0,12,2,21,1,1,0,15,109,0,0,1,1,0,12,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0, +18,109,0,16,8,48,0,57,18,118,0,59,120,120,120,120,0,48,18,109,0,16,10,49,0,57,18,118,0,59,121,121, +121,121,0,48,46,18,109,0,16,10,50,0,57,18,118,0,59,122,122,122,122,0,48,46,18,109,0,16,10,51,0,57, +18,118,0,59,119,119,119,119,0,48,46,20,0,0,1,0,12,2,21,1,1,0,12,118,0,0,1,1,0,15,109,0,0,0,1,9,18, +95,95,114,101,116,86,97,108,0,59,120,0,58,100,111,116,0,18,118,0,0,18,109,0,16,8,48,0,57,0,0,20,0, +9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,100,111,116,0,18,118,0,0,18,109,0,16,10,49,0,57,0,0, +20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,100,111,116,0,18,118,0,0,18,109,0,16,10,50,0, +57,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,100,111,116,0,18,118,0,0,18,109,0,16,10, +51,0,57,0,0,20,0,0,1,0,0,2,1,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110, +0,16,8,48,0,57,21,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,21,0,0,1,0,0,2,2,1,0,2,13,109, +0,0,1,1,0,13,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,22,0,9,18,109,0,16,10,49,0, +57,18,110,0,16,10,49,0,57,22,0,0,1,0,0,2,3,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,109,0,18,109, +0,18,110,0,48,20,0,0,1,0,0,2,4,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18, +110,0,16,8,48,0,57,24,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,24,0,0,1,0,0,2,1,1,0,2,14, +109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,21,0,9,18,109,0,16,10, +49,0,57,18,110,0,16,10,49,0,57,21,0,9,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,21,0,0,1,0,0,2, +2,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,22,0,9,18, 109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,22,0,9,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,22, -0,9,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,22,0,0,1,0,0,2,3,1,0,2,15,109,0,0,1,1,0,15,110,0, -0,0,1,9,18,109,0,18,109,0,18,110,0,48,20,0,0,1,0,0,2,4,1,0,2,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18, -109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,24,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,24,0, -9,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,24,0,9,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0, -57,24,0,0,1,0,0,2,1,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,21,0,9,18, -109,0,16,10,49,0,57,18,97,0,21,0,0,1,0,0,2,2,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8, -48,0,57,18,97,0,22,0,9,18,109,0,16,10,49,0,57,18,97,0,22,0,0,1,0,0,2,3,1,0,2,13,109,0,0,1,1,0,9,97, -0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,23,0,9,18,109,0,16,10,49,0,57,18,97,0,23,0,0,1,0,0,2,4,1,0, -2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,24,0,9,18,109,0,16,10,49,0,57,18, -97,0,24,0,0,1,0,0,2,1,1,0,2,14,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,21,0,9, -18,109,0,16,10,49,0,57,18,97,0,21,0,9,18,109,0,16,10,50,0,57,18,97,0,21,0,0,1,0,0,2,2,1,0,2,14,109, -0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,22,0,9,18,109,0,16,10,49,0,57,18,97,0,22,0, -9,18,109,0,16,10,50,0,57,18,97,0,22,0,0,1,0,0,2,3,1,0,2,14,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0, -16,8,48,0,57,18,97,0,23,0,9,18,109,0,16,10,49,0,57,18,97,0,23,0,9,18,109,0,16,10,50,0,57,18,97,0, -23,0,0,1,0,0,2,4,1,0,2,14,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,24,0,9,18,109, -0,16,10,49,0,57,18,97,0,24,0,9,18,109,0,16,10,50,0,57,18,97,0,24,0,0,1,0,0,2,1,1,0,2,15,109,0,0,1, -1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,21,0,9,18,109,0,16,10,49,0,57,18,97,0,21,0,9,18, -109,0,16,10,50,0,57,18,97,0,21,0,9,18,109,0,16,10,51,0,57,18,97,0,21,0,0,1,0,0,2,2,1,0,2,15,109,0, -0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,22,0,9,18,109,0,16,10,49,0,57,18,97,0,22,0,9, -18,109,0,16,10,50,0,57,18,97,0,22,0,9,18,109,0,16,10,51,0,57,18,97,0,22,0,0,1,0,0,2,3,1,0,2,15,109, -0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,23,0,9,18,109,0,16,10,49,0,57,18,97,0,23,0, -9,18,109,0,16,10,50,0,57,18,97,0,23,0,9,18,109,0,16,10,51,0,57,18,97,0,23,0,0,1,0,0,2,4,1,0,2,15, -109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,24,0,9,18,109,0,16,10,49,0,57,18,97,0, -24,0,9,18,109,0,16,10,50,0,57,18,97,0,24,0,9,18,109,0,16,10,51,0,57,18,97,0,24,0,0,1,0,0,2,3,1,0,2, -10,118,0,0,1,1,0,13,109,0,0,0,1,9,18,118,0,18,118,0,18,109,0,48,20,0,0,1,0,0,2,3,1,0,2,11,118,0,0, -1,1,0,14,109,0,0,0,1,9,18,118,0,18,118,0,18,109,0,48,20,0,0,1,0,0,2,3,1,0,2,12,118,0,0,1,1,0,15, -109,0,0,0,1,9,18,118,0,18,118,0,18,109,0,48,20,0,0,1,0,5,2,25,1,0,2,5,97,0,0,0,1,9,18,97,0,18,97,0, -16,10,49,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,18,97,0,20,0,0,1,0,6,2,25,1,0,2,6,118,0,0,0, -1,9,18,118,0,18,118,0,58,105,118,101,99,50,0,16,10,49,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97, -108,0,18,118,0,20,0,0,1,0,7,2,25,1,0,2,7,118,0,0,0,1,9,18,118,0,18,118,0,58,105,118,101,99,51,0,16, -10,49,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,8,2,25,1,0,2,8,118,0,0, -0,1,9,18,118,0,18,118,0,58,105,118,101,99,52,0,16,10,49,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97, -108,0,18,118,0,20,0,0,1,0,9,2,25,1,0,2,9,97,0,0,0,1,9,18,97,0,18,97,0,17,49,0,48,0,0,47,20,0,9,18, -95,95,114,101,116,86,97,108,0,18,97,0,20,0,0,1,0,10,2,25,1,0,2,10,118,0,0,0,1,9,18,118,0,18,118,0, -58,118,101,99,50,0,17,49,0,48,0,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1, -0,11,2,25,1,0,2,11,118,0,0,0,1,9,18,118,0,18,118,0,58,118,101,99,51,0,17,49,0,48,0,0,0,0,47,20,0,9, -18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,12,2,25,1,0,2,12,118,0,0,0,1,9,18,118,0,18, -118,0,58,118,101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20, -0,0,1,0,13,2,25,1,0,2,13,109,0,0,0,1,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99, -50,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,50,0, -17,49,0,48,0,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,18,109,0,20,0,0,1,0,14,2,25,1,0,2,14, -109,0,0,0,1,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,47, -20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,47,20,0, -9,18,109,0,16,10,50,0,57,18,109,0,16,10,50,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,47,20,0,9,18, -95,95,114,101,116,86,97,108,0,18,109,0,20,0,0,1,0,15,2,25,1,0,2,15,109,0,0,0,1,9,18,109,0,16,8,48, -0,57,18,109,0,16,8,48,0,57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,49,0,57, -18,109,0,16,10,49,0,57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,50,0,57,18, -109,0,16,10,50,0,57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,51,0,57,18,109, -0,16,10,51,0,57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0, -18,109,0,20,0,0,1,0,5,2,24,1,0,2,5,97,0,0,0,1,9,18,97,0,18,97,0,16,10,49,0,46,20,0,9,18,95,95,114, -101,116,86,97,108,0,18,97,0,20,0,0,1,0,6,2,24,1,0,2,6,118,0,0,0,1,9,18,118,0,18,118,0,58,105,118, -101,99,50,0,16,10,49,0,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,7,2,24,1, -0,2,7,118,0,0,0,1,9,18,118,0,18,118,0,58,105,118,101,99,51,0,16,10,49,0,0,0,46,20,0,9,18,95,95,114, -101,116,86,97,108,0,18,118,0,20,0,0,1,0,8,2,24,1,0,2,8,118,0,0,0,1,9,18,118,0,18,118,0,58,105,118, -101,99,52,0,16,10,49,0,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,9,2,24,1, -0,2,9,97,0,0,0,1,9,18,97,0,18,97,0,17,49,0,48,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,97, -0,20,0,0,1,0,10,2,24,1,0,2,10,118,0,0,0,1,9,18,118,0,18,118,0,58,118,101,99,50,0,17,49,0,48,0,0,0, -0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,11,2,24,1,0,2,11,118,0,0,0,1,9,18, -118,0,18,118,0,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18, -118,0,20,0,0,1,0,12,2,24,1,0,2,12,118,0,0,0,1,9,18,118,0,18,118,0,58,118,101,99,52,0,17,49,0,48,0, -0,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,13,2,24,1,0,2,13,109,0,0,0,1, -9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,50,0,17,49,0,48,0,0,0,0,46,20,0,9,18, -109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,50,0,17,49,0,48,0,0,0,0,46,20,0,9,18,95, -95,114,101,116,86,97,108,0,18,109,0,20,0,0,1,0,14,2,24,1,0,2,14,109,0,0,0,1,9,18,109,0,16,8,48,0, -57,18,109,0,16,8,48,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,49,0,57,18, -109,0,16,10,49,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,50,0,57,18,109, -0,16,10,50,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0, -18,109,0,20,0,0,1,0,15,2,24,1,0,2,15,109,0,0,0,1,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58, -118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118, -101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,50,0,57,18,109,0,16,10,50,0,57,58,118,101, -99,52,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,51,0,57,18,109,0,16,10,51,0,57,58,118,101,99, -52,0,17,49,0,48,0,0,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,109,0,20,0,0,1,0,5,0,95,95, -112,111,115,116,68,101,99,114,0,1,0,2,5,97,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,97,0,20,0, -9,18,97,0,18,97,0,16,10,49,0,47,20,0,0,1,0,6,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,6,118,0, -0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,105,118,101,99,50,0, -16,10,49,0,0,0,47,20,0,0,1,0,7,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,7,118,0,0,0,1,9,18,95, -95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,105,118,101,99,51,0,16,10,49,0,0,0, -47,20,0,0,1,0,8,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,8,118,0,0,0,1,9,18,95,95,114,101,116, -86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,105,118,101,99,52,0,16,10,49,0,0,0,47,20,0,0,1,0, -9,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,9,97,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18, -97,0,20,0,9,18,97,0,18,97,0,17,49,0,48,0,0,47,20,0,0,1,0,10,0,95,95,112,111,115,116,68,101,99,114, -0,1,0,2,10,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,118, -101,99,50,0,17,49,0,48,0,0,0,0,47,20,0,0,1,0,11,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,11, -118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,118,101,99,51, -0,17,49,0,48,0,0,0,0,47,20,0,0,1,0,12,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,12,118,0,0,0,1, -9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,118,101,99,52,0,17,49,0,48, -0,0,0,0,47,20,0,0,1,0,13,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,13,109,0,0,0,1,9,18,95,95, -114,101,116,86,97,108,0,18,109,0,20,0,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99, -50,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,50,0, -17,49,0,48,0,0,0,0,47,20,0,0,1,0,14,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,14,109,0,0,0,1,9, -18,95,95,114,101,116,86,97,108,0,18,109,0,20,0,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58, -118,101,99,51,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118, -101,99,51,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,50,0,57,18,109,0,16,10,50,0,57,58,118,101, -99,51,0,17,49,0,48,0,0,0,0,47,20,0,0,1,0,15,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,15,109,0, -0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,109,0,20,0,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0, +0,0,1,0,0,2,3,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,18,109,0,18,110,0,48,20,0,0,1,0,0,2, +4,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,24,0,9,18, +109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,24,0,9,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,24, +0,0,1,0,0,2,1,1,0,2,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57, +21,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,21,0,9,18,109,0,16,10,50,0,57,18,110,0,16,10, +50,0,57,21,0,9,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,21,0,0,1,0,0,2,2,1,0,2,15,109,0,0,1,1, +0,15,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,22,0,9,18,109,0,16,10,49,0,57,18, +110,0,16,10,49,0,57,22,0,9,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,22,0,9,18,109,0,16,10,51, +0,57,18,110,0,16,10,51,0,57,22,0,0,1,0,0,2,3,1,0,2,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,18, +109,0,18,110,0,48,20,0,0,1,0,0,2,4,1,0,2,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,16,8,48,0,57, +18,110,0,16,8,48,0,57,24,0,9,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,24,0,9,18,109,0,16,10, +50,0,57,18,110,0,16,10,50,0,57,24,0,9,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,24,0,0,1,0,0,2, +1,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,21,0,9,18,109,0,16,10,49,0, +57,18,97,0,21,0,0,1,0,0,2,2,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,22, +0,9,18,109,0,16,10,49,0,57,18,97,0,22,0,0,1,0,0,2,3,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0, +16,8,48,0,57,18,97,0,23,0,9,18,109,0,16,10,49,0,57,18,97,0,23,0,0,1,0,0,2,4,1,0,2,13,109,0,0,1,1,0, +9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,24,0,9,18,109,0,16,10,49,0,57,18,97,0,24,0,0,1,0,0,2, +1,1,0,2,14,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,21,0,9,18,109,0,16,10,49,0, +57,18,97,0,21,0,9,18,109,0,16,10,50,0,57,18,97,0,21,0,0,1,0,0,2,2,1,0,2,14,109,0,0,1,1,0,9,97,0,0, +0,1,9,18,109,0,16,8,48,0,57,18,97,0,22,0,9,18,109,0,16,10,49,0,57,18,97,0,22,0,9,18,109,0,16,10,50, +0,57,18,97,0,22,0,0,1,0,0,2,3,1,0,2,14,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0, +23,0,9,18,109,0,16,10,49,0,57,18,97,0,23,0,9,18,109,0,16,10,50,0,57,18,97,0,23,0,0,1,0,0,2,4,1,0,2, +14,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,24,0,9,18,109,0,16,10,49,0,57,18,97, +0,24,0,9,18,109,0,16,10,50,0,57,18,97,0,24,0,0,1,0,0,2,1,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1,9,18, +109,0,16,8,48,0,57,18,97,0,21,0,9,18,109,0,16,10,49,0,57,18,97,0,21,0,9,18,109,0,16,10,50,0,57,18, +97,0,21,0,9,18,109,0,16,10,51,0,57,18,97,0,21,0,0,1,0,0,2,2,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1,9, +18,109,0,16,8,48,0,57,18,97,0,22,0,9,18,109,0,16,10,49,0,57,18,97,0,22,0,9,18,109,0,16,10,50,0,57, +18,97,0,22,0,9,18,109,0,16,10,51,0,57,18,97,0,22,0,0,1,0,0,2,3,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1, +9,18,109,0,16,8,48,0,57,18,97,0,23,0,9,18,109,0,16,10,49,0,57,18,97,0,23,0,9,18,109,0,16,10,50,0, +57,18,97,0,23,0,9,18,109,0,16,10,51,0,57,18,97,0,23,0,0,1,0,0,2,4,1,0,2,15,109,0,0,1,1,0,9,97,0,0, +0,1,9,18,109,0,16,8,48,0,57,18,97,0,24,0,9,18,109,0,16,10,49,0,57,18,97,0,24,0,9,18,109,0,16,10,50, +0,57,18,97,0,24,0,9,18,109,0,16,10,51,0,57,18,97,0,24,0,0,1,0,0,2,3,1,0,2,10,118,0,0,1,1,0,13,109, +0,0,0,1,9,18,118,0,18,118,0,18,109,0,48,20,0,0,1,0,0,2,3,1,0,2,11,118,0,0,1,1,0,14,109,0,0,0,1,9, +18,118,0,18,118,0,18,109,0,48,20,0,0,1,0,0,2,3,1,0,2,12,118,0,0,1,1,0,15,109,0,0,0,1,9,18,118,0,18, +118,0,18,109,0,48,20,0,0,1,0,5,2,25,1,0,2,5,97,0,0,0,1,9,18,97,0,18,97,0,16,10,49,0,47,20,0,9,18, +95,95,114,101,116,86,97,108,0,18,97,0,20,0,0,1,0,6,2,25,1,0,2,6,118,0,0,0,1,9,18,118,0,18,118,0,58, +105,118,101,99,50,0,16,10,49,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0, +7,2,25,1,0,2,7,118,0,0,0,1,9,18,118,0,18,118,0,58,105,118,101,99,51,0,16,10,49,0,0,0,47,20,0,9,18, +95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,8,2,25,1,0,2,8,118,0,0,0,1,9,18,118,0,18,118,0, +58,105,118,101,99,52,0,16,10,49,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1, +0,9,2,25,1,0,2,9,97,0,0,0,1,9,18,97,0,18,97,0,17,49,0,48,0,0,47,20,0,9,18,95,95,114,101,116,86,97, +108,0,18,97,0,20,0,0,1,0,10,2,25,1,0,2,10,118,0,0,0,1,9,18,118,0,18,118,0,58,118,101,99,50,0,17,49, +0,48,0,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,11,2,25,1,0,2,11,118,0, +0,0,1,9,18,118,0,18,118,0,58,118,101,99,51,0,17,49,0,48,0,0,0,0,47,20,0,9,18,95,95,114,101,116,86, +97,108,0,18,118,0,20,0,0,1,0,12,2,25,1,0,2,12,118,0,0,0,1,9,18,118,0,18,118,0,58,118,101,99,52,0, +17,49,0,48,0,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,13,2,25,1,0,2,13, +109,0,0,0,1,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,50,0,17,49,0,48,0,0,0,0,47, +20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,50,0,17,49,0,48,0,0,0,0,47,20,0, +9,18,95,95,114,101,116,86,97,108,0,18,109,0,20,0,0,1,0,14,2,25,1,0,2,14,109,0,0,0,1,9,18,109,0,16, +8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,49, +0,57,18,109,0,16,10,49,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,50,0,57, +18,109,0,16,10,50,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97, +108,0,18,109,0,20,0,0,1,0,15,2,25,1,0,2,15,109,0,0,0,1,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0, 57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57, 58,118,101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,50,0,57,18,109,0,16,10,50,0,57,58, 118,101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,51,0,57,18,109,0,16,10,51,0,57,58,118, -101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,0,1,0,9,0,95,95,112,111,115,116,73,110,99,114,0,1,0,2,9,97, -0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,97,0,20,0,9,18,97,0,18,97,0,16,10,49,0,46,20,0,0,1,0, -10,0,95,95,112,111,115,116,73,110,99,114,0,1,0,2,10,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0, -18,118,0,20,0,9,18,118,0,18,118,0,58,118,101,99,50,0,17,49,0,48,0,0,0,0,46,20,0,0,1,0,11,0,95,95, -112,111,115,116,73,110,99,114,0,1,0,2,11,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0, -20,0,9,18,118,0,18,118,0,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,0,1,0,12,0,95,95,112,111, -115,116,73,110,99,114,0,1,0,2,12,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9,18, -118,0,18,118,0,58,118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,0,1,0,5,0,95,95,112,111,115,116,73, -110,99,114,0,1,0,2,5,97,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,97,0,20,0,9,18,97,0,18,97,0, -16,10,49,0,46,20,0,0,1,0,6,0,95,95,112,111,115,116,73,110,99,114,0,1,0,2,6,118,0,0,0,1,9,18,95,95, -114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,105,118,101,99,50,0,16,10,49,0,0,0,46, -20,0,0,1,0,7,0,95,95,112,111,115,116,73,110,99,114,0,1,0,2,7,118,0,0,0,1,9,18,95,95,114,101,116,86, -97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,105,118,101,99,51,0,16,10,49,0,0,0,46,20,0,0,1,0,8,0, -95,95,112,111,115,116,73,110,99,114,0,1,0,2,8,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18, -118,0,20,0,9,18,118,0,18,118,0,58,105,118,101,99,51,0,16,10,49,0,0,0,46,20,0,0,1,0,13,0,95,95,112, -111,115,116,73,110,99,114,0,1,0,2,13,109,0,0,0,1,3,2,0,13,1,110,0,2,18,109,0,0,0,9,18,109,0,16,8, +101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,9,18,95,95,114,101,116,86,97,108,0,18,109,0,20,0,0,1,0,5,2, +24,1,0,2,5,97,0,0,0,1,9,18,97,0,18,97,0,16,10,49,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18, +97,0,20,0,0,1,0,6,2,24,1,0,2,6,118,0,0,0,1,9,18,118,0,18,118,0,58,105,118,101,99,50,0,16,10,49,0,0, +0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,7,2,24,1,0,2,7,118,0,0,0,1,9,18, +118,0,18,118,0,58,105,118,101,99,51,0,16,10,49,0,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18, +118,0,20,0,0,1,0,8,2,24,1,0,2,8,118,0,0,0,1,9,18,118,0,18,118,0,58,105,118,101,99,52,0,16,10,49,0, +0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,9,2,24,1,0,2,9,97,0,0,0,1,9,18, +97,0,18,97,0,17,49,0,48,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,97,0,20,0,0,1,0,10,2,24, +1,0,2,10,118,0,0,0,1,9,18,118,0,18,118,0,58,118,101,99,50,0,17,49,0,48,0,0,0,0,46,20,0,9,18,95,95, +114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,11,2,24,1,0,2,11,118,0,0,0,1,9,18,118,0,18,118,0,58, +118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0, +12,2,24,1,0,2,12,118,0,0,0,1,9,18,118,0,18,118,0,58,118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,9, +18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,0,1,0,13,2,24,1,0,2,13,109,0,0,0,1,9,18,109,0,16,8, 48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,50,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,49,0, -57,18,109,0,16,10,49,0,57,58,118,101,99,50,0,17,49,0,48,0,0,0,0,46,20,0,8,18,110,0,0,0,1,0,14,0,95, -95,112,111,115,116,73,110,99,114,0,1,0,2,14,109,0,0,0,1,3,2,0,14,1,110,0,2,18,109,0,0,0,9,18,109,0, -16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10, -49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,50,0, -57,18,109,0,16,10,50,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,8,18,110,0,0,0,1,0,15,0,95, -95,112,111,115,116,73,110,99,114,0,1,0,2,15,109,0,0,0,1,3,2,0,15,1,110,0,2,18,109,0,0,0,9,18,109,0, -16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10, -49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,50,0, -57,18,109,0,16,10,50,0,57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,51,0,57, -18,109,0,16,10,51,0,57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,8,18,110,0,0,0,1,0,1,2,15,1,1, -0,9,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,115,103,116,0,18,95,95,114,101,116,86,97,108,0,59, -120,0,0,18,98,0,0,18,97,0,0,0,0,1,0,1,2,15,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,58,102,108,111,97, -116,0,18,97,0,0,0,58,102,108,111,97,116,0,18,98,0,0,0,40,0,0,1,0,1,2,16,1,1,0,9,97,0,0,1,1,0,9,98, -0,0,0,1,3,2,0,1,1,99,0,0,0,4,102,108,111,97,116,95,108,101,115,115,0,18,99,0,0,18,98,0,0,18,97,0,0, -0,8,18,99,0,0,0,1,0,1,2,16,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,58,102,108,111,97,116,0,18,97,0,0,0, -58,102,108,111,97,116,0,18,98,0,0,0,41,0,0,1,0,1,2,18,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,1,1, -103,0,0,1,1,101,0,0,0,4,102,108,111,97,116,95,108,101,115,115,0,18,103,0,0,18,98,0,0,18,97,0,0,0,4, -102,108,111,97,116,95,101,113,117,97,108,0,18,101,0,0,18,97,0,0,18,98,0,0,0,8,18,103,0,18,101,0,32, -0,0,1,0,1,2,18,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108, -111,97,116,0,18,98,0,0,0,43,0,0,1,0,1,2,17,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,1,1,103,0,0,1,1, -101,0,0,0,4,102,108,111,97,116,95,108,101,115,115,0,18,103,0,0,18,97,0,0,18,98,0,0,0,4,102,108,111, -97,116,95,101,113,117,97,108,0,18,101,0,0,18,97,0,0,18,98,0,0,0,8,18,103,0,18,101,0,32,0,0,1,0,1,2, -17,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108,111,97,116,0, -18,98,0,0,0,42,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,9,102,0,0,0,1,4,102,108,111,97, -116,95,112,114,105,110,116,0,18,102,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,5,105, -0,0,0,1,4,105,110,116,95,112,114,105,110,116,0,18,105,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83, -65,0,1,1,0,1,98,0,0,0,1,4,98,111,111,108,95,112,114,105,110,116,0,18,98,0,0,0,0,1,0,0,0,112,114, -105,110,116,77,69,83,65,0,1,1,0,10,118,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59, -120,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,121,0,0,0,0,0,1,0,0,0,112,114,105, -110,116,77,69,83,65,0,1,1,0,11,118,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,120, -0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,121,0,0,0,0,9,58,112,114,105,110,116,77, -69,83,65,0,18,118,0,59,122,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,12,118,0,0,0, -1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114,105,110,116,77,69,83, -65,0,18,118,0,59,121,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,122,0,0,0,0,9,58, -112,114,105,110,116,77,69,83,65,0,18,118,0,59,119,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83, -65,0,1,1,0,6,118,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112, -114,105,110,116,77,69,83,65,0,18,118,0,59,121,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0, -1,1,0,7,118,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114, -105,110,116,77,69,83,65,0,18,118,0,59,121,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0, -59,122,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,8,118,0,0,0,1,9,58,112,114,105, -110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59, -121,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,122,0,0,0,0,9,58,112,114,105,110, -116,77,69,83,65,0,18,118,0,59,119,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,2,118, -0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114,105,110,116,77, -69,83,65,0,18,118,0,59,121,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,3,118,0,0,0,1, -9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114,105,110,116,77,69,83, -65,0,18,118,0,59,121,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,122,0,0,0,0,0,1,0, -0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,4,118,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0, -18,118,0,59,120,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,121,0,0,0,0,9,58,112, -114,105,110,116,77,69,83,65,0,18,118,0,59,122,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18, -118,0,59,119,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,13,109,0,0,0,1,9,58,112,114, -105,110,116,77,69,83,65,0,18,109,0,16,8,48,0,57,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18, -109,0,16,10,49,0,57,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,14,109,0,0,0,1,9,58, -112,114,105,110,116,77,69,83,65,0,18,109,0,16,8,48,0,57,0,0,0,9,58,112,114,105,110,116,77,69,83,65, -0,18,109,0,16,10,49,0,57,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,109,0,16,10,50,0,57,0,0,0, -0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,15,109,0,0,0,1,9,58,112,114,105,110,116,77,69,83, -65,0,18,109,0,16,8,48,0,57,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,109,0,16,10,49,0,57,0,0, -0,9,58,112,114,105,110,116,77,69,83,65,0,18,109,0,16,10,50,0,57,0,0,0,9,58,112,114,105,110,116,77, -69,83,65,0,18,109,0,16,10,51,0,57,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,16,101,0, -0,0,1,4,105,110,116,95,112,114,105,110,116,0,18,101,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83, -65,0,1,1,0,17,101,0,0,0,1,4,105,110,116,95,112,114,105,110,116,0,18,101,0,0,0,0,1,0,0,0,112,114, -105,110,116,77,69,83,65,0,1,1,0,18,101,0,0,0,1,4,105,110,116,95,112,114,105,110,116,0,18,101,0,0,0, -0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,19,101,0,0,0,1,4,105,110,116,95,112,114,105,110, -116,0,18,101,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,20,101,0,0,0,1,4,105,110,116, -95,112,114,105,110,116,0,18,101,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,21,101,0,0, -0,1,4,105,110,116,95,112,114,105,110,116,0,18,101,0,0,0,0,0 +57,18,109,0,16,10,49,0,57,58,118,101,99,50,0,17,49,0,48,0,0,0,0,46,20,0,9,18,95,95,114,101,116,86, +97,108,0,18,109,0,20,0,0,1,0,14,2,24,1,0,2,14,109,0,0,0,1,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48, +0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57, +58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,50,0,57,18,109,0,16,10,50,0,57,58, +118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,109,0,20,0,0,1,0, +15,2,24,1,0,2,15,109,0,0,0,1,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,52,0,17, +49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,52,0,17,49,0, +48,0,0,0,0,46,20,0,9,18,109,0,16,10,50,0,57,18,109,0,16,10,50,0,57,58,118,101,99,52,0,17,49,0,48,0, +0,0,0,46,20,0,9,18,109,0,16,10,51,0,57,18,109,0,16,10,51,0,57,58,118,101,99,52,0,17,49,0,48,0,0,0, +0,46,20,0,9,18,95,95,114,101,116,86,97,108,0,18,109,0,20,0,0,1,0,5,0,95,95,112,111,115,116,68,101, +99,114,0,1,0,2,5,97,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,97,0,20,0,9,18,97,0,18,97,0,16, +10,49,0,47,20,0,0,1,0,6,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,6,118,0,0,0,1,9,18,95,95,114, +101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,105,118,101,99,50,0,16,10,49,0,0,0,47,20, +0,0,1,0,7,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,7,118,0,0,0,1,9,18,95,95,114,101,116,86,97, +108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,105,118,101,99,51,0,16,10,49,0,0,0,47,20,0,0,1,0,8,0,95, +95,112,111,115,116,68,101,99,114,0,1,0,2,8,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0, +20,0,9,18,118,0,18,118,0,58,105,118,101,99,52,0,16,10,49,0,0,0,47,20,0,0,1,0,9,0,95,95,112,111,115, +116,68,101,99,114,0,1,0,2,9,97,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,97,0,20,0,9,18,97,0, +18,97,0,17,49,0,48,0,0,47,20,0,0,1,0,10,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,10,118,0,0,0, +1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,118,101,99,50,0,17,49,0, +48,0,0,0,0,47,20,0,0,1,0,11,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,11,118,0,0,0,1,9,18,95, +95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,118,101,99,51,0,17,49,0,48,0,0,0,0, +47,20,0,0,1,0,12,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,12,118,0,0,0,1,9,18,95,95,114,101, +116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,118,101,99,52,0,17,49,0,48,0,0,0,0,47,20,0,0, +1,0,13,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,13,109,0,0,0,1,9,18,95,95,114,101,116,86,97, +108,0,18,109,0,20,0,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,50,0,17,49,0,48,0, +0,0,0,47,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,50,0,17,49,0,48,0,0,0, +0,47,20,0,0,1,0,14,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,14,109,0,0,0,1,9,18,95,95,114,101, +116,86,97,108,0,18,109,0,20,0,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,51,0,17, +49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,51,0,17,49,0, +48,0,0,0,0,47,20,0,9,18,109,0,16,10,50,0,57,18,109,0,16,10,50,0,57,58,118,101,99,51,0,17,49,0,48,0, +0,0,0,47,20,0,0,1,0,15,0,95,95,112,111,115,116,68,101,99,114,0,1,0,2,15,109,0,0,0,1,9,18,95,95,114, +101,116,86,97,108,0,18,109,0,20,0,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0,57,58,118,101,99,52,0, +17,49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57,58,118,101,99,52,0,17, +49,0,48,0,0,0,0,47,20,0,9,18,109,0,16,10,50,0,57,18,109,0,16,10,50,0,57,58,118,101,99,52,0,17,49,0, +48,0,0,0,0,47,20,0,9,18,109,0,16,10,51,0,57,18,109,0,16,10,51,0,57,58,118,101,99,52,0,17,49,0,48,0, +0,0,0,47,20,0,0,1,0,9,0,95,95,112,111,115,116,73,110,99,114,0,1,0,2,9,97,0,0,0,1,9,18,95,95,114, +101,116,86,97,108,0,18,97,0,20,0,9,18,97,0,18,97,0,16,10,49,0,46,20,0,0,1,0,10,0,95,95,112,111,115, +116,73,110,99,114,0,1,0,2,10,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118, +0,18,118,0,58,118,101,99,50,0,17,49,0,48,0,0,0,0,46,20,0,0,1,0,11,0,95,95,112,111,115,116,73,110, +99,114,0,1,0,2,11,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0, +58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,0,1,0,12,0,95,95,112,111,115,116,73,110,99,114,0,1,0, +2,12,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18,118,0,58,118,101, +99,52,0,17,49,0,48,0,0,0,0,46,20,0,0,1,0,5,0,95,95,112,111,115,116,73,110,99,114,0,1,0,2,5,97,0,0, +0,1,9,18,95,95,114,101,116,86,97,108,0,18,97,0,20,0,9,18,97,0,18,97,0,16,10,49,0,46,20,0,0,1,0,6,0, +95,95,112,111,115,116,73,110,99,114,0,1,0,2,6,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18, +118,0,20,0,9,18,118,0,18,118,0,58,105,118,101,99,50,0,16,10,49,0,0,0,46,20,0,0,1,0,7,0,95,95,112, +111,115,116,73,110,99,114,0,1,0,2,7,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9, +18,118,0,18,118,0,58,105,118,101,99,51,0,16,10,49,0,0,0,46,20,0,0,1,0,8,0,95,95,112,111,115,116,73, +110,99,114,0,1,0,2,8,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,20,0,9,18,118,0,18, +118,0,58,105,118,101,99,51,0,16,10,49,0,0,0,46,20,0,0,1,0,13,0,95,95,112,111,115,116,73,110,99,114, +0,1,0,2,13,109,0,0,0,1,3,2,0,13,1,110,0,2,18,109,0,0,0,9,18,109,0,16,8,48,0,57,18,109,0,16,8,48,0, +57,58,118,101,99,50,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49,0,57, +58,118,101,99,50,0,17,49,0,48,0,0,0,0,46,20,0,8,18,110,0,0,0,1,0,14,0,95,95,112,111,115,116,73,110, +99,114,0,1,0,2,14,109,0,0,0,1,3,2,0,14,1,110,0,2,18,109,0,0,0,9,18,109,0,16,8,48,0,57,18,109,0,16, +8,48,0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49, +0,57,58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,50,0,57,18,109,0,16,10,50,0,57, +58,118,101,99,51,0,17,49,0,48,0,0,0,0,46,20,0,8,18,110,0,0,0,1,0,15,0,95,95,112,111,115,116,73,110, +99,114,0,1,0,2,15,109,0,0,0,1,3,2,0,15,1,110,0,2,18,109,0,0,0,9,18,109,0,16,8,48,0,57,18,109,0,16, +8,48,0,57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,49,0,57,18,109,0,16,10,49, +0,57,58,118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,50,0,57,18,109,0,16,10,50,0,57, +58,118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,9,18,109,0,16,10,51,0,57,18,109,0,16,10,51,0,57,58, +118,101,99,52,0,17,49,0,48,0,0,0,0,46,20,0,8,18,110,0,0,0,1,0,1,2,15,1,1,0,9,97,0,0,1,1,0,9,98,0,0, +0,1,4,118,101,99,52,95,115,103,116,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,98,0,0,18,97,0, +0,0,0,1,0,1,2,15,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,58,102,108,111,97,116,0,18,97,0,0,0,58,102, +108,111,97,116,0,18,98,0,0,0,40,0,0,1,0,1,2,16,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,1,1,99,0,0, +0,4,102,108,111,97,116,95,108,101,115,115,0,18,99,0,0,18,98,0,0,18,97,0,0,0,8,18,99,0,0,0,1,0,1,2, +16,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108,111,97,116,0, +18,98,0,0,0,41,0,0,1,0,1,2,18,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,1,1,103,0,0,1,1,101,0,0,0,4, +102,108,111,97,116,95,108,101,115,115,0,18,103,0,0,18,98,0,0,18,97,0,0,0,4,102,108,111,97,116,95, +101,113,117,97,108,0,18,101,0,0,18,97,0,0,18,98,0,0,0,8,18,103,0,18,101,0,32,0,0,1,0,1,2,18,1,1,0, +5,97,0,0,1,1,0,5,98,0,0,0,1,8,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108,111,97,116,0,18,98,0, +0,0,43,0,0,1,0,1,2,17,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,1,1,103,0,0,1,1,101,0,0,0,4,102,108, +111,97,116,95,108,101,115,115,0,18,103,0,0,18,97,0,0,18,98,0,0,0,4,102,108,111,97,116,95,101,113, +117,97,108,0,18,101,0,0,18,97,0,0,18,98,0,0,0,8,18,103,0,18,101,0,32,0,0,1,0,1,2,17,1,1,0,5,97,0,0, +1,1,0,5,98,0,0,0,1,8,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108,111,97,116,0,18,98,0,0,0,42,0, +0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,9,102,0,0,0,1,4,102,108,111,97,116,95,112,114, +105,110,116,0,18,102,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,5,105,0,0,0,1,4,105, +110,116,95,112,114,105,110,116,0,18,105,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,1, +98,0,0,0,1,4,98,111,111,108,95,112,114,105,110,116,0,18,98,0,0,0,0,1,0,0,0,112,114,105,110,116,77, +69,83,65,0,1,1,0,10,118,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9, +58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,121,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69, +83,65,0,1,1,0,11,118,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58, +112,114,105,110,116,77,69,83,65,0,18,118,0,59,121,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0, +18,118,0,59,122,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,12,118,0,0,0,1,9,58,112, +114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18, +118,0,59,121,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,122,0,0,0,0,9,58,112,114, +105,110,116,77,69,83,65,0,18,118,0,59,119,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1, +0,6,118,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114,105, +110,116,77,69,83,65,0,18,118,0,59,121,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,7, +118,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114,105,110, +116,77,69,83,65,0,18,118,0,59,121,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,122,0, +0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,8,118,0,0,0,1,9,58,112,114,105,110,116,77, +69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,121,0,0,0,0, +9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,122,0,0,0,0,9,58,112,114,105,110,116,77,69,83, +65,0,18,118,0,59,119,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,2,118,0,0,0,1,9,58, +112,114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0, +18,118,0,59,121,0,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,3,118,0,0,0,1,9,58,112, +114,105,110,116,77,69,83,65,0,18,118,0,59,120,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18, +118,0,59,121,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,122,0,0,0,0,0,1,0,0,0,112, +114,105,110,116,77,69,83,65,0,1,1,0,4,118,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0, +59,120,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,121,0,0,0,0,9,58,112,114,105,110, +116,77,69,83,65,0,18,118,0,59,122,0,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,118,0,59,119,0, +0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,13,109,0,0,0,1,9,58,112,114,105,110,116,77, +69,83,65,0,18,109,0,16,8,48,0,57,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,109,0,16,10,49,0, +57,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,14,109,0,0,0,1,9,58,112,114,105,110,116, +77,69,83,65,0,18,109,0,16,8,48,0,57,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,109,0,16,10,49, +0,57,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,109,0,16,10,50,0,57,0,0,0,0,1,0,0,0,112,114, +105,110,116,77,69,83,65,0,1,1,0,15,109,0,0,0,1,9,58,112,114,105,110,116,77,69,83,65,0,18,109,0,16, +8,48,0,57,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18,109,0,16,10,49,0,57,0,0,0,9,58,112,114, +105,110,116,77,69,83,65,0,18,109,0,16,10,50,0,57,0,0,0,9,58,112,114,105,110,116,77,69,83,65,0,18, +109,0,16,10,51,0,57,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,16,101,0,0,0,1,4,105, +110,116,95,112,114,105,110,116,0,18,101,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,17, +101,0,0,0,1,4,105,110,116,95,112,114,105,110,116,0,18,101,0,0,0,0,1,0,0,0,112,114,105,110,116,77, +69,83,65,0,1,1,0,18,101,0,0,0,1,4,105,110,116,95,112,114,105,110,116,0,18,101,0,0,0,0,1,0,0,0,112, +114,105,110,116,77,69,83,65,0,1,1,0,19,101,0,0,0,1,4,105,110,116,95,112,114,105,110,116,0,18,101,0, +0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,20,101,0,0,0,1,4,105,110,116,95,112,114,105, +110,116,0,18,101,0,0,0,0,1,0,0,0,112,114,105,110,116,77,69,83,65,0,1,1,0,21,101,0,0,0,1,4,105,110, +116,95,112,114,105,110,116,0,18,101,0,0,0,0,0 diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index f6ea57b3f2..ebead3274e 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2514,49 +2514,6 @@ _slang_gen_subscript(slang_assemble_ctx * A, slang_operation *oper) } -/** - * Look for expressions such as: gl_ModelviewMatrix * gl_Vertex - * and replace with this: gl_Vertex * gl_ModelviewMatrixTranpose - * Since matrices are stored in column-major order, the second form of - * multiplication is much more efficient (just 4 dot products). - */ -static void -_slang_check_matmul_optimization(slang_assemble_ctx *A, slang_operation *oper) -{ - static const struct { - const char *orig; - const char *tranpose; - } matrices[] = { - {"gl_ModelViewMatrix", "gl_ModelViewMatrixTranspose"}, - {"gl_ProjectionMatrix", "gl_ProjectionMatrixTranspose"}, - {"gl_ModelViewProjectionMatrix", "gl_ModelViewProjectionMatrixTranspose"}, - {"gl_TextureMatrix", "gl_TextureMatrixTranspose"}, - {"gl_NormalMatrix", "__NormalMatrixTranspose"}, - { NULL, NULL } - }; - - assert(oper->type == SLANG_OPER_MULTIPLY); - if (oper->children[0].type == SLANG_OPER_IDENTIFIER) { - GLuint i; - for (i = 0; matrices[i].orig; i++) { - if (oper->children[0].a_id - == slang_atom_pool_atom(A->atoms, matrices[i].orig)) { - /* - _mesa_printf("Replace %s with %s\n", - matrices[i].orig, matrices[i].tranpose); - */ - assert(oper->children[0].type == SLANG_OPER_IDENTIFIER); - oper->children[0].a_id - = slang_atom_pool_atom(A->atoms, matrices[i].tranpose); - /* finally, swap the operands */ - _slang_operation_swap(&oper->children[0], &oper->children[1]); - return; - } - } - } -} - - /** * Generate IR tree for a slang_operation (AST node) */ @@ -2690,7 +2647,6 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper) { slang_ir_node *n; assert(oper->num_children == 2); - _slang_check_matmul_optimization(A, oper); n = _slang_gen_function_call_name(A, "*", oper, NULL); return n; } -- cgit v1.2.3 From da3e48186dc25f40925ca89b08baa5cd34143647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 7 Apr 2008 10:28:42 +0200 Subject: r300: Fix r300VAPInputRoute{0,1} for big endian platforms. --- src/mesa/drivers/dri/r300/r300_emit.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index deb62b2762..e7371133d3 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -210,18 +210,23 @@ static void r300EmitVec(GLcontext * ctx, struct r300_dma_region *rvb, static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, int *inputs, GLint * tab, GLuint nr) { - GLushort i, w; - uint16_t * dst16 = (uint16_t *) dst; - + GLuint i, dw; + /* type, inputs, stop bit, size */ - for (i = 0; i < nr; i++) { + for (i = 0; i < nr; i += 2) { /* make sure input is valid, would lockup the gpu */ assert(inputs[tab[i]] != -1); - w = R300_INPUT_ROUTE_FLOAT | (inputs[tab[i]] << 8) | (attribptr[tab[i]]->size - 1); + dw = R300_INPUT_ROUTE_FLOAT | (inputs[tab[i]] << 8) | (attribptr[tab[i]]->size - 1); if (i + 1 == nr) { - w |= R300_VAP_INPUT_ROUTE_END; + dw |= R300_VAP_INPUT_ROUTE_END; + } else { + assert(inputs[tab[i + 1]] != -1); + dw |= (R300_INPUT_ROUTE_FLOAT | (inputs[tab[i + 1]] << 8) | (attribptr[tab[i + 1]]->size - 1)) << 16; + if (i + 2 == nr) { + dw |= (R300_VAP_INPUT_ROUTE_END << 16); + } } - dst16[i] = w; + dst[i >> 1] = dw; } return (nr + 1) >> 1; @@ -237,11 +242,14 @@ static GLuint r300VAPInputRoute1Swizzle(int swizzle[4]) GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr) { - GLuint i; - uint16_t * dst16 = (uint16_t *) dst; + GLuint i, dw; - for (i = 0; i < nr; i++) { - dst16[i] = r300VAPInputRoute1Swizzle(swizzle[i]) | R300_INPUT_ROUTE_ENABLE; + for (i = 0; i < nr; i += 2) { + dw = r300VAPInputRoute1Swizzle(swizzle[i]) | R300_INPUT_ROUTE_ENABLE; + if (i + 1 < nr) { + dw |= (r300VAPInputRoute1Swizzle(swizzle[i + 1]) | R300_INPUT_ROUTE_ENABLE) << 16; + } + dst[i >> 1] = dw; } return (nr + 1) >> 1; -- cgit v1.2.3 From 3f4e80c06b5b6efcd540ca5daf734100fad19ff0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 11 Apr 2008 08:08:22 -0600 Subject: comments --- src/mesa/main/getstring.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index c15f6a39bc..55fb42096d 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -81,6 +81,7 @@ _mesa_GetString( GLenum name ) case GL_RENDERER: return (const GLubyte *) renderer; case GL_VERSION: + /* tests for 1.3: */ if (ctx->Extensions.ARB_multisample && ctx->Extensions.ARB_multitexture && ctx->Extensions.ARB_texture_border_clamp && @@ -89,6 +90,7 @@ _mesa_GetString( GLenum name ) ctx->Extensions.EXT_texture_env_add && ctx->Extensions.ARB_texture_env_combine && ctx->Extensions.ARB_texture_env_dot3) { + /* tests for 1.4: */ if (ctx->Extensions.ARB_depth_texture && ctx->Extensions.ARB_shadow && ctx->Extensions.ARB_texture_env_crossbar && @@ -105,9 +107,11 @@ _mesa_GetString( GLenum name ) ctx->Extensions.EXT_stencil_wrap && ctx->Extensions.EXT_texture_lod_bias && ctx->Extensions.SGIS_generate_mipmap) { + /* tests for 1.5: */ if (ctx->Extensions.ARB_occlusion_query && ctx->Extensions.ARB_vertex_buffer_object && ctx->Extensions.EXT_shadow_funcs) { + /* tests for 2.0: */ if (ctx->Extensions.ARB_draw_buffers && ctx->Extensions.ARB_point_sprite && ctx->Extensions.ARB_shader_objects && @@ -115,6 +119,7 @@ _mesa_GetString( GLenum name ) ctx->Extensions.ARB_fragment_shader && ctx->Extensions.ARB_texture_non_power_of_two && ctx->Extensions.EXT_blend_equation_separate) { + /* tests for 2.1: */ if (ctx->Extensions.ARB_shading_language_120 && ctx->Extensions.EXT_pixel_buffer_object && ctx->Extensions.EXT_texture_sRGB) { -- cgit v1.2.3 From 51ad219d6fbcdaa50e2f1b5854dfbbc4b8cab8fc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 11 Apr 2008 09:35:18 -0600 Subject: fix failed assertion (parameter can be a PROGRAM_CONSTANT) --- src/mesa/shader/prog_execute.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa') diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 00a375078b..7f9687c36f 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -89,6 +89,7 @@ get_register_pointer(const struct prog_src_register *source, else { const struct gl_program_parameter_list *params; ASSERT(source->File == PROGRAM_LOCAL_PARAM || + source->File == PROGRAM_CONSTANT || source->File == PROGRAM_STATE_VAR); params = machine->CurProgram->Parameters; if (reg < 0 || reg >= params->NumParameters) -- cgit v1.2.3 From 32134b5508495fbb1d9fc2f844e22fbb082dcda6 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Sat, 12 Apr 2008 02:40:27 +0200 Subject: r200: fix XPD vertex program instruction when using temps as inputs due to the two read ports limit into temp memory may need the MAD_2 instruction for the second instruction of the decomposed XPD. While here, also try to avoid MAD_2 for MAD if all 3 inputs are temps but the temps aren't actually distinct. --- src/mesa/drivers/dri/r200/r200_vertprog.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index 7fba6c750d..b1e027dc1c 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -745,9 +745,16 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte goto next; case OPCODE_MAD: + /* only 2 read ports into temp memory thus may need the macro op MAD_2 + instead (requiring 2 clocks) if all inputs are in temp memory + (and, only if they actually reference 3 distinct temps) */ hw_op=(src[0].File == PROGRAM_TEMPORARY && src[1].File == PROGRAM_TEMPORARY && - src[2].File == PROGRAM_TEMPORARY) ? R200_VPI_OUT_OP_MAD_2 : R200_VPI_OUT_OP_MAD; + src[2].File == PROGRAM_TEMPORARY && + (((src[0].RelAddr << 8) | src[0].Index) != ((src[1].RelAddr << 8) | src[1].Index)) && + (((src[0].RelAddr << 8) | src[0].Index) != ((src[2].RelAddr << 8) | src[2].Index)) && + (((src[1].RelAddr << 8) | src[1].Index) != ((src[2].RelAddr << 8) | src[2].Index))) ? + R200_VPI_OUT_OP_MAD_2 : R200_VPI_OUT_OP_MAD; o_inst->op = MAKE_VSF_OP(hw_op, t_dst(&dst), t_dst_mask(dst.WriteMask)); @@ -875,8 +882,11 @@ else { case OPCODE_XPD: /* mul r0, r1.yzxw, r2.zxyw mad r0, -r2.yzxw, r1.zxyw, r0 - NOTE: might need MAD_2 */ + hw_op=(src[0].File == PROGRAM_TEMPORARY && + src[1].File == PROGRAM_TEMPORARY && + (((src[0].RelAddr << 8) | src[0].Index) != ((src[1].RelAddr << 8) | src[1].Index))) ? + R200_VPI_OUT_OP_MAD_2 : R200_VPI_OUT_OP_MAD; o_inst->op = MAKE_VSF_OP(R200_VPI_OUT_OP_MUL, (u_temp_i << R200_VPI_OUT_REG_INDEX_SHIFT) | R200_VSF_OUT_CLASS_TMP, @@ -902,7 +912,7 @@ else { o_inst++; u_temp_i--; - o_inst->op = MAKE_VSF_OP(R200_VPI_OUT_OP_MAD, t_dst(&dst), + o_inst->op = MAKE_VSF_OP(hw_op, t_dst(&dst), t_dst_mask(dst.WriteMask)); o_inst->src0 = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), -- cgit v1.2.3 From 7be8d5664aa3005f5ec19dd48b0719ed94e8b252 Mon Sep 17 00:00:00 2001 From: David Flynn Date: Mon, 14 Apr 2008 12:55:12 -0600 Subject: define #extension GL_ARB_texture_rectangle --- src/mesa/shader/slang/slang_preprocess.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index 076e982f8f..cf8cd5f87a 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -483,6 +483,7 @@ pp_cond_stack_reevaluate (pp_cond_stack *self) typedef struct { GLboolean MESA_shader_debug; /* GL_MESA_shader_debug enable */ + GLboolean GL_ARB_texture_rectangle; /* GL_ARB_texture_rectangle enable */ } pp_ext; /* @@ -498,6 +499,7 @@ static GLvoid pp_ext_init (pp_ext *self) { pp_ext_disable_all (self); + self->GL_ARB_texture_rectangle = GL_TRUE; /* Other initialization code goes here. */ } @@ -506,6 +508,8 @@ pp_ext_set (pp_ext *self, const char *name, GLboolean enable) { if (_mesa_strcmp (name, "MESA_shader_debug") == 0) self->MESA_shader_debug = enable; + else if (_mesa_strcmp (name, "GL_ARB_texture_rectangle") == 0) + self->GL_ARB_texture_rectangle = enable; /* Next extension name tests go here. */ else return GL_FALSE; -- cgit v1.2.3 From 8fd2b7d9ddbc3c832d0452eb32709d8c835fb193 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Apr 2008 13:43:24 -0600 Subject: fix GL_ARB_texture_rectangle breakage --- src/mesa/shader/slang/slang_preprocess.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index cf8cd5f87a..1645afcc18 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -483,7 +483,7 @@ pp_cond_stack_reevaluate (pp_cond_stack *self) typedef struct { GLboolean MESA_shader_debug; /* GL_MESA_shader_debug enable */ - GLboolean GL_ARB_texture_rectangle; /* GL_ARB_texture_rectangle enable */ + GLboolean ARB_texture_rectangle; /* GL_ARB_texture_rectangle enable */ } pp_ext; /* @@ -499,7 +499,7 @@ static GLvoid pp_ext_init (pp_ext *self) { pp_ext_disable_all (self); - self->GL_ARB_texture_rectangle = GL_TRUE; + self->ARB_texture_rectangle = GL_TRUE; /* Other initialization code goes here. */ } @@ -509,7 +509,7 @@ pp_ext_set (pp_ext *self, const char *name, GLboolean enable) if (_mesa_strcmp (name, "MESA_shader_debug") == 0) self->MESA_shader_debug = enable; else if (_mesa_strcmp (name, "GL_ARB_texture_rectangle") == 0) - self->GL_ARB_texture_rectangle = enable; + self->ARB_texture_rectangle = enable; /* Next extension name tests go here. */ else return GL_FALSE; -- cgit v1.2.3 From 118c2bc860037f084166d3406039d82198ddf3d6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Apr 2008 14:10:32 -0600 Subject: only use __x86_64__, not __amd64__ (bug 15503) --- src/mesa/drivers/dri/sis/sis_context.h | 2 +- src/mesa/main/imports.h | 2 +- src/mesa/math/m_debug_util.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h index 6289fb4500..5fc8267879 100644 --- a/src/mesa/drivers/dri/sis/sis_context.h +++ b/src/mesa/drivers/dri/sis/sis_context.h @@ -401,7 +401,7 @@ struct sis_context #define MMIO_READ(reg) *(volatile GLint *)(smesa->IOBase + (reg)) #define MMIO_READf(reg) *(volatile GLfloat *)(smesa->IOBase + (reg)) -#if defined(__i386__) || defined(__amd64__) +#if defined(__i386__) || defined(__x86_64__) #define MMIO_WMB() __asm __volatile("" : : : "memory") #elif defined(__ia64__) #define MMIO_WMB() __asm __volatile("mf" : : : "memory") diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index b0234a2b85..7ee26b423c 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -159,7 +159,7 @@ typedef union { GLfloat f; GLint i; } fi_type; ***/ #if defined(__i386__) || defined(__386__) || defined(__sparc__) || \ defined(__s390x__) || defined(__powerpc__) || \ - defined(__amd64__) || defined(__x86_64__) || \ + defined(__x86_64__) || \ defined(ia64) || defined(__ia64__) || \ defined(__hppa__) || defined(hpux) || \ defined(__mips) || defined(_MIPS_ARCH) || \ diff --git a/src/mesa/math/m_debug_util.h b/src/mesa/math/m_debug_util.h index f7ce4679b6..2d1d8b1880 100644 --- a/src/mesa/math/m_debug_util.h +++ b/src/mesa/math/m_debug_util.h @@ -185,7 +185,7 @@ extern char *mesa_profile; #endif -#elif defined(__amd64__) +#elif defined(__x86_64__) #define rdtscll(val) do { \ unsigned int a,d; \ -- cgit v1.2.3 From bbb042f0b809ebb754547397b8f22a5751c275da Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 14 Apr 2008 20:54:13 -0600 Subject: fix multi-draw buffer regression --- src/mesa/swrast/s_span.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 864f77a417..656a90a99a 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1402,9 +1402,8 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) */ { const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; - const GLboolean multiFragOutputs - = fp && fp->Base.InputsRead >= (1 << FRAG_RESULT_DATA0); const GLuint numBuffers = fb->_NumColorDrawBuffers; + const GLboolean multiFragOutputs = numBuffers > 1; GLuint buf; for (buf = 0; buf < numBuffers; buf++) { -- cgit v1.2.3 From 7cc7ff7051d427ff45b4d7d3664e2eecd13d0e13 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 16 Apr 2008 16:22:05 +1000 Subject: intel/fake_bufmgr: Attempt to restrict references to objects in a batchbuffer > aperture size. So with compiz on Intel hw with fake bufmgr, opening 4 firefox windows at 1680x1050 and hitting alt-tab, could cause the batchbuffer to try and reference more than the 32MB of RAM allocated. Fix 1: Fix 1 is to pre-verify the list of buffers against the current batchbuffer and if it can't possibly fit in the aperture to flush the batchbuffer to the hardware and try again. If the buffers still can't fit well then you are hosed as I'm not sure there is a nice way to tell anyone. Fix 2: Next problem was that even with a simple check for total < aperture, we ran into fragmentation issues, this meant that half way down a set of buffers, we would fail as no blocks were available. Fix this by nuking the memory manager from orbit and letting it start again and relayout the blocks in a manner that fits. Fix 3: Finally the initial problem we were seeing was a memcpy to a NULL backing store. We seem to end up with a texture at some point that never gets mapped but ends up with data in it. compiz al-tab icons have this property. So I created a card dirty bit that memcpy's any buffer that is !static and is written to back to memory. This probably is wrong but it makes compiz work for now. Caveats: 965 support is still fail. --- src/mesa/drivers/dri/common/dri_bufmgr.c | 10 +- src/mesa/drivers/dri/common/dri_bufmgr.h | 9 +- src/mesa/drivers/dri/common/dri_bufmgr_fake.c | 121 +++++++++++++++++++++++-- src/mesa/drivers/dri/i915/i915_vtbl.c | 31 +++++++ src/mesa/drivers/dri/intel/intel_batchbuffer.c | 10 +- src/mesa/drivers/dri/intel/intel_blit.c | 10 ++ src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c | 14 ++- 7 files changed, 187 insertions(+), 18 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 8413a51577..4df006fb9f 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -142,10 +142,10 @@ dri_bufmgr_destroy(dri_bufmgr *bufmgr) } -void dri_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, +int dri_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, GLuint offset, dri_bo *target_buf) { - reloc_buf->bufmgr->emit_reloc(reloc_buf, flags, delta, offset, target_buf); + return reloc_buf->bufmgr->emit_reloc(reloc_buf, flags, delta, offset, target_buf); } void *dri_process_relocs(dri_bo *batch_buf, GLuint *count) @@ -163,3 +163,9 @@ dri_bufmgr_set_debug(dri_bufmgr *bufmgr, GLboolean enable_debug) { bufmgr->debug = enable_debug; } + +int +dri_bufmgr_check_aperture_space(dri_bo *bo) +{ + return bo->bufmgr->check_aperture_space(bo); +} diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h index 08cf8ca3e1..4593eaf9f7 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.h +++ b/src/mesa/drivers/dri/common/dri_bufmgr.h @@ -156,7 +156,7 @@ struct _dri_bufmgr { * \param target Buffer whose offset should be written into the relocation * entry. */ - void (*emit_reloc)(dri_bo *reloc_buf, uint64_t flags, GLuint delta, + int (*emit_reloc)(dri_bo *reloc_buf, uint64_t flags, GLuint delta, GLuint offset, dri_bo *target); /** @@ -176,6 +176,7 @@ struct _dri_bufmgr { void (*post_submit)(dri_bo *batch_buf, dri_fence **fence); + int (*check_aperture_space)(dri_bo *bo); GLboolean debug; /**< Enables verbose debugging printouts */ }; @@ -211,9 +212,11 @@ void dri_bo_fake_disable_backing_store(dri_bo *bo, void *ptr); void dri_bufmgr_destroy(dri_bufmgr *bufmgr); -void dri_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, - GLuint offset, dri_bo *target_buf); +int dri_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, + GLuint offset, dri_bo *target_buf); void *dri_process_relocs(dri_bo *batch_buf, uint32_t *count); void dri_post_process_relocs(dri_bo *batch_buf); void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence); +int dri_bufmgr_check_aperture_space(dri_bo *bo); + #endif diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c index 9d94ca3b39..c3c28afc9f 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c @@ -133,6 +133,9 @@ typedef struct _bufmgr_fake { GLboolean debug; GLboolean performed_rendering; + + /* keep track of the current total size of objects we have relocs for */ + unsigned long current_total_size; } dri_bufmgr_fake; typedef struct _dri_bo_fake { @@ -142,6 +145,8 @@ typedef struct _dri_bo_fake { const char *name; unsigned dirty:1; + unsigned size_accounted:1; /*this buffers size has been accounted against the aperture */ + unsigned card_dirty:1; /* has the card written to this buffer - we make need to copy it back */ unsigned int refcount; /* Flags may consist of any of the DRM_BO flags, plus * DRM_BO_NO_BACKING_STORE and BM_NO_FENCE_SUBDATA, which are the first two @@ -177,6 +182,8 @@ typedef struct _dri_fence_fake { static int clear_fenced(dri_bufmgr_fake *bufmgr_fake, unsigned int fence_cookie); +static int dri_fake_check_aperture_space(dri_bo *bo); + #define MAXFENCE 0x7fffffff static GLboolean FENCE_LTE( unsigned a, unsigned b ) @@ -264,11 +271,19 @@ alloc_block(dri_bo *bo) */ static void free_block(dri_bufmgr_fake *bufmgr_fake, struct block *block) { + dri_bo_fake *bo_fake; DBG("free block %p\n", block); if (!block) return; + bo_fake = (dri_bo_fake *)block->bo; + if (bo_fake->card_dirty == GL_TRUE) { + memcpy(bo_fake->backing_store, block->virtual, block->bo->size); + bo_fake->card_dirty = GL_FALSE; + bo_fake->dirty = GL_TRUE; + } + if (block->on_hardware) { block->bo = NULL; } @@ -287,11 +302,15 @@ static void free_block(dri_bufmgr_fake *bufmgr_fake, struct block *block) static void alloc_backing_store(dri_bo *bo) { + dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr; dri_bo_fake *bo_fake = (dri_bo_fake *)bo; assert(!bo_fake->backing_store); assert(!(bo_fake->flags & (BM_PINNED|BM_NO_BACKING_STORE))); bo_fake->backing_store = ALIGN_MALLOC(bo->size, 64); + + DBG("alloc_backing - buf %d %p %d\n", bo_fake->id, bo_fake->backing_store, bo->size); + assert(bo_fake->backing_store); } static void @@ -495,9 +514,6 @@ static GLboolean evict_and_alloc_block(dri_bo *bo) DBG("%s 0x%x bytes failed\n", __FUNCTION__, bo->size); - assert(is_empty_list(&bufmgr_fake->on_hardware)); - assert(is_empty_list(&bufmgr_fake->fenced)); - return GL_FALSE; } @@ -784,6 +800,26 @@ dri_fake_bo_unmap(dri_bo *bo) return 0; } +static void +dri_fake_kick_all(dri_bufmgr_fake *bufmgr_fake) +{ + struct block *block, *tmp; + + bufmgr_fake->performed_rendering = GL_FALSE; + /* okay for ever BO that is on the HW kick it off. + seriously not afraid of the POLICE right now */ + foreach_s(block, tmp, &bufmgr_fake->on_hardware) { + dri_bo_fake *bo_fake = (dri_bo_fake *)block->bo; + + block->on_hardware = 0; + free_block(bufmgr_fake, block); + bo_fake->block = NULL; + bo_fake->validated = GL_FALSE; + bo_fake->dirty = GL_TRUE; + block->bo->offset = -1; + } +} + static int dri_fake_bo_validate(dri_bo *bo, uint64_t flags) { @@ -810,6 +846,9 @@ dri_fake_bo_validate(dri_bo *bo, uint64_t flags) return 0; } + /* reset size accounted */ + bo_fake->size_accounted = 0; + /* Allocate the card memory */ if (!bo_fake->block && !evict_and_alloc_block(bo)) { bufmgr_fake->fail = 1; @@ -836,7 +875,13 @@ dri_fake_bo_validate(dri_bo *bo, uint64_t flags) */ dri_bufmgr_fake_wait_idle(bufmgr_fake); - memcpy(bo_fake->block->virtual, bo_fake->backing_store, bo->size); + /* we may never have mapped this BO so it might not have any backing store */ + /* if this happens it should be rare, but 0 the card memory in any case */ + if (bo_fake->backing_store) + memcpy(bo_fake->block->virtual, bo_fake->backing_store, bo->size); + else + memset(bo_fake->block->virtual, 0, bo->size); + bo_fake->dirty = 0; } @@ -917,17 +962,25 @@ dri_fake_destroy(dri_bufmgr *bufmgr) free(bufmgr); } -static void +static int dri_fake_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, GLuint offset, dri_bo *target_buf) { dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)reloc_buf->bufmgr; struct fake_buffer_reloc *r; dri_bo_fake *reloc_fake = (dri_bo_fake *)reloc_buf; - int i; + dri_bo_fake *target_fake = (dri_bo_fake *)target_buf; + int ret, i; assert(reloc_buf); assert(target_buf); + + if (!target_fake->is_static && !target_fake->size_accounted) { + ret = dri_fake_check_aperture_space(target_buf); + if (ret) + return ret; + } + if (reloc_fake->relocs == NULL) { reloc_fake->relocs = malloc(sizeof(struct fake_buffer_reloc) * MAX_RELOCS); @@ -954,7 +1007,7 @@ dri_fake_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, } } - return; + return 0; } /** @@ -1008,8 +1061,11 @@ dri_fake_reloc_and_validate_buffer(dri_bo *bo) /* Validate the target buffer if that hasn't been done. */ if (!target_fake->validated) { ret = dri_fake_reloc_and_validate_buffer(r->target_buf); - if (ret != 0) + if (ret != 0) { + if (bo->virtual != NULL) + dri_bo_unmap(bo); return ret; + } } /* Calculate the value of the relocation entry. */ @@ -1028,8 +1084,15 @@ dri_fake_reloc_and_validate_buffer(dri_bo *bo) if (bo->virtual != NULL) dri_bo_unmap(bo); - if (bo_fake->validate_flags & DRM_BO_FLAG_WRITE) + if (bo_fake->validate_flags & DRM_BO_FLAG_WRITE) { + if (!(bo_fake->flags & (BM_NO_BACKING_STORE|BM_PINNED))) { + if (bo_fake->backing_store == 0) + alloc_backing_store(bo); + + bo_fake->card_dirty = GL_TRUE; + } bufmgr_fake->performed_rendering = GL_TRUE; + } return dri_fake_bo_validate(bo, bo_fake->validate_flags); } @@ -1040,17 +1103,30 @@ dri_fake_process_relocs(dri_bo *batch_buf, GLuint *count_p) dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)batch_buf->bufmgr; dri_bo_fake *batch_fake = (dri_bo_fake *)batch_buf; int ret; + int retry_count = 0; bufmgr_fake->performed_rendering = GL_FALSE; dri_fake_calculate_validate_flags(batch_buf); batch_fake->validate_flags = DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ; + + /* we've ran out of RAM so blow the whole lot away and retry */ + restart: ret = dri_fake_reloc_and_validate_buffer(batch_buf); + if (bufmgr_fake->fail == 1) { + if (retry_count == 0) { + retry_count++; + dri_fake_kick_all(bufmgr_fake); + bufmgr_fake->fail = 0; + goto restart; + } + } assert(ret == 0); *count_p = 0; /* junk */ + bufmgr_fake->current_total_size = 0; return NULL; } @@ -1097,6 +1173,29 @@ dri_fake_post_submit(dri_bo *batch_buf, dri_fence **last_fence) dri_bo_fake_post_submit(batch_buf); } +static int +dri_fake_check_aperture_space(dri_bo *bo) +{ + dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr; + dri_bo_fake *bo_fake = (dri_bo_fake *)bo; + GLuint sz; + + sz = (bo->size + bo_fake->alignment - 1) & ~(bo_fake->alignment - 1); + + if (bo_fake->size_accounted || bo_fake->is_static) + return 0; + + if (bufmgr_fake->current_total_size + sz > bufmgr_fake->size) { + DBG("check_space: bo %d %d overflowed bufmgr\n", bo_fake->id, sz); + return -1; + } + + bufmgr_fake->current_total_size += sz; + bo_fake->size_accounted = 1; + DBG("check_space: bo %d %d %d\n", bo_fake->id, bo->size, bufmgr_fake->current_total_size); + return 0; +} + dri_bufmgr * dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, unsigned long size, @@ -1132,7 +1231,8 @@ dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, bufmgr_fake->bufmgr.emit_reloc = dri_fake_emit_reloc; bufmgr_fake->bufmgr.process_relocs = dri_fake_process_relocs; bufmgr_fake->bufmgr.post_submit = dri_fake_post_submit; - bufmgr_fake->bufmgr.debug = GL_FALSE; + bufmgr_fake->bufmgr.check_aperture_space = dri_fake_check_aperture_space; + bufmgr_fake->bufmgr.debug = GL_TRUE; bufmgr_fake->fence_emit = fence_emit; bufmgr_fake->fence_wait = fence_wait; @@ -1140,3 +1240,4 @@ dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, return &bufmgr_fake->bufmgr; } + diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 94d70be441..0f246513dd 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -295,6 +295,7 @@ i915_emit_state(struct intel_context *intel) struct i915_context *i915 = i915_context(&intel->ctx); struct i915_hw_state *state = i915->current; int i; + int ret, count; GLuint dirty; BATCH_LOCALS; @@ -311,7 +312,37 @@ i915_emit_state(struct intel_context *intel) */ intel_batchbuffer_require_space(intel->batch, get_state_size(state) + 8, LOOP_CLIPRECTS); + count = 0; + again: + dirty = get_dirty(state); + + ret = 0; + if (dirty & I915_UPLOAD_BUFFERS) { + ret |= dri_bufmgr_check_aperture_space(state->draw_region->buffer); + ret |= dri_bufmgr_check_aperture_space(state->depth_region->buffer); + } + + if (dirty & I915_UPLOAD_TEX_ALL) { + for (i = 0; i < I915_TEX_UNITS; i++) + if (dirty & I915_UPLOAD_TEX(i)) { + if (state->tex_buffer[i]) { + ret |= dri_bufmgr_check_aperture_space(state->tex_buffer[i]); + } + } + } + if (ret) { + if (count == 0) { + count++; + intel_batchbuffer_flush(intel->batch); + goto again; + } else { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "i915 emit state"); + assert(0); + } + } + /* work out list of buffers to emit */ + /* Do this here as we may have flushed the batchbuffer above, * causing more state to be dirty! */ diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index c1701f0640..d4abbb0860 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -87,6 +87,10 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch) batch->ptr = batch->map; batch->dirty_state = ~0; batch->cliprect_mode = IGNORE_CLIPRECTS; + + /* account batchbuffer in aperture */ + dri_bufmgr_check_aperture_space(batch->buf); + } struct intel_batchbuffer * @@ -264,7 +268,11 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, dri_bo *buffer, GLuint flags, GLuint delta) { - dri_emit_reloc(batch->buf, flags, delta, batch->ptr - batch->map, buffer); + int ret; + int count = 0; + + ret = dri_emit_reloc(batch->buf, flags, delta, batch->ptr - batch->map, buffer); + /* * Using the old buffer offset, write in what the right data would be, in case * the buffer doesn't move and we can short-circuit the relocation processing diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index f4358bb3dd..0f990c00b4 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -54,6 +54,7 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, struct intel_context *intel; const intelScreenPrivate *intelScreen; + int ret; DBG("%s\n", __FUNCTION__); @@ -123,6 +124,15 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, } #endif + again: + ret = dri_bufmgr_check_aperture_space(dst->buffer); + ret |= dri_bufmgr_check_aperture_space(src->buffer); + + if (ret) { + intel_batchbuffer_flush(intel->batch); + goto again; + } + for (i = 0; i < nbox; i++, pbox++) { drm_clip_rect_t box = *pbox; diff --git a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c index f164b48963..6828425e77 100644 --- a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c @@ -817,7 +817,7 @@ dri_bufmgr_ttm_destroy(dri_bufmgr *bufmgr) * the relocation entry write when the buffer hasn't moved from the * last known offset in target_buf. */ -static void +static int dri_ttm_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, GLuint offset, dri_bo *target_buf) { @@ -851,6 +851,7 @@ dri_ttm_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, reloc_buf_ttm->reloc_buf_data[0]++; /* Increment relocation count */ /* Check wraparound */ assert(reloc_buf_ttm->reloc_buf_data[0] != 0); + return 0; } /** @@ -1039,6 +1040,15 @@ intel_ttm_enable_bo_reuse(dri_bufmgr *bufmgr) } } +/* + * + */ +static int +dri_ttm_check_aperture_space(dri_bo *bo) +{ + return 0; +} + /** * Initializes the TTM buffer manager, which uses the kernel to allocate, map, * and manage map buffer objections. @@ -1082,7 +1092,7 @@ intel_bufmgr_ttm_init(int fd, unsigned int fence_type, bufmgr_ttm->bufmgr.process_relocs = dri_ttm_process_reloc; bufmgr_ttm->bufmgr.post_submit = dri_ttm_post_submit; bufmgr_ttm->bufmgr.debug = GL_FALSE; - + bufmgr_ttm->bufmgr.check_aperture_space = dri_ttm_check_aperture_space; /* Initialize the linked lists for BO reuse cache. */ for (i = 0; i < INTEL_TTM_BO_BUCKETS; i++) bufmgr_ttm->cache_bucket[i].tail = &bufmgr_ttm->cache_bucket[i].head; -- cgit v1.2.3 From 96338dd1470bb088cbbe50d629cd30175245a784 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 16 Apr 2008 16:37:13 +1000 Subject: intel: fix _mesa_error ctx I introduced at lsat minute --- src/mesa/drivers/dri/i915/i830_vtbl.c | 32 +++++++++++++++++++++++++++++++- src/mesa/drivers/dri/i915/i915_vtbl.c | 3 +++ 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index d1b07c5a2f..c5a85fe035 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -25,6 +25,7 @@ * **************************************************************************/ +#include "glapi.h" #include "i830_context.h" #include "i830_reg.h" @@ -418,8 +419,9 @@ i830_emit_state(struct intel_context *intel) { struct i830_context *i830 = i830_context(&intel->ctx); struct i830_hw_state *state = i830->current; - int i; + int i, ret, count; GLuint dirty; + GET_CURRENT_CONTEXT(ctx); BATCH_LOCALS; /* We don't hold the lock at this point, so want to make sure that @@ -435,6 +437,34 @@ i830_emit_state(struct intel_context *intel) */ intel_batchbuffer_require_space(intel->batch, get_state_size(state) + 8, LOOP_CLIPRECTS); + count = 0; + again: + dirty = get_dirty(state); + + ret = 0; + if (dirty & I830_UPLOAD_BUFFERS) { + ret |= dri_bufmgr_check_aperture_space(state->draw_region->buffer); + ret |= dri_bufmgr_check_aperture_space(state->depth_region->buffer); + } + + for (i = 0; i < I830_TEX_UNITS; i++) + if (dirty & I830_UPLOAD_TEX(i)) { + if (state->tex_buffer[i]) { + ret |= dri_bufmgr_check_aperture_space(state->tex_buffer[i]); + } + } + + if (ret) { + if (count == 0) { + count++; + intel_batchbuffer_flush(intel->batch); + goto again; + } else { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "i830 emit state"); + assert(0); + } + } + /* Do this here as we may have flushed the batchbuffer above, * causing more state to be dirty! diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 0f246513dd..5cf74d5906 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -43,6 +43,8 @@ #include "i915_reg.h" #include "i915_context.h" +#include "glapi.h" + static void i915_render_prevalidate(struct intel_context *intel) { @@ -297,6 +299,7 @@ i915_emit_state(struct intel_context *intel) int i; int ret, count; GLuint dirty; + GET_CURRENT_CONTEXT(ctx); BATCH_LOCALS; /* We don't hold the lock at this point, so want to make sure that -- cgit v1.2.3 From b64448b3e4026d3f11f366515b7544a6581403f3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 16 Apr 2008 16:49:32 +1000 Subject: bufmgr_fake: disable debugging again --- src/mesa/drivers/dri/common/dri_bufmgr_fake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c index c3c28afc9f..61dd49d9dd 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c @@ -1232,7 +1232,7 @@ dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, bufmgr_fake->bufmgr.process_relocs = dri_fake_process_relocs; bufmgr_fake->bufmgr.post_submit = dri_fake_post_submit; bufmgr_fake->bufmgr.check_aperture_space = dri_fake_check_aperture_space; - bufmgr_fake->bufmgr.debug = GL_TRUE; + bufmgr_fake->bufmgr.debug = GL_FALSE; bufmgr_fake->fence_emit = fence_emit; bufmgr_fake->fence_wait = fence_wait; -- cgit v1.2.3