Commit 78bd9c98 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

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

parent 9be8d0a9
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment