mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Make HLSL_TYPE_DEPTHSTENCILVIEW into a separate class.
This commit is contained in:
parent
76971d811e
commit
ee2bde3aba
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
@ -1517,6 +1517,7 @@ D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type)
|
||||
case HLSL_CLASS_STRING:
|
||||
case HLSL_CLASS_TEXTURE:
|
||||
return D3DXPC_OBJECT;
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_EFFECT_GROUP:
|
||||
case HLSL_CLASS_PASS:
|
||||
case HLSL_CLASS_TECHNIQUE:
|
||||
@ -1617,6 +1618,7 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type)
|
||||
case HLSL_CLASS_STRING:
|
||||
return D3DXPT_STRING;
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_EFFECT_GROUP:
|
||||
case HLSL_CLASS_PASS:
|
||||
case HLSL_CLASS_TECHNIQUE:
|
||||
|
@ -354,7 +354,6 @@ static const char * get_fx_4_type_name(const struct hlsl_type *type)
|
||||
[HLSL_TYPE_PIXELSHADER] = "PixelShader",
|
||||
[HLSL_TYPE_VERTEXSHADER] = "VertexShader",
|
||||
[HLSL_TYPE_RENDERTARGETVIEW] = "RenderTargetView",
|
||||
[HLSL_TYPE_DEPTHSTENCILVIEW] = "DepthStencilView",
|
||||
};
|
||||
static const char * const texture_type_names[] =
|
||||
{
|
||||
@ -380,19 +379,28 @@ static const char * get_fx_4_type_name(const struct hlsl_type *type)
|
||||
[HLSL_SAMPLER_DIM_STRUCTURED_BUFFER] = "RWStructuredBuffer",
|
||||
};
|
||||
|
||||
if (type->class == HLSL_CLASS_TEXTURE)
|
||||
return texture_type_names[type->sampler_dim];
|
||||
|
||||
if (type->class == HLSL_CLASS_UAV)
|
||||
return uav_type_names[type->sampler_dim];
|
||||
|
||||
switch (type->base_type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_TYPE_PIXELSHADER:
|
||||
case HLSL_TYPE_VERTEXSHADER:
|
||||
case HLSL_TYPE_RENDERTARGETVIEW:
|
||||
case HLSL_TYPE_DEPTHSTENCILVIEW:
|
||||
return object_type_names[type->base_type];
|
||||
case HLSL_CLASS_TEXTURE:
|
||||
return texture_type_names[type->sampler_dim];
|
||||
|
||||
case HLSL_CLASS_UAV:
|
||||
return uav_type_names[type->sampler_dim];
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
return "DepthStencilView";
|
||||
|
||||
case HLSL_CLASS_OBJECT:
|
||||
switch (type->base_type)
|
||||
{
|
||||
case HLSL_TYPE_PIXELSHADER:
|
||||
case HLSL_TYPE_VERTEXSHADER:
|
||||
case HLSL_TYPE_RENDERTARGETVIEW:
|
||||
return object_type_names[type->base_type];
|
||||
default:
|
||||
return type->name;
|
||||
}
|
||||
|
||||
default:
|
||||
return type->name;
|
||||
}
|
||||
@ -426,6 +434,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
||||
put_u32_unaligned(buffer, 1);
|
||||
break;
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_TEXTURE:
|
||||
case HLSL_CLASS_UAV:
|
||||
@ -513,6 +522,10 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
||||
|
||||
put_u32_unaligned(buffer, uav_type[type->sampler_dim]);
|
||||
}
|
||||
else if (type->class == HLSL_CLASS_DEPTH_STENCIL_VIEW)
|
||||
{
|
||||
put_u32_unaligned(buffer, 20);
|
||||
}
|
||||
else if (type->class == HLSL_CLASS_OBJECT)
|
||||
{
|
||||
static const uint32_t object_type[] =
|
||||
@ -520,12 +533,10 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
||||
[HLSL_TYPE_PIXELSHADER] = 5,
|
||||
[HLSL_TYPE_VERTEXSHADER] = 6,
|
||||
[HLSL_TYPE_RENDERTARGETVIEW] = 19,
|
||||
[HLSL_TYPE_DEPTHSTENCILVIEW] = 20,
|
||||
};
|
||||
|
||||
switch (type->base_type)
|
||||
{
|
||||
case HLSL_TYPE_DEPTHSTENCILVIEW:
|
||||
case HLSL_TYPE_PIXELSHADER:
|
||||
case HLSL_TYPE_RENDERTARGETVIEW:
|
||||
case HLSL_TYPE_VERTEXSHADER:
|
||||
@ -834,6 +845,7 @@ static bool is_type_supported_fx_2(struct hlsl_ctx *ctx, const struct hlsl_type
|
||||
hlsl_fixme(ctx, loc, "Write fx 2.0 parameter class %#x.", type->class);
|
||||
return false;
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_UAV:
|
||||
case HLSL_CLASS_VOID:
|
||||
return false;
|
||||
|
@ -363,6 +363,7 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
|
||||
type->reg_size[HLSL_REGSET_UAVS] = 1;
|
||||
break;
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_EFFECT_GROUP:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_PASS:
|
||||
@ -428,6 +429,7 @@ static bool type_is_single_component(const struct hlsl_type *type)
|
||||
{
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_SCALAR:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
@ -567,6 +569,7 @@ unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_ty
|
||||
}
|
||||
break;
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_STRING:
|
||||
@ -943,6 +946,7 @@ unsigned int hlsl_type_component_count(const struct hlsl_type *type)
|
||||
case HLSL_CLASS_ARRAY:
|
||||
return hlsl_type_component_count(type->e.array.type) * type->e.array.elements_count;
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_STRING:
|
||||
@ -2366,6 +2370,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
|
||||
}
|
||||
return string;
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_EFFECT_GROUP:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_PASS:
|
||||
@ -3550,7 +3555,6 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
|
||||
{"pixelshader", HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1},
|
||||
{"vertexshader", HLSL_CLASS_OBJECT, HLSL_TYPE_VERTEXSHADER, 1, 1},
|
||||
{"RenderTargetView",HLSL_CLASS_OBJECT, HLSL_TYPE_RENDERTARGETVIEW, 1, 1},
|
||||
{"DepthStencilView",HLSL_CLASS_OBJECT, HLSL_TYPE_DEPTHSTENCILVIEW, 1, 1},
|
||||
};
|
||||
|
||||
static const struct
|
||||
@ -3662,6 +3666,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
|
||||
}
|
||||
|
||||
ctx->builtin_types.Void = hlsl_new_simple_type(ctx, "void", HLSL_CLASS_VOID);
|
||||
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, "pass", HLSL_CLASS_PASS));
|
||||
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "STRING", HLSL_CLASS_STRING));
|
||||
|
@ -79,6 +79,7 @@ enum hlsl_type_class
|
||||
HLSL_CLASS_STRUCT,
|
||||
HLSL_CLASS_ARRAY,
|
||||
HLSL_CLASS_OBJECT,
|
||||
HLSL_CLASS_DEPTH_STENCIL_VIEW,
|
||||
HLSL_CLASS_EFFECT_GROUP,
|
||||
HLSL_CLASS_PASS,
|
||||
HLSL_CLASS_SAMPLER,
|
||||
@ -101,7 +102,6 @@ enum hlsl_base_type
|
||||
HLSL_TYPE_PIXELSHADER,
|
||||
HLSL_TYPE_VERTEXSHADER,
|
||||
HLSL_TYPE_RENDERTARGETVIEW,
|
||||
HLSL_TYPE_DEPTHSTENCILVIEW,
|
||||
};
|
||||
|
||||
enum hlsl_sampler_dim
|
||||
|
@ -1638,6 +1638,7 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx,
|
||||
* matrices yet. */
|
||||
return false;
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_EFFECT_GROUP:
|
||||
case HLSL_CLASS_PASS:
|
||||
case HLSL_CLASS_STRING:
|
||||
|
@ -3006,6 +3006,7 @@ static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type)
|
||||
return D3D_SVC_VECTOR;
|
||||
|
||||
case HLSL_CLASS_ARRAY:
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_EFFECT_GROUP:
|
||||
case HLSL_CLASS_STRUCT:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
|
Loading…
x
Reference in New Issue
Block a user