mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Validate the parsed shader in vsir_parse().
This commit is contained in:
parent
3a3f95e1e7
commit
32e6a1bb4d
Notes:
Henri Verbeet
2024-10-23 16:18:19 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1215
@ -1391,18 +1391,6 @@ int d3dbc_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t c
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
WARN("Failed to parse shader.\n");
|
||||
vsir_program_cleanup(program);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = vkd3d_shader_parser_validate(&sm1.p, config_flags)) < 0)
|
||||
{
|
||||
WARN("Failed to validate shader after parsing, ret %d.\n", ret);
|
||||
|
||||
if (TRACE_ON())
|
||||
vsir_program_trace(program);
|
||||
|
||||
vsir_program_cleanup(program);
|
||||
return ret;
|
||||
}
|
||||
|
@ -10603,22 +10603,7 @@ int dxil_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t co
|
||||
vkd3d_free(byte_code);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
WARN("Failed to parse shader.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = vkd3d_shader_parser_validate(&sm6.p, config_flags)) < 0)
|
||||
{
|
||||
WARN("Failed to validate shader after parsing, ret %d.\n", ret);
|
||||
|
||||
if (TRACE_ON())
|
||||
vsir_program_trace(program);
|
||||
|
||||
sm6_parser_cleanup(&sm6);
|
||||
vsir_program_cleanup(program);
|
||||
return ret;
|
||||
}
|
||||
|
||||
sm6_parser_cleanup(&sm6);
|
||||
|
||||
|
@ -2964,22 +2964,10 @@ int tpf_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t con
|
||||
|
||||
if (sm4.p.failed)
|
||||
{
|
||||
WARN("Failed to parse shader.\n");
|
||||
vsir_program_cleanup(program);
|
||||
return VKD3D_ERROR_INVALID_SHADER;
|
||||
}
|
||||
|
||||
if ((ret = vkd3d_shader_parser_validate(&sm4.p, config_flags)) < 0)
|
||||
{
|
||||
WARN("Failed to validate shader after parsing, ret %d.\n", ret);
|
||||
|
||||
if (TRACE_ON())
|
||||
vsir_program_trace(program);
|
||||
|
||||
vsir_program_cleanup(program);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return VKD3D_OK;
|
||||
}
|
||||
|
||||
|
@ -706,7 +706,20 @@ static enum vkd3d_result vsir_parse(const struct vkd3d_shader_compile_info *comp
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
WARN("Failed to parse shader.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = vsir_program_validate(program, config_flags, compile_info->source_name, message_context)) < 0)
|
||||
{
|
||||
WARN("Failed to validate shader after parsing, ret %d.\n", ret);
|
||||
|
||||
if (TRACE_ON())
|
||||
vsir_program_trace(program);
|
||||
|
||||
vsir_program_cleanup(program);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1477,12 +1477,6 @@ void vkd3d_shader_parser_init(struct vkd3d_shader_parser *parser, struct vsir_pr
|
||||
void vkd3d_shader_parser_warning(struct vkd3d_shader_parser *parser,
|
||||
enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(3, 4);
|
||||
|
||||
static inline enum vkd3d_result vkd3d_shader_parser_validate(struct vkd3d_shader_parser *parser, uint64_t config_flags)
|
||||
{
|
||||
return vsir_program_validate(parser->program, config_flags,
|
||||
parser->location.source_name, parser->message_context);
|
||||
}
|
||||
|
||||
struct vkd3d_shader_descriptor_info1
|
||||
{
|
||||
enum vkd3d_shader_descriptor_type type;
|
||||
|
Loading…
Reference in New Issue
Block a user