[PATCH 2/6] wined3d: Extend shader_glsl_gen_sample_code() to support offsets.
Henri Verbeet
hverbeet at gmail.com
Wed Mar 9 06:39:10 CST 2016
On 8 March 2016 at 17:46, Józef Kucia <jkucia at codeweavers.com> wrote:
> +static void shader_glsl_append_imm_ivec(struct wined3d_string_buffer *buffer,
> + const int *values, unsigned int size)
> +{
> + const char *fmt = "%#x";
> + char str[4][17] = {{0}};
I guess this is inspired by shader_glsl_append_imm_vec4(), but I think
you can just append to the buffer here.
> + if (1 > size || size > 4)
I don't think "1 > size" is all that more readable than "!size".
> + for (i = size - 1; i >= 0; --i)
> + {
> + sprintf(str[i], fmt, values[i]);
> + fmt = "%#x, ";
> + }
If you use ", %#x" for the format you don't need the awkward reverse loop.
> - if (flags != WINED3D_GLSL_SAMPLE_LOAD)
> - ERR("Unexpected flags for texelFetch %#x.\n", flags & ~WINED3D_GLSL_SAMPLE_LOAD);
> + static const DWORD texel_fetch_flags = WINED3D_GLSL_SAMPLE_LOAD | WINED3D_GLSL_SAMPLE_OFFSET;
> + if (flags & ~texel_fetch_flags)
> + ERR("Unexpected flags for texelFetch %#x.\n", flags & ~texel_fetch_flags);
The original had this as well, of course, but "Unexpected flags %#x
for texelFetch.\n" may be better.
More information about the wine-devel
mailing list