mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/spirv: Pass a parser pointer to spirv_compiler_generate_spirv().
This commit is contained in:
parent
2a5ae0a8c6
commit
d14f42be9d
Notes:
Alexandre Julliard
2023-01-24 22:28:11 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/60
@ -9577,7 +9577,7 @@ static bool is_dcl_instruction(enum vkd3d_shader_opcode handler_idx)
|
||||
|| handler_idx == VKD3DSIH_HS_DECLS;
|
||||
}
|
||||
|
||||
int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
|
||||
static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
int ret = VKD3D_OK;
|
||||
@ -9934,12 +9934,22 @@ int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
|
||||
}
|
||||
|
||||
int spirv_compiler_generate_spirv(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *spirv)
|
||||
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_parser *parser,
|
||||
struct vkd3d_shader_code *spirv)
|
||||
{
|
||||
const struct vkd3d_shader_instruction_array *instructions = &parser->instructions;
|
||||
const struct vkd3d_shader_spirv_target_info *info = compiler->spirv_target_info;
|
||||
const struct vkd3d_shader_spirv_domain_shader_target_info *ds_info;
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
const struct vkd3d_shader_phase *phase;
|
||||
enum vkd3d_result result = VKD3D_OK;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < instructions->count; ++i)
|
||||
{
|
||||
if ((result = spirv_compiler_handle_instruction(compiler, &instructions->elements[i])) < 0)
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((phase = spirv_compiler_get_current_shader_phase(compiler)))
|
||||
spirv_compiler_leave_shader_phase(compiler, phase);
|
||||
|
@ -1176,7 +1176,6 @@ static int compile_dxbc_tpf(const struct vkd3d_shader_compile_info *compile_info
|
||||
struct vkd3d_shader_compile_info scan_info;
|
||||
struct spirv_compiler *spirv_compiler;
|
||||
struct vkd3d_shader_parser *parser;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
scan_info = *compile_info;
|
||||
@ -1234,13 +1233,7 @@ static int compile_dxbc_tpf(const struct vkd3d_shader_compile_info *compile_info
|
||||
return VKD3D_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < parser->instructions.count && ret >= 0; ++i)
|
||||
{
|
||||
ret = spirv_compiler_handle_instruction(spirv_compiler, &parser->instructions.elements[i]);
|
||||
}
|
||||
|
||||
if (ret >= 0)
|
||||
ret = spirv_compiler_generate_spirv(spirv_compiler, compile_info, out);
|
||||
ret = spirv_compiler_generate_spirv(spirv_compiler, compile_info, parser, out);
|
||||
|
||||
spirv_compiler_destroy(spirv_compiler);
|
||||
vkd3d_shader_parser_destroy(parser);
|
||||
|
@ -1144,10 +1144,9 @@ struct spirv_compiler *spirv_compiler_create(const struct vkd3d_shader_version *
|
||||
const struct vkd3d_shader_desc *shader_desc, const struct vkd3d_shader_compile_info *compile_info,
|
||||
const struct vkd3d_shader_scan_descriptor_info *scan_descriptor_info,
|
||||
struct vkd3d_shader_message_context *message_context, const struct vkd3d_shader_location *location);
|
||||
int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction);
|
||||
int spirv_compiler_generate_spirv(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *spirv);
|
||||
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_parser *parser,
|
||||
struct vkd3d_shader_code *spirv);
|
||||
void spirv_compiler_destroy(struct spirv_compiler *compiler);
|
||||
|
||||
void vkd3d_compute_dxbc_checksum(const void *dxbc, size_t size, uint32_t checksum[4]);
|
||||
|
Loading…
Reference in New Issue
Block a user