|
|
|
@ -324,13 +324,16 @@ VkResult create_layer(
|
|
|
|
|
|
|
|
|
|
VK_RESULT(create_storage_buffer(gpu->allocator, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT, sizeof(UILayer), &container->layers[index].layer, &container->layers[index].layer_memory));
|
|
|
|
|
if(input->num_strings > 0) {
|
|
|
|
|
VK_RESULT(create_storage_buffer(gpu->allocator, 0, sizeof(UIString)*input->num_strings, &container->layers[index].strings, &container->layers[index].strings_memory))
|
|
|
|
|
VK_RESULT(create_storage_buffer(gpu->allocator, 0, sizeof(UIString)*input->num_strings, &container->layers[index].strings, &container->layers[index].strings_memory));
|
|
|
|
|
container->layers[index].strings_buffer = malloc(sizeof(UIString)*input->num_strings);
|
|
|
|
|
}
|
|
|
|
|
if(input->num_codes + input->num_drawables > 0) {
|
|
|
|
|
VK_RESULT(create_storage_buffer(gpu->allocator, 0, sizeof(UIDrawable)*(input->num_drawables + input->num_codes), &container->layers[index].drawables, &container->layers[index].drawables_memory));
|
|
|
|
|
container->layers[index].drawables_buffer = malloc(sizeof(UIDrawable)*input->num_drawables);
|
|
|
|
|
}
|
|
|
|
|
if(input->num_codes > 0) {
|
|
|
|
|
VK_RESULT(create_storage_buffer(gpu->allocator, 0, sizeof(uint32_t)*input->num_codes, &container->layers[index].codes, &container->layers[index].codes_memory));
|
|
|
|
|
container->layers[index].codes_buffer = malloc(sizeof(uint32_t)*input->num_codes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VkBuffer transfer;
|
|
|
|
@ -379,6 +382,7 @@ VkResult create_layer(
|
|
|
|
|
UIString* strings = (UIString*)(mapped + sizeof(UILayer));
|
|
|
|
|
for(uint32_t i = 0; i < input->num_strings; i++) {
|
|
|
|
|
memcpy(&strings[i], &input->strings[i], sizeof(UIString));
|
|
|
|
|
memcpy(&container->layers[index].strings_buffer[i], &input->strings[i], sizeof(UIString));
|
|
|
|
|
}
|
|
|
|
|
command_copy_buffer(command_buffer, transfer, container->layers[index].strings, sizeof(UILayer), 0, sizeof(UIString)*input->num_strings);
|
|
|
|
|
}
|
|
|
|
@ -387,6 +391,7 @@ VkResult create_layer(
|
|
|
|
|
UIDrawable* drawables = (UIDrawable*)(mapped + sizeof(UILayer) + sizeof(UIString)*input->num_strings);
|
|
|
|
|
for(uint32_t i = 0; i < input->num_drawables; i++) {
|
|
|
|
|
memcpy(&drawables[i], &input->drawables[i], sizeof(UIDrawable));
|
|
|
|
|
memcpy(&container->layers[index].drawables_buffer[i], &input->drawables[i], sizeof(UIDrawable));
|
|
|
|
|
}
|
|
|
|
|
command_copy_buffer(command_buffer, transfer, container->layers[index].drawables, sizeof(UILayer) + sizeof(UIString)*input->num_strings, 0, sizeof(UIDrawable)*input->num_drawables);
|
|
|
|
|
}
|
|
|
|
@ -395,6 +400,7 @@ VkResult create_layer(
|
|
|
|
|
uint32_t* codes = (uint32_t*)(mapped + sizeof(UILayer) + sizeof(UIString)*input->num_strings + sizeof(UIDrawable)*input->num_drawables);
|
|
|
|
|
for(uint32_t i = 0; i < input->num_codes; i++) {
|
|
|
|
|
codes[i] = input->codes[i];
|
|
|
|
|
container->layers[index].codes_buffer[i] = input->codes[i];
|
|
|
|
|
}
|
|
|
|
|
vkCmdFillBuffer(command_buffer, container->layers[index].codes, sizeof(UIDrawable)*input->num_drawables, sizeof(UIDrawable)*input->num_codes, 0x00000000);
|
|
|
|
|
command_copy_buffer(command_buffer, transfer, container->layers[index].codes, sizeof(UILayer) + sizeof(UIString)*input->num_strings + sizeof(UIDrawable)*input->num_drawables, 0, sizeof(uint32_t)*input->num_codes);
|
|
|
|
|