mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
vkd3d-shader/ir: Pass an initialised vsir_program structure to vkd3d_shader_parser_init().
This commit is contained in:
committed by
Alexandre Julliard
parent
9e4a790de1
commit
19b552ce1b
Notes:
Alexandre Julliard
2024-05-16 23:13:19 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/869
@@ -2517,6 +2517,7 @@ static bool shader_sm4_init(struct vkd3d_shader_sm4_parser *sm4, const uint32_t
|
||||
{
|
||||
struct vkd3d_shader_version version;
|
||||
uint32_t version_token, token_count;
|
||||
struct vsir_program *program;
|
||||
|
||||
if (byte_code_size / sizeof(*byte_code) < 2)
|
||||
{
|
||||
@@ -2570,10 +2571,15 @@ static bool shader_sm4_init(struct vkd3d_shader_sm4_parser *sm4, const uint32_t
|
||||
version.major = VKD3D_SM4_VERSION_MAJOR(version_token);
|
||||
version.minor = VKD3D_SM4_VERSION_MINOR(version_token);
|
||||
|
||||
/* Estimate instruction count to avoid reallocation in most shaders. */
|
||||
if (!vkd3d_shader_parser_init(&sm4->p, message_context, source_name, &version, &shader_sm4_parser_ops,
|
||||
token_count / 7u + 20))
|
||||
if (!(program = vkd3d_malloc(sizeof(*program))))
|
||||
return false;
|
||||
/* Estimate instruction count to avoid reallocation in most shaders. */
|
||||
if (!vsir_program_init(program, &version, token_count / 7u + 20))
|
||||
{
|
||||
vkd3d_free(program);
|
||||
return false;
|
||||
}
|
||||
vkd3d_shader_parser_init(&sm4->p, program, message_context, source_name, &shader_sm4_parser_ops);
|
||||
sm4->ptr = sm4->start;
|
||||
|
||||
init_sm4_lookup_tables(&sm4->lookup);
|
||||
|
||||
Reference in New Issue
Block a user