mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/sm4: Set an error state when shader_sm4_error() is called.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8543a1741e
commit
a0c2e52b4b
@ -183,6 +183,8 @@ static void VKD3D_PRINTF_FUNC(3, 4) shader_sm4_error(struct vkd3d_shader_sm4_par
|
|||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
vkd3d_shader_verror(sm4->p.message_context, &sm4->p.location, error, format, args);
|
vkd3d_shader_verror(sm4->p.message_context, &sm4->p.location, error, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
|
sm4->p.failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, const uint32_t **ptr,
|
static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, const uint32_t **ptr,
|
||||||
@ -1665,6 +1667,7 @@ void shader_sm4_reset(struct vkd3d_shader_parser *parser)
|
|||||||
struct vkd3d_shader_sm4_parser *sm4 = vkd3d_shader_sm4_parser(parser);
|
struct vkd3d_shader_sm4_parser *sm4 = vkd3d_shader_sm4_parser(parser);
|
||||||
|
|
||||||
parser->ptr = sm4->start;
|
parser->ptr = sm4->start;
|
||||||
|
parser->failed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compile_info,
|
int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compile_info,
|
||||||
|
@ -114,8 +114,8 @@ int vkd3d_glsl_generator_generate(struct vkd3d_glsl_generator *generator,
|
|||||||
vkd3d_glsl_handle_instruction(generator, &ins);
|
vkd3d_glsl_handle_instruction(generator, &ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (generator->failed)
|
if (parser->failed || generator->failed)
|
||||||
return VKD3D_ERROR;
|
return VKD3D_ERROR_INVALID_SHADER;
|
||||||
|
|
||||||
vkd3d_string_buffer_printf(&generator->buffer, "}\n");
|
vkd3d_string_buffer_printf(&generator->buffer, "}\n");
|
||||||
|
|
||||||
|
@ -1937,6 +1937,9 @@ enum vkd3d_result vkd3d_dxbc_binary_to_text(struct vkd3d_shader_parser *parser,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parser->failed)
|
||||||
|
result = VKD3D_ERROR_INVALID_SHADER;
|
||||||
|
|
||||||
if ((code = vkd3d_malloc(buffer->content_size)))
|
if ((code = vkd3d_malloc(buffer->content_size)))
|
||||||
{
|
{
|
||||||
memcpy(code, buffer->buffer, buffer->content_size);
|
memcpy(code, buffer->buffer, buffer->content_size);
|
||||||
|
@ -958,7 +958,7 @@ static int scan_dxbc(const struct vkd3d_shader_compile_info *compile_info,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = VKD3D_OK;
|
ret = parser->failed ? VKD3D_ERROR_INVALID_SHADER : VKD3D_OK;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
vkd3d_shader_scan_context_cleanup(&context);
|
vkd3d_shader_scan_context_cleanup(&context);
|
||||||
@ -1084,6 +1084,9 @@ static int compile_dxbc_tpf(const struct vkd3d_shader_compile_info *compile_info
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parser->failed)
|
||||||
|
ret = VKD3D_ERROR_INVALID_SHADER;
|
||||||
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
ret = vkd3d_dxbc_compiler_generate_spirv(spirv_compiler, compile_info, out);
|
ret = vkd3d_dxbc_compiler_generate_spirv(spirv_compiler, compile_info, out);
|
||||||
|
|
||||||
|
@ -897,6 +897,7 @@ struct vkd3d_shader_parser
|
|||||||
{
|
{
|
||||||
struct vkd3d_shader_message_context *message_context;
|
struct vkd3d_shader_message_context *message_context;
|
||||||
struct vkd3d_shader_location location;
|
struct vkd3d_shader_location location;
|
||||||
|
bool failed;
|
||||||
|
|
||||||
struct vkd3d_shader_desc shader_desc;
|
struct vkd3d_shader_desc shader_desc;
|
||||||
struct vkd3d_shader_version shader_version;
|
struct vkd3d_shader_version shader_version;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user