mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/fx: Handle fx_4+ texture types.
This commit is contained in:
parent
a6057a1365
commit
e5f4f60214
Notes:
Alexandre Julliard
2024-02-22 23:03:49 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/660
@ -327,6 +327,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
|||||||
struct vkd3d_bytecode_buffer *buffer = &fx->unstructured;
|
struct vkd3d_bytecode_buffer *buffer = &fx->unstructured;
|
||||||
uint32_t name_offset, offset, size, stride, numeric_desc;
|
uint32_t name_offset, offset, size, stride, numeric_desc;
|
||||||
uint32_t elements_count = 0;
|
uint32_t elements_count = 0;
|
||||||
|
const char *name;
|
||||||
static const uint32_t variable_type[] =
|
static const uint32_t variable_type[] =
|
||||||
{
|
{
|
||||||
[HLSL_CLASS_SCALAR] = 1,
|
[HLSL_CLASS_SCALAR] = 1,
|
||||||
@ -335,6 +336,19 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
|||||||
[HLSL_CLASS_OBJECT] = 2,
|
[HLSL_CLASS_OBJECT] = 2,
|
||||||
[HLSL_CLASS_STRUCT] = 3,
|
[HLSL_CLASS_STRUCT] = 3,
|
||||||
};
|
};
|
||||||
|
static const char * const texture_type_names[] =
|
||||||
|
{
|
||||||
|
[HLSL_SAMPLER_DIM_GENERIC] = "texture",
|
||||||
|
[HLSL_SAMPLER_DIM_1D] = "Texture1D",
|
||||||
|
[HLSL_SAMPLER_DIM_1DARRAY] = "Texture1DArray",
|
||||||
|
[HLSL_SAMPLER_DIM_2D] = "Texture2D",
|
||||||
|
[HLSL_SAMPLER_DIM_2DARRAY] = "Texture2DArray",
|
||||||
|
[HLSL_SAMPLER_DIM_2DMS] = "Texture2DMS",
|
||||||
|
[HLSL_SAMPLER_DIM_2DMSARRAY] = "Texture2DMSArray",
|
||||||
|
[HLSL_SAMPLER_DIM_3D] = "Texture3D",
|
||||||
|
[HLSL_SAMPLER_DIM_CUBE] = "TextureCube",
|
||||||
|
[HLSL_SAMPLER_DIM_CUBEARRAY] = "TextureCubeArray",
|
||||||
|
};
|
||||||
|
|
||||||
/* Resolve arrays to element type and number of elements. */
|
/* Resolve arrays to element type and number of elements. */
|
||||||
if (type->class == HLSL_CLASS_ARRAY)
|
if (type->class == HLSL_CLASS_ARRAY)
|
||||||
@ -343,7 +357,12 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
|||||||
type = hlsl_get_multiarray_element_type(type);
|
type = hlsl_get_multiarray_element_type(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
name_offset = write_string(type->name, fx);
|
if (type->base_type == HLSL_TYPE_TEXTURE)
|
||||||
|
name = texture_type_names[type->sampler_dim];
|
||||||
|
else
|
||||||
|
name = type->name;
|
||||||
|
|
||||||
|
name_offset = write_string(name, fx);
|
||||||
offset = put_u32_unaligned(buffer, name_offset);
|
offset = put_u32_unaligned(buffer, name_offset);
|
||||||
|
|
||||||
switch (type->class)
|
switch (type->class)
|
||||||
@ -397,12 +416,28 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
|
|||||||
{
|
{
|
||||||
[HLSL_TYPE_RENDERTARGETVIEW] = 19,
|
[HLSL_TYPE_RENDERTARGETVIEW] = 19,
|
||||||
};
|
};
|
||||||
|
static const uint32_t texture_type[] =
|
||||||
|
{
|
||||||
|
[HLSL_SAMPLER_DIM_GENERIC] = 9,
|
||||||
|
[HLSL_SAMPLER_DIM_1D] = 10,
|
||||||
|
[HLSL_SAMPLER_DIM_1DARRAY] = 11,
|
||||||
|
[HLSL_SAMPLER_DIM_2D] = 12,
|
||||||
|
[HLSL_SAMPLER_DIM_2DARRAY] = 13,
|
||||||
|
[HLSL_SAMPLER_DIM_2DMS] = 14,
|
||||||
|
[HLSL_SAMPLER_DIM_2DMSARRAY] = 15,
|
||||||
|
[HLSL_SAMPLER_DIM_3D] = 16,
|
||||||
|
[HLSL_SAMPLER_DIM_CUBE] = 17,
|
||||||
|
[HLSL_SAMPLER_DIM_CUBEARRAY] = 23,
|
||||||
|
};
|
||||||
|
|
||||||
switch (type->base_type)
|
switch (type->base_type)
|
||||||
{
|
{
|
||||||
case HLSL_TYPE_RENDERTARGETVIEW:
|
case HLSL_TYPE_RENDERTARGETVIEW:
|
||||||
put_u32_unaligned(buffer, object_type[type->base_type]);
|
put_u32_unaligned(buffer, object_type[type->base_type]);
|
||||||
break;
|
break;
|
||||||
|
case HLSL_TYPE_TEXTURE:
|
||||||
|
put_u32_unaligned(buffer, texture_type[type->sampler_dim]);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
FIXME("Object type %u is not supported.\n", type->base_type);
|
FIXME("Object type %u is not supported.\n", type->base_type);
|
||||||
set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED);
|
set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED);
|
||||||
|
Loading…
Reference in New Issue
Block a user