[vulkan] Move frames from vulkan_ctx to renderctx
Part of the command buffer fix, but also a step towards cleaning up vulkan_ctx.
This commit is contained in:
parent
6deeed1829
commit
bba82d3da1
|
@ -89,7 +89,7 @@ typedef struct aliasctx_s {
|
||||||
} aliasctx_t;
|
} aliasctx_t;
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
struct qfv_renderframe_s;
|
struct qfv_orenderframe_s;
|
||||||
struct entity_s;
|
struct entity_s;
|
||||||
struct mod_alias_ctx_s;
|
struct mod_alias_ctx_s;
|
||||||
|
|
||||||
|
@ -106,13 +106,13 @@ void Vulkan_Mod_MakeAliasModelDisplayLists (struct mod_alias_ctx_s *alias_ctx,
|
||||||
void Vulkan_AliasAddSkin (struct vulkan_ctx_s *ctx, qfv_alias_skin_t *skin);
|
void Vulkan_AliasAddSkin (struct vulkan_ctx_s *ctx, qfv_alias_skin_t *skin);
|
||||||
void Vulkan_AliasRemoveSkin (struct vulkan_ctx_s *ctx, qfv_alias_skin_t *skin);
|
void Vulkan_AliasRemoveSkin (struct vulkan_ctx_s *ctx, qfv_alias_skin_t *skin);
|
||||||
|
|
||||||
void Vulkan_AliasBegin (struct qfv_renderframe_s *rFrame);
|
void Vulkan_AliasBegin (struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_DrawAlias (struct entity_s ent, struct qfv_renderframe_s *rFrame);
|
void Vulkan_DrawAlias (struct entity_s ent, struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_AliasEnd (struct qfv_renderframe_s *rFrame);
|
void Vulkan_AliasEnd (struct qfv_orenderframe_s *rFrame);
|
||||||
|
|
||||||
void Vulkan_Alias_Init (struct vulkan_ctx_s *ctx);
|
void Vulkan_Alias_Init (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Alias_Shutdown (struct vulkan_ctx_s *ctx);
|
void Vulkan_Alias_Shutdown (struct vulkan_ctx_s *ctx);
|
||||||
|
|
||||||
void Vulkan_AliasDepthRange (struct qfv_renderframe_s *rFrame, float n, float f);
|
void Vulkan_AliasDepthRange (struct qfv_orenderframe_s *rFrame, float n, float f);
|
||||||
|
|
||||||
#endif//__QF_Vulkan_qf_alias_h
|
#endif//__QF_Vulkan_qf_alias_h
|
||||||
|
|
|
@ -386,10 +386,10 @@ typedef struct bspctx_s {
|
||||||
} bspctx_t;
|
} bspctx_t;
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
struct qfv_renderframe_s;
|
struct qfv_orenderframe_s;
|
||||||
void Vulkan_DrawWorld (struct qfv_renderframe_s *rFrame);
|
void Vulkan_DrawWorld (struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_DrawSky (struct qfv_renderframe_s *rFrame);
|
void Vulkan_DrawSky (struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_DrawWaterSurfaces (struct qfv_renderframe_s *rFrame);
|
void Vulkan_DrawWaterSurfaces (struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_Bsp_Flush (struct vulkan_ctx_s *ctx);
|
void Vulkan_Bsp_Flush (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_LoadSkys (const char *sky, struct vulkan_ctx_s *ctx);
|
void Vulkan_LoadSkys (const char *sky, struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_RegisterTextures (model_t **models, int num_models,
|
void Vulkan_RegisterTextures (model_t **models, int num_models,
|
||||||
|
|
|
@ -54,10 +54,10 @@ typedef struct composectx_s {
|
||||||
} composectx_t;
|
} composectx_t;
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
struct qfv_renderframe_s;
|
struct qfv_orenderframe_s;
|
||||||
|
|
||||||
void Vulkan_Compose_Init (struct vulkan_ctx_s *ctx);
|
void Vulkan_Compose_Init (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Compose_Shutdown (struct vulkan_ctx_s *ctx);
|
void Vulkan_Compose_Shutdown (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Compose_Draw (struct qfv_renderframe_s *rFrame);
|
void Vulkan_Compose_Draw (struct qfv_orenderframe_s *rFrame);
|
||||||
|
|
||||||
#endif//__QF_Vulkan_qf_compose_h
|
#endif//__QF_Vulkan_qf_compose_h
|
||||||
|
|
|
@ -98,7 +98,7 @@ typedef struct iqmctx_s {
|
||||||
} iqmctx_t;
|
} iqmctx_t;
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
struct qfv_renderframe_s;
|
struct qfv_orenderframe_s;
|
||||||
struct entity_s;
|
struct entity_s;
|
||||||
struct mod_iqm_ctx_s;
|
struct mod_iqm_ctx_s;
|
||||||
struct iqm_s;
|
struct iqm_s;
|
||||||
|
@ -111,9 +111,9 @@ void Vulkan_IQMRemoveBones (struct vulkan_ctx_s *ctx, struct iqm_s *iqm);
|
||||||
void Vulkan_IQMAddSkin (struct vulkan_ctx_s *ctx, qfv_iqm_skin_t *skin);
|
void Vulkan_IQMAddSkin (struct vulkan_ctx_s *ctx, qfv_iqm_skin_t *skin);
|
||||||
void Vulkan_IQMRemoveSkin (struct vulkan_ctx_s *ctx, qfv_iqm_skin_t *skin);
|
void Vulkan_IQMRemoveSkin (struct vulkan_ctx_s *ctx, qfv_iqm_skin_t *skin);
|
||||||
|
|
||||||
void Vulkan_IQMBegin (struct qfv_renderframe_s *rFrame);
|
void Vulkan_IQMBegin (struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_DrawIQM (struct entity_s ent, struct qfv_renderframe_s *rFrame);
|
void Vulkan_DrawIQM (struct entity_s ent, struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_IQMEnd (struct qfv_renderframe_s *rFrame);
|
void Vulkan_IQMEnd (struct qfv_orenderframe_s *rFrame);
|
||||||
|
|
||||||
void Vulkan_IQM_Init (struct vulkan_ctx_s *ctx);
|
void Vulkan_IQM_Init (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_IQM_Shutdown (struct vulkan_ctx_s *ctx);
|
void Vulkan_IQM_Shutdown (struct vulkan_ctx_s *ctx);
|
||||||
|
|
|
@ -117,12 +117,12 @@ typedef struct lightingctx_s {
|
||||||
} lightingctx_t;
|
} lightingctx_t;
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
struct qfv_renderframe_s;
|
struct qfv_orenderframe_s;
|
||||||
|
|
||||||
void Vulkan_Lighting_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
void Vulkan_Lighting_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Lighting_Init (struct vulkan_ctx_s *ctx);
|
void Vulkan_Lighting_Init (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Lighting_Shutdown (struct vulkan_ctx_s *ctx);
|
void Vulkan_Lighting_Shutdown (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Lighting_Draw (struct qfv_renderframe_s *rFrame);
|
void Vulkan_Lighting_Draw (struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_LoadLights (struct scene_s *scene, struct vulkan_ctx_s *ctx);
|
void Vulkan_LoadLights (struct scene_s *scene, struct vulkan_ctx_s *ctx);
|
||||||
|
|
||||||
#endif//__QF_Vulkan_qf_lighting_h
|
#endif//__QF_Vulkan_qf_lighting_h
|
||||||
|
|
|
@ -29,14 +29,14 @@
|
||||||
#define __QF_Vulkan_qf_main_h
|
#define __QF_Vulkan_qf_main_h
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
struct qfv_renderframe_s;
|
struct qfv_orenderframe_s;
|
||||||
struct entqueue_s;
|
struct entqueue_s;
|
||||||
struct scene_s;
|
struct scene_s;
|
||||||
|
|
||||||
void Vulkan_Main_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
void Vulkan_Main_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_NewScene (struct scene_s *scene, struct vulkan_ctx_s *ctx);
|
void Vulkan_NewScene (struct scene_s *scene, struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_RenderView (struct qfv_renderframe_s *rFrame);
|
void Vulkan_RenderView (struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_RenderEntities (struct entqueue_s *queue,
|
void Vulkan_RenderEntities (struct entqueue_s *queue,
|
||||||
struct qfv_renderframe_s *rFrame);
|
struct qfv_orenderframe_s *rFrame);
|
||||||
|
|
||||||
#endif//__QF_Vulkan_qf_main_h
|
#endif//__QF_Vulkan_qf_main_h
|
||||||
|
|
|
@ -74,12 +74,12 @@ typedef struct particlectx_s {
|
||||||
|
|
||||||
struct cvar_s;
|
struct cvar_s;
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
struct qfv_renderframe_s;
|
struct qfv_orenderframe_s;
|
||||||
|
|
||||||
struct psystem_s *Vulkan_ParticleSystem (struct vulkan_ctx_s *ctx);
|
struct psystem_s *Vulkan_ParticleSystem (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Particles_Init (struct vulkan_ctx_s *ctx);
|
void Vulkan_Particles_Init (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Particles_Shutdown (struct vulkan_ctx_s *ctx);
|
void Vulkan_Particles_Shutdown (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_DrawParticles (struct qfv_renderframe_s *rFrame);
|
void Vulkan_DrawParticles (struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_Particles_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
void Vulkan_Particles_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
||||||
|
|
||||||
#endif//__QF_Vulkan_qf_particles_h
|
#endif//__QF_Vulkan_qf_particles_h
|
||||||
|
|
|
@ -25,7 +25,7 @@ typedef struct qfv_osubpass_s {
|
||||||
typedef struct qfv_subpassset_s
|
typedef struct qfv_subpassset_s
|
||||||
DARRAY_TYPE (qfv_osubpass_t) qfv_subpassset_t;
|
DARRAY_TYPE (qfv_osubpass_t) qfv_subpassset_t;
|
||||||
|
|
||||||
typedef struct qfv_renderframe_s {
|
typedef struct qfv_orenderframe_s {
|
||||||
struct vulkan_ctx_s *vulkan_ctx;
|
struct vulkan_ctx_s *vulkan_ctx;
|
||||||
struct qfv_orenderpass_s *renderpass;
|
struct qfv_orenderpass_s *renderpass;
|
||||||
VkSubpassContents subpassContents;
|
VkSubpassContents subpassContents;
|
||||||
|
@ -33,15 +33,15 @@ typedef struct qfv_renderframe_s {
|
||||||
int subpassCount;
|
int subpassCount;
|
||||||
qfv_osubpass_t *subpassInfo;
|
qfv_osubpass_t *subpassInfo;
|
||||||
struct qfv_cmdbufferset_s *subpassCmdSets;
|
struct qfv_cmdbufferset_s *subpassCmdSets;
|
||||||
} qfv_renderframe_t;
|
} qfv_orenderframe_t;
|
||||||
|
|
||||||
typedef struct qfv_renderframeset_s
|
typedef struct qfv_orenderframeset_s
|
||||||
DARRAY_TYPE (qfv_renderframe_t) qfv_renderframeset_t;
|
DARRAY_TYPE (qfv_orenderframe_t) qfv_orenderframeset_t;
|
||||||
|
|
||||||
typedef struct clearvalueset_s
|
typedef struct clearvalueset_s
|
||||||
DARRAY_TYPE (VkClearValue) clearvalueset_t;
|
DARRAY_TYPE (VkClearValue) clearvalueset_t;
|
||||||
|
|
||||||
typedef void (*qfv_draw_t) (qfv_renderframe_t *rFrame);
|
typedef void (*qfv_draw_t) (qfv_orenderframe_t *rFrame);
|
||||||
|
|
||||||
typedef struct qfv_orenderpass_s {
|
typedef struct qfv_orenderpass_s {
|
||||||
struct vulkan_ctx_s *vulkan_ctx;
|
struct vulkan_ctx_s *vulkan_ctx;
|
||||||
|
@ -64,7 +64,7 @@ typedef struct qfv_orenderpass_s {
|
||||||
int primary_commands;
|
int primary_commands;
|
||||||
size_t subpassCount;
|
size_t subpassCount;
|
||||||
qfv_subpassset_t *subpass_info;
|
qfv_subpassset_t *subpass_info;
|
||||||
qfv_renderframeset_t frames;
|
qfv_orenderframeset_t frames;
|
||||||
|
|
||||||
qfv_draw_t draw;
|
qfv_draw_t draw;
|
||||||
} qfv_orenderpass_t;
|
} qfv_orenderpass_t;
|
||||||
|
|
|
@ -77,7 +77,7 @@ typedef struct spritectx_s {
|
||||||
} spritectx_t;
|
} spritectx_t;
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
struct qfv_renderframe_s;
|
struct qfv_orenderframe_s;
|
||||||
struct entity_s;
|
struct entity_s;
|
||||||
struct mod_sprite_ctx_s;
|
struct mod_sprite_ctx_s;
|
||||||
|
|
||||||
|
@ -88,9 +88,9 @@ void Vulkan_Sprite_DescriptorSet (struct vulkan_ctx_s *ctx,
|
||||||
void Vulkan_Mod_SpriteLoadFrames (struct mod_sprite_ctx_s *sprite_ctx,
|
void Vulkan_Mod_SpriteLoadFrames (struct mod_sprite_ctx_s *sprite_ctx,
|
||||||
struct vulkan_ctx_s *ctx);
|
struct vulkan_ctx_s *ctx);
|
||||||
|
|
||||||
void Vulkan_SpriteBegin (struct qfv_renderframe_s *rFrame);
|
void Vulkan_SpriteBegin (struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_DrawSprite (struct entity_s ent, struct qfv_renderframe_s *rFrame);
|
void Vulkan_DrawSprite (struct entity_s ent, struct qfv_orenderframe_s *rFrame);
|
||||||
void Vulkan_SpriteEnd (struct qfv_renderframe_s *rFrame);
|
void Vulkan_SpriteEnd (struct qfv_orenderframe_s *rFrame);
|
||||||
|
|
||||||
void Vulkan_Sprite_Init (struct vulkan_ctx_s *ctx);
|
void Vulkan_Sprite_Init (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Sprite_Shutdown (struct vulkan_ctx_s *ctx);
|
void Vulkan_Sprite_Shutdown (struct vulkan_ctx_s *ctx);
|
||||||
|
|
|
@ -46,11 +46,11 @@ typedef struct translucentctx_s {
|
||||||
} translucentctx_t;
|
} translucentctx_t;
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
struct qfv_renderframe_s;
|
struct qfv_orenderframe_s;
|
||||||
|
|
||||||
void Vulkan_Translucent_Init (struct vulkan_ctx_s *ctx);
|
void Vulkan_Translucent_Init (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Translucent_Shutdown (struct vulkan_ctx_s *ctx);
|
void Vulkan_Translucent_Shutdown (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Translucent_Draw (struct qfv_renderframe_s *rFrame);
|
void Vulkan_Translucent_Draw (struct qfv_orenderframe_s *rFrame);
|
||||||
VkDescriptorSet Vulkan_Translucent_Descriptors (struct vulkan_ctx_s *ctx,
|
VkDescriptorSet Vulkan_Translucent_Descriptors (struct vulkan_ctx_s *ctx,
|
||||||
int frame)__attribute__((pure));
|
int frame)__attribute__((pure));
|
||||||
void Vulkan_Translucent_CreateBuffers (struct vulkan_ctx_s *ctx,
|
void Vulkan_Translucent_CreateBuffers (struct vulkan_ctx_s *ctx,
|
||||||
|
|
|
@ -69,8 +69,6 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
void Vulkan_DestroyFrames (struct vulkan_ctx_s *ctx);
|
|
||||||
void Vulkan_CreateFrames (struct vulkan_ctx_s *ctx);
|
|
||||||
void Vulkan_CreateCapture (struct vulkan_ctx_s *ctx);
|
void Vulkan_CreateCapture (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
void Vulkan_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_DestroyRenderPasses (struct vulkan_ctx_s *ctx);
|
void Vulkan_DestroyRenderPasses (struct vulkan_ctx_s *ctx);
|
||||||
|
|
|
@ -358,11 +358,22 @@ typedef struct qfv_job_s {
|
||||||
VkCommandPool command_pool;
|
VkCommandPool command_pool;
|
||||||
} qfv_job_t;
|
} qfv_job_t;
|
||||||
|
|
||||||
|
typedef struct qfv_renderframe_s {
|
||||||
|
VkFence fence;
|
||||||
|
VkSemaphore imageAvailableSemaphore;
|
||||||
|
VkSemaphore renderDoneSemaphore;
|
||||||
|
VkCommandPool command_pool;
|
||||||
|
} qfv_renderframe_t;
|
||||||
|
|
||||||
|
typedef struct qfv_renderframeset_s
|
||||||
|
DARRAY_TYPE (qfv_renderframe_t) qfv_renderframeset_t;
|
||||||
|
|
||||||
typedef struct qfv_renderctx_s {
|
typedef struct qfv_renderctx_s {
|
||||||
struct hashctx_s *hashctx;
|
struct hashctx_s *hashctx;
|
||||||
exprtab_t task_functions;
|
exprtab_t task_functions;
|
||||||
qfv_jobinfo_t *jobinfo;
|
qfv_jobinfo_t *jobinfo;
|
||||||
qfv_job_t *job;
|
qfv_job_t *job;
|
||||||
|
qfv_renderframeset_t frames;
|
||||||
} qfv_renderctx_t;
|
} qfv_renderctx_t;
|
||||||
|
|
||||||
typedef struct qfv_taskctx_s {
|
typedef struct qfv_taskctx_s {
|
||||||
|
|
|
@ -10,17 +10,6 @@
|
||||||
#include "QF/qtypes.h"
|
#include "QF/qtypes.h"
|
||||||
#include "QF/simd/types.h"
|
#include "QF/simd/types.h"
|
||||||
|
|
||||||
typedef struct vulkan_frame_s {
|
|
||||||
VkFence fence;
|
|
||||||
VkSemaphore imageAvailableSemaphore;
|
|
||||||
VkSemaphore renderDoneSemaphore;
|
|
||||||
VkCommandBuffer cmdBuffer;
|
|
||||||
VkCommandPool command_pool;
|
|
||||||
} vulkan_frame_t;
|
|
||||||
|
|
||||||
typedef struct vulkan_frameset_s
|
|
||||||
DARRAY_TYPE (vulkan_frame_t) vulkan_frameset_t;
|
|
||||||
|
|
||||||
typedef struct qfv_renderpassset_s
|
typedef struct qfv_renderpassset_s
|
||||||
DARRAY_TYPE (struct qfv_orenderpass_s *) qfv_renderpassset_t;
|
DARRAY_TYPE (struct qfv_orenderpass_s *) qfv_renderpassset_t;
|
||||||
|
|
||||||
|
@ -66,7 +55,6 @@ typedef struct vulkan_ctx_s {
|
||||||
VkCommandPool cmdpool;
|
VkCommandPool cmdpool;
|
||||||
struct qfv_stagebuf_s *staging;
|
struct qfv_stagebuf_s *staging;
|
||||||
uint32_t curFrame;
|
uint32_t curFrame;
|
||||||
vulkan_frameset_t frames;
|
|
||||||
qfv_renderpassset_t renderPasses;
|
qfv_renderpassset_t renderPasses;
|
||||||
struct qfv_orenderpass_s *output_renderpass;
|
struct qfv_orenderpass_s *output_renderpass;
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,6 @@ vulkan_R_Init (void)
|
||||||
QFV_Render_Init (vulkan_ctx);
|
QFV_Render_Init (vulkan_ctx);
|
||||||
|
|
||||||
Vulkan_CreateStagingBuffers (vulkan_ctx);
|
Vulkan_CreateStagingBuffers (vulkan_ctx);
|
||||||
Vulkan_CreateFrames (vulkan_ctx);
|
|
||||||
Vulkan_Texture_Init (vulkan_ctx);
|
Vulkan_Texture_Init (vulkan_ctx);
|
||||||
Vulkan_Palette_Init (vulkan_ctx, vid.palette);
|
Vulkan_Palette_Init (vulkan_ctx, vid.palette);
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,7 @@ QFV_RunRenderJob (vulkan_ctx_t *ctx)
|
||||||
auto device = ctx->device;
|
auto device = ctx->device;
|
||||||
auto dfunc = device->funcs;
|
auto dfunc = device->funcs;
|
||||||
auto queue = &device->queue;
|
auto queue = &device->queue;
|
||||||
auto frame = &ctx->frames.a[ctx->curFrame];
|
auto frame = &rctx->frames.a[ctx->curFrame];
|
||||||
VkPipelineStageFlags waitStage
|
VkPipelineStageFlags waitStage
|
||||||
= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||||
VkSubmitInfo submitInfo = {
|
VkSubmitInfo submitInfo = {
|
||||||
|
@ -354,7 +354,8 @@ wait_on_fence (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||||
auto dfunc = device->funcs;
|
auto dfunc = device->funcs;
|
||||||
auto dev = device->dev;
|
auto dev = device->dev;
|
||||||
|
|
||||||
__auto_type frame = &ctx->frames.a[ctx->curFrame];
|
auto rctx = ctx->render_context;
|
||||||
|
auto frame = &rctx->frames.a[ctx->curFrame];
|
||||||
|
|
||||||
dfunc->vkWaitForFences (dev, 1, &frame->fence, VK_TRUE, 2000000000);
|
dfunc->vkWaitForFences (dev, 1, &frame->fence, VK_TRUE, 2000000000);
|
||||||
|
|
||||||
|
@ -443,6 +444,28 @@ QFV_Render_Init (vulkan_ctx_t *ctx)
|
||||||
rctx->task_functions.symbols = 0;
|
rctx->task_functions.symbols = 0;
|
||||||
|
|
||||||
QFV_Render_AddTasks (ctx, render_task_syms);
|
QFV_Render_AddTasks (ctx, render_task_syms);
|
||||||
|
|
||||||
|
auto device = ctx->device;
|
||||||
|
size_t frames = vulkan_frame_count;
|
||||||
|
DARRAY_INIT (&rctx->frames, frames);
|
||||||
|
DARRAY_RESIZE (&rctx->frames, frames);
|
||||||
|
for (size_t i = 0; i < rctx->frames.size; i++) {
|
||||||
|
auto frame = &rctx->frames.a[i];
|
||||||
|
frame->fence = QFV_CreateFence (device, 1);
|
||||||
|
frame->imageAvailableSemaphore = QFV_CreateSemaphore (device);
|
||||||
|
QFV_duSetObjectName (device, VK_OBJECT_TYPE_SEMAPHORE,
|
||||||
|
frame->imageAvailableSemaphore,
|
||||||
|
va (ctx->va_ctx, "sc image:%zd", i));
|
||||||
|
frame->renderDoneSemaphore = QFV_CreateSemaphore (device);
|
||||||
|
VkCommandPoolCreateInfo poolCInfo = {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
||||||
|
.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT,
|
||||||
|
.queueFamilyIndex = device->queue.queueFamily,
|
||||||
|
};
|
||||||
|
auto dfunc = device->funcs;
|
||||||
|
dfunc->vkCreateCommandPool (device->dev, &poolCInfo, 0,
|
||||||
|
&frame->command_pool);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -483,10 +506,18 @@ QFV_Render_Shutdown (vulkan_ctx_t *ctx)
|
||||||
DARRAY_CLEAR (&job->commands);
|
DARRAY_CLEAR (&job->commands);
|
||||||
free (rctx->job);
|
free (rctx->job);
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < ctx->frames.size; i++) {
|
|
||||||
auto frame = &ctx->frames.a[i];
|
for (uint32_t i = 0; i < rctx->frames.size; i++) {
|
||||||
dfunc->vkDestroyCommandPool (device->dev, frame->command_pool, 0);
|
auto dev = device->dev;
|
||||||
|
auto df = dfunc;
|
||||||
|
auto frame = &rctx->frames.a[i];
|
||||||
|
df->vkDestroyFence (dev, frame->fence, 0);
|
||||||
|
df->vkDestroySemaphore (dev, frame->imageAvailableSemaphore, 0);
|
||||||
|
df->vkDestroySemaphore (dev, frame->renderDoneSemaphore, 0);
|
||||||
|
df->vkDestroyCommandPool (dev, frame->command_pool, 0);
|
||||||
}
|
}
|
||||||
|
DARRAY_CLEAR (&rctx->frames);
|
||||||
|
|
||||||
if (rctx->jobinfo) {
|
if (rctx->jobinfo) {
|
||||||
__auto_type jinfo = rctx->jobinfo;
|
__auto_type jinfo = rctx->jobinfo;
|
||||||
for (uint32_t i = 0; i < jinfo->num_descriptorsetlayouts; i++) {
|
for (uint32_t i = 0; i < jinfo->num_descriptorsetlayouts; i++) {
|
||||||
|
|
|
@ -1125,17 +1125,6 @@ create_objects (vulkan_ctx_t *ctx, objcount_t *counts)
|
||||||
|
|
||||||
counts->num_descriptorsets = s.inds.num_descriptorsets;
|
counts->num_descriptorsets = s.inds.num_descriptorsets;
|
||||||
init_job (ctx, counts, s);
|
init_job (ctx, counts, s);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < ctx->frames.size; i++) {
|
|
||||||
VkCommandPoolCreateInfo poolCInfo = {
|
|
||||||
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
|
||||||
.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT,
|
|
||||||
.queueFamilyIndex = device->queue.queueFamily,
|
|
||||||
};
|
|
||||||
auto frame = &ctx->frames.a[i];
|
|
||||||
dfunc->vkCreateCommandPool (device->dev, &poolCInfo, 0,
|
|
||||||
&frame->command_pool);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1187,19 +1187,19 @@ parse_task_params (const plitem_t *item, void **data,
|
||||||
|
|
||||||
#include "libs/video/renderer/vulkan/vkparse.cinc"
|
#include "libs/video/renderer/vulkan/vkparse.cinc"
|
||||||
|
|
||||||
static exprsym_t vulkan_frameset_t_symbols[] = {
|
static exprsym_t qfv_renderframeset_t_symbols[] = {
|
||||||
{"size", &cexpr_size_t, (void *)field_offset (vulkan_frameset_t, size)},
|
{"size", &cexpr_size_t, (void *)field_offset (qfv_renderframeset_t, size)},
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
static exprtab_t vulkan_frameset_t_symtab = {
|
static exprtab_t qfv_renderframeset_t_symtab = {
|
||||||
vulkan_frameset_t_symbols,
|
qfv_renderframeset_t_symbols,
|
||||||
};
|
};
|
||||||
exprtype_t vulkan_frameset_t_type = {
|
exprtype_t qfv_renderframeset_t_type = {
|
||||||
.name = "frameset",
|
.name = "frameset",
|
||||||
.size = sizeof (vulkan_frameset_t *),
|
.size = sizeof (qfv_renderframeset_t *),
|
||||||
.binops = cexpr_struct_binops,
|
.binops = cexpr_struct_binops,
|
||||||
.unops = 0,
|
.unops = 0,
|
||||||
.data = &vulkan_frameset_t_symtab,
|
.data = &qfv_renderframeset_t_symtab,
|
||||||
};
|
};
|
||||||
|
|
||||||
static hashtab_t *
|
static hashtab_t *
|
||||||
|
@ -1257,9 +1257,10 @@ parse_object (vulkan_ctx_t *ctx, memsuper_t *memsuper, plitem_t *plist,
|
||||||
plitem_t *messages = PL_NewArray ();
|
plitem_t *messages = PL_NewArray ();
|
||||||
exprctx_t exprctx = { .symtab = &root_symtab };
|
exprctx_t exprctx = { .symtab = &root_symtab };
|
||||||
parsectx_t parsectx = { &exprctx, ctx, properties };
|
parsectx_t parsectx = { &exprctx, ctx, properties };
|
||||||
|
auto rctx = ctx->render_context;
|
||||||
exprsym_t var_syms[] = {
|
exprsym_t var_syms[] = {
|
||||||
{"output", &qfv_output_t_type, &sctx->output},
|
{"output", &qfv_output_t_type, &sctx->output},
|
||||||
{"frames", &vulkan_frameset_t_type, &ctx->frames},
|
{"frames", &qfv_renderframeset_t_type, &rctx->frames},
|
||||||
{"msaaSamples", &VkSampleCountFlagBits_type, &ctx->msaaSamples},
|
{"msaaSamples", &VkSampleCountFlagBits_type, &ctx->msaaSamples},
|
||||||
{"physDevLimits", &VkPhysicalDeviceLimits_type,
|
{"physDevLimits", &VkPhysicalDeviceLimits_type,
|
||||||
&ctx->device->physDev->properties->limits },
|
&ctx->device->physDev->properties->limits },
|
||||||
|
@ -2050,7 +2051,7 @@ void Vulkan_Script_Init (vulkan_ctx_t *ctx)
|
||||||
ectx.hashctx = 0;//&sctx->hashctx;
|
ectx.hashctx = 0;//&sctx->hashctx;
|
||||||
vkgen_init_symtabs (&ectx);
|
vkgen_init_symtabs (&ectx);
|
||||||
cexpr_init_symtab (&qfv_output_t_symtab, &ectx);
|
cexpr_init_symtab (&qfv_output_t_symtab, &ectx);
|
||||||
cexpr_init_symtab (&vulkan_frameset_t_symtab, &ectx);
|
cexpr_init_symtab (&qfv_renderframeset_t_symtab, &ectx);
|
||||||
cexpr_init_symtab (&data_array_symtab, &ectx);
|
cexpr_init_symtab (&data_array_symtab, &ectx);
|
||||||
|
|
||||||
sctx->shaderModules = handlref_symtab (shaderModule_free, sctx);
|
sctx->shaderModules = handlref_symtab (shaderModule_free, sctx);
|
||||||
|
@ -2336,7 +2337,7 @@ QFV_ParseJobInfo (vulkan_ctx_t *ctx, plitem_t *item, qfv_renderctx_t *rctx)
|
||||||
};
|
};
|
||||||
exprsym_t var_syms[] = {
|
exprsym_t var_syms[] = {
|
||||||
{"render_output", &qfv_output_t_type, &sctx->output},
|
{"render_output", &qfv_output_t_type, &sctx->output},
|
||||||
{"frames", &vulkan_frameset_t_type, &ctx->frames},
|
{"frames", &qfv_renderframeset_t_type, &rctx->frames},
|
||||||
{"msaaSamples", &VkSampleCountFlagBits_type, &ctx->msaaSamples},
|
{"msaaSamples", &VkSampleCountFlagBits_type, &ctx->msaaSamples},
|
||||||
{"physDevLimits", &VkPhysicalDeviceLimits_type,
|
{"physDevLimits", &VkPhysicalDeviceLimits_type,
|
||||||
&ctx->device->physDev->properties->limits },
|
&ctx->device->physDev->properties->limits },
|
||||||
|
|
|
@ -77,7 +77,7 @@ static void
|
||||||
emit_commands (VkCommandBuffer cmd, int pose1, int pose2,
|
emit_commands (VkCommandBuffer cmd, int pose1, int pose2,
|
||||||
qfv_alias_skin_t *skin,
|
qfv_alias_skin_t *skin,
|
||||||
uint32_t numPC, qfv_push_constants_t *constants,
|
uint32_t numPC, qfv_push_constants_t *constants,
|
||||||
aliashdr_t *hdr, qfv_renderframe_t *rFrame, entity_t ent)
|
aliashdr_t *hdr, qfv_orenderframe_t *rFrame, entity_t ent)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -117,7 +117,7 @@ emit_commands (VkCommandBuffer cmd, int pose1, int pose2,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_DrawAlias (entity_t ent, qfv_renderframe_t *rFrame)
|
Vulkan_DrawAlias (entity_t ent, qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
aliasctx_t *actx = ctx->alias_context;
|
aliasctx_t *actx = ctx->alias_context;
|
||||||
|
@ -181,7 +181,7 @@ Vulkan_DrawAlias (entity_t ent, qfv_renderframe_t *rFrame)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alias_begin_subpass (QFV_AliasSubpass subpass, VkPipeline pipeline,
|
alias_begin_subpass (QFV_AliasSubpass subpass, VkPipeline pipeline,
|
||||||
qfv_renderframe_t *rFrame)
|
qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -234,7 +234,7 @@ alias_end_subpass (VkCommandBuffer cmd, vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_AliasBegin (qfv_renderframe_t *rFrame)
|
Vulkan_AliasBegin (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
aliasctx_t *actx = ctx->alias_context;
|
aliasctx_t *actx = ctx->alias_context;
|
||||||
|
@ -251,7 +251,7 @@ Vulkan_AliasBegin (qfv_renderframe_t *rFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_AliasEnd (qfv_renderframe_t *rFrame)
|
Vulkan_AliasEnd (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
aliasctx_t *actx = ctx->alias_context;
|
aliasctx_t *actx = ctx->alias_context;
|
||||||
|
@ -262,7 +262,7 @@ Vulkan_AliasEnd (qfv_renderframe_t *rFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_AliasDepthRange (qfv_renderframe_t *rFrame,
|
Vulkan_AliasDepthRange (qfv_orenderframe_t *rFrame,
|
||||||
float minDepth, float maxDepth)
|
float minDepth, float maxDepth)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
|
@ -321,7 +321,8 @@ Vulkan_Alias_Init (vulkan_ctx_t *ctx)
|
||||||
aliasctx_t *actx = calloc (1, sizeof (aliasctx_t));
|
aliasctx_t *actx = calloc (1, sizeof (aliasctx_t));
|
||||||
ctx->alias_context = actx;
|
ctx->alias_context = actx;
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&actx->frames, frames);
|
DARRAY_INIT (&actx->frames, frames);
|
||||||
DARRAY_RESIZE (&actx->frames, frames);
|
DARRAY_RESIZE (&actx->frames, frames);
|
||||||
actx->frames.grow = 0;
|
actx->frames.grow = 0;
|
||||||
|
|
|
@ -773,7 +773,7 @@ push_fragconst (bsp_push_constants_t *constants, VkPipelineLayout layout,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bsp_begin_subpass (QFV_BspSubpass subpass, VkPipeline pipeline,
|
bsp_begin_subpass (QFV_BspSubpass subpass, VkPipeline pipeline,
|
||||||
VkPipelineLayout layout, qfv_renderframe_t *rFrame)
|
VkPipelineLayout layout, qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -834,7 +834,7 @@ bsp_end_subpass (VkCommandBuffer cmd, vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bsp_begin (qfv_renderframe_t *rFrame)
|
bsp_begin (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
bspctx_t *bctx = ctx->bsp_context;
|
bspctx_t *bctx = ctx->bsp_context;
|
||||||
|
@ -864,7 +864,7 @@ bsp_end (vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
turb_begin (qfv_renderframe_t *rFrame)
|
turb_begin (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
bspctx_t *bctx = ctx->bsp_context;
|
bspctx_t *bctx = ctx->bsp_context;
|
||||||
|
@ -889,7 +889,7 @@ turb_end (vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sky_begin (qfv_renderframe_t *rFrame)
|
sky_begin (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
bspctx_t *bctx = ctx->bsp_context;
|
bspctx_t *bctx = ctx->bsp_context;
|
||||||
|
@ -1025,7 +1025,7 @@ ent_model_cmp (const void *_a, const void *_b)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_DrawWorld (qfv_renderframe_t *rFrame)
|
Vulkan_DrawWorld (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -1127,7 +1127,7 @@ Vulkan_Bsp_Flush (vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_DrawWaterSurfaces (qfv_renderframe_t *rFrame)
|
Vulkan_DrawWaterSurfaces (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -1163,7 +1163,7 @@ Vulkan_DrawWaterSurfaces (qfv_renderframe_t *rFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_DrawSky (qfv_renderframe_t *rFrame)
|
Vulkan_DrawSky (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -1450,7 +1450,8 @@ Vulkan_Bsp_Init (vulkan_ctx_t *ctx)
|
||||||
DARRAY_INIT (&bctx->main_pass.draw_queues[i], 64);
|
DARRAY_INIT (&bctx->main_pass.draw_queues[i], 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&bctx->frames, frames);
|
DARRAY_INIT (&bctx->frames, frames);
|
||||||
DARRAY_RESIZE (&bctx->frames, frames);
|
DARRAY_RESIZE (&bctx->frames, frames);
|
||||||
bctx->frames.grow = 0;
|
bctx->frames.grow = 0;
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
#include "vid_vulkan.h"
|
#include "vid_vulkan.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_Compose_Draw (qfv_renderframe_t *rFrame)
|
Vulkan_Compose_Draw (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -146,7 +146,8 @@ Vulkan_Compose_Init (vulkan_ctx_t *ctx)
|
||||||
composectx_t *cctx = calloc (1, sizeof (composectx_t));
|
composectx_t *cctx = calloc (1, sizeof (composectx_t));
|
||||||
ctx->compose_context = cctx;
|
ctx->compose_context = cctx;
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&cctx->frames, frames);
|
DARRAY_INIT (&cctx->frames, frames);
|
||||||
DARRAY_RESIZE (&cctx->frames, frames);
|
DARRAY_RESIZE (&cctx->frames, frames);
|
||||||
cctx->frames.grow = 0;
|
cctx->frames.grow = 0;
|
||||||
|
|
|
@ -285,7 +285,8 @@ create_buffers (vulkan_ctx_t *ctx)
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
qfv_devfuncs_t *dfunc = device->funcs;
|
qfv_devfuncs_t *dfunc = device->funcs;
|
||||||
drawctx_t *dctx = ctx->draw_context;
|
drawctx_t *dctx = ctx->draw_context;
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
|
|
||||||
dctx->draw_resource = malloc (2 * sizeof (qfv_resource_t)
|
dctx->draw_resource = malloc (2 * sizeof (qfv_resource_t)
|
||||||
// index buffer
|
// index buffer
|
||||||
|
@ -1030,7 +1031,8 @@ Vulkan_Draw_Init (vulkan_ctx_t *ctx)
|
||||||
drawctx_t *dctx = calloc (1, sizeof (drawctx_t));
|
drawctx_t *dctx = calloc (1, sizeof (drawctx_t));
|
||||||
ctx->draw_context = dctx;
|
ctx->draw_context = dctx;
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&dctx->frames, frames);
|
DARRAY_INIT (&dctx->frames, frames);
|
||||||
DARRAY_RESIZE (&dctx->frames, frames);
|
DARRAY_RESIZE (&dctx->frames, frames);
|
||||||
dctx->frames.grow = 0;
|
dctx->frames.grow = 0;
|
||||||
|
|
|
@ -78,7 +78,7 @@ static void
|
||||||
emit_commands (VkCommandBuffer cmd, int pose1, int pose2,
|
emit_commands (VkCommandBuffer cmd, int pose1, int pose2,
|
||||||
qfv_iqm_skin_t *skins,
|
qfv_iqm_skin_t *skins,
|
||||||
uint32_t numPC, qfv_push_constants_t *constants,
|
uint32_t numPC, qfv_push_constants_t *constants,
|
||||||
iqm_t *iqm, qfv_renderframe_t *rFrame, entity_t ent)
|
iqm_t *iqm, qfv_orenderframe_t *rFrame, entity_t ent)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -127,7 +127,7 @@ emit_commands (VkCommandBuffer cmd, int pose1, int pose2,
|
||||||
#define a(x) ((x) & ~0x3f)
|
#define a(x) ((x) & ~0x3f)
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_DrawIQM (entity_t ent, qfv_renderframe_t *rFrame)
|
Vulkan_DrawIQM (entity_t ent, qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -207,7 +207,7 @@ Vulkan_DrawIQM (entity_t ent, qfv_renderframe_t *rFrame)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
iqm_begin_subpass (QFV_IQMSubpass subpass, VkPipeline pipeline,
|
iqm_begin_subpass (QFV_IQMSubpass subpass, VkPipeline pipeline,
|
||||||
qfv_renderframe_t *rFrame)
|
qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -258,7 +258,7 @@ iqm_end_subpass (VkCommandBuffer cmd, vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_IQMBegin (qfv_renderframe_t *rFrame)
|
Vulkan_IQMBegin (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
iqmctx_t *ictx = ctx->iqm_context;
|
iqmctx_t *ictx = ctx->iqm_context;
|
||||||
|
@ -275,7 +275,7 @@ Vulkan_IQMBegin (qfv_renderframe_t *rFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_IQMEnd (qfv_renderframe_t *rFrame)
|
Vulkan_IQMEnd (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
iqmctx_t *ictx = ctx->iqm_context;
|
iqmctx_t *ictx = ctx->iqm_context;
|
||||||
|
@ -386,7 +386,8 @@ Vulkan_IQM_Init (vulkan_ctx_t *ctx)
|
||||||
iqmctx_t *ictx = calloc (1, sizeof (iqmctx_t));
|
iqmctx_t *ictx = calloc (1, sizeof (iqmctx_t));
|
||||||
ctx->iqm_context = ictx;
|
ctx->iqm_context = ictx;
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&ictx->frames, frames);
|
DARRAY_INIT (&ictx->frames, frames);
|
||||||
DARRAY_RESIZE (&ictx->frames, frames);
|
DARRAY_RESIZE (&ictx->frames, frames);
|
||||||
ictx->frames.grow = 0;
|
ictx->frames.grow = 0;
|
||||||
|
|
|
@ -148,7 +148,7 @@ update_lights (vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_Lighting_Draw (qfv_renderframe_t *rFrame)
|
Vulkan_Lighting_Draw (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -220,7 +220,7 @@ Vulkan_Lighting_Draw (qfv_renderframe_t *rFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lighting_draw_maps (qfv_renderframe_t *rFrame)
|
lighting_draw_maps (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -361,7 +361,8 @@ Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
||||||
DARRAY_INIT (&lctx->light_images, 16);
|
DARRAY_INIT (&lctx->light_images, 16);
|
||||||
DARRAY_INIT (&lctx->light_renderers, 16);
|
DARRAY_INIT (&lctx->light_renderers, 16);
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&lctx->frames, frames);
|
DARRAY_INIT (&lctx->frames, frames);
|
||||||
DARRAY_RESIZE (&lctx->frames, frames);
|
DARRAY_RESIZE (&lctx->frames, frames);
|
||||||
lctx->frames.grow = 0;
|
lctx->frames.grow = 0;
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
#include "vid_vulkan.h"
|
#include "vid_vulkan.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_RenderEntities (entqueue_t *queue, qfv_renderframe_t *rFrame)
|
Vulkan_RenderEntities (entqueue_t *queue, qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
if (!r_drawentities)
|
if (!r_drawentities)
|
||||||
return;
|
return;
|
||||||
|
@ -123,7 +123,7 @@ Vulkan_DrawViewModel (vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_RenderView (qfv_renderframe_t *rFrame)
|
Vulkan_RenderView (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ Vulkan_NewScene (scene_t *scene, vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
main_draw (qfv_renderframe_t *rFrame)
|
main_draw (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
Vulkan_RenderView (rFrame);
|
Vulkan_RenderView (rFrame);
|
||||||
Vulkan_Lighting_Draw (rFrame);
|
Vulkan_Lighting_Draw (rFrame);
|
||||||
|
|
|
@ -238,7 +238,8 @@ Vulkan_Matrix_Init (vulkan_ctx_t *ctx)
|
||||||
matrixctx_t *mctx = calloc (1, sizeof (matrixctx_t));
|
matrixctx_t *mctx = calloc (1, sizeof (matrixctx_t));
|
||||||
ctx->matrix_context = mctx;
|
ctx->matrix_context = mctx;
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&mctx->frames, frames);
|
DARRAY_INIT (&mctx->frames, frames);
|
||||||
DARRAY_RESIZE (&mctx->frames, frames);
|
DARRAY_RESIZE (&mctx->frames, frames);
|
||||||
mctx->frames.grow = 0;
|
mctx->frames.grow = 0;
|
||||||
|
|
|
@ -63,12 +63,12 @@
|
||||||
#include "vkparse.h"//FIXME
|
#include "vkparse.h"//FIXME
|
||||||
|
|
||||||
static void
|
static void
|
||||||
preoutput_draw (qfv_renderframe_t *rFrame)
|
preoutput_draw (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
process_input (qfv_renderframe_t *rFrame)
|
process_input (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
|
@ -143,7 +143,7 @@ process_input (qfv_renderframe_t *rFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
draw_output (qfv_renderframe_t *rFrame)
|
draw_output (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
process_input (rFrame);
|
process_input (rFrame);
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,8 @@ acquire_output (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||||
auto ctx = taskctx->ctx;
|
auto ctx = taskctx->ctx;
|
||||||
auto device = ctx->device;
|
auto device = ctx->device;
|
||||||
auto dfunc = device->funcs;
|
auto dfunc = device->funcs;
|
||||||
auto frame = &ctx->frames.a[ctx->curFrame];
|
auto rctx = ctx->render_context;
|
||||||
|
auto frame = &rctx->frames.a[ctx->curFrame];
|
||||||
auto octx = ctx->output_context;
|
auto octx = ctx->output_context;
|
||||||
auto sc = ctx->swapchain;
|
auto sc = ctx->swapchain;
|
||||||
|
|
||||||
|
@ -321,7 +322,8 @@ Vulkan_Output_Init (vulkan_ctx_t *ctx)
|
||||||
|
|
||||||
outputctx_t *octx = ctx->output_context;
|
outputctx_t *octx = ctx->output_context;
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&octx->frames, frames);
|
DARRAY_INIT (&octx->frames, frames);
|
||||||
DARRAY_RESIZE (&octx->frames, frames);
|
DARRAY_RESIZE (&octx->frames, frames);
|
||||||
octx->frames.grow = 0;
|
octx->frames.grow = 0;
|
||||||
|
|
|
@ -72,7 +72,7 @@ static const char * __attribute__((used)) particle_pass_names[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
particle_begin_subpass (VkPipeline pipeline, qfv_renderframe_t *rFrame)
|
particle_begin_subpass (VkPipeline pipeline, qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -121,7 +121,7 @@ particle_end_subpass (VkCommandBuffer cmd, vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_DrawParticles (qfv_renderframe_t *rFrame)
|
Vulkan_DrawParticles (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -187,7 +187,8 @@ create_buffers (vulkan_ctx_t *ctx)
|
||||||
qfv_devfuncs_t *dfunc = device->funcs;
|
qfv_devfuncs_t *dfunc = device->funcs;
|
||||||
particlectx_t *pctx = ctx->particle_context;
|
particlectx_t *pctx = ctx->particle_context;
|
||||||
size_t mp = MaxParticles;
|
size_t mp = MaxParticles;
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
|
|
||||||
pctx->resources = malloc (sizeof (qfv_resource_t)
|
pctx->resources = malloc (sizeof (qfv_resource_t)
|
||||||
// states buffer
|
// states buffer
|
||||||
|
@ -417,7 +418,8 @@ Vulkan_Particles_Init (vulkan_ctx_t *ctx)
|
||||||
ctx->particle_context = pctx;
|
ctx->particle_context = pctx;
|
||||||
pctx->psystem = &r_psystem;
|
pctx->psystem = &r_psystem;
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&pctx->frames, frames);
|
DARRAY_INIT (&pctx->frames, frames);
|
||||||
DARRAY_RESIZE (&pctx->frames, frames);
|
DARRAY_RESIZE (&pctx->frames, frames);
|
||||||
pctx->frames.grow = 0;
|
pctx->frames.grow = 0;
|
||||||
|
@ -481,7 +483,7 @@ Vulkan_Particles_Shutdown (vulkan_ctx_t *ctx)
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
qfv_devfuncs_t *dfunc = device->funcs;
|
qfv_devfuncs_t *dfunc = device->funcs;
|
||||||
particlectx_t *pctx = ctx->particle_context;
|
particlectx_t *pctx = ctx->particle_context;
|
||||||
size_t frames = ctx->frames.size;
|
size_t frames = pctx->frames.size;
|
||||||
|
|
||||||
for (size_t i = 0; i < frames; i++) {
|
for (size_t i = 0; i < frames; i++) {
|
||||||
__auto_type pframe = &pctx->frames.a[i];
|
__auto_type pframe = &pctx->frames.a[i];
|
||||||
|
@ -507,7 +509,7 @@ Vulkan_ParticleSystem (vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
particles_update (qfv_renderframe_t *rFrame)
|
particles_update (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
|
|
@ -257,7 +257,7 @@ QFV_RenderPass_CreateFramebuffer (qfv_orenderpass_t *renderpass)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_renderframe (vulkan_ctx_t *ctx, qfv_orenderpass_t *rp,
|
init_renderframe (vulkan_ctx_t *ctx, qfv_orenderpass_t *rp,
|
||||||
qfv_renderframe_t *rFrame)
|
qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
rFrame->vulkan_ctx = ctx;
|
rFrame->vulkan_ctx = ctx;
|
||||||
rFrame->renderpass = rp;
|
rFrame->renderpass = rp;
|
||||||
|
@ -353,7 +353,7 @@ QFV_RenderPass_New (vulkan_ctx_t *ctx, const char *name, qfv_draw_t function)
|
||||||
}
|
}
|
||||||
|
|
||||||
DARRAY_INIT (&rp->frames, 4);
|
DARRAY_INIT (&rp->frames, 4);
|
||||||
DARRAY_RESIZE (&rp->frames, ctx->frames.size);
|
//DARRAY_RESIZE (&rp->frames, ctx->frames.size);
|
||||||
for (size_t i = 0; i < rp->frames.size; i++) {
|
for (size_t i = 0; i < rp->frames.size; i++) {
|
||||||
init_renderframe (ctx, rp, &rp->frames.a[i]);
|
init_renderframe (ctx, rp, &rp->frames.a[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "QF/Vulkan/descriptor.h"
|
#include "QF/Vulkan/descriptor.h"
|
||||||
#include "QF/Vulkan/device.h"
|
#include "QF/Vulkan/device.h"
|
||||||
#include "QF/Vulkan/instance.h"
|
#include "QF/Vulkan/instance.h"
|
||||||
|
#include "QF/Vulkan/render.h"
|
||||||
#include "QF/Vulkan/resource.h"
|
#include "QF/Vulkan/resource.h"
|
||||||
|
|
||||||
#include "r_internal.h"
|
#include "r_internal.h"
|
||||||
|
@ -143,7 +144,8 @@ Vulkan_Scene_Init (vulkan_ctx_t *ctx)
|
||||||
ctx->scene_context = sctx;
|
ctx->scene_context = sctx;
|
||||||
sctx->max_entities = qfv_max_entities;
|
sctx->max_entities = qfv_max_entities;
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&sctx->frames, frames);
|
DARRAY_INIT (&sctx->frames, frames);
|
||||||
DARRAY_RESIZE (&sctx->frames, frames);
|
DARRAY_RESIZE (&sctx->frames, frames);
|
||||||
sctx->frames.grow = 0;
|
sctx->frames.grow = 0;
|
||||||
|
|
|
@ -83,7 +83,7 @@ static QFV_Subpass subpass_map[] = {
|
||||||
static void
|
static void
|
||||||
emit_commands (VkCommandBuffer cmd, qfv_sprite_t *sprite,
|
emit_commands (VkCommandBuffer cmd, qfv_sprite_t *sprite,
|
||||||
int numPC, qfv_push_constants_t *constants,
|
int numPC, qfv_push_constants_t *constants,
|
||||||
qfv_renderframe_t *rFrame, entity_t ent)
|
qfv_orenderframe_t *rFrame, entity_t ent)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -104,7 +104,7 @@ emit_commands (VkCommandBuffer cmd, qfv_sprite_t *sprite,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_DrawSprite (entity_t ent, qfv_renderframe_t *rFrame)
|
Vulkan_DrawSprite (entity_t ent, qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
spritectx_t *sctx = ctx->sprite_context;
|
spritectx_t *sctx = ctx->sprite_context;
|
||||||
|
@ -142,7 +142,7 @@ Vulkan_DrawSprite (entity_t ent, qfv_renderframe_t *rFrame)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sprite_begin_subpass (QFV_SpriteSubpass subpass, VkPipeline pipeline,
|
sprite_begin_subpass (QFV_SpriteSubpass subpass, VkPipeline pipeline,
|
||||||
qfv_renderframe_t *rFrame)
|
qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -193,7 +193,7 @@ sprite_end_subpass (VkCommandBuffer cmd, vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_SpriteBegin (qfv_renderframe_t *rFrame)
|
Vulkan_SpriteBegin (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
spritectx_t *sctx = ctx->sprite_context;
|
spritectx_t *sctx = ctx->sprite_context;
|
||||||
|
@ -210,7 +210,7 @@ Vulkan_SpriteBegin (qfv_renderframe_t *rFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_SpriteEnd (qfv_renderframe_t *rFrame)
|
Vulkan_SpriteEnd (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
spritectx_t *sctx = ctx->sprite_context;
|
spritectx_t *sctx = ctx->sprite_context;
|
||||||
|
@ -310,7 +310,8 @@ Vulkan_Sprite_Init (vulkan_ctx_t *ctx)
|
||||||
spritectx_t *sctx = calloc (1, sizeof (spritectx_t));
|
spritectx_t *sctx = calloc (1, sizeof (spritectx_t));
|
||||||
ctx->sprite_context = sctx;
|
ctx->sprite_context = sctx;
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&sctx->frames, frames);
|
DARRAY_INIT (&sctx->frames, frames);
|
||||||
DARRAY_RESIZE (&sctx->frames, frames);
|
DARRAY_RESIZE (&sctx->frames, frames);
|
||||||
sctx->frames.grow = 0;
|
sctx->frames.grow = 0;
|
||||||
|
|
|
@ -143,7 +143,8 @@ Vulkan_Translucent_Init (vulkan_ctx_t *ctx)
|
||||||
translucentctx_t *tctx = calloc (1, sizeof (translucentctx_t));
|
translucentctx_t *tctx = calloc (1, sizeof (translucentctx_t));
|
||||||
ctx->translucent_context = tctx;
|
ctx->translucent_context = tctx;
|
||||||
|
|
||||||
size_t frames = ctx->frames.size;
|
auto rctx = ctx->render_context;
|
||||||
|
size_t frames = rctx->frames.size;
|
||||||
DARRAY_INIT (&tctx->frames, frames);
|
DARRAY_INIT (&tctx->frames, frames);
|
||||||
DARRAY_RESIZE (&tctx->frames, frames);
|
DARRAY_RESIZE (&tctx->frames, frames);
|
||||||
tctx->frames.grow = 0;
|
tctx->frames.grow = 0;
|
||||||
|
@ -211,7 +212,7 @@ Vulkan_Translucent_CreateBuffers (vulkan_ctx_t *ctx, VkExtent2D extent)
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
qfv_devfuncs_t *dfunc = device->funcs;
|
qfv_devfuncs_t *dfunc = device->funcs;
|
||||||
__auto_type tctx = ctx->translucent_context;
|
__auto_type tctx = ctx->translucent_context;
|
||||||
size_t frames = ctx->frames.size;
|
size_t frames = tctx->frames.size;
|
||||||
|
|
||||||
if (tctx->resources) {
|
if (tctx->resources) {
|
||||||
QFV_DestroyResource (device, tctx->resources);
|
QFV_DestroyResource (device, tctx->resources);
|
||||||
|
@ -314,7 +315,7 @@ Vulkan_Translucent_CreateBuffers (vulkan_ctx_t *ctx, VkExtent2D extent)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
translucent_clear (qfv_renderframe_t *rFrame)
|
translucent_clear (qfv_orenderframe_t *rFrame)
|
||||||
{
|
{
|
||||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
|
|
@ -125,9 +125,6 @@ Vulkan_Shutdown_Common (vulkan_ctx_t *ctx)
|
||||||
if (ctx->capture) {
|
if (ctx->capture) {
|
||||||
QFV_DestroyCapture (ctx->capture);
|
QFV_DestroyCapture (ctx->capture);
|
||||||
}
|
}
|
||||||
if (ctx->frames.size) {
|
|
||||||
Vulkan_DestroyFrames (ctx);
|
|
||||||
}
|
|
||||||
if (ctx->swapchain) {
|
if (ctx->swapchain) {
|
||||||
QFV_DestroySwapchain (ctx->swapchain);
|
QFV_DestroySwapchain (ctx->swapchain);
|
||||||
}
|
}
|
||||||
|
@ -216,58 +213,15 @@ Vulkan_DestroyRenderPasses (vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Vulkan_CreateFrames (vulkan_ctx_t *ctx)
|
|
||||||
{
|
|
||||||
qfv_device_t *device = ctx->device;
|
|
||||||
VkCommandPool cmdpool = ctx->cmdpool;
|
|
||||||
|
|
||||||
if (!ctx->frames.grow) {
|
|
||||||
DARRAY_INIT (&ctx->frames, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
DARRAY_RESIZE (&ctx->frames, vulkan_frame_count);
|
|
||||||
|
|
||||||
__auto_type cmdBuffers = QFV_AllocCommandBufferSet (ctx->frames.size,
|
|
||||||
alloca);
|
|
||||||
QFV_AllocateCommandBuffers (device, cmdpool, 0, cmdBuffers);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < ctx->frames.size; i++) {
|
|
||||||
__auto_type frame = &ctx->frames.a[i];
|
|
||||||
frame->fence = QFV_CreateFence (device, 1);
|
|
||||||
frame->imageAvailableSemaphore = QFV_CreateSemaphore (device);
|
|
||||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_SEMAPHORE,
|
|
||||||
frame->imageAvailableSemaphore,
|
|
||||||
va (ctx->va_ctx, "sc image:%zd", i));
|
|
||||||
frame->renderDoneSemaphore = QFV_CreateSemaphore (device);
|
|
||||||
frame->cmdBuffer = cmdBuffers->a[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_CreateCapture (vulkan_ctx_t *ctx)
|
Vulkan_CreateCapture (vulkan_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
ctx->capture = QFV_CreateCapture (ctx->device, ctx->frames.size,
|
//FIXME this should be in render
|
||||||
|
auto rctx = ctx->render_context;
|
||||||
|
ctx->capture = QFV_CreateCapture (ctx->device, rctx->frames.size,
|
||||||
ctx->swapchain, ctx->cmdpool);
|
ctx->swapchain, ctx->cmdpool);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Vulkan_DestroyFrames (vulkan_ctx_t *ctx)
|
|
||||||
{
|
|
||||||
qfv_device_t *device = ctx->device;
|
|
||||||
qfv_devfuncs_t *df = device->funcs;
|
|
||||||
VkDevice dev = device->dev;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < ctx->frames.size; i++) {
|
|
||||||
__auto_type frame = &ctx->frames.a[i];
|
|
||||||
df->vkDestroyFence (dev, frame->fence, 0);
|
|
||||||
df->vkDestroySemaphore (dev, frame->imageAvailableSemaphore, 0);
|
|
||||||
df->vkDestroySemaphore (dev, frame->renderDoneSemaphore, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
DARRAY_CLEAR (&ctx->frames);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_BeginEntityLabel (vulkan_ctx_t *ctx, VkCommandBuffer cmd, entity_t ent)
|
Vulkan_BeginEntityLabel (vulkan_ctx_t *ctx, VkCommandBuffer cmd, entity_t ent)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue