increase draw limit; fix deinit validation

This commit is contained in:
Ivan Avdeev 2021-01-16 13:49:07 -08:00
parent 48e6765222
commit b9d872f279
4 changed files with 31 additions and 9 deletions

View File

@ -30,7 +30,7 @@ typedef struct vertex_2d_s {
float u, v;
} vertex_2d_t;
#define MAX_PICS 1024
#define MAX_PICS 4096
static struct {
VkPipeline pipeline;
@ -207,6 +207,11 @@ static VkPipeline createPipeline( void )
XVK_CHECK(vkCreateGraphicsPipelines(vk_core.device, VK_NULL_HANDLE, 1, &gpci, NULL, &pipeline));
vkDestroyPipelineLayout(vk_core.device, gpci.layout, NULL);
for (int i = 0; i < (int)ARRAYSIZE(shader_stages); ++i)
vkDestroyShaderModule(vk_core.device, shader_stages[i].module, NULL);
return pipeline;
}
@ -241,5 +246,6 @@ qboolean initVk2d( void )
void deinitVk2d( void )
{
// FIXME deinit stuff
destroyBuffer(&g2d.pics_buffer);
vkDestroyPipeline(vk_core.device, g2d.pipeline, NULL);
}

View File

@ -39,6 +39,7 @@
X(vkCreateDevice) \
X(vkGetDeviceProcAddr) \
X(vkDestroyDevice) \
X(vkDestroySurfaceKHR) \
#define INSTANCE_DEBUG_FUNCS(X) \
X(vkCreateDebugUtilsMessengerEXT) \
@ -374,8 +375,8 @@ static qboolean createRenderPass( void ) {
VkAttachmentDescription attachments[] = {{
.format = VK_FORMAT_B8G8R8A8_SRGB,// FIXME too early swapchain.create_info.imageFormat;
.samples = VK_SAMPLE_COUNT_1_BIT,
//.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
//.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
@ -633,11 +634,18 @@ qboolean R_VkInit( void )
void R_VkShutdown( void )
{
renderstateDestroy();
deinitVk2d();
vkDestroySwapchainKHR(vk_core.device, vk_core.swapchain.swapchain, NULL);
vkDestroyCommandPool(vk_core.device, vk_core.command_pool, NULL);
for (uint32_t i = 0; i < vk_core.swapchain.num_images; ++i)
{
vkDestroyImageView(vk_core.device, vk_core.swapchain.image_views[i], NULL);
vkDestroyFramebuffer(vk_core.device, vk_core.swapchain.framebuffers[i], NULL);
}
vkDestroySwapchainKHR(vk_core.device, vk_core.swapchain.swapchain, NULL);
vkDestroyRenderPass(vk_core.device, vk_core.render_pass, NULL);
vkDestroyDevice(vk_core.device, NULL);
if (vk_core.debug_messenger)
@ -645,10 +653,8 @@ void R_VkShutdown( void )
vkDestroyDebugUtilsMessengerEXT(vk_core.instance, vk_core.debug_messenger, NULL);
}
// TODO destroy surface
vkDestroySurfaceKHR(vk_core.instance, vk_core.surface, NULL);
vkDestroyInstance(vk_core.instance, NULL);
Mem_FreePool(&vk_core.pool);
}

View File

@ -106,6 +106,13 @@ const char *resultName(VkResult result);
X(vkCmdBindPipeline) \
X(vkCmdBindVertexBuffers) \
X(vkCmdDraw) \
X(vkDestroyCommandPool) \
X(vkDestroyImageView) \
X(vkDestroyFramebuffer) \
X(vkDestroyRenderPass) \
X(vkDestroyShaderModule) \
X(vkDestroyPipeline) \
X(vkDestroyPipelineLayout) \
#define X(f) extern PFN_##f f;
DEVICE_FUNCS(X)

View File

@ -158,4 +158,7 @@ qboolean renderstateInit( void )
void renderstateDestroy( void )
{
destroyFence(grs.fence);
destroySemaphore(grs.done);
destroySemaphore(grs.image_available);
}