mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Make HLSL_TYPE_PIXELSHADER into a separate class.
This commit is contained in:
parent
874937dab4
commit
d9f7a88329
Notes:
Alexandre Julliard
2024-05-06 22:37:26 +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/831
@ -1514,7 +1514,7 @@ D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type)
|
||||
return D3DXPC_STRUCT;
|
||||
case HLSL_CLASS_VECTOR:
|
||||
return D3DXPC_VECTOR;
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_STRING:
|
||||
case HLSL_CLASS_TEXTURE:
|
||||
@ -1601,16 +1601,6 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type)
|
||||
}
|
||||
break;
|
||||
|
||||
case HLSL_CLASS_OBJECT:
|
||||
switch (type->base_type)
|
||||
{
|
||||
case HLSL_TYPE_PIXELSHADER:
|
||||
return D3DXPT_PIXELSHADER;
|
||||
default:
|
||||
vkd3d_unreachable();
|
||||
}
|
||||
vkd3d_unreachable();
|
||||
|
||||
case HLSL_CLASS_ARRAY:
|
||||
return hlsl_sm1_base_type(type->e.array.type);
|
||||
|
||||
@ -1620,6 +1610,9 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type)
|
||||
case HLSL_CLASS_STRING:
|
||||
return D3DXPT_STRING;
|
||||
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
return D3DXPT_PIXELSHADER;
|
||||
|
||||
case HLSL_CLASS_VERTEX_SHADER:
|
||||
return D3DXPT_VERTEXSHADER;
|
||||
|
||||
|
@ -349,10 +349,6 @@ static uint32_t get_fx_4_numeric_type_description(const struct hlsl_type *type,
|
||||
|
||||
static const char * get_fx_4_type_name(const struct hlsl_type *type)
|
||||
{
|
||||
static const char * const object_type_names[] =
|
||||
{
|
||||
[HLSL_TYPE_PIXELSHADER] = "PixelShader",
|
||||
};
|
||||
static const char * const texture_type_names[] =
|
||||
{
|
||||
[HLSL_SAMPLER_DIM_GENERIC] = "texture",
|
||||
@ -394,14 +390,8 @@ static const char * get_fx_4_type_name(const struct hlsl_type *type)
|
||||
case HLSL_CLASS_VERTEX_SHADER:
|
||||
return "VertexShader";
|
||||
|
||||
case HLSL_CLASS_OBJECT:
|
||||
switch (type->base_type)
|
||||
{
|
||||
case HLSL_TYPE_PIXELSHADER:
|
||||
return object_type_names[type->base_type];
|
||||
default:
|
||||
return type->name;
|
||||
}
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
return "PixelShader";
|
||||
|
||||
default:
|
||||
return type->name;
|
||||
@ -414,7 +404,6 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
||||
uint32_t name_offset, offset, size, stride, numeric_desc;
|
||||
uint32_t elements_count = 0;
|
||||
const char *name;
|
||||
struct hlsl_ctx *ctx = fx->ctx;
|
||||
|
||||
/* Resolve arrays to element type and number of elements. */
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
@ -437,7 +426,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
||||
break;
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_RENDER_TARGET_VIEW:
|
||||
case HLSL_CLASS_TEXTURE:
|
||||
case HLSL_CLASS_UAV:
|
||||
@ -534,27 +523,14 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
||||
{
|
||||
put_u32_unaligned(buffer, 19);
|
||||
}
|
||||
else if (type->class == HLSL_CLASS_PIXEL_SHADER)
|
||||
{
|
||||
put_u32_unaligned(buffer, 5);
|
||||
}
|
||||
else if (type->class == HLSL_CLASS_VERTEX_SHADER)
|
||||
{
|
||||
put_u32_unaligned(buffer, 6);
|
||||
}
|
||||
else if (type->class == HLSL_CLASS_OBJECT)
|
||||
{
|
||||
static const uint32_t object_type[] =
|
||||
{
|
||||
[HLSL_TYPE_PIXELSHADER] = 5,
|
||||
};
|
||||
|
||||
switch (type->base_type)
|
||||
{
|
||||
case HLSL_TYPE_PIXELSHADER:
|
||||
put_u32_unaligned(buffer, object_type[type->base_type]);
|
||||
break;
|
||||
default:
|
||||
hlsl_fixme(ctx, &ctx->location, "Object type %u is not supported.", type->base_type);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (hlsl_is_numeric_type(type))
|
||||
{
|
||||
numeric_desc = get_fx_4_numeric_type_description(type, fx);
|
||||
@ -842,17 +818,7 @@ static bool is_type_supported_fx_2(struct hlsl_ctx *ctx, const struct hlsl_type
|
||||
}
|
||||
break;
|
||||
|
||||
case HLSL_CLASS_OBJECT:
|
||||
switch (type->base_type)
|
||||
{
|
||||
case HLSL_TYPE_PIXELSHADER:
|
||||
hlsl_fixme(ctx, loc, "Write fx 2.0 parameter object type %#x.", type->base_type);
|
||||
return false;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_STRING:
|
||||
case HLSL_CLASS_VERTEX_SHADER:
|
||||
@ -1052,21 +1018,7 @@ static void write_fx_4_object_variable(struct hlsl_ir_var *var, struct fx_write_
|
||||
case HLSL_CLASS_UAV:
|
||||
break;
|
||||
|
||||
case HLSL_CLASS_OBJECT:
|
||||
switch (type->base_type)
|
||||
{
|
||||
case HLSL_TYPE_PIXELSHADER:
|
||||
/* FIXME: write shader blobs, once parser support works. */
|
||||
for (i = 0; i < elements_count; ++i)
|
||||
put_u32(buffer, 0);
|
||||
++fx->shader_variable_count;
|
||||
break;
|
||||
default:
|
||||
hlsl_fixme(ctx, &ctx->location, "Writing initializer for object type %u is not implemented.",
|
||||
type->base_type);
|
||||
}
|
||||
break;
|
||||
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_VERTEX_SHADER:
|
||||
/* FIXME: write shader blobs, once parser support works. */
|
||||
for (i = 0; i < elements_count; ++i)
|
||||
@ -1159,6 +1111,7 @@ static bool is_object_variable(const struct hlsl_ir_var *var)
|
||||
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_RENDER_TARGET_VIEW:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_TEXTURE:
|
||||
@ -1166,15 +1119,6 @@ static bool is_object_variable(const struct hlsl_ir_var *var)
|
||||
case HLSL_CLASS_VERTEX_SHADER:
|
||||
return true;
|
||||
|
||||
case HLSL_CLASS_OBJECT:
|
||||
switch (type->base_type)
|
||||
{
|
||||
case HLSL_TYPE_PIXELSHADER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -365,8 +365,8 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_EFFECT_GROUP:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_PASS:
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_RENDER_TARGET_VIEW:
|
||||
case HLSL_CLASS_STRING:
|
||||
case HLSL_CLASS_TECHNIQUE:
|
||||
@ -432,8 +432,8 @@ static bool type_is_single_component(const struct hlsl_type *type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_SCALAR:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_STRING:
|
||||
case HLSL_CLASS_RENDER_TARGET_VIEW:
|
||||
@ -574,7 +574,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_PIXEL_SHADER:
|
||||
case HLSL_CLASS_RENDER_TARGET_VIEW:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_STRING:
|
||||
@ -953,7 +953,7 @@ unsigned int hlsl_type_component_count(const struct hlsl_type *type)
|
||||
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_PIXEL_SHADER:
|
||||
case HLSL_CLASS_RENDER_TARGET_VIEW:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_STRING:
|
||||
@ -2380,8 +2380,8 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
|
||||
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_EFFECT_GROUP:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_PASS:
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_RENDER_TARGET_VIEW:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_STRING:
|
||||
@ -3562,7 +3562,6 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
|
||||
{"dword", HLSL_CLASS_SCALAR, HLSL_TYPE_UINT, 1, 1},
|
||||
{"vector", HLSL_CLASS_VECTOR, HLSL_TYPE_FLOAT, 4, 1},
|
||||
{"matrix", HLSL_CLASS_MATRIX, HLSL_TYPE_FLOAT, 4, 4},
|
||||
{"pixelshader", HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1},
|
||||
};
|
||||
|
||||
static const struct
|
||||
@ -3686,6 +3685,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, "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, "pixelshader", HLSL_CLASS_PIXEL_SHADER));
|
||||
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, "texture", HLSL_CLASS_TEXTURE));
|
||||
|
@ -78,10 +78,10 @@ enum hlsl_type_class
|
||||
HLSL_CLASS_LAST_NUMERIC = HLSL_CLASS_MATRIX,
|
||||
HLSL_CLASS_STRUCT,
|
||||
HLSL_CLASS_ARRAY,
|
||||
HLSL_CLASS_OBJECT,
|
||||
HLSL_CLASS_DEPTH_STENCIL_VIEW,
|
||||
HLSL_CLASS_EFFECT_GROUP,
|
||||
HLSL_CLASS_PASS,
|
||||
HLSL_CLASS_PIXEL_SHADER,
|
||||
HLSL_CLASS_RENDER_TARGET_VIEW,
|
||||
HLSL_CLASS_SAMPLER,
|
||||
HLSL_CLASS_STRING,
|
||||
@ -101,7 +101,6 @@ enum hlsl_base_type
|
||||
HLSL_TYPE_UINT,
|
||||
HLSL_TYPE_BOOL,
|
||||
HLSL_TYPE_LAST_SCALAR = HLSL_TYPE_BOOL,
|
||||
HLSL_TYPE_PIXELSHADER,
|
||||
};
|
||||
|
||||
enum hlsl_sampler_dim
|
||||
@ -144,7 +143,6 @@ struct hlsl_type
|
||||
|
||||
enum hlsl_type_class class;
|
||||
/* If class is <= HLSL_CLASS_LAST_NUMERIC, then base_type is <= HLSL_TYPE_LAST_SCALAR.
|
||||
* If class is HLSL_CLASS_OBJECT, then base_type is > HLSL_TYPE_LAST_SCALAR.
|
||||
* Otherwise, base_type is not used. */
|
||||
enum hlsl_base_type base_type;
|
||||
|
||||
|
@ -1625,11 +1625,11 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx,
|
||||
{
|
||||
case HLSL_CLASS_SCALAR:
|
||||
case HLSL_CLASS_VECTOR:
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_TEXTURE:
|
||||
case HLSL_CLASS_UAV:
|
||||
case HLSL_CLASS_VERTEX_SHADER:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
break;
|
||||
|
||||
case HLSL_CLASS_MATRIX:
|
||||
|
@ -3009,8 +3009,8 @@ static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type)
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_EFFECT_GROUP:
|
||||
case HLSL_CLASS_STRUCT:
|
||||
case HLSL_CLASS_OBJECT:
|
||||
case HLSL_CLASS_PASS:
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_RENDER_TARGET_VIEW:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_STRING:
|
||||
|
Loading…
Reference in New Issue
Block a user