|
|
|
@ -195,6 +195,7 @@ VkResult create_hex_context(
|
|
|
|
|
|
|
|
|
|
VK_RESULT(vkCreateGraphicsPipelines(gpu->device, VK_NULL_HANDLE, 1, &graphics_pipeline_info, NULL, &context->graphics.pipeline));
|
|
|
|
|
|
|
|
|
|
memset(&context->data, 0, sizeof(GPUHexContext));
|
|
|
|
|
glm_perspective(-M_PI*1/8, (float)gpu->swapchain_extent.width/(float)gpu->swapchain_extent.height, 0.01, 1000, context->data.proj);
|
|
|
|
|
glm_mat4_identity(context->data.view);
|
|
|
|
|
VK_RESULT(create_storage_buffer(
|
|
|
|
@ -203,9 +204,8 @@ VkResult create_hex_context(
|
|
|
|
|
sizeof(GPUHexContext),
|
|
|
|
|
&context->context,
|
|
|
|
|
&context->context_memory));
|
|
|
|
|
fprintf(stderr, "Created hex context %p\n", context->context);
|
|
|
|
|
context->address = buffer_address(gpu->device, context->context);
|
|
|
|
|
VK_RESULT(add_transfer(&context->data, context->context, 0, sizeof(GPUHexContext) - (sizeof(GPUHexContext) - offsetof(GPUHexContext, regions)), 0, gpu));
|
|
|
|
|
VK_RESULT(add_transfer(&context->data, context->context, 0, sizeof(GPUHexContext), gpu->current_frame, gpu));
|
|
|
|
|
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
|
}
|
|
|
|
@ -233,11 +233,11 @@ VkResult create_hex_region(int32_t q, int32_t r, HexRegion** region, HexContext*
|
|
|
|
|
sizeof(GPUHexRegion),
|
|
|
|
|
&(*region)->region,
|
|
|
|
|
&(*region)->region_memory));
|
|
|
|
|
VK_RESULT(add_transfer(&(*region)->q, (*region)->region, offsetof(GPUHexRegion, q), sizeof(uint32_t)*2, 0, gpu));
|
|
|
|
|
VK_RESULT(add_transfer(&(*region)->q, (*region)->region, offsetof(GPUHexRegion, q), sizeof(uint32_t)*2, gpu->current_frame, gpu));
|
|
|
|
|
|
|
|
|
|
(*region)->address = buffer_address(gpu->device, (*region)->region);
|
|
|
|
|
|
|
|
|
|
VK_RESULT(add_transfer(&(*region)->address, hex->context, offsetof(GPUHexContext, regions) + sizeof(VkDeviceAddress)*i, sizeof(VkDeviceAddress), 0, gpu));
|
|
|
|
|
VK_RESULT(add_transfer(&(*region)->address, hex->context, offsetof(GPUHexContext, regions) + sizeof(VkDeviceAddress)*i, sizeof(VkDeviceAddress), gpu->current_frame, gpu));
|
|
|
|
|
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|