Daniel Ansorregui : wined3d: Simplify "glsl_generate_ffp" texture projection.
Alexandre Julliard
julliard at winehq.org
Mon Nov 26 16:20:12 CST 2018
Module: wine
Branch: master
Commit: 5a961e8de7f3b0ffb812f6f8e0972345084fce24
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5a961e8de7f3b0ffb812f6f8e0972345084fce24
Author: Daniel Ansorregui <mailszeros at gmail.com>
Date: Sat Nov 24 20:13:32 2018 +0000
wined3d: Simplify "glsl_generate_ffp" texture projection.
This is to simplify the code before adding the FETCH4
modifications. No change is intended in the shader generation.
Signed-off-by: Daniel Ansorregui <mailszeros at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/glsl_shader.c | 63 ++++++++++++----------------------------------
1 file changed, 16 insertions(+), 47 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index ad59e97..5f1a866 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -9869,65 +9869,34 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
switch (settings->op[stage].tex_type)
{
case WINED3D_GL_RES_TYPE_TEX_1D:
- if (proj)
- {
- texture_function = "texture1DProj";
- coord_mask = "xw";
- }
- else
- {
- texture_function = "texture1D";
- coord_mask = "x";
- }
+ texture_function = "texture1D";
+ coord_mask = "x";
break;
case WINED3D_GL_RES_TYPE_TEX_2D:
- if (proj)
- {
- texture_function = "texture2DProj";
- coord_mask = "xyw";
- }
- else
- {
- texture_function = "texture2D";
- coord_mask = "xy";
- }
+ texture_function = "texture2D";
+ coord_mask = "xy";
break;
case WINED3D_GL_RES_TYPE_TEX_3D:
- if (proj)
- {
- texture_function = "texture3DProj";
- coord_mask = "xyzw";
- }
- else
- {
- texture_function = "texture3D";
- coord_mask = "xyz";
- }
+ texture_function = "texture3D";
+ coord_mask = "xyz";
break;
case WINED3D_GL_RES_TYPE_TEX_CUBE:
texture_function = "textureCube";
coord_mask = "xyz";
break;
case WINED3D_GL_RES_TYPE_TEX_RECT:
- if (proj)
- {
- texture_function = "texture2DRectProj";
- coord_mask = "xyw";
- }
- else
- {
- texture_function = "texture2DRect";
- coord_mask = "xy";
- }
+ texture_function = "texture2DRect";
+ coord_mask = "xy";
break;
default:
FIXME("Unhandled texture type %#x.\n", settings->op[stage].tex_type);
texture_function = "";
coord_mask = "xyzw";
+ proj = FALSE;
break;
}
if (!legacy_syntax)
- texture_function = proj ? "textureProj" : "texture";
+ texture_function = "texture";
if (stage > 0
&& (settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP
@@ -9959,8 +9928,8 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
shader_addline(buffer, "ret = ffp_texcoord[%u] + ret.xyxy;\n", stage);
}
- shader_addline(buffer, "tex%u = %s(ps_sampler%u, ret.%s);\n",
- stage, texture_function, stage, coord_mask);
+ shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ret.%s%s);\n",
+ stage, texture_function, proj ? "Proj" : "", stage, coord_mask, proj ? "w" : "");
if (settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE)
shader_addline(buffer, "tex%u *= clamp(tex%u.z * bumpenv_lum_scale%u + bumpenv_lum_offset%u, 0.0, 1.0);\n",
@@ -9968,13 +9937,13 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
}
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);
+ shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ffp_texcoord[%u].xyz);\n",
+ stage, texture_function, proj ? "Proj" : "", stage, stage);
}
else
{
- shader_addline(buffer, "tex%u = %s(ps_sampler%u, ffp_texcoord[%u].%s);\n",
- stage, texture_function, stage, stage, coord_mask);
+ shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ffp_texcoord[%u].%s%s);\n",
+ stage, texture_function, proj ? "Proj" : "", stage, stage, coord_mask, proj ? "w" : "");
}
string_buffer_sprintf(tex_reg_name, "tex%u", stage);
More information about the wine-cvs
mailing list