mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader: Use a separate allocation for the "semantic_name" field of shader signature elements.
For tpf shader this would previously be a pointer into the original shader code, and for d3dbc shaders we'd use static strings. Unfortunately the dxil parser creates shader signatures where these are pointers to metadata strings, and those go away when we call sm6_parser_cleanup(). We could conceivably store a flag in the shader signature to indicate whether shader_signature_cleanup()/vkd3d_shader_free_shader_signature() should free the "semantic_name" field. It'd be a little ugly, and seems unlikely to be worth it, but I'd be willing to be convinced.
This commit is contained in:
committed by
Alexandre Julliard
parent
105ef28273
commit
b5ac6ac636
Notes:
Alexandre Julliard
2024-05-23 23:23:55 +02:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/880
@@ -9445,7 +9445,22 @@ static enum vkd3d_result sm6_parser_read_signature(struct sm6_parser *sm6, const
|
||||
}
|
||||
}
|
||||
|
||||
vkd3d_free(s->elements);
|
||||
for (i = 0; i < operand_count; ++i)
|
||||
{
|
||||
if ((elements[i].semantic_name = vkd3d_strdup(elements[i].semantic_name)))
|
||||
continue;
|
||||
|
||||
vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
|
||||
"Failed to allocate signature element semantic name.");
|
||||
for (j = 0; j < i; ++j)
|
||||
{
|
||||
vkd3d_free((void *)elements[j].semantic_name);
|
||||
}
|
||||
vkd3d_free(elements);
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
shader_signature_cleanup(s);
|
||||
s->elements = elements;
|
||||
s->element_count = operand_count;
|
||||
|
||||
|
Reference in New Issue
Block a user