wined3d: Use non-deprecated texture sample builtins in shaders on core profile.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2015-10-15 22:01:06 +02:00 committed by Alexandre Julliard
parent 9be8d0a9f4
commit 78bd9c9811
1 changed files with 25 additions and 14 deletions

View File

@ -66,6 +66,7 @@ struct glsl_sample_function
struct wined3d_string_buffer *name;
DWORD coord_mask;
enum wined3d_data_type data_type;
BOOL output_single_component;
};
enum heap_node_op
@ -2657,6 +2658,8 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context
if (resource_type == WINED3D_SHADER_RESOURCE_TEXTURE_CUBE)
projected = FALSE;
if (needs_legacy_glsl_syntax(gl_info))
{
if (shadow)
base = "shadow";
@ -2673,6 +2676,7 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context
else
FIXME("Unsupported grad function.\n");
}
}
sample_function->name = string_buffer_get(priv->string_buffers);
string_buffer_sprintf(sample_function->name, "%s%s%s%s%s", base, type_part, projected ? "Proj" : "",
@ -2682,6 +2686,7 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context
if (shadow)
++coord_size;
sample_function->coord_mask = (1u << coord_size) - 1;
sample_function->output_single_component = shadow && !needs_legacy_glsl_syntax(gl_info);
}
static void shader_glsl_release_sample_function(const struct wined3d_shader_context *ctx,
@ -2828,6 +2833,9 @@ static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_s
shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &ins->dst[0], sample_function->data_type);
if (sample_function->output_single_component)
shader_addline(ins->ctx->buffer, "vec4(");
shader_addline(ins->ctx->buffer, "%s(%s_sampler%u, ",
sample_function->name->buffer, shader_glsl_get_prefix(version->type), sampler);
@ -2874,6 +2882,9 @@ static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_s
else
shader_addline(ins->ctx->buffer, ")");
if (sample_function->output_single_component)
shader_addline(ins->ctx->buffer, ")");
shader_addline(ins->ctx->buffer, "%s);\n", dst_swizzle);
if (!is_identity_fixup(fixup))