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@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
74931f9217
commit
5a961e8de7
|
@ -9869,65 +9869,34 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
|
||||||
switch (settings->op[stage].tex_type)
|
switch (settings->op[stage].tex_type)
|
||||||
{
|
{
|
||||||
case WINED3D_GL_RES_TYPE_TEX_1D:
|
case WINED3D_GL_RES_TYPE_TEX_1D:
|
||||||
if (proj)
|
texture_function = "texture1D";
|
||||||
{
|
coord_mask = "x";
|
||||||
texture_function = "texture1DProj";
|
|
||||||
coord_mask = "xw";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texture_function = "texture1D";
|
|
||||||
coord_mask = "x";
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case WINED3D_GL_RES_TYPE_TEX_2D:
|
case WINED3D_GL_RES_TYPE_TEX_2D:
|
||||||
if (proj)
|
texture_function = "texture2D";
|
||||||
{
|
coord_mask = "xy";
|
||||||
texture_function = "texture2DProj";
|
|
||||||
coord_mask = "xyw";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texture_function = "texture2D";
|
|
||||||
coord_mask = "xy";
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case WINED3D_GL_RES_TYPE_TEX_3D:
|
case WINED3D_GL_RES_TYPE_TEX_3D:
|
||||||
if (proj)
|
texture_function = "texture3D";
|
||||||
{
|
coord_mask = "xyz";
|
||||||
texture_function = "texture3DProj";
|
|
||||||
coord_mask = "xyzw";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texture_function = "texture3D";
|
|
||||||
coord_mask = "xyz";
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case WINED3D_GL_RES_TYPE_TEX_CUBE:
|
case WINED3D_GL_RES_TYPE_TEX_CUBE:
|
||||||
texture_function = "textureCube";
|
texture_function = "textureCube";
|
||||||
coord_mask = "xyz";
|
coord_mask = "xyz";
|
||||||
break;
|
break;
|
||||||
case WINED3D_GL_RES_TYPE_TEX_RECT:
|
case WINED3D_GL_RES_TYPE_TEX_RECT:
|
||||||
if (proj)
|
texture_function = "texture2DRect";
|
||||||
{
|
coord_mask = "xy";
|
||||||
texture_function = "texture2DRectProj";
|
|
||||||
coord_mask = "xyw";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texture_function = "texture2DRect";
|
|
||||||
coord_mask = "xy";
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FIXME("Unhandled texture type %#x.\n", settings->op[stage].tex_type);
|
FIXME("Unhandled texture type %#x.\n", settings->op[stage].tex_type);
|
||||||
texture_function = "";
|
texture_function = "";
|
||||||
coord_mask = "xyzw";
|
coord_mask = "xyzw";
|
||||||
|
proj = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!legacy_syntax)
|
if (!legacy_syntax)
|
||||||
texture_function = proj ? "textureProj" : "texture";
|
texture_function = "texture";
|
||||||
|
|
||||||
if (stage > 0
|
if (stage > 0
|
||||||
&& (settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP
|
&& (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, "ret = ffp_texcoord[%u] + ret.xyxy;\n", stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
shader_addline(buffer, "tex%u = %s(ps_sampler%u, ret.%s);\n",
|
shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ret.%s%s);\n",
|
||||||
stage, texture_function, stage, coord_mask);
|
stage, texture_function, proj ? "Proj" : "", stage, coord_mask, proj ? "w" : "");
|
||||||
|
|
||||||
if (settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE)
|
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",
|
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)
|
else if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT3)
|
||||||
{
|
{
|
||||||
shader_addline(buffer, "tex%u = %s(ps_sampler%u, ffp_texcoord[%u].xyz);\n",
|
shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ffp_texcoord[%u].xyz);\n",
|
||||||
stage, texture_function, stage, stage);
|
stage, texture_function, proj ? "Proj" : "", stage, stage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shader_addline(buffer, "tex%u = %s(ps_sampler%u, ffp_texcoord[%u].%s);\n",
|
shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ffp_texcoord[%u].%s%s);\n",
|
||||||
stage, texture_function, stage, stage, coord_mask);
|
stage, texture_function, proj ? "Proj" : "", stage, stage, coord_mask, proj ? "w" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
string_buffer_sprintf(tex_reg_name, "tex%u", stage);
|
string_buffer_sprintf(tex_reg_name, "tex%u", stage);
|
||||||
|
|
Loading…
Reference in New Issue