wined3d: Don't clamp texture lookups in the GLSL fixed function fragment pipe.

This commit is contained in:
Henri Verbeet 2013-09-03 09:47:23 +02:00 committed by Alexandre Julliard
parent 50e2ee73a4
commit 0d2d847914
1 changed files with 7 additions and 25 deletions

View File

@ -5507,7 +5507,7 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct wined3d_shader_buf
{ {
const char *texture_function, *coord_mask; const char *texture_function, *coord_mask;
char tex_reg_name[8]; char tex_reg_name[8];
BOOL proj, clamp; BOOL proj;
if (!(tex_map & (1 << stage))) if (!(tex_map & (1 << stage)))
continue; continue;
@ -5527,12 +5527,6 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct wined3d_shader_buf
proj = TRUE; proj = TRUE;
} }
if (settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP
|| settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE)
clamp = FALSE;
else
clamp = TRUE;
switch (settings->op[stage].tex_type) switch (settings->op[stage].tex_type)
{ {
case tex_1d: case tex_1d:
@ -5624,10 +5618,6 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct wined3d_shader_buf
shader_addline(buffer, "ret = gl_TexCoord[%u] + ret.xyxy;\n", stage); shader_addline(buffer, "ret = gl_TexCoord[%u] + ret.xyxy;\n", stage);
} }
if (clamp)
shader_addline(buffer, "tex%u = clamp(%s(ps_sampler%u, ret.%s), 0.0, 1.0);\n",
stage, texture_function, stage, coord_mask);
else
shader_addline(buffer, "tex%u = %s(ps_sampler%u, ret.%s);\n", shader_addline(buffer, "tex%u = %s(ps_sampler%u, ret.%s);\n",
stage, texture_function, stage, coord_mask); stage, texture_function, stage, coord_mask);
@ -5637,19 +5627,11 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct wined3d_shader_buf
} }
else if (settings->op[stage].projected == proj_count3) else if (settings->op[stage].projected == proj_count3)
{ {
if (clamp)
shader_addline(buffer, "tex%u = clamp(%s(ps_sampler%u, gl_TexCoord[%u].xyz), 0.0, 1.0);\n",
stage, texture_function, stage, stage);
else
shader_addline(buffer, "tex%u = %s(ps_sampler%u, gl_TexCoord[%u].xyz);\n", shader_addline(buffer, "tex%u = %s(ps_sampler%u, gl_TexCoord[%u].xyz);\n",
stage, texture_function, stage, stage); stage, texture_function, stage, stage);
} }
else else
{ {
if (clamp)
shader_addline(buffer, "tex%u = clamp(%s(ps_sampler%u, gl_TexCoord[%u].%s), 0.0, 1.0);\n",
stage, texture_function, stage, stage, coord_mask);
else
shader_addline(buffer, "tex%u = %s(ps_sampler%u, gl_TexCoord[%u].%s);\n", shader_addline(buffer, "tex%u = %s(ps_sampler%u, gl_TexCoord[%u].%s);\n",
stage, texture_function, stage, stage, coord_mask); stage, texture_function, stage, stage, coord_mask);
} }