vkd3d-shader/hlsl: Make HLSL_TYPE_RENDERTARGETVIEW into a separate class.

This commit is contained in:
Zebediah Figura 2024-02-27 13:34:52 -06:00 committed by Alexandre Julliard
parent ee2bde3aba
commit d7da278693
Notes: Alexandre Julliard 2024-04-23 22:58:08 +02: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/811
6 changed files with 29 additions and 10 deletions

View File

@ -1520,6 +1520,7 @@ D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type)
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_TECHNIQUE: case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
@ -1621,6 +1622,7 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type)
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_TECHNIQUE: case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:

View File

@ -353,7 +353,6 @@ static const char * get_fx_4_type_name(const struct hlsl_type *type)
{ {
[HLSL_TYPE_PIXELSHADER] = "PixelShader", [HLSL_TYPE_PIXELSHADER] = "PixelShader",
[HLSL_TYPE_VERTEXSHADER] = "VertexShader", [HLSL_TYPE_VERTEXSHADER] = "VertexShader",
[HLSL_TYPE_RENDERTARGETVIEW] = "RenderTargetView",
}; };
static const char * const texture_type_names[] = static const char * const texture_type_names[] =
{ {
@ -390,12 +389,14 @@ static const char * get_fx_4_type_name(const struct hlsl_type *type)
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
return "DepthStencilView"; return "DepthStencilView";
case HLSL_CLASS_RENDER_TARGET_VIEW:
return "RenderTargetView";
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
switch (type->base_type) switch (type->base_type)
{ {
case HLSL_TYPE_PIXELSHADER: case HLSL_TYPE_PIXELSHADER:
case HLSL_TYPE_VERTEXSHADER: case HLSL_TYPE_VERTEXSHADER:
case HLSL_TYPE_RENDERTARGETVIEW:
return object_type_names[type->base_type]; return object_type_names[type->base_type];
default: default:
return type->name; return type->name;
@ -436,6 +437,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_TEXTURE: case HLSL_CLASS_TEXTURE:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:
put_u32_unaligned(buffer, 2); put_u32_unaligned(buffer, 2);
@ -526,19 +528,21 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
{ {
put_u32_unaligned(buffer, 20); put_u32_unaligned(buffer, 20);
} }
else if (type->class == HLSL_CLASS_RENDER_TARGET_VIEW)
{
put_u32_unaligned(buffer, 19);
}
else if (type->class == HLSL_CLASS_OBJECT) else if (type->class == HLSL_CLASS_OBJECT)
{ {
static const uint32_t object_type[] = static const uint32_t object_type[] =
{ {
[HLSL_TYPE_PIXELSHADER] = 5, [HLSL_TYPE_PIXELSHADER] = 5,
[HLSL_TYPE_VERTEXSHADER] = 6, [HLSL_TYPE_VERTEXSHADER] = 6,
[HLSL_TYPE_RENDERTARGETVIEW] = 19,
}; };
switch (type->base_type) switch (type->base_type)
{ {
case HLSL_TYPE_PIXELSHADER: case HLSL_TYPE_PIXELSHADER:
case HLSL_TYPE_RENDERTARGETVIEW:
case HLSL_TYPE_VERTEXSHADER: case HLSL_TYPE_VERTEXSHADER:
put_u32_unaligned(buffer, object_type[type->base_type]); put_u32_unaligned(buffer, object_type[type->base_type]);
break; break;
@ -547,11 +551,17 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
return 0; return 0;
} }
} }
else /* Numeric type */ else if (hlsl_is_numeric_type(type))
{ {
numeric_desc = get_fx_4_numeric_type_description(type, fx); numeric_desc = get_fx_4_numeric_type_description(type, fx);
put_u32_unaligned(buffer, numeric_desc); put_u32_unaligned(buffer, numeric_desc);
} }
else
{
FIXME("Type %u is not supported.\n", type->class);
set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED);
return 0;
}
return offset; return offset;
} }
@ -847,6 +857,7 @@ static bool is_type_supported_fx_2(struct hlsl_ctx *ctx, const struct hlsl_type
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
return false; return false;
@ -1032,6 +1043,7 @@ static void write_fx_4_object_variable(struct hlsl_ir_var *var, struct fx_write_
/* Initializer */ /* Initializer */
switch (type->class) switch (type->class)
{ {
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_TEXTURE: case HLSL_CLASS_TEXTURE:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:
break; break;
@ -1039,8 +1051,6 @@ static void write_fx_4_object_variable(struct hlsl_ir_var *var, struct fx_write_
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
switch (type->base_type) switch (type->base_type)
{ {
case HLSL_TYPE_RENDERTARGETVIEW:
break;
case HLSL_TYPE_PIXELSHADER: case HLSL_TYPE_PIXELSHADER:
case HLSL_TYPE_VERTEXSHADER: case HLSL_TYPE_VERTEXSHADER:
/* FIXME: write shader blobs, once parser support works. */ /* FIXME: write shader blobs, once parser support works. */
@ -1139,6 +1149,7 @@ static bool is_object_variable(const struct hlsl_ir_var *var)
switch (type->class) switch (type->class)
{ {
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_TEXTURE: case HLSL_CLASS_TEXTURE:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:
@ -1149,7 +1160,6 @@ static bool is_object_variable(const struct hlsl_ir_var *var)
{ {
case HLSL_TYPE_PIXELSHADER: case HLSL_TYPE_PIXELSHADER:
case HLSL_TYPE_VERTEXSHADER: case HLSL_TYPE_VERTEXSHADER:
case HLSL_TYPE_RENDERTARGETVIEW:
return true; return true;
default: default:
return false; return false;

View File

@ -367,6 +367,7 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
case HLSL_CLASS_TECHNIQUE: case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
@ -434,6 +435,7 @@ static bool type_is_single_component(const struct hlsl_type *type)
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_TEXTURE: case HLSL_CLASS_TEXTURE:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:
return true; return true;
@ -571,6 +573,7 @@ unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_ty
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
case HLSL_CLASS_TEXTURE: case HLSL_CLASS_TEXTURE:
@ -948,6 +951,7 @@ unsigned int hlsl_type_component_count(const struct hlsl_type *type)
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
case HLSL_CLASS_TEXTURE: case HLSL_CLASS_TEXTURE:
@ -2374,6 +2378,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
case HLSL_CLASS_TECHNIQUE: case HLSL_CLASS_TECHNIQUE:
@ -3554,7 +3559,6 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
{"matrix", HLSL_CLASS_MATRIX, HLSL_TYPE_FLOAT, 4, 4}, {"matrix", HLSL_CLASS_MATRIX, HLSL_TYPE_FLOAT, 4, 4},
{"pixelshader", HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1}, {"pixelshader", HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1},
{"vertexshader", HLSL_CLASS_OBJECT, HLSL_TYPE_VERTEXSHADER, 1, 1}, {"vertexshader", HLSL_CLASS_OBJECT, HLSL_TYPE_VERTEXSHADER, 1, 1},
{"RenderTargetView",HLSL_CLASS_OBJECT, HLSL_TYPE_RENDERTARGETVIEW, 1, 1},
}; };
static const struct static const struct
@ -3669,6 +3673,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "DepthStencilView", HLSL_CLASS_DEPTH_STENCIL_VIEW)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "DepthStencilView", HLSL_CLASS_DEPTH_STENCIL_VIEW));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "fxgroup", HLSL_CLASS_EFFECT_GROUP)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "fxgroup", HLSL_CLASS_EFFECT_GROUP));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "pass", HLSL_CLASS_PASS)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "pass", HLSL_CLASS_PASS));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "RenderTargetView", HLSL_CLASS_RENDER_TARGET_VIEW));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "STRING", HLSL_CLASS_STRING)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "STRING", HLSL_CLASS_STRING));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "texture", HLSL_CLASS_TEXTURE)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "texture", HLSL_CLASS_TEXTURE));

View File

@ -82,6 +82,7 @@ enum hlsl_type_class
HLSL_CLASS_DEPTH_STENCIL_VIEW, HLSL_CLASS_DEPTH_STENCIL_VIEW,
HLSL_CLASS_EFFECT_GROUP, HLSL_CLASS_EFFECT_GROUP,
HLSL_CLASS_PASS, HLSL_CLASS_PASS,
HLSL_CLASS_RENDER_TARGET_VIEW,
HLSL_CLASS_SAMPLER, HLSL_CLASS_SAMPLER,
HLSL_CLASS_STRING, HLSL_CLASS_STRING,
HLSL_CLASS_TECHNIQUE, HLSL_CLASS_TECHNIQUE,
@ -101,7 +102,6 @@ enum hlsl_base_type
HLSL_TYPE_LAST_SCALAR = HLSL_TYPE_BOOL, HLSL_TYPE_LAST_SCALAR = HLSL_TYPE_BOOL,
HLSL_TYPE_PIXELSHADER, HLSL_TYPE_PIXELSHADER,
HLSL_TYPE_VERTEXSHADER, HLSL_TYPE_VERTEXSHADER,
HLSL_TYPE_RENDERTARGETVIEW,
}; };
enum hlsl_sampler_dim enum hlsl_sampler_dim

View File

@ -1641,6 +1641,7 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx,
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
case HLSL_CLASS_TECHNIQUE: case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:

View File

@ -3011,6 +3011,7 @@ static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type)
case HLSL_CLASS_STRUCT: case HLSL_CLASS_STRUCT:
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
case HLSL_CLASS_TECHNIQUE: case HLSL_CLASS_TECHNIQUE: