mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Use the instruction array interface in scan_with_parser().
This commit is contained in:
parent
e9a2642d6a
commit
2559d622de
Notes:
Alexandre Julliard
2023-01-24 22:28:12 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/60
@ -1067,9 +1067,10 @@ static int scan_with_parser(const struct vkd3d_shader_compile_info *compile_info
|
||||
struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_parser *parser)
|
||||
{
|
||||
struct vkd3d_shader_scan_descriptor_info *scan_descriptor_info;
|
||||
struct vkd3d_shader_instruction instruction;
|
||||
struct vkd3d_shader_instruction *instruction;
|
||||
struct vkd3d_shader_scan_context context;
|
||||
int ret;
|
||||
int ret = VKD3D_OK;
|
||||
unsigned int i;
|
||||
|
||||
if ((scan_descriptor_info = vkd3d_find_struct(compile_info->next, SCAN_DESCRIPTOR_INFO)))
|
||||
{
|
||||
@ -1084,30 +1085,17 @@ static int scan_with_parser(const struct vkd3d_shader_compile_info *compile_info
|
||||
vkd3d_shader_trace(parser);
|
||||
}
|
||||
|
||||
while (!vkd3d_shader_parser_is_end(parser))
|
||||
for (i = 0; i < parser->instructions.count; ++i)
|
||||
{
|
||||
vkd3d_shader_parser_read_instruction(parser, &instruction);
|
||||
|
||||
if (instruction.handler_idx == VKD3DSIH_INVALID)
|
||||
{
|
||||
WARN("Encountered unrecognized or invalid instruction.\n");
|
||||
if (scan_descriptor_info)
|
||||
vkd3d_shader_free_scan_descriptor_info(scan_descriptor_info);
|
||||
ret = VKD3D_ERROR_INVALID_SHADER;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ((ret = vkd3d_shader_scan_instruction(&context, &instruction)) < 0)
|
||||
instruction = &parser->instructions.elements[i];
|
||||
if ((ret = vkd3d_shader_scan_instruction(&context, instruction)) < 0)
|
||||
{
|
||||
if (scan_descriptor_info)
|
||||
vkd3d_shader_free_scan_descriptor_info(scan_descriptor_info);
|
||||
goto done;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ret = parser->failed ? VKD3D_ERROR_INVALID_SHADER : VKD3D_OK;
|
||||
|
||||
done:
|
||||
vkd3d_shader_scan_context_cleanup(&context);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user