mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-25 22:01:33 +00:00
[vulkan] Move main render pass setup to Vulkan_Main
And support sorting of render passes by an order index.
This commit is contained in:
parent
e45867d335
commit
5e1ce5b46e
5 changed files with 47 additions and 22 deletions
|
@ -33,6 +33,7 @@ struct qfv_renderframe_s;
|
|||
struct entqueue_s;
|
||||
struct scene_s;
|
||||
|
||||
void Vulkan_Main_CreateRenderPasses (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_RenderEntities (struct entqueue_s *queue,
|
||||
|
|
|
@ -48,6 +48,7 @@ typedef struct qfv_renderpass_s {
|
|||
qfv_framebufferset_t *framebuffers;
|
||||
VkViewport viewport;
|
||||
VkRect2D scissor;
|
||||
int order;
|
||||
|
||||
size_t subpassCount;
|
||||
qfv_subpassset_t *subpass_info;
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
#endif
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
enum {
|
||||
QFV_rp_main,
|
||||
};
|
||||
|
||||
//FIXME location
|
||||
typedef enum {
|
||||
QFV_passDepth, // geometry
|
||||
|
|
|
@ -48,17 +48,21 @@
|
|||
#include "QF/scene/entity.h"
|
||||
#include "QF/scene/scene.h"
|
||||
|
||||
#include "QF/Vulkan/qf_vid.h"
|
||||
#include "QF/Vulkan/qf_alias.h"
|
||||
#include "QF/Vulkan/qf_bsp.h"
|
||||
#include "QF/Vulkan/qf_compose.h"
|
||||
#include "QF/Vulkan/qf_draw.h"
|
||||
#include "QF/Vulkan/qf_iqm.h"
|
||||
#include "QF/Vulkan/qf_lighting.h"
|
||||
#include "QF/Vulkan/qf_lightmap.h"
|
||||
#include "QF/Vulkan/qf_main.h"
|
||||
#include "QF/Vulkan/qf_matrices.h"
|
||||
#include "QF/Vulkan/qf_particles.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_scene.h"
|
||||
#include "QF/Vulkan/qf_sprite.h"
|
||||
#include "QF/Vulkan/qf_vid.h"
|
||||
#include "QF/Vulkan/swapchain.h"
|
||||
|
||||
#include "mod_internal.h"
|
||||
#include "r_internal.h"
|
||||
|
@ -151,3 +155,28 @@ Vulkan_NewScene (scene_t *scene, vulkan_ctx_t *ctx)
|
|||
Vulkan_BuildDisplayLists (scene->models, scene->num_models, ctx);
|
||||
Vulkan_LoadLights (scene, ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
main_draw (qfv_renderframe_t *rFrame)
|
||||
{
|
||||
Vulkan_Matrix_Draw (rFrame);
|
||||
Vulkan_RenderView (rFrame);
|
||||
Vulkan_FlushText (rFrame);//FIXME delayed by a frame?
|
||||
Vulkan_Lighting_Draw (rFrame);
|
||||
Vulkan_Compose_Draw (rFrame);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Main_CreateRenderPasses (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_output_t output = {
|
||||
.extent = ctx->swapchain->extent,
|
||||
.view = ctx->swapchain->imageViews->a[0],
|
||||
.format = ctx->swapchain->format,
|
||||
.view_list = ctx->swapchain->imageViews->a,
|
||||
};
|
||||
__auto_type rp = Vulkan_CreateRenderPass (ctx, "deferred",
|
||||
&output, main_draw);
|
||||
rp->order = QFV_rp_main;
|
||||
DARRAY_APPEND (&ctx->renderPasses, rp);
|
||||
}
|
||||
|
|
|
@ -39,23 +39,20 @@
|
|||
#include "QF/cvar.h"
|
||||
#include "QF/dstring.h"
|
||||
#include "QF/hash.h"
|
||||
#include "QF/heapsort.h"
|
||||
#include "QF/plist.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/scene/entity.h"
|
||||
#include "QF/Vulkan/capture.h"
|
||||
#include "QF/Vulkan/command.h"
|
||||
#include "QF/Vulkan/debug.h"
|
||||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/staging.h"
|
||||
#include "QF/Vulkan/swapchain.h"
|
||||
|
||||
#include "QF/Vulkan/qf_alias.h"
|
||||
#include "QF/Vulkan/qf_bsp.h"
|
||||
#include "QF/Vulkan/qf_compose.h"
|
||||
#include "QF/Vulkan/qf_draw.h"
|
||||
#include "QF/Vulkan/qf_lighting.h"
|
||||
#include "QF/Vulkan/qf_main.h"
|
||||
#include "QF/Vulkan/qf_matrices.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_vid.h"
|
||||
|
||||
|
@ -365,28 +362,21 @@ qfv_load_pipeline (vulkan_ctx_t *ctx, const char *name)
|
|||
return item;
|
||||
}
|
||||
|
||||
static void
|
||||
renderpass_draw (qfv_renderframe_t *rFrame)
|
||||
static int
|
||||
renderpass_cmp (const void *_a, const void *_b)
|
||||
{
|
||||
Vulkan_Matrix_Draw (rFrame);
|
||||
Vulkan_RenderView (rFrame);
|
||||
Vulkan_FlushText (rFrame);//FIXME delayed by a frame?
|
||||
Vulkan_Lighting_Draw (rFrame);
|
||||
Vulkan_Compose_Draw (rFrame);
|
||||
const qfv_renderpass_t *a = _a;
|
||||
const qfv_renderpass_t *b = _b;
|
||||
return a->order - b->order;
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_CreateRenderPasses (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_output_t output = {
|
||||
.extent = ctx->swapchain->extent,
|
||||
.view = ctx->swapchain->imageViews->a[0],
|
||||
.format = ctx->swapchain->format,
|
||||
.view_list = ctx->swapchain->imageViews->a,
|
||||
};
|
||||
__auto_type rp = Vulkan_CreateRenderPass (ctx, "deferred",
|
||||
&output, renderpass_draw);
|
||||
DARRAY_APPEND (&ctx->renderPasses, rp);
|
||||
Vulkan_Main_CreateRenderPasses (ctx);
|
||||
|
||||
heapsort (ctx->renderPasses.a, ctx->renderPasses.size,
|
||||
sizeof (qfv_renderpass_t *), renderpass_cmp);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue