From baf2f94b761e0fadeb63e1e79c8ac9684b1fa688 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 22 Apr 2009 10:48:34 +0200 Subject: [PATCH] wined3d: Get rid of the WINED3DVS_* swizzle constants. They're redundant. --- dlls/wined3d/baseshader.c | 3 ++- dlls/wined3d/glsl_shader.c | 24 ++++++++++++------------ dlls/wined3d/wined3d_private_types.h | 24 ------------------------ 3 files changed, 14 insertions(+), 37 deletions(-) diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index ceb2473fd65..5145a41d41c 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -789,7 +789,8 @@ static void shader_dump_param(const DWORD param, const DWORD addr_token, int inp * swizzle bits fields: * RRGGBBAA */ - if ((WINED3DVS_NOSWIZZLE >> WINED3DVS_SWIZZLE_SHIFT) != swizzle) { + if ((WINED3DSP_NOSWIZZLE >> WINED3DSP_SWIZZLE_SHIFT) != swizzle) + { if (swizzle_x == swizzle_y && swizzle_x == swizzle_z && swizzle_x == swizzle_w) { diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index e5affd28a9e..da304320e35 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2472,7 +2472,7 @@ static void pshader_glsl_tex(const struct wined3d_shader_instruction *ins) shader_glsl_get_sample_function(sampler_type, sample_flags, &sample_function); mask |= sample_function.coord_mask; - if (shader_version < WINED3DPS_VERSION(2,0)) swizzle = WINED3DVS_NOSWIZZLE; + if (shader_version < WINED3DPS_VERSION(2,0)) swizzle = WINED3DSP_NOSWIZZLE; else swizzle = ins->src[1].swizzle; /* 1.0-1.3: Use destination register as coordinate source. @@ -2602,17 +2602,17 @@ static void pshader_glsl_texdp3tex(const struct wined3d_shader_instruction *ins) switch(mask_size) { case 1: - shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DVS_NOSWIZZLE, NULL, + shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "dot(gl_TexCoord[%u].xyz, %s)", sampler_idx, src0_param.param_str); break; case 2: - shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DVS_NOSWIZZLE, NULL, + shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "vec2(dot(gl_TexCoord[%u].xyz, %s), 0.0)", sampler_idx, src0_param.param_str); break; case 3: - shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DVS_NOSWIZZLE, NULL, + shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "vec3(dot(gl_TexCoord[%u].xyz, %s), 0.0, 0.0)", sampler_idx, src0_param.param_str); break; @@ -2722,7 +2722,7 @@ static void pshader_glsl_texm3x2tex(const struct wined3d_shader_instruction *ins shader_glsl_get_sample_function(sampler_type, 0, &sample_function); /* Sample the texture using the calculated coordinates */ - shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DVS_NOSWIZZLE, NULL, "tmp0.xy"); + shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "tmp0.xy"); } /** Process the WINED3DSIO_TEXM3X3TEX instruction in GLSL @@ -2744,7 +2744,7 @@ static void pshader_glsl_texm3x3tex(const struct wined3d_shader_instruction *ins shader_glsl_get_sample_function(sampler_type, 0, &sample_function); /* Sample the texture using the calculated coordinates */ - shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DVS_NOSWIZZLE, NULL, "tmp0.xyz"); + shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "tmp0.xyz"); current_state->current_row = 0; } @@ -2795,7 +2795,7 @@ static void pshader_glsl_texm3x3spec(const struct wined3d_shader_instruction *in shader_glsl_get_sample_function(stype, 0, &sample_function); /* Sample the texture */ - shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DVS_NOSWIZZLE, NULL, "tmp0.xyz"); + shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "tmp0.xyz"); current_state->current_row = 0; } @@ -2827,7 +2827,7 @@ static void pshader_glsl_texm3x3vspec(const struct wined3d_shader_instruction *i shader_glsl_get_sample_function(sampler_type, 0, &sample_function); /* Sample the texture using the calculated coordinates */ - shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DVS_NOSWIZZLE, NULL, "tmp0.xyz"); + shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "tmp0.xyz"); current_state->current_row = 0; } @@ -2877,7 +2877,7 @@ static void pshader_glsl_texbem(const struct wined3d_shader_instruction *ins) shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, &coord_param); - shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DVS_NOSWIZZLE, NULL, + shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "T%u%s + vec4(bumpenvmat%d * %s, 0.0, 0.0)%s", sampler_idx, coord_mask, sampler_idx, coord_param.param_str, coord_mask); @@ -2920,7 +2920,7 @@ static void pshader_glsl_texreg2ar(const struct wined3d_shader_instruction *ins) shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_ALL, &src0_param); shader_glsl_get_sample_function(sampler_type, 0, &sample_function); - shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DVS_NOSWIZZLE, NULL, + shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "%s.wx", src0_param.reg_name); } @@ -2936,7 +2936,7 @@ static void pshader_glsl_texreg2gb(const struct wined3d_shader_instruction *ins) shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_ALL, &src0_param); shader_glsl_get_sample_function(sampler_type, 0, &sample_function); - shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DVS_NOSWIZZLE, NULL, + shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "%s.yz", src0_param.reg_name); } @@ -2953,7 +2953,7 @@ static void pshader_glsl_texreg2rgb(const struct wined3d_shader_instruction *ins shader_glsl_get_sample_function(sampler_type, 0, &sample_function); shader_glsl_add_src_param(ins, &ins->src[0], sample_function.coord_mask, &src0_param); - shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DVS_NOSWIZZLE, NULL, + shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DSP_NOSWIZZLE, NULL, "%s", src0_param.param_str); } diff --git a/dlls/wined3d/wined3d_private_types.h b/dlls/wined3d/wined3d_private_types.h index 2d9ae033f29..42ed6c966ba 100644 --- a/dlls/wined3d/wined3d_private_types.h +++ b/dlls/wined3d/wined3d_private_types.h @@ -98,33 +98,9 @@ typedef enum _WINED3DVS_RASTOUT_OFFSETS { } WINED3DVS_RASTOUT_OFFSETS; /** Source register modifiers **/ -#define WINED3DVS_SWIZZLE_SHIFT 16 -#define WINED3DVS_SWIZZLE_MASK (0xFF << WINED3DVS_SWIZZLE_SHIFT) #define WINED3DSP_SWIZZLE_SHIFT 16 #define WINED3DSP_SWIZZLE_MASK (0xFF << WINED3DSP_SWIZZLE_SHIFT) -#define WINED3DVS_X_X (0 << WINED3DVS_SWIZZLE_SHIFT) -#define WINED3DVS_X_Y (1 << WINED3DVS_SWIZZLE_SHIFT) -#define WINED3DVS_X_Z (2 << WINED3DVS_SWIZZLE_SHIFT) -#define WINED3DVS_X_W (3 << WINED3DVS_SWIZZLE_SHIFT) - -#define WINED3DVS_Y_X (0 << (WINED3DVS_SWIZZLE_SHIFT + 2)) -#define WINED3DVS_Y_Y (1 << (WINED3DVS_SWIZZLE_SHIFT + 2)) -#define WINED3DVS_Y_Z (2 << (WINED3DVS_SWIZZLE_SHIFT + 2)) -#define WINED3DVS_Y_W (3 << (WINED3DVS_SWIZZLE_SHIFT + 2)) - -#define WINED3DVS_Z_X (0 << (WINED3DVS_SWIZZLE_SHIFT + 4)) -#define WINED3DVS_Z_Y (1 << (WINED3DVS_SWIZZLE_SHIFT + 4)) -#define WINED3DVS_Z_Z (2 << (WINED3DVS_SWIZZLE_SHIFT + 4)) -#define WINED3DVS_Z_W (3 << (WINED3DVS_SWIZZLE_SHIFT + 4)) - -#define WINED3DVS_W_X (0 << (WINED3DVS_SWIZZLE_SHIFT + 6)) -#define WINED3DVS_W_Y (1 << (WINED3DVS_SWIZZLE_SHIFT + 6)) -#define WINED3DVS_W_Z (2 << (WINED3DVS_SWIZZLE_SHIFT + 6)) -#define WINED3DVS_W_W (3 << (WINED3DVS_SWIZZLE_SHIFT + 6)) - -#define WINED3DVS_NOSWIZZLE (WINED3DVS_X_X | WINED3DVS_Y_Y | WINED3DVS_Z_Z | WINED3DVS_W_W) - #define WINED3DSP_NOSWIZZLE \ ((0 << (WINED3DSP_SWIZZLE_SHIFT + 0)) | (1 << (WINED3DSP_SWIZZLE_SHIFT + 2)) | \ (2 << (WINED3DSP_SWIZZLE_SHIFT + 4)) | (3 << (WINED3DSP_SWIZZLE_SHIFT + 6)))