mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
libs/vkd3d-shader: Import shader tracing from wined3d.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2fa29dd823
commit
a5808cfdd7
@ -68,6 +68,7 @@ libvkd3d_shader_la_SOURCES = \
|
|||||||
include/private/vkd3d_shader.h \
|
include/private/vkd3d_shader.h \
|
||||||
libs/vkd3d-shader/dxbc.c \
|
libs/vkd3d-shader/dxbc.c \
|
||||||
libs/vkd3d-shader/spirv.c \
|
libs/vkd3d-shader/spirv.c \
|
||||||
|
libs/vkd3d-shader/trace.c \
|
||||||
libs/vkd3d-shader/vkd3d_shader.map \
|
libs/vkd3d-shader/vkd3d_shader.map \
|
||||||
libs/vkd3d-shader/vkd3d_shader_main.c \
|
libs/vkd3d-shader/vkd3d_shader_main.c \
|
||||||
libs/vkd3d-shader/vkd3d_shader_private.h
|
libs/vkd3d-shader/vkd3d_shader_private.h
|
||||||
|
@ -1485,18 +1485,18 @@ static BOOL shader_sm4_read_param(struct vkd3d_sm4_data *priv, const DWORD **ptr
|
|||||||
WARN("Invalid ptr %p, end %p.\n", *ptr, end);
|
WARN("Invalid ptr %p, end %p.\n", *ptr, end);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
memcpy(param->u.immconst_data, *ptr, 1 * sizeof(DWORD));
|
memcpy(param->u.immconst_uint, *ptr, 1 * sizeof(DWORD));
|
||||||
*ptr += 1;
|
*ptr += 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VKD3D_SM4_IMMCONST_VEC4:
|
case VKD3D_SM4_IMMCONST_VEC4:
|
||||||
param->immconst_type = VKD3D_IMMCONST_VEC4;
|
param->immconst_type = VKD3D_IMMCONST_VEC4;
|
||||||
if (end - *ptr < 4)
|
if (end - *ptr < VKD3D_VEC4_SIZE)
|
||||||
{
|
{
|
||||||
WARN("Invalid ptr %p, end %p.\n", *ptr, end);
|
WARN("Invalid ptr %p, end %p.\n", *ptr, end);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
memcpy(param->u.immconst_data, *ptr, 4 * sizeof(DWORD));
|
memcpy(param->u.immconst_uint, *ptr, VKD3D_VEC4_SIZE * sizeof(DWORD));
|
||||||
*ptr += 4;
|
*ptr += 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1692,6 +1692,8 @@ void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct vkd3d_sha
|
|||||||
|
|
||||||
ins->handler_idx = opcode_info->handler_idx;
|
ins->handler_idx = opcode_info->handler_idx;
|
||||||
ins->flags = 0;
|
ins->flags = 0;
|
||||||
|
ins->coissue = false;
|
||||||
|
ins->predicate = NULL;
|
||||||
ins->dst_count = strlen(opcode_info->dst_info);
|
ins->dst_count = strlen(opcode_info->dst_info);
|
||||||
ins->dst = priv->dst_param;
|
ins->dst = priv->dst_param;
|
||||||
ins->src_count = strlen(opcode_info->src_info);
|
ins->src_count = strlen(opcode_info->src_info);
|
||||||
|
@ -2386,14 +2386,14 @@ static uint32_t vkd3d_dxbc_compiler_emit_load_constant(struct vkd3d_dxbc_compile
|
|||||||
if (reg->immconst_type == VKD3D_IMMCONST_SCALAR)
|
if (reg->immconst_type == VKD3D_IMMCONST_SCALAR)
|
||||||
{
|
{
|
||||||
assert(component_count == 1);
|
assert(component_count == 1);
|
||||||
values[0] = *reg->u.immconst_data;
|
values[0] = *reg->u.immconst_uint;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0, j = 0; i < VKD3D_VEC4_SIZE; ++i)
|
for (i = 0, j = 0; i < VKD3D_VEC4_SIZE; ++i)
|
||||||
{
|
{
|
||||||
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
||||||
values[j++] = reg->u.immconst_data[vkd3d_swizzle_get_component(swizzle, i)];
|
values[j++] = reg->u.immconst_uint[vkd3d_swizzle_get_component(swizzle, i)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4598,7 +4598,7 @@ static void vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_
|
|||||||
assert(cf_info->current_block == VKD3D_BLOCK_SWITCH);
|
assert(cf_info->current_block == VKD3D_BLOCK_SWITCH);
|
||||||
|
|
||||||
assert(src->swizzle == VKD3D_NO_SWIZZLE && src->reg.type == VKD3DSPR_IMMCONST);
|
assert(src->swizzle == VKD3D_NO_SWIZZLE && src->reg.type == VKD3DSPR_IMMCONST);
|
||||||
value = *src->reg.u.immconst_data;
|
value = *src->reg.u.immconst_uint;
|
||||||
|
|
||||||
if (!vkd3d_array_reserve((void **)&cf_info->u.switch_.case_blocks, &cf_info->u.switch_.case_blocks_size,
|
if (!vkd3d_array_reserve((void **)&cf_info->u.switch_.case_blocks, &cf_info->u.switch_.case_blocks_size,
|
||||||
2 * (cf_info->u.switch_.case_block_count + 1), sizeof(*cf_info->u.switch_.case_blocks)))
|
2 * (cf_info->u.switch_.case_block_count + 1), sizeof(*cf_info->u.switch_.case_blocks)))
|
||||||
|
1606
libs/vkd3d-shader/trace.c
Normal file
1606
libs/vkd3d-shader/trace.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -76,6 +76,9 @@ int vkd3d_shader_compile_dxbc(const struct vkd3d_shader_code *dxbc,
|
|||||||
if ((ret = vkd3d_shader_parser_init(&parser, dxbc)) < 0)
|
if ((ret = vkd3d_shader_parser_init(&parser, dxbc)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (TRACE_ON())
|
||||||
|
vkd3d_shader_trace(parser.data);
|
||||||
|
|
||||||
if (!(spirv_compiler = vkd3d_dxbc_compiler_create(&parser.shader_version,
|
if (!(spirv_compiler = vkd3d_dxbc_compiler_create(&parser.shader_version,
|
||||||
&parser.shader_desc, compiler_options, shader_interface, compile_args, &scan_info)))
|
&parser.shader_desc, compiler_options, shader_interface, compile_args, &scan_info)))
|
||||||
{
|
{
|
||||||
|
@ -479,6 +479,9 @@ enum vkd3d_tessellator_partitioning
|
|||||||
VKD3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4,
|
VKD3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define VKD3DSI_TEXLD_PROJECT 0x1
|
||||||
|
|
||||||
#define VKD3DSI_INDEXED_DYNAMIC 0x4
|
#define VKD3DSI_INDEXED_DYNAMIC 0x4
|
||||||
#define VKD3DSI_RESINFO_RCP_FLOAT 0x1
|
#define VKD3DSI_RESINFO_RCP_FLOAT 0x1
|
||||||
#define VKD3DSI_RESINFO_UINT 0x2
|
#define VKD3DSI_RESINFO_UINT 0x2
|
||||||
@ -573,7 +576,8 @@ struct vkd3d_shader_register
|
|||||||
enum vkd3d_immconst_type immconst_type;
|
enum vkd3d_immconst_type immconst_type;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
DWORD immconst_data[VKD3D_VEC4_SIZE];
|
DWORD immconst_uint[VKD3D_VEC4_SIZE];
|
||||||
|
float immconst_float[VKD3D_VEC4_SIZE];
|
||||||
unsigned fp_body_idx;
|
unsigned fp_body_idx;
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
@ -743,6 +747,8 @@ struct vkd3d_shader_instruction
|
|||||||
const struct vkd3d_shader_dst_param *dst;
|
const struct vkd3d_shader_dst_param *dst;
|
||||||
const struct vkd3d_shader_src_param *src;
|
const struct vkd3d_shader_src_param *src;
|
||||||
struct vkd3d_shader_texel_offset texel_offset;
|
struct vkd3d_shader_texel_offset texel_offset;
|
||||||
|
bool coissue;
|
||||||
|
const struct vkd3d_shader_src_param *predicate;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct vkd3d_shader_semantic semantic;
|
struct vkd3d_shader_semantic semantic;
|
||||||
@ -772,6 +778,8 @@ static inline BOOL vkd3d_shader_instruction_has_texel_offset(const struct vkd3d_
|
|||||||
return ins->texel_offset.u || ins->texel_offset.v || ins->texel_offset.w;
|
return ins->texel_offset.u || ins->texel_offset.v || ins->texel_offset.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vkd3d_shader_trace(void *data) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
void *shader_sm4_init(const DWORD *byte_code, size_t byte_code_size,
|
void *shader_sm4_init(const DWORD *byte_code, size_t byte_code_size,
|
||||||
const struct vkd3d_shader_signature *output_signature) DECLSPEC_HIDDEN;
|
const struct vkd3d_shader_signature *output_signature) DECLSPEC_HIDDEN;
|
||||||
void shader_sm4_free(void *data) DECLSPEC_HIDDEN;
|
void shader_sm4_free(void *data) DECLSPEC_HIDDEN;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user