vkd3d-shader: Parse shader model 5 resource strides.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2021-02-19 15:57:11 +01:00 committed by Alexandre Julliard
parent d40d8c858e
commit 3bacb33556
3 changed files with 18 additions and 7 deletions

View File

@ -29,6 +29,9 @@
#define VKD3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT 6
#define VKD3D_SM5_MODIFIER_RESOURCE_TYPE_MASK (0xfu << VKD3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT)
#define VKD3D_SM5_MODIFIER_RESOURCE_STRIDE_SHIFT 11
#define VKD3D_SM5_MODIFIER_RESOURCE_STRIDE_MASK (0xfffu << VKD3D_SM5_MODIFIER_RESOURCE_STRIDE_SHIFT)
#define VKD3D_SM4_AOFFIMMI_U_SHIFT 9
#define VKD3D_SM4_AOFFIMMI_U_MASK (0xfu << VKD3D_SM4_AOFFIMMI_U_SHIFT)
#define VKD3D_SM4_AOFFIMMI_V_SHIFT 13
@ -1835,6 +1838,9 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct vkd3d_sh
FIXME("Unhandled resource type %#x.\n", resource_type);
ins->resource_type = VKD3D_SHADER_RESOURCE_NONE;
}
ins->resource_stride
= (modifier & VKD3D_SM5_MODIFIER_RESOURCE_STRIDE_MASK) >> VKD3D_SM5_MODIFIER_RESOURCE_STRIDE_SHIFT;
break;
}
@ -1899,6 +1905,7 @@ void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct vkd3d_sha
ins->src_count = strlen(opcode_info->src_info);
ins->src = priv->src_param;
ins->resource_type = VKD3D_SHADER_RESOURCE_NONE;
ins->resource_stride = 0;
ins->resource_data_type[0] = VKD3D_DATA_FLOAT;
ins->resource_data_type[1] = VKD3D_DATA_FLOAT;
ins->resource_data_type[2] = VKD3D_DATA_FLOAT;

View File

@ -1635,6 +1635,16 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler,
default:
shader_dump_instruction_flags(compiler, ins);
if (ins->resource_type != VKD3D_SHADER_RESOURCE_NONE)
{
shader_addline(buffer, "_indexable(");
shader_dump_resource_type(compiler, ins->resource_type);
if (ins->resource_stride)
shader_print_uint_literal(compiler, ", stride=", ins->resource_stride, "");
shader_addline(buffer, ")");
}
if (vkd3d_shader_instruction_has_texel_offset(ins))
{
shader_print_int_literal(compiler, "(", ins->texel_offset.u, "");
@ -1642,13 +1652,6 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler,
shader_print_int_literal(compiler, ",", ins->texel_offset.w, ")");
}
if (ins->resource_type != VKD3D_SHADER_RESOURCE_NONE)
{
shader_addline(buffer, "(");
shader_dump_resource_type(compiler, ins->resource_type);
shader_addline(buffer, ")");
}
if (ins->resource_data_type[0] != VKD3D_DATA_FLOAT
|| ins->resource_data_type[1] != VKD3D_DATA_FLOAT
|| ins->resource_data_type[2] != VKD3D_DATA_FLOAT

View File

@ -787,6 +787,7 @@ struct vkd3d_shader_instruction
const struct vkd3d_shader_src_param *src;
struct vkd3d_shader_texel_offset texel_offset;
enum vkd3d_shader_resource_type resource_type;
unsigned int resource_stride;
enum vkd3d_data_type resource_data_type[VKD3D_VEC4_SIZE];
bool coissue;
const struct vkd3d_shader_src_param *predicate;