vkd3d-shader/hlsl: Replace HLSL_MODIFIER_RASTERIZER_ORDERED with a hlsl_type.e.resource flag.

This commit is contained in:
Henri Verbeet 2024-02-19 12:52:31 +01:00 committed by Alexandre Julliard
parent 49d14613a5
commit d4223a03c8
Notes: Alexandre Julliard 2024-02-21 23:33:25 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/659
4 changed files with 18 additions and 12 deletions

View File

@ -758,8 +758,8 @@ struct hlsl_type *hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_
return type;
}
struct hlsl_type *hlsl_new_uav_type(struct hlsl_ctx *ctx,
enum hlsl_sampler_dim dim, struct hlsl_type *format, uint32_t modifiers)
struct hlsl_type *hlsl_new_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
struct hlsl_type *format, bool rasteriser_ordered)
{
struct hlsl_type *type;
@ -770,8 +770,8 @@ struct hlsl_type *hlsl_new_uav_type(struct hlsl_ctx *ctx,
type->dimx = format->dimx;
type->dimy = 1;
type->sampler_dim = dim;
type->modifiers = modifiers;
type->e.resource.format = format;
type->e.resource.rasteriser_ordered = rasteriser_ordered;
hlsl_type_calculate_reg_size(ctx, type);
list_add_tail(&ctx->types, &type->entry);
return type;
@ -890,6 +890,8 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
if (t1->base_type == HLSL_TYPE_TEXTURE && t1->sampler_dim != HLSL_SAMPLER_DIM_GENERIC
&& !hlsl_types_are_equal(t1->e.resource.format, t2->e.resource.format))
return false;
if (t1->base_type == HLSL_TYPE_UAV && t1->e.resource.rasteriser_ordered != t2->e.resource.rasteriser_ordered)
return false;
}
if ((t1->modifiers & HLSL_MODIFIER_ROW_MAJOR)
!= (t2->modifiers & HLSL_MODIFIER_ROW_MAJOR))
@ -1009,7 +1011,10 @@ struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
if (type->base_type == HLSL_TYPE_TECHNIQUE)
type->e.version = old->e.version;
if (old->base_type == HLSL_TYPE_TEXTURE || old->base_type == HLSL_TYPE_UAV)
{
type->e.resource.format = old->e.resource.format;
type->e.resource.rasteriser_ordered = old->e.resource.rasteriser_ordered;
}
break;
default:

View File

@ -200,6 +200,8 @@ struct hlsl_type
{
/* Format of the data contained within the type. */
struct hlsl_type *format;
/* The type is a rasteriser-ordered view. */
bool rasteriser_ordered;
} resource;
/* Additional field to distinguish object types. Currently used only for technique types. */
unsigned int version;
@ -370,11 +372,10 @@ struct hlsl_attribute
#define HLSL_STORAGE_CENTROID 0x00004000
#define HLSL_STORAGE_NOPERSPECTIVE 0x00008000
#define HLSL_STORAGE_LINEAR 0x00010000
#define HLSL_MODIFIER_RASTERIZER_ORDERED 0x00020000
#define HLSL_TYPE_MODIFIERS_MASK (HLSL_MODIFIER_PRECISE | HLSL_MODIFIER_VOLATILE | \
HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \
HLSL_MODIFIER_COLUMN_MAJOR | HLSL_MODIFIER_RASTERIZER_ORDERED)
HLSL_MODIFIER_COLUMN_MAJOR)
#define HLSL_INTERPOLATION_MODIFIERS_MASK (HLSL_STORAGE_NOINTERPOLATION | HLSL_STORAGE_CENTROID | \
HLSL_STORAGE_NOPERSPECTIVE | HLSL_STORAGE_LINEAR)
@ -1282,8 +1283,8 @@ struct hlsl_ir_var *hlsl_new_synthetic_var_named(struct hlsl_ctx *ctx, const cha
struct hlsl_type *type, const struct vkd3d_shader_location *loc, bool dummy_scope);
struct hlsl_type *hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, struct hlsl_type *format,
unsigned int sample_count);
struct hlsl_type *hlsl_new_uav_type(struct hlsl_ctx *ctx,
enum hlsl_sampler_dim dim, struct hlsl_type *format, uint32_t modifiers);
struct hlsl_type *hlsl_new_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
struct hlsl_type *format, bool rasteriser_ordered);
struct hlsl_ir_node *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
const struct vkd3d_shader_location *loc);
struct hlsl_ir_node *hlsl_new_unary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg,

View File

@ -6263,12 +6263,12 @@ type_no_void:
| uav_type '<' type '>'
{
validate_uav_type(ctx, $1, $3, &@3);
$$ = hlsl_new_uav_type(ctx, $1, $3, 0);
$$ = hlsl_new_uav_type(ctx, $1, $3, false);
}
| rov_type '<' type '>'
{
validate_uav_type(ctx, $1, $3, &@3);
$$ = hlsl_new_uav_type(ctx, $1, $3, HLSL_MODIFIER_RASTERIZER_ORDERED);
$$ = hlsl_new_uav_type(ctx, $1, $3, true);
}
| TYPE_IDENTIFIER
{

View File

@ -4259,6 +4259,9 @@ static void write_sm4_dcl_textures(const struct tpf_writer *tpf, const struct ex
instr.opcode = VKD3D_SM5_OP_DCL_UAV_TYPED;
break;
}
if (resource->data_type->e.resource.rasteriser_ordered)
instr.opcode |= VKD3DSUF_RASTERISER_ORDERED_VIEW << VKD3D_SM5_UAV_FLAGS_SHIFT;
}
else
{
@ -4272,9 +4275,6 @@ static void write_sm4_dcl_textures(const struct tpf_writer *tpf, const struct ex
instr.extra_bits |= component_type->sample_count << VKD3D_SM4_RESOURCE_SAMPLE_COUNT_SHIFT;
}
if (resource->data_type->modifiers & HLSL_MODIFIER_RASTERIZER_ORDERED)
instr.opcode |= VKD3DSUF_RASTERISER_ORDERED_VIEW << VKD3D_SM5_UAV_FLAGS_SHIFT;
write_sm4_instruction(tpf, &instr);
}
}