vkd3d-shader/dxil: Get rid of sm6_parser_require_space().

It's not obvious what this last remaining use of
sm6_parser_require_space() is preallocating space for, and that's as
good of a reason as any to get rid of it.
This commit is contained in:
Francisco Casas
2025-09-30 09:26:08 -03:00
committed by Henri Verbeet
parent 03a58d74b9
commit da4d5ef339
Notes: Henri Verbeet 2025-10-03 00:55:08 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1761
3 changed files with 1 additions and 27 deletions

View File

@@ -3681,18 +3681,6 @@ static bool bitcode_parse_alignment(uint64_t encoded_alignment, unsigned int *al
return true;
}
static struct vkd3d_shader_instruction *sm6_parser_require_space(struct sm6_parser *sm6, size_t extra)
{
struct vkd3d_shader_instruction_array *instructions = &sm6->program->instructions;
if (!shader_instruction_array_reserve(instructions, instructions->count + extra))
{
ERR("Failed to allocate instruction.\n");
return NULL;
}
return &instructions->elements[instructions->count];
}
static struct vkd3d_shader_instruction *sm6_parser_add_instruction(struct sm6_parser *sm6,
enum vkd3d_shader_opcode op)
{
@@ -10723,7 +10711,6 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, struct vsir_pro
{
size_t count, length, function_count, expected_function_count, byte_code_size = dxbc_desc->byte_code_size;
const struct vkd3d_shader_location location = {.source_name = compile_info->source_name};
struct shader_signature *patch_constant_signature, *output_signature, *input_signature;
uint32_t version_token, dxil_version, token_count, magic;
const uint32_t *byte_code = dxbc_desc->byte_code;
unsigned int chunk_offset, chunk_size;
@@ -10837,9 +10824,6 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, struct vsir_pro
break;
}
input_signature = &program->input_signature;
output_signature = &program->output_signature;
patch_constant_signature = &program->patch_constant_signature;
program->features = dxbc_desc->features;
memset(dxbc_desc, 0, sizeof(*dxbc_desc));
@@ -10981,15 +10965,6 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, struct vsir_pro
goto fail;
}
if (!sm6_parser_require_space(sm6, output_signature->element_count + input_signature->element_count
+ patch_constant_signature->element_count))
{
vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
"Out of memory emitting shader signature declarations.");
ret = VKD3D_ERROR_OUT_OF_MEMORY;
goto fail;
}
program->ssa_count = sm6->ssa_next_id;
if (!(fn = sm6_parser_get_function(sm6, sm6->entry_point)))

View File

@@ -477,7 +477,7 @@ void *shader_param_allocator_get(struct vkd3d_shader_param_allocator *allocator,
return params;
}
bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *array, size_t reserve)
static bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *array, size_t reserve)
{
if (!vkd3d_array_reserve((void **)&array->elements, &array->capacity, reserve, sizeof(*array->elements)))
{

View File

@@ -1438,7 +1438,6 @@ struct vkd3d_shader_instruction_array
struct vkd3d_shader_instruction *shader_instruction_array_append(struct vkd3d_shader_instruction_array *array);
bool shader_instruction_array_insert_at(struct vkd3d_shader_instruction_array *instructions, size_t idx, size_t count);
bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *instructions, size_t reserve);
struct vsir_program_iterator
{