Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/arb_program_shader.c | 48 ++++++++++++++++++++++++++------------ dlls/wined3d/ati_fragment_shader.c | 18 ++++++-------- dlls/wined3d/glsl_shader.c | 14 +++++------ dlls/wined3d/utils.c | 10 ++++---- dlls/wined3d/wined3d_private.h | 8 +++---- 5 files changed, 56 insertions(+), 42 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 2f65d5c1c51..f0586e2d3c2 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -6379,12 +6379,17 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
textype = arbfp_texture_target(settings->op[stage].tex_type);
- if(settings->op[stage].projected == proj_none) { + if (settings->op[stage].projected == WINED3D_PROJECTION_NONE) + { instr = "TEX"; - } else if(settings->op[stage].projected == proj_count4 || - settings->op[stage].projected == proj_count3) { + } + else if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT4 + || settings->op[stage].projected == WINED3D_PROJECTION_COUNT3) + { instr = "TXP"; - } else { + } + else + { FIXME("Unexpected projection mode %d\n", settings->op[stage].projected); instr = "TXP"; } @@ -6398,18 +6403,27 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con shader_addline(&buffer, "SWZ arg1, bumpmat%u, y, w, 0, 0;\n", stage - 1); shader_addline(&buffer, "DP3 ret.y, arg1, tex%u;\n", stage - 1);
- /* with projective textures, texbem only divides the static texture coord, not the displacement, - * so multiply the displacement with the dividing parameter before passing it to TXP - */ - if (settings->op[stage].projected != proj_none) { - if(settings->op[stage].projected == proj_count4) { + /* With projective textures, texbem only divides the static + * texture coordinate, not the displacement, so multiply the + * displacement with the dividing parameter before passing it to + * TXP. */ + if (settings->op[stage].projected != WINED3D_PROJECTION_NONE) + { + if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT4) + { shader_addline(&buffer, "MOV ret.w, fragment.texcoord[%u].w;\n", stage); - shader_addline(&buffer, "MUL ret.xyz, ret, fragment.texcoord[%u].w, fragment.texcoord[%u];\n", stage, stage); - } else { + shader_addline(&buffer, "MUL ret.xyz, ret, fragment.texcoord[%u].w, fragment.texcoord[%u];\n", + stage, stage); + } + else + { shader_addline(&buffer, "MOV ret.w, fragment.texcoord[%u].z;\n", stage); - shader_addline(&buffer, "MAD ret.xyz, ret, fragment.texcoord[%u].z, fragment.texcoord[%u];\n", stage, stage); + shader_addline(&buffer, "MAD ret.xyz, ret, fragment.texcoord[%u].z, fragment.texcoord[%u];\n", + stage, stage); } - } else { + } + else + { shader_addline(&buffer, "ADD ret, ret, fragment.texcoord[%u];\n", stage); }
@@ -6421,12 +6435,16 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con stage - 1, stage - 1, stage - 1); shader_addline(&buffer, "MUL tex%u, tex%u, ret.x;\n", stage, stage); } - } else if(settings->op[stage].projected == proj_count3) { + } + else if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT3) + { shader_addline(&buffer, "MOV ret, fragment.texcoord[%u];\n", stage); shader_addline(&buffer, "MOV ret.w, ret.z;\n"); shader_addline(&buffer, "%s tex%u, ret, texture[%u], %s;\n", instr, stage, stage, textype); - } else { + } + else + { shader_addline(&buffer, "%s tex%u, fragment.texcoord[%u], texture[%u], %s;\n", instr, stage, stage, stage, textype); } diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c index 9d6837a2f22..3fd4758681b 100644 --- a/dlls/wined3d/ati_fragment_shader.c +++ b/dlls/wined3d/ati_fragment_shader.c @@ -505,16 +505,13 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES],
TRACE("glSampleMapATI(GL_REG_%d_ATI, GL_TEXTURE_%d_ARB, GL_SWIZZLE_STR_ATI)\n", stage, stage); - GL_EXTCALL(glSampleMapATI(GL_REG_0_ATI + stage, - GL_TEXTURE0_ARB + stage, - GL_SWIZZLE_STR_ATI)); - if(op[stage + 1].projected == proj_none) { + GL_EXTCALL(glSampleMapATI(GL_REG_0_ATI + stage, GL_TEXTURE0_ARB + stage, GL_SWIZZLE_STR_ATI)); + if (op[stage + 1].projected == WINED3D_PROJECTION_NONE) swizzle = GL_SWIZZLE_STR_ATI; - } else if(op[stage + 1].projected == proj_count4) { + else if (op[stage + 1].projected == WINED3D_PROJECTION_COUNT4) swizzle = GL_SWIZZLE_STQ_DQ_ATI; - } else { + else swizzle = GL_SWIZZLE_STR_DR_ATI; - } TRACE("glPassTexCoordATI(GL_REG_%d_ATI, GL_TEXTURE_%d_ARB, %s)\n", stage + 1, stage + 1, debug_swizzle(swizzle)); GL_EXTCALL(glPassTexCoordATI(GL_REG_0_ATI + stage + 1, @@ -579,13 +576,12 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], if (op[stage].cop == WINED3D_TOP_DISABLE) break;
- if(op[stage].projected == proj_none) { + if (op[stage].projected == WINED3D_PROJECTION_NONE) swizzle = GL_SWIZZLE_STR_ATI; - } else if(op[stage].projected == proj_count3) { + else if (op[stage].projected == WINED3D_PROJECTION_COUNT3) swizzle = GL_SWIZZLE_STR_DR_ATI; - } else { + else swizzle = GL_SWIZZLE_STQ_DQ_ATI; - }
if (op_reads_texture(&op[stage])) { diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 1a9886353d1..6aaee8a4af5 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -9495,12 +9495,12 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv * if (!(tex_map & (1u << stage))) continue;
- if (settings->op[stage].projected == proj_none) + if (settings->op[stage].projected == WINED3D_PROJECTION_NONE) { proj = FALSE; } - else if (settings->op[stage].projected == proj_count4 - || settings->op[stage].projected == proj_count3) + else if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT4 + || settings->op[stage].projected == WINED3D_PROJECTION_COUNT3) { proj = TRUE; } @@ -9583,12 +9583,12 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv * shader_addline(buffer, "ret.xy = bumpenv_mat%u * tex%u.xy;\n", stage - 1, stage - 1);
/* With projective textures, texbem only divides the static - * texture coord, not the displacement, so multiply the + * texture coordinate, not the displacement, so multiply the * displacement with the dividing parameter before passing it to * TXP. */ - if (settings->op[stage].projected != proj_none) + if (settings->op[stage].projected != WINED3D_PROJECTION_NONE) { - if (settings->op[stage].projected == proj_count4) + if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT4) { shader_addline(buffer, "ret.xy = (ret.xy * ffp_texcoord[%u].w) + ffp_texcoord[%u].xy;\n", stage, stage); @@ -9613,7 +9613,7 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv * shader_addline(buffer, "tex%u *= clamp(tex%u.z * bumpenv_lum_scale%u + bumpenv_lum_offset%u, 0.0, 1.0);\n", stage, stage - 1, stage - 1, stage - 1); } - else if (settings->op[stage].projected == proj_count3) + else if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT3) { shader_addline(buffer, "tex%u = %s(ps_sampler%u, ffp_texcoord[%u].xyz);\n", stage, texture_function, stage, stage); diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index a54e18efd9c..7ca371b3ffc 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5495,7 +5495,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY; settings->op[i].dst = resultreg; settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D; - settings->op[i].projected = proj_none; + settings->op[i].projected = WINED3D_PROJECTION_NONE; i++; break; } @@ -5619,15 +5619,15 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d { ttff = state->texture_states[i][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS]; if (ttff == (WINED3D_TTFF_PROJECTED | WINED3D_TTFF_COUNT3)) - settings->op[i].projected = proj_count3; + settings->op[i].projected = WINED3D_PROJECTION_COUNT3; else if (ttff & WINED3D_TTFF_PROJECTED) - settings->op[i].projected = proj_count4; + settings->op[i].projected = WINED3D_PROJECTION_COUNT4; else - settings->op[i].projected = proj_none; + settings->op[i].projected = WINED3D_PROJECTION_NONE; } else { - settings->op[i].projected = proj_none; + settings->op[i].projected = WINED3D_PROJECTION_NONE; }
settings->op[i].cop = cop; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8c739aac547..12a95fdc6c5 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2634,11 +2634,11 @@ BOOL wined3d_caps_gl_ctx_test_viewport_subpixel_bits(struct wined3d_caps_gl_ctx
void install_gl_compat_wrapper(struct wined3d_gl_info *gl_info, enum wined3d_gl_extension ext) DECLSPEC_HIDDEN;
-enum projection_types +enum wined3d_projection_type { - proj_none = 0, - proj_count3 = 1, - proj_count4 = 2 + WINED3D_PROJECTION_NONE = 0, + WINED3D_PROJECTION_COUNT3 = 1, + WINED3D_PROJECTION_COUNT4 = 2 };
enum dst_arg