mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Add texel_offset field to hlsl_ir_resource_load.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> 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:
parent
591cec956e
commit
2570967aab
@ -644,7 +644,7 @@ struct hlsl_ir_load *hlsl_new_var_load(struct hlsl_ctx *ctx, struct hlsl_ir_var
|
||||
struct hlsl_ir_resource_load *hlsl_new_resource_load(struct hlsl_ctx *ctx, struct hlsl_type *data_type,
|
||||
enum hlsl_resource_load_type type, struct hlsl_ir_var *resource, struct hlsl_ir_node *resource_offset,
|
||||
struct hlsl_ir_var *sampler, struct hlsl_ir_node *sampler_offset, struct hlsl_ir_node *coords,
|
||||
const struct vkd3d_shader_location *loc)
|
||||
struct hlsl_ir_node *texel_offset, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_resource_load *load;
|
||||
|
||||
@ -657,6 +657,7 @@ struct hlsl_ir_resource_load *hlsl_new_resource_load(struct hlsl_ctx *ctx, struc
|
||||
load->sampler.var = sampler;
|
||||
hlsl_src_from_node(&load->sampler.offset, sampler_offset);
|
||||
hlsl_src_from_node(&load->coords, coords);
|
||||
hlsl_src_from_node(&load->texel_offset, texel_offset);
|
||||
return load;
|
||||
}
|
||||
|
||||
@ -1285,6 +1286,11 @@ static void dump_ir_resource_load(struct vkd3d_string_buffer *buffer, const stru
|
||||
dump_deref(buffer, &load->sampler);
|
||||
vkd3d_string_buffer_printf(buffer, ", coords = ");
|
||||
dump_src(buffer, &load->coords);
|
||||
if (load->texel_offset.node)
|
||||
{
|
||||
vkd3d_string_buffer_printf(buffer, ", offset = ");
|
||||
dump_src(buffer, &load->texel_offset);
|
||||
}
|
||||
vkd3d_string_buffer_printf(buffer, ")");
|
||||
}
|
||||
|
||||
@ -1458,6 +1464,7 @@ static void free_ir_resource_load(struct hlsl_ir_resource_load *load)
|
||||
hlsl_src_remove(&load->coords);
|
||||
hlsl_src_remove(&load->sampler.offset);
|
||||
hlsl_src_remove(&load->resource.offset);
|
||||
hlsl_src_remove(&load->texel_offset);
|
||||
vkd3d_free(load);
|
||||
}
|
||||
|
||||
|
@ -384,6 +384,7 @@ struct hlsl_ir_resource_load
|
||||
enum hlsl_resource_load_type load_type;
|
||||
struct hlsl_deref resource, sampler;
|
||||
struct hlsl_src coords;
|
||||
struct hlsl_src texel_offset;
|
||||
};
|
||||
|
||||
struct hlsl_ir_store
|
||||
@ -708,7 +709,7 @@ struct hlsl_ir_loop *hlsl_new_loop(struct hlsl_ctx *ctx, struct vkd3d_shader_loc
|
||||
struct hlsl_ir_resource_load *hlsl_new_resource_load(struct hlsl_ctx *ctx, struct hlsl_type *data_type,
|
||||
enum hlsl_resource_load_type type, struct hlsl_ir_var *resource, struct hlsl_ir_node *resource_offset,
|
||||
struct hlsl_ir_var *sampler, struct hlsl_ir_node *sampler_offset, struct hlsl_ir_node *coords,
|
||||
const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_ir_node *texel_offset, const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_ir_store *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs);
|
||||
struct hlsl_ir_store *hlsl_new_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct hlsl_ir_node *offset,
|
||||
struct hlsl_ir_node *rhs, unsigned int writemask, struct vkd3d_shader_location loc);
|
||||
|
@ -1875,7 +1875,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
|
||||
return false;
|
||||
|
||||
if (!(load = hlsl_new_resource_load(ctx, object_type->e.resource_format, HLSL_RESOURCE_LOAD,
|
||||
object_load->src.var, object_load->src.offset.node, NULL, NULL, coords, loc)))
|
||||
object_load->src.var, object_load->src.offset.node, NULL, NULL, coords, NULL, loc)))
|
||||
return false;
|
||||
list_add_tail(instrs, &load->node.entry);
|
||||
return true;
|
||||
@ -1885,6 +1885,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
|
||||
const unsigned int sampler_dim = sampler_dim_count(object_type->sampler_dim);
|
||||
const struct hlsl_type *sampler_type;
|
||||
struct hlsl_ir_resource_load *load;
|
||||
struct hlsl_ir_node *offset = NULL;
|
||||
struct hlsl_ir_load *sampler_load;
|
||||
struct hlsl_ir_node *coords;
|
||||
|
||||
@ -1894,8 +1895,6 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
|
||||
"Wrong number of arguments to method 'Sample': expected 2 or 3, but got %u.", params->args_count);
|
||||
return false;
|
||||
}
|
||||
if (params->args_count == 3)
|
||||
FIXME("Ignoring offset parameter.\n");
|
||||
|
||||
sampler_type = params->args[0]->data_type;
|
||||
if (sampler_type->type != HLSL_CLASS_OBJECT || sampler_type->base_type != HLSL_TYPE_SAMPLER
|
||||
@ -1915,11 +1914,18 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
|
||||
|
||||
if (!(coords = add_implicit_conversion(ctx, instrs, params->args[1],
|
||||
hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, sampler_dim), loc)))
|
||||
coords = params->args[1];
|
||||
return false;
|
||||
|
||||
if (params->args_count == 3)
|
||||
{
|
||||
if (!(offset = add_implicit_conversion(ctx, instrs, params->args[2],
|
||||
hlsl_get_vector_type(ctx, HLSL_TYPE_INT, sampler_dim), loc)))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(load = hlsl_new_resource_load(ctx, object_type->e.resource_format,
|
||||
HLSL_RESOURCE_SAMPLE, object_load->src.var, object_load->src.offset.node,
|
||||
sampler_load->src.var, sampler_load->src.offset.node, coords, loc)))
|
||||
sampler_load->src.var, sampler_load->src.offset.node, coords, offset, loc)))
|
||||
return false;
|
||||
list_add_tail(instrs, &load->node.entry);
|
||||
return true;
|
||||
|
@ -1052,6 +1052,8 @@ static void compute_liveness_recurse(struct hlsl_block *block, unsigned int loop
|
||||
}
|
||||
|
||||
load->coords.node->last_read = instr->index;
|
||||
if (load->texel_offset.node)
|
||||
load->texel_offset.node->last_read = instr->index;
|
||||
break;
|
||||
}
|
||||
case HLSL_IR_SWIZZLE:
|
||||
|
Loading…
Reference in New Issue
Block a user