[PATCH 6/6] wined3d: Use non-deprecated texture sample builtins also in the fragment pipeline replacement shaders.
Henri Verbeet
hverbeet at gmail.com
Fri Oct 16 05:30:56 CDT 2015
On 15 October 2015 at 22:01, Matteo Bruni <mbruni at codeweavers.com> wrote:
> @@ -6259,7 +6259,7 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
> {
> struct wined3d_string_buffer *buffer = &priv->shader_buffer;
> BYTE lum_map = 0, bump_map = 0, tex_map = 0, tss_const_map = 0;
> - BOOL tempreg_used = FALSE, tfactor_used = FALSE;
> + BOOL tempreg_used = FALSE, tfactor_used = FALSE, legacy_syntax = needs_legacy_glsl_syntax(gl_info);
> const char *final_combiner_src = "ret";
> UINT lowest_disabled_stage;
> GLuint shader_id;
> @@ -6480,52 +6480,52 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
> case WINED3D_GL_RES_TYPE_TEX_1D:
> if (proj)
> {
> - texture_function = "texture1DProj";
> + texture_function = legacy_syntax ? "texture1DProj" : "textureProj";
> coord_mask = "xw";
> }
> else
> {
> - texture_function = "texture1D";
> + texture_function = legacy_syntax ? "texture1D" : "texture";
> coord_mask = "x";
> }
> break;
> case WINED3D_GL_RES_TYPE_TEX_2D:
> if (proj)
> {
> - texture_function = "texture2DProj";
> + texture_function = legacy_syntax ? "texture2DProj" : "textureProj";
> coord_mask = "xyw";
> }
> else
> {
> - texture_function = "texture2D";
> + texture_function = legacy_syntax ? "texture2D" : "texture";
> coord_mask = "xy";
> }
> break;
> case WINED3D_GL_RES_TYPE_TEX_3D:
> if (proj)
> {
> - texture_function = "texture3DProj";
> + texture_function = legacy_syntax ? "texture3DProj" : "textureProj";
> coord_mask = "xyzw";
> }
> else
> {
> - texture_function = "texture3D";
> + texture_function = legacy_syntax ? "texture3D" : "texture";
> coord_mask = "xyz";
> }
> break;
> case WINED3D_GL_RES_TYPE_TEX_CUBE:
> - texture_function = "textureCube";
> + texture_function = legacy_syntax ? "textureCube" : "texture";
> coord_mask = "xyz";
> break;
> case WINED3D_GL_RES_TYPE_TEX_RECT:
> if (proj)
> {
> - texture_function = "texture2DRectProj";
> + texture_function = legacy_syntax ? "texture2DRectProj" : "textureProj";
> coord_mask = "xyw";
> }
> else
> {
> - texture_function = "texture2DRect";
> + texture_function = legacy_syntax ? "texture2DRect" : "texture";
> coord_mask = "xy";
> }
> break;
It seems like it would be at least as readable to adjust "proj" for
cube textures and then just do
if (!needs_legacy_glsl_syntax(gl_info))
texture_function = proj ? "textureProj" : "texture";
More information about the wine-devel
mailing list