mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-07 18:01:30 +00:00
[vulkan] Nuke the old render pass code from orbit
Gotta be sure :) With the new system mostly up and running (just bsp rendering and descriptor sets/layout handling to go, and they're independent of the old render pass system), the old system can finally be cleared out.
This commit is contained in:
parent
4abf316f6c
commit
5140346c22
34 changed files with 36 additions and 833 deletions
|
@ -208,7 +208,6 @@ include_qf_vulkan = \
|
|||
include/QF/Vulkan/qf_output.h \
|
||||
include/QF/Vulkan/qf_palette.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_texture.h \
|
||||
|
|
|
@ -89,7 +89,6 @@ typedef struct aliasctx_s {
|
|||
} aliasctx_t;
|
||||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_orenderframe_s;
|
||||
struct entity_s;
|
||||
struct mod_alias_ctx_s;
|
||||
|
||||
|
|
|
@ -386,10 +386,6 @@ typedef struct bspctx_s {
|
|||
} bspctx_t;
|
||||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_orenderframe_s;
|
||||
void Vulkan_DrawWorld (struct qfv_orenderframe_s *rFrame);
|
||||
void Vulkan_DrawSky (struct qfv_orenderframe_s *rFrame);
|
||||
void Vulkan_DrawWaterSurfaces (struct qfv_orenderframe_s *rFrame);
|
||||
void Vulkan_Bsp_Flush (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,
|
||||
|
|
|
@ -54,7 +54,6 @@ typedef struct composectx_s {
|
|||
} composectx_t;
|
||||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_orenderframe_s;
|
||||
|
||||
void Vulkan_Compose_Init (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Compose_Shutdown (struct vulkan_ctx_s *ctx);
|
||||
|
|
|
@ -98,7 +98,6 @@ typedef struct iqmctx_s {
|
|||
} iqmctx_t;
|
||||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_orenderframe_s;
|
||||
struct entity_s;
|
||||
struct mod_iqm_ctx_s;
|
||||
struct iqm_s;
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "QF/modelgen.h"
|
||||
#include "QF/scene/light.h"
|
||||
#include "QF/Vulkan/qf_vid.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/command.h"
|
||||
#include "QF/Vulkan/image.h"
|
||||
#include "QF/simd/types.h"
|
||||
|
@ -105,7 +104,6 @@ typedef struct lightingctx_s {
|
|||
qfv_imageset_t light_images;
|
||||
light_renderer_set_t light_renderers;
|
||||
|
||||
qfv_orenderpass_t *qfv_renderpass;
|
||||
VkRenderPass renderpass_6;
|
||||
VkRenderPass renderpass_4;
|
||||
VkRenderPass renderpass_1;
|
||||
|
@ -117,9 +115,7 @@ typedef struct lightingctx_s {
|
|||
} lightingctx_t;
|
||||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_orenderframe_s;
|
||||
|
||||
void Vulkan_Lighting_CreateRenderPasses (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_LoadLights (struct scene_s *scene, struct vulkan_ctx_s *ctx);
|
||||
|
|
|
@ -29,12 +29,9 @@
|
|||
#define __QF_Vulkan_qf_main_h
|
||||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_orenderframe_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_orenderframe_s *rFrame);
|
||||
|
||||
#endif//__QF_Vulkan_qf_main_h
|
||||
|
|
|
@ -60,7 +60,6 @@ struct vulkan_ctx_s;
|
|||
|
||||
void Vulkan_Output_Init (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Output_Shutdown (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Output_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Output_SetInput (struct vulkan_ctx_s *ctx, VkImageView input);
|
||||
|
||||
#endif//__QF_Vulkan_qf_output_h
|
||||
|
|
|
@ -74,11 +74,9 @@ typedef struct particlectx_s {
|
|||
|
||||
struct cvar_s;
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_orenderframe_s;
|
||||
|
||||
struct psystem_s *Vulkan_ParticleSystem (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_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
||||
|
||||
#endif//__QF_Vulkan_qf_particles_h
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
#ifndef __QF_Vulkan_qf_renderpass_h
|
||||
#define __QF_Vulkan_qf_renderpass_h
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
#define VK_NO_PROTOTYPES
|
||||
#endif
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#include "QF/darray.h"
|
||||
#include "QF/simd/types.h"
|
||||
|
||||
#include "QF/Vulkan/render.h"
|
||||
|
||||
typedef struct qfv_framebufferset_s
|
||||
DARRAY_TYPE (VkFramebuffer) qfv_framebufferset_t;
|
||||
|
||||
#define QFV_AllocFrameBuffers(num, allocator) \
|
||||
DARRAY_ALLOCFIXED (qfv_framebufferset_t, num, allocator)
|
||||
|
||||
typedef struct qfv_osubpass_s {
|
||||
vec4f_t color;
|
||||
const char *name;
|
||||
} qfv_osubpass_t;
|
||||
|
||||
typedef struct qfv_subpassset_s
|
||||
DARRAY_TYPE (qfv_osubpass_t) qfv_subpassset_t;
|
||||
|
||||
typedef struct qfv_orenderframe_s {
|
||||
struct vulkan_ctx_s *vulkan_ctx;
|
||||
struct qfv_orenderpass_s *renderpass;
|
||||
VkSubpassContents subpassContents;
|
||||
VkFramebuffer framebuffer;
|
||||
int subpassCount;
|
||||
qfv_osubpass_t *subpassInfo;
|
||||
struct qfv_cmdbufferset_s *subpassCmdSets;
|
||||
} qfv_orenderframe_t;
|
||||
|
||||
typedef struct qfv_orenderframeset_s
|
||||
DARRAY_TYPE (qfv_orenderframe_t) qfv_orenderframeset_t;
|
||||
|
||||
typedef struct clearvalueset_s
|
||||
DARRAY_TYPE (VkClearValue) clearvalueset_t;
|
||||
|
||||
typedef void (*qfv_draw_t) (qfv_orenderframe_t *rFrame);
|
||||
|
||||
typedef struct qfv_orenderpass_s {
|
||||
struct vulkan_ctx_s *vulkan_ctx;
|
||||
vec4f_t color; // for debugging
|
||||
const char *name; // for debugging
|
||||
struct plitem_s *renderpassDef;
|
||||
VkRenderPass renderpass;
|
||||
clearvalueset_t *clearValues;
|
||||
struct qfv_imageset_s *attachment_images;
|
||||
struct qfv_imageviewset_s *attachment_views;
|
||||
VkDeviceMemory attachmentMemory;
|
||||
size_t attachmentMemory_size;
|
||||
|
||||
qfv_output_t output;
|
||||
qfv_framebufferset_t *framebuffers;
|
||||
VkViewport viewport;
|
||||
VkRect2D scissor;
|
||||
VkRect2D renderArea;
|
||||
int order;
|
||||
int primary_commands;
|
||||
size_t subpassCount;
|
||||
qfv_subpassset_t *subpass_info;
|
||||
qfv_orenderframeset_t frames;
|
||||
|
||||
qfv_draw_t draw;
|
||||
} qfv_orenderpass_t;
|
||||
|
||||
qfv_orenderpass_t *QFV_RenderPass_New (struct vulkan_ctx_s *ctx,
|
||||
const char *name, qfv_draw_t draw);
|
||||
void QFV_RenderPass_Delete (qfv_orenderpass_t *renderpass);
|
||||
void QFV_RenderPass_CreateAttachments (qfv_orenderpass_t *renderpass);
|
||||
void QFV_RenderPass_CreateRenderPass (qfv_orenderpass_t *renderpass);
|
||||
void QFV_RenderPass_CreateFramebuffer (qfv_orenderpass_t *renderpass);
|
||||
|
||||
|
||||
#endif//__QF_Vulkan_qf_renderpass_h
|
|
@ -77,7 +77,6 @@ typedef struct spritectx_s {
|
|||
} spritectx_t;
|
||||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_orenderframe_s;
|
||||
struct entity_s;
|
||||
struct mod_sprite_ctx_s;
|
||||
|
||||
|
|
|
@ -18,18 +18,10 @@ typedef struct qfv_transtate_s {
|
|||
int32_t maxFragments;
|
||||
} qfv_transtate_t;
|
||||
|
||||
typedef enum {
|
||||
QFV_translucentClear,
|
||||
QFV_translucentBlend,
|
||||
|
||||
QFV_translucentNumPasses
|
||||
} QFV_TranslucentSubpass;
|
||||
|
||||
typedef struct translucentframe_s {
|
||||
VkDescriptorSet descriptors;
|
||||
VkImage heads;
|
||||
VkBuffer state;
|
||||
qfv_cmdbufferset_t cmdSet;
|
||||
} translucentframe_t;
|
||||
|
||||
typedef struct translucentframeset_s
|
||||
|
@ -46,15 +38,12 @@ typedef struct translucentctx_s {
|
|||
} translucentctx_t;
|
||||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_orenderframe_s;
|
||||
|
||||
void Vulkan_Translucent_Init (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Translucent_Shutdown (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Translucent_Draw (struct qfv_orenderframe_s *rFrame);
|
||||
VkDescriptorSet Vulkan_Translucent_Descriptors (struct vulkan_ctx_s *ctx,
|
||||
int frame)__attribute__((pure));
|
||||
void Vulkan_Translucent_CreateBuffers (struct vulkan_ctx_s *ctx,
|
||||
VkExtent2D extent);
|
||||
void Vulkan_Translucent_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
||||
|
||||
#endif//__QF_Vulkan_qf_translucent_h
|
||||
|
|
|
@ -70,8 +70,6 @@ enum {
|
|||
|
||||
struct vulkan_ctx_s;
|
||||
void Vulkan_CreateCapture (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_DestroyRenderPasses (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_CreateSwapchain (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_CreateDevice (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Init_Common (struct vulkan_ctx_s *ctx);
|
||||
|
|
|
@ -56,7 +56,6 @@ typedef struct vulkan_ctx_s {
|
|||
struct qfv_stagebuf_s *staging;
|
||||
uint32_t curFrame;
|
||||
qfv_renderpassset_t renderPasses;
|
||||
struct qfv_orenderpass_s *output_renderpass;
|
||||
|
||||
struct qfv_capture_s *capture;
|
||||
void (*capture_callback) (const byte *data, int width, int height);
|
||||
|
|
|
@ -254,7 +254,6 @@ libs_video_renderer_librender_vulkan_la_SOURCES = \
|
|||
libs/video/renderer/vulkan/vulkan_output.c \
|
||||
libs/video/renderer/vulkan/vulkan_palette.c \
|
||||
libs/video/renderer/vulkan/vulkan_particles.c \
|
||||
libs/video/renderer/vulkan/vulkan_renderpass.c \
|
||||
libs/video/renderer/vulkan/vulkan_scene.c \
|
||||
libs/video/renderer/vulkan/vulkan_sprite.c \
|
||||
libs/video/renderer/vulkan/vulkan_texture.c \
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "QF/Vulkan/qf_output.h"
|
||||
#include "QF/Vulkan/qf_palette.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_texture.h"
|
||||
|
@ -100,7 +99,6 @@ vulkan_R_Init (void)
|
|||
Vulkan_CreateSwapchain (vulkan_ctx);
|
||||
Vulkan_CreateCapture (vulkan_ctx);
|
||||
|
||||
Vulkan_CreateRenderPasses (vulkan_ctx);
|
||||
Vulkan_Output_Init (vulkan_ctx);
|
||||
|
||||
Vulkan_Matrix_Init (vulkan_ctx);
|
||||
|
@ -579,7 +577,6 @@ vulkan_vid_render_shutdown (void)
|
|||
Vulkan_Scene_Shutdown (vulkan_ctx);
|
||||
Vulkan_Matrix_Shutdown (vulkan_ctx);
|
||||
|
||||
Vulkan_DestroyRenderPasses (vulkan_ctx);
|
||||
Vulkan_Output_Shutdown (vulkan_ctx);
|
||||
|
||||
Vulkan_Palette_Shutdown (vulkan_ctx);
|
||||
|
|
|
@ -1453,6 +1453,7 @@ steps = {
|
|||
};
|
||||
};
|
||||
setup_main = {
|
||||
dependencies = (wait_on_fence);
|
||||
process = {
|
||||
tasks = (
|
||||
{ func = update_framebuffer;
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
#include "QF/Vulkan/render.h"
|
||||
#include "QF/Vulkan/shader.h"
|
||||
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
|
||||
#include "vid_vulkan.h"
|
||||
|
||||
#include "vkparse.h"
|
||||
|
@ -1695,80 +1693,6 @@ QFV_ParseFramebuffer (vulkan_ctx_t *ctx, plitem_t *plist, plitem_t *properties)
|
|||
return framebuffer;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_clearvalueset (const plfield_t *field, const plitem_t *item, void *data,
|
||||
plitem_t *messages, void *context)
|
||||
{
|
||||
plelement_t element = {
|
||||
QFDictionary,
|
||||
sizeof (VkClearValue),
|
||||
vkparse_alloc,
|
||||
parse_VkClearValue,
|
||||
0,
|
||||
};
|
||||
plfield_t f = { 0, 0, 0, 0, &element };
|
||||
|
||||
if (!PL_ParseArray (&f, item, data, messages, context)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
clearvalueset_t *
|
||||
QFV_ParseClearValues (vulkan_ctx_t *ctx, plitem_t *plist, plitem_t *properties)
|
||||
{
|
||||
clearvalueset_t *cv = 0;
|
||||
memsuper_t *memsuper = new_memsuper ();
|
||||
clearvalueset_t *clearValues = 0;
|
||||
|
||||
if (parse_object (ctx, memsuper, plist, parse_clearvalueset, &clearValues,
|
||||
properties)) {
|
||||
cv = DARRAY_ALLOCFIXED (clearvalueset_t, clearValues->size, malloc);
|
||||
memcpy (cv->a, clearValues->a, cv->size * sizeof (cv->a[0]));
|
||||
}
|
||||
delete_memsuper (memsuper);
|
||||
return cv;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_subpassset (const plfield_t *field, const plitem_t *item, void *data,
|
||||
plitem_t *messages, void *context)
|
||||
{
|
||||
plelement_t element = {
|
||||
QFDictionary,
|
||||
sizeof (qfv_osubpass_t),
|
||||
vkparse_alloc,
|
||||
parse_qfv_osubpass_t,
|
||||
0,
|
||||
};
|
||||
plfield_t f = { 0, 0, 0, 0, &element };
|
||||
|
||||
if (!PL_ParseArray (&f, item, data, messages, context)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
qfv_subpassset_t *
|
||||
QFV_ParseSubpasses (vulkan_ctx_t *ctx, plitem_t *plist, plitem_t *properties)
|
||||
{
|
||||
qfv_subpassset_t *sp = 0;
|
||||
memsuper_t *memsuper = new_memsuper ();
|
||||
qfv_subpassset_t *subpasses = 0;
|
||||
|
||||
if (parse_object (ctx, memsuper, plist, parse_subpassset, &subpasses,
|
||||
properties)) {
|
||||
sp = DARRAY_ALLOCFIXED (qfv_subpassset_t, subpasses->size, malloc);
|
||||
memcpy (sp->a, subpasses->a, sp->size * sizeof (sp->a[0]));
|
||||
// the name is in memsuper which is about to be freed
|
||||
for (size_t i = 0; i < sp->size; i++) {
|
||||
sp->a[i].name = strdup (sp->a[i].name);
|
||||
}
|
||||
}
|
||||
delete_memsuper (memsuper);
|
||||
return sp;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_rgba (const plfield_t *field, const plitem_t *item, void *data,
|
||||
plitem_t *messages, void *context)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __vkparse_h
|
||||
#define __vkparse_h
|
||||
|
||||
#include "QF/Vulkan/render.h"
|
||||
|
||||
typedef struct parsectx_s {
|
||||
struct exprctx_s *ectx;
|
||||
struct vulkan_ctx_s *vctx;
|
||||
|
@ -66,9 +68,6 @@ struct qfv_imageviewset_s *QFV_ParseImageViewSet (vulkan_ctx_t *ctx,
|
|||
plitem_t *properties);
|
||||
VkFramebuffer QFV_ParseFramebuffer (vulkan_ctx_t *ctx, plitem_t *plist,
|
||||
plitem_t *properties);
|
||||
struct clearvalueset_s *QFV_ParseClearValues (vulkan_ctx_t *ctx,
|
||||
plitem_t *plist,
|
||||
plitem_t *properties);
|
||||
|
||||
struct qfv_subpassset_s *QFV_ParseSubpasses (vulkan_ctx_t *ctx,
|
||||
plitem_t *plist,
|
||||
|
|
|
@ -30,7 +30,6 @@ search = (
|
|||
VkRenderPassCreateInfo,
|
||||
VkRenderPassMultiviewCreateInfo,
|
||||
|
||||
qfv_osubpass_t,
|
||||
qfv_output_t,
|
||||
|
||||
qfv_descriptorsetlayoutinfo_t,
|
||||
|
|
|
@ -252,8 +252,6 @@ Vulkan_Alias_Init (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&actx->frames, frames);
|
||||
actx->frames.grow = 0;
|
||||
|
||||
actx->depth = Vulkan_CreateGraphicsPipeline (ctx, "alias_depth");
|
||||
actx->gbuf = Vulkan_CreateGraphicsPipeline (ctx, "alias_gbuf");
|
||||
actx->layout = Vulkan_CreatePipelineLayout (ctx, "alias_layout");
|
||||
actx->sampler = Vulkan_CreateSampler (ctx, "alias_sampler");
|
||||
qfvPopDebug (ctx);
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
#include "QF/Vulkan/qf_bsp.h"
|
||||
#include "QF/Vulkan/qf_lightmap.h"
|
||||
#include "QF/Vulkan/qf_matrices.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_scene.h"
|
||||
#include "QF/Vulkan/qf_texture.h"
|
||||
#include "QF/Vulkan/qf_translucent.h"
|
||||
|
@ -88,20 +87,13 @@ typedef struct bsp_push_constants_s {
|
|||
float turb_scale;
|
||||
} bsp_push_constants_t;
|
||||
|
||||
static const char * __attribute__((used)) bsp_pass_names[] = {
|
||||
static const char *bsp_pass_names[] = {
|
||||
"depth",
|
||||
"g-buffer",
|
||||
"sky",
|
||||
"turb",
|
||||
};
|
||||
|
||||
static QFV_Subpass subpass_map[] = {
|
||||
[QFV_bspDepth] = QFV_passDepth,
|
||||
[QFV_bspGBuffer] = QFV_passGBuffer,
|
||||
[QFV_bspSky] = QFV_passTranslucentFrag,
|
||||
[QFV_bspTurb] = QFV_passTranslucentFrag,
|
||||
};
|
||||
|
||||
static void
|
||||
add_texture (texture_t *tx, vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -586,7 +578,7 @@ Vulkan_BuildDisplayLists (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
R_DrawBrushModel (entity_t ent, bsp_pass_t *pass, vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -615,7 +607,7 @@ R_DrawBrushModel (entity_t ent, bsp_pass_t *pass, vulkan_ctx_t *ctx)
|
|||
renderer->render_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
static inline void
|
||||
visit_leaf (mleaf_t *leaf)
|
||||
{
|
||||
|
@ -737,7 +729,7 @@ R_VisitWorldNodes (bsp_pass_t *pass, vulkan_ctx_t *ctx)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
bind_texture (vulktex_t *tex, uint32_t setnum, VkPipelineLayout layout,
|
||||
qfv_devfuncs_t *dfunc, VkCommandBuffer cmd)
|
||||
|
@ -916,7 +908,7 @@ sky_end (vulkan_ctx_t *ctx)
|
|||
|
||||
bsp_end_subpass (bframe->cmdSet.a[QFV_bspSky], ctx);
|
||||
}
|
||||
|
||||
#endif
|
||||
static void
|
||||
clear_queues (bspctx_t *bctx, bsp_pass_t *pass)
|
||||
{
|
||||
|
@ -932,7 +924,7 @@ clear_queues (bspctx_t *bctx, bsp_pass_t *pass)
|
|||
}
|
||||
pass->index_count = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
queue_faces (bsp_pass_t *pass, const bspctx_t *bctx, bspframe_t *bframe)
|
||||
{
|
||||
|
@ -1092,7 +1084,7 @@ Vulkan_DrawWorld (qfv_orenderframe_t *rFrame)
|
|||
draw_queue (pass, 0, layout, device, bframe->cmdSet.a[QFV_bspGBuffer]);
|
||||
bsp_end (ctx);
|
||||
}
|
||||
|
||||
#endif
|
||||
void
|
||||
Vulkan_Bsp_Flush (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -1125,7 +1117,7 @@ Vulkan_Bsp_Flush (vulkan_ctx_t *ctx)
|
|||
};
|
||||
dfunc->vkFlushMappedMemoryRanges (device->dev, 2, ranges);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
Vulkan_DrawWaterSurfaces (qfv_orenderframe_t *rFrame)
|
||||
{
|
||||
|
@ -1189,7 +1181,7 @@ Vulkan_DrawSky (qfv_orenderframe_t *rFrame)
|
|||
|
||||
sky_end (ctx);
|
||||
}
|
||||
|
||||
#endif
|
||||
static void
|
||||
create_default_skys (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -1480,11 +1472,6 @@ Vulkan_Bsp_Init (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&bctx->frames, frames);
|
||||
bctx->frames.grow = 0;
|
||||
|
||||
bctx->depth = Vulkan_CreateGraphicsPipeline (ctx, "bsp_depth");
|
||||
bctx->gbuf = Vulkan_CreateGraphicsPipeline (ctx, "bsp_gbuf");
|
||||
bctx->skybox = Vulkan_CreateGraphicsPipeline (ctx, "bsp_skybox");
|
||||
bctx->skysheet = Vulkan_CreateGraphicsPipeline (ctx, "bsp_skysheet");
|
||||
bctx->turb = Vulkan_CreateGraphicsPipeline (ctx, "bsp_turb");
|
||||
bctx->layout = Vulkan_CreatePipelineLayout (ctx, "quakebsp_layout");
|
||||
bctx->sampler = Vulkan_CreateSampler (ctx, "quakebsp_sampler");
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "QF/sys.h"
|
||||
|
||||
#include "QF/Vulkan/qf_compose.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_translucent.h"
|
||||
#include "QF/Vulkan/debug.h"
|
||||
#include "QF/Vulkan/descriptor.h"
|
||||
|
@ -120,7 +119,6 @@ Vulkan_Compose_Init (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&cctx->frames, frames);
|
||||
cctx->frames.grow = 0;
|
||||
|
||||
cctx->pipeline = Vulkan_CreateGraphicsPipeline (ctx, "compose");
|
||||
cctx->layout = Vulkan_CreatePipelineLayout (ctx, "compose_layout");
|
||||
|
||||
__auto_type cmdSet = QFV_AllocCommandBufferSet (1, alloca);
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#include "compat.h"
|
||||
#include "QF/Vulkan/qf_draw.h"
|
||||
#include "QF/Vulkan/qf_matrices.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_texture.h"
|
||||
#include "QF/Vulkan/qf_vid.h"
|
||||
#include "QF/Vulkan/barrier.h"
|
||||
|
@ -63,6 +62,7 @@
|
|||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/image.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
#include "QF/Vulkan/resource.h"
|
||||
#include "QF/Vulkan/scrap.h"
|
||||
#include "QF/Vulkan/staging.h"
|
||||
|
@ -1089,9 +1089,6 @@ Vulkan_Draw_Init (vulkan_ctx_t *ctx)
|
|||
|
||||
flush_draw_scrap (ctx);
|
||||
|
||||
dctx->quad_pipeline = Vulkan_CreateGraphicsPipeline (ctx, "slice");
|
||||
dctx->line_pipeline = Vulkan_CreateGraphicsPipeline (ctx, "lines");
|
||||
|
||||
dctx->lines_layout = Vulkan_CreatePipelineLayout (ctx, "lines_layout");
|
||||
dctx->quad_layout = Vulkan_CreatePipelineLayout (ctx, "quad_layout");
|
||||
__auto_type sl = Vulkan_CreateDescriptorSetLayout (ctx, "quad_data_set");
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
#include "QF/Vulkan/qf_iqm.h"
|
||||
#include "QF/Vulkan/qf_matrices.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_texture.h"
|
||||
#include "QF/Vulkan/debug.h"
|
||||
#include "QF/Vulkan/descriptor.h"
|
||||
|
@ -316,8 +315,6 @@ Vulkan_IQM_Init (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&ictx->frames, frames);
|
||||
ictx->frames.grow = 0;
|
||||
|
||||
ictx->depth = Vulkan_CreateGraphicsPipeline (ctx, "iqm_depth");
|
||||
ictx->gbuf = Vulkan_CreateGraphicsPipeline (ctx, "iqm_gbuf");
|
||||
ictx->layout = Vulkan_CreatePipelineLayout (ctx, "iqm_layout");
|
||||
ictx->sampler = Vulkan_CreateSampler (ctx, "alias_sampler");
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
|
||||
#include "QF/Vulkan/qf_draw.h"
|
||||
#include "QF/Vulkan/qf_lighting.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_texture.h"
|
||||
#include "QF/Vulkan/barrier.h"
|
||||
#include "QF/Vulkan/buffer.h"
|
||||
|
@ -146,7 +145,7 @@ update_lights (vulkan_ctx_t *ctx)
|
|||
0, 0, 0, 1, &bb.barrier, 0, 0);
|
||||
QFV_PacketSubmit (packet);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
lighting_draw_maps (qfv_orenderframe_t *rFrame)
|
||||
{
|
||||
|
@ -207,8 +206,6 @@ lighting_draw_maps (qfv_orenderframe_t *rFrame)
|
|||
void
|
||||
Vulkan_Lighting_CreateRenderPasses (vulkan_ctx_t *ctx)
|
||||
{
|
||||
lightingctx_t *lctx = calloc (1, sizeof (lightingctx_t));
|
||||
ctx->lighting_context = lctx;
|
||||
|
||||
// extents are dynamic and filled in for each light
|
||||
// frame buffers are highly dynamic
|
||||
|
@ -220,7 +217,7 @@ Vulkan_Lighting_CreateRenderPasses (vulkan_ctx_t *ctx)
|
|||
|
||||
lctx->qfv_renderpass = rp;
|
||||
}
|
||||
|
||||
#endif
|
||||
static VkDescriptorBufferInfo base_buffer_info = {
|
||||
0, 0, VK_WHOLE_SIZE
|
||||
};
|
||||
|
@ -302,6 +299,9 @@ Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
|||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
lightingctx_t *lctx = calloc (1, sizeof (lightingctx_t));
|
||||
ctx->lighting_context = lctx;
|
||||
|
||||
qfvPushDebug (ctx, "lighting init");
|
||||
QFV_Render_AddTasks (ctx, lighting_task_syms);
|
||||
|
||||
|
@ -309,7 +309,7 @@ Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
|||
|
||||
Vulkan_Script_SetOutput (ctx,
|
||||
&(qfv_output_t) { .format = VK_FORMAT_X8_D24_UNORM_PACK32 });
|
||||
lightingctx_t *lctx = ctx->lighting_context;
|
||||
#if 0
|
||||
plitem_t *rp_def = lctx->qfv_renderpass->renderpassDef;
|
||||
plitem_t *rp_cfg = PL_ObjectForKey (rp_def, "renderpass_6");
|
||||
lctx->renderpass_6 = QFV_ParseRenderPass (ctx, rp_cfg, rp_def);
|
||||
|
@ -317,7 +317,7 @@ Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
|||
lctx->renderpass_4 = QFV_ParseRenderPass (ctx, rp_cfg, rp_def);
|
||||
rp_cfg = PL_ObjectForKey (rp_def, "renderpass_1");
|
||||
lctx->renderpass_1 = QFV_ParseRenderPass (ctx, rp_cfg, rp_def);
|
||||
|
||||
#endif
|
||||
lctx->cmdpool = QFV_CreateCommandPool (device, device->queue.queueFamily,
|
||||
1, 1);
|
||||
|
||||
|
@ -331,7 +331,6 @@ Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&lctx->frames, frames);
|
||||
lctx->frames.grow = 0;
|
||||
|
||||
lctx->pipeline = Vulkan_CreateGraphicsPipeline (ctx, "lighting");
|
||||
lctx->layout = Vulkan_CreatePipelineLayout (ctx, "lighting_layout");
|
||||
lctx->sampler = Vulkan_CreateSampler (ctx, "shadow_sampler");
|
||||
|
||||
|
@ -611,6 +610,7 @@ create_view (const light_renderer_t *lr, int id, vulkan_ctx_t *ctx)
|
|||
static VkFramebuffer
|
||||
create_framebuffer (const light_renderer_t *lr, vulkan_ctx_t *ctx)
|
||||
{
|
||||
return 0;//FIXME
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
#include "QF/Vulkan/qf_matrices.h"
|
||||
#include "QF/Vulkan/qf_output.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_translucent.h"
|
||||
|
@ -67,7 +66,7 @@
|
|||
#include "mod_internal.h"
|
||||
#include "r_internal.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
||||
#if 0
|
||||
static void
|
||||
Vulkan_DrawViewModel (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -103,7 +102,7 @@ Vulkan_RenderView (qfv_orenderframe_t *rFrame)
|
|||
Vulkan_Bsp_Flush (ctx);
|
||||
Vulkan_Scene_Flush (ctx);
|
||||
}
|
||||
|
||||
#endif
|
||||
void
|
||||
Vulkan_NewScene (scene_t *scene, vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -125,24 +124,3 @@ 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_orenderframe_t *rFrame)
|
||||
{
|
||||
Vulkan_RenderView (rFrame);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Main_CreateRenderPasses (vulkan_ctx_t *ctx)
|
||||
{
|
||||
__auto_type rp = QFV_RenderPass_New (ctx, "deferred", main_draw);
|
||||
Vulkan_ConfigOutput (ctx, &rp->output);
|
||||
QFV_RenderPass_CreateAttachments (rp);
|
||||
QFV_RenderPass_CreateRenderPass (rp);
|
||||
QFV_RenderPass_CreateFramebuffer (rp);
|
||||
rp->order = QFV_rp_main;
|
||||
DARRAY_APPEND (&ctx->renderPasses, rp);
|
||||
|
||||
Vulkan_Output_SetInput (ctx, rp->output.view);
|
||||
Vulkan_Translucent_CreateBuffers (ctx, rp->output.extent);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/Vulkan/qf_matrices.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/barrier.h"
|
||||
#include "QF/Vulkan/buffer.h"
|
||||
#include "QF/Vulkan/debug.h"
|
||||
|
@ -51,6 +50,7 @@
|
|||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/projection.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
#include "QF/Vulkan/staging.h"
|
||||
|
||||
#include "r_internal.h"
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "QF/Vulkan/qf_draw.h"
|
||||
#include "QF/Vulkan/qf_matrices.h"
|
||||
#include "QF/Vulkan/qf_output.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_vid.h"
|
||||
#include "QF/Vulkan/capture.h"
|
||||
#include "QF/Vulkan/debug.h"
|
||||
|
@ -62,48 +61,6 @@
|
|||
#include "vid_vulkan.h"
|
||||
#include "vkparse.h"//FIXME
|
||||
|
||||
static void
|
||||
preoutput_draw (qfv_orenderframe_t *rFrame)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
process_input (qfv_orenderframe_t *rFrame)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
draw_output (qfv_orenderframe_t *rFrame)
|
||||
{
|
||||
process_input (rFrame);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Output_CreateRenderPasses (vulkan_ctx_t *ctx)
|
||||
{
|
||||
outputctx_t *octx = calloc (1, sizeof (outputctx_t));
|
||||
ctx->output_context = octx;
|
||||
|
||||
__auto_type out = QFV_RenderPass_New (ctx, "output", draw_output);
|
||||
out->output = (qfv_output_t) {
|
||||
.extent = ctx->swapchain->extent,
|
||||
.format = ctx->swapchain->format,
|
||||
.frames = ctx->swapchain->numImages,
|
||||
.view_list = ctx->swapchain->imageViews->a,
|
||||
};
|
||||
QFV_RenderPass_CreateRenderPass (out);
|
||||
QFV_RenderPass_CreateFramebuffer (out);
|
||||
ctx->output_renderpass = out;
|
||||
|
||||
|
||||
out->order = QFV_rp_output;
|
||||
DARRAY_APPEND (&ctx->renderPasses, out);
|
||||
|
||||
__auto_type pre = QFV_RenderPass_New (ctx, "preoutput", preoutput_draw);
|
||||
pre->order = QFV_rp_preoutput;
|
||||
DARRAY_APPEND (&ctx->renderPasses, pre);
|
||||
}
|
||||
|
||||
static void
|
||||
acquire_output (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
|
@ -132,17 +89,6 @@ acquire_output (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
sc = ctx->swapchain;
|
||||
Vulkan_CreateCapture (ctx);
|
||||
|
||||
__auto_type out = ctx->output_renderpass;
|
||||
out->output = (qfv_output_t) {
|
||||
.extent = ctx->swapchain->extent,
|
||||
.format = ctx->swapchain->format,
|
||||
.frames = ctx->swapchain->numImages,
|
||||
.view_list = ctx->swapchain->imageViews->a,
|
||||
};
|
||||
out->viewport.width = out->output.extent.width;
|
||||
out->viewport.height = out->output.extent.height;
|
||||
out->scissor.extent = out->output.extent;
|
||||
|
||||
dfunc->vkDestroySemaphore (device->dev, frame->imageAvailableSemaphore,
|
||||
0);
|
||||
frame->imageAvailableSemaphore = QFV_CreateSemaphore (device);
|
||||
|
@ -243,6 +189,7 @@ output_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
};
|
||||
dfunc->vkCmdBindDescriptorSets (cmd, VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
layout, 0, 2, set, 0, 0);
|
||||
#if 0
|
||||
if (scr_fisheye) {
|
||||
float width = r_refdef.vrect.width;
|
||||
float height = r_refdef.vrect.height;
|
||||
|
@ -261,6 +208,7 @@ output_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
};
|
||||
QFV_PushConstants (device, cmd, layout, 1, push_constants);
|
||||
}
|
||||
#endif
|
||||
|
||||
dfunc->vkCmdDraw (cmd, 3, 1, 0, 0);
|
||||
}
|
||||
|
@ -292,11 +240,12 @@ Vulkan_Output_Init (vulkan_ctx_t *ctx)
|
|||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
|
||||
outputctx_t *octx = calloc (1, sizeof (outputctx_t));
|
||||
ctx->output_context = octx;
|
||||
|
||||
qfvPushDebug (ctx, "output init");
|
||||
QFV_Render_AddTasks (ctx, output_task_syms);
|
||||
|
||||
outputctx_t *octx = ctx->output_context;
|
||||
|
||||
auto rctx = ctx->render_context;
|
||||
size_t frames = rctx->frames.size;
|
||||
DARRAY_INIT (&octx->frames, frames);
|
||||
|
@ -306,9 +255,6 @@ Vulkan_Output_Init (vulkan_ctx_t *ctx)
|
|||
__auto_type pld = ctx->script_context->pipelineDef;//FIXME
|
||||
ctx->script_context->pipelineDef = Vulkan_GetConfig (ctx, "qf_output");
|
||||
|
||||
octx->output = Vulkan_CreateGraphicsPipeline (ctx, "output");
|
||||
octx->waterwarp = Vulkan_CreateGraphicsPipeline (ctx, "waterwarp");
|
||||
octx->fisheye = Vulkan_CreateGraphicsPipeline (ctx, "fisheye");
|
||||
octx->output_layout = Vulkan_CreatePipelineLayout (ctx, "output_layout");
|
||||
octx->warp_layout = Vulkan_CreatePipelineLayout (ctx, "waterwarp_layout");
|
||||
octx->fish_layout = Vulkan_CreatePipelineLayout (ctx, "fisheye_layout");
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "QF/Vulkan/qf_matrices.h"
|
||||
#include "QF/Vulkan/qf_palette.h"
|
||||
#include "QF/Vulkan/qf_particles.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_translucent.h"
|
||||
|
||||
#include "r_internal.h"
|
||||
|
@ -275,7 +274,7 @@ update_particles (const exprval_t **p, exprval_t *result, exprctx_t *ectx)
|
|||
0, 0);
|
||||
|
||||
dfunc->vkCmdBindPipeline (packet->cmd, VK_PIPELINE_BIND_POINT_COMPUTE,
|
||||
pctx->update);
|
||||
taskctx->pipeline->pipeline);
|
||||
VkDescriptorSet set[3] = {
|
||||
pframe->curDescriptors,
|
||||
pframe->inDescriptors,
|
||||
|
@ -436,9 +435,6 @@ Vulkan_Particles_Init (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&pctx->frames, frames);
|
||||
pctx->frames.grow = 0;
|
||||
|
||||
pctx->physics = Vulkan_CreateComputePipeline (ctx, "partphysics");
|
||||
pctx->update = Vulkan_CreateComputePipeline (ctx, "partupdate");
|
||||
pctx->draw = Vulkan_CreateGraphicsPipeline (ctx, "partdraw");
|
||||
pctx->physics_layout = Vulkan_CreatePipelineLayout (ctx,
|
||||
"partphysics_layout");
|
||||
pctx->update_layout = Vulkan_CreatePipelineLayout (ctx,
|
||||
|
@ -506,16 +502,3 @@ Vulkan_ParticleSystem (vulkan_ctx_t *ctx)
|
|||
{
|
||||
return ctx->particle_context->psystem; //FIXME support more
|
||||
}
|
||||
|
||||
static void
|
||||
particles_update (qfv_orenderframe_t *rFrame)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Particles_CreateRenderPasses (vulkan_ctx_t *ctx)
|
||||
{
|
||||
__auto_type rp = QFV_RenderPass_New (ctx, "particles", particles_update);
|
||||
rp->order = QFV_rp_particles;
|
||||
DARRAY_APPEND (&ctx->renderPasses, rp);
|
||||
}
|
||||
|
|
|
@ -1,380 +0,0 @@
|
|||
/*
|
||||
renderpass.c
|
||||
|
||||
Vulkan render pass and frame buffer functions
|
||||
|
||||
Copyright (C) 2020 Bill Currie <bill@taniwha.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/hash.h"
|
||||
#include "QF/plist.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "QF/Vulkan/command.h"
|
||||
#include "QF/Vulkan/debug.h"
|
||||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/image.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
|
||||
#include "vid_vulkan.h"
|
||||
#include "vkparse.h"
|
||||
|
||||
static plitem_t *
|
||||
get_rp_item (vulkan_ctx_t *ctx, qfv_orenderpass_t *rp, const char *name)
|
||||
{
|
||||
rp->renderpassDef = Vulkan_GetConfig (ctx, rp->name);
|
||||
|
||||
plitem_t *item = rp->renderpassDef;
|
||||
if (!item) {
|
||||
Sys_Printf ("error loading %s\n", rp->name);
|
||||
} else if ((item = PL_ObjectForKey (item, name))) {
|
||||
Sys_MaskPrintf (SYS_vulkan_parse, "Found %s def\n", name);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
static size_t
|
||||
get_image_size (VkImage image, qfv_device_t *device)
|
||||
{
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
size_t size;
|
||||
size_t align;
|
||||
|
||||
VkMemoryRequirements requirements;
|
||||
dfunc->vkGetImageMemoryRequirements (device->dev, image, &requirements);
|
||||
size = requirements.size;
|
||||
align = requirements.alignment - 1;
|
||||
size = (size + align) & ~(align);
|
||||
return size;
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_framebuffers (vulkan_ctx_t *ctx, qfv_orenderpass_t *rp)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
for (size_t i = 0; i < rp->framebuffers->size; i++) {
|
||||
dfunc->vkDestroyFramebuffer (device->dev, rp->framebuffers->a[i], 0);
|
||||
}
|
||||
free (rp->framebuffers);
|
||||
rp->framebuffers = 0;
|
||||
}
|
||||
|
||||
void
|
||||
QFV_RenderPass_CreateAttachments (qfv_orenderpass_t *renderpass)
|
||||
{
|
||||
vulkan_ctx_t *ctx = renderpass->vulkan_ctx;
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
__auto_type rp = renderpass;
|
||||
|
||||
if (rp->output.image) {
|
||||
// if output has an image, then the view is owned by the renderpass
|
||||
dfunc->vkDestroyImageView (device->dev, rp->output.view, 0);
|
||||
dfunc->vkDestroyImage (device->dev, rp->output.image, 0);
|
||||
free (rp->output.view_list);
|
||||
rp->output.view_list = 0;
|
||||
rp->output.view = 0;
|
||||
rp->output.image = 0;
|
||||
}
|
||||
if (rp->attachment_views) {
|
||||
for (size_t i = 0; i < rp->attachment_views->size; i++) {
|
||||
dfunc->vkDestroyImageView (device->dev,
|
||||
rp->attachment_views->a[i], 0);
|
||||
}
|
||||
free (rp->attachment_views);
|
||||
rp->attachment_views = 0;
|
||||
}
|
||||
if (rp->attachment_images) {
|
||||
for (size_t i = 0; i < rp->attachment_images->size; i++) {
|
||||
dfunc->vkDestroyImage (device->dev, rp->attachment_images->a[i], 0);
|
||||
}
|
||||
free (rp->attachment_images);
|
||||
rp->attachment_images = 0;
|
||||
}
|
||||
|
||||
plitem_t *output_def = get_rp_item (ctx, rp, "output");
|
||||
plitem_t *images_def = get_rp_item (ctx, rp, "images");
|
||||
plitem_t *views_def = get_rp_item (ctx, rp, "imageViews");
|
||||
|
||||
plitem_t *rp_def = rp->renderpassDef;
|
||||
|
||||
size_t memSize = 0;
|
||||
VkImage ref_image = 0;
|
||||
if (output_def) {
|
||||
// QFV_ParseOutput clears the structure, but extent and frames need to
|
||||
// be preserved
|
||||
qfv_output_t output = rp->output;
|
||||
QFV_ParseOutput (ctx, &output, output_def, rp_def);
|
||||
rp->output.format = output.format;
|
||||
rp->output.finalLayout = output.finalLayout;
|
||||
|
||||
plitem_t *image = PL_ObjectForKey (output_def, "image");
|
||||
Vulkan_Script_SetOutput (ctx, &rp->output);
|
||||
rp->output.image = QFV_ParseImage (ctx, image, rp_def);
|
||||
memSize += get_image_size (rp->output.image, device);
|
||||
ref_image = rp->output.image;
|
||||
}
|
||||
if (images_def) {
|
||||
__auto_type images = QFV_ParseImageSet (ctx, images_def, rp_def);
|
||||
rp->attachment_images = images;
|
||||
ref_image = images->a[0];
|
||||
for (size_t i = 0; i < images->size; i++) {
|
||||
memSize += get_image_size (images->a[i], device);
|
||||
}
|
||||
}
|
||||
VkDeviceMemory mem = rp->attachmentMemory;
|
||||
if (memSize > rp->attachmentMemory_size) {
|
||||
if (rp->attachmentMemory) {
|
||||
dfunc->vkFreeMemory (device->dev, rp->attachmentMemory, 0);
|
||||
}
|
||||
rp->attachmentMemory_size = memSize;
|
||||
mem = QFV_AllocImageMemory (device, ref_image,
|
||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||
memSize, 0);
|
||||
rp->attachmentMemory = mem;
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_DEVICE_MEMORY,
|
||||
mem, "memory:framebuffers");
|
||||
}
|
||||
size_t offset = 0;
|
||||
if (rp->output.image) {
|
||||
QFV_BindImageMemory (device, rp->output.image, mem, offset);
|
||||
offset += get_image_size (rp->output.image, device);
|
||||
|
||||
plitem_t *view = PL_ObjectForKey (output_def, "view");
|
||||
Vulkan_Script_SetOutput (ctx, &rp->output);
|
||||
rp->output.view = QFV_ParseImageView (ctx, view, rp_def);
|
||||
rp->output.view_list = malloc (rp->output.frames
|
||||
* sizeof (VkImageView));
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE,
|
||||
rp->output.image,
|
||||
va (ctx->va_ctx, "image:%s:output", rp->name));
|
||||
QFV_duSetObjectName (ctx->device, VK_OBJECT_TYPE_IMAGE_VIEW,
|
||||
rp->output.view,
|
||||
va (ctx->va_ctx, "iview:%s:output", rp->name));
|
||||
for (uint32_t i = 0; i < rp->output.frames; i++) {
|
||||
rp->output.view_list[i] = rp->output.view;
|
||||
}
|
||||
}
|
||||
if (rp->attachment_images) {
|
||||
__auto_type images = rp->attachment_images;
|
||||
for (size_t i = 0; i < images->size; i++) {
|
||||
QFV_BindImageMemory (device, images->a[i], mem, offset);
|
||||
offset += get_image_size (images->a[i], device);
|
||||
}
|
||||
}
|
||||
|
||||
if (views_def) {
|
||||
__auto_type views = QFV_ParseImageViewSet (ctx, views_def, rp_def);
|
||||
rp->attachment_views = views;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
QFV_RenderPass_CreateRenderPass (qfv_orenderpass_t *renderpass)
|
||||
{
|
||||
vulkan_ctx_t *ctx = renderpass->vulkan_ctx;
|
||||
__auto_type rp = renderpass;
|
||||
|
||||
plitem_t *rp_cfg = get_rp_item (ctx, rp, "renderpass");
|
||||
if (rp_cfg) {
|
||||
hashtab_t *tab = ctx->script_context->renderpasses;
|
||||
const char *path;
|
||||
path = va (ctx->va_ctx, "$"QFV_PROPERTIES".%s", rp->name);
|
||||
__auto_type renderpass = (VkRenderPass) QFV_GetHandle (tab, path);
|
||||
if (renderpass) {
|
||||
rp->renderpass = renderpass;
|
||||
} else {
|
||||
Vulkan_Script_SetOutput (ctx, &rp->output);
|
||||
rp->renderpass = QFV_ParseRenderPass (ctx, rp_cfg,
|
||||
rp->renderpassDef);
|
||||
QFV_AddHandle (tab, path, (uint64_t) rp->renderpass);
|
||||
QFV_duSetObjectName (ctx->device, VK_OBJECT_TYPE_RENDER_PASS,
|
||||
rp->renderpass, va (ctx->va_ctx,
|
||||
"renderpass:%s",
|
||||
rp->name));
|
||||
}
|
||||
rp->subpassCount = PL_A_NumObjects (PL_ObjectForKey (rp_cfg,
|
||||
"subpasses"));
|
||||
}
|
||||
|
||||
|
||||
plitem_t *item = get_rp_item (ctx, rp, "clearValues");
|
||||
rp->clearValues = QFV_ParseClearValues (ctx, item, rp->renderpassDef);
|
||||
}
|
||||
|
||||
void
|
||||
QFV_RenderPass_CreateFramebuffer (qfv_orenderpass_t *renderpass)
|
||||
{
|
||||
vulkan_ctx_t *ctx = renderpass->vulkan_ctx;
|
||||
__auto_type rp = renderpass;
|
||||
|
||||
if (renderpass->framebuffers) {
|
||||
destroy_framebuffers (ctx, renderpass);
|
||||
}
|
||||
|
||||
plitem_t *fb_def = get_rp_item (ctx, rp, "framebuffer");
|
||||
plitem_t *rp_def = rp->renderpassDef;
|
||||
if (fb_def) {
|
||||
rp->framebuffers = QFV_AllocFrameBuffers (rp->output.frames, malloc);
|
||||
for (size_t i = 0; i < rp->framebuffers->size; i++) {
|
||||
rp->output.view = rp->output.view_list[i];
|
||||
Vulkan_Script_SetOutput (ctx, &rp->output);
|
||||
rp->framebuffers->a[i] = QFV_ParseFramebuffer (ctx, fb_def, rp_def);
|
||||
}
|
||||
}
|
||||
|
||||
int width = rp->output.extent.width;
|
||||
int height = rp->output.extent.height;
|
||||
rp->viewport = (VkViewport) { 0, 0, width, height, 0, 1 };
|
||||
rp->scissor = (VkRect2D) { {0, 0}, {width, height} };
|
||||
rp->renderArea = (VkRect2D) { {0, 0}, {width, height} };
|
||||
}
|
||||
|
||||
static void
|
||||
init_renderframe (vulkan_ctx_t *ctx, qfv_orenderpass_t *rp,
|
||||
qfv_orenderframe_t *rFrame)
|
||||
{
|
||||
rFrame->vulkan_ctx = ctx;
|
||||
rFrame->renderpass = rp;
|
||||
rFrame->subpassContents = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS;
|
||||
rFrame->framebuffer = 0;
|
||||
rFrame->subpassCount = rp->subpassCount;
|
||||
rFrame->subpassInfo = 0;
|
||||
if (rp->subpass_info) {
|
||||
rFrame->subpassInfo = rp->subpass_info->a;
|
||||
}
|
||||
rFrame->subpassCmdSets = malloc (rp->subpassCount
|
||||
* sizeof (qfv_cmdbufferset_t));
|
||||
for (size_t j = 0; j < rp->subpassCount; j++) {
|
||||
DARRAY_INIT (&rFrame->subpassCmdSets[j], 4);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_attachments (vulkan_ctx_t *ctx, qfv_orenderpass_t *rp)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
if (rp->output.image) {
|
||||
// if output has an image, then the view is owned by the renderpass
|
||||
dfunc->vkDestroyImageView (device->dev, rp->output.view, 0);
|
||||
dfunc->vkDestroyImage (device->dev, rp->output.image, 0);
|
||||
free (rp->output.view_list);
|
||||
rp->output.view_list = 0;
|
||||
rp->output.view = 0;
|
||||
rp->output.image = 0;
|
||||
}
|
||||
if (rp->attachment_views) {
|
||||
for (size_t i = 0; i < rp->attachment_views->size; i++) {
|
||||
dfunc->vkDestroyImageView (device->dev,
|
||||
rp->attachment_views->a[i], 0);
|
||||
}
|
||||
}
|
||||
if (rp->attachment_images) {
|
||||
for (size_t i = 0; i < rp->attachment_images->size; i++) {
|
||||
dfunc->vkDestroyImage (device->dev, rp->attachment_images->a[i], 0);
|
||||
}
|
||||
}
|
||||
dfunc->vkFreeMemory (device->dev, rp->attachmentMemory, 0);
|
||||
|
||||
free (rp->attachment_images);
|
||||
free (rp->attachment_views);
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_renderframes (vulkan_ctx_t *ctx, qfv_orenderpass_t *rp)
|
||||
{
|
||||
for (size_t i = 0; i < rp->frames.size; i++) {
|
||||
__auto_type rFrame = &rp->frames.a[i];
|
||||
for (int j = 0; j < rFrame->subpassCount; j++) {
|
||||
DARRAY_CLEAR (&rFrame->subpassCmdSets[j]);
|
||||
}
|
||||
free (rFrame->subpassCmdSets);
|
||||
}
|
||||
}
|
||||
|
||||
qfv_orenderpass_t *
|
||||
QFV_RenderPass_New (vulkan_ctx_t *ctx, const char *name, qfv_draw_t function)
|
||||
{
|
||||
qfv_orenderpass_t *rp = calloc (1, sizeof (qfv_orenderpass_t));
|
||||
rp->vulkan_ctx = ctx;
|
||||
rp->name = name;
|
||||
rp->draw = function;
|
||||
rp->renderpassDef = Vulkan_GetConfig (ctx, rp->name);
|
||||
|
||||
plitem_t *rp_info = get_rp_item (ctx, rp, "info");
|
||||
if (rp_info) {
|
||||
plitem_t *subpass_info = PL_ObjectForKey (rp_info, "subpass_info");
|
||||
if (subpass_info) {
|
||||
rp->subpass_info = QFV_ParseSubpasses (ctx, subpass_info,
|
||||
rp->renderpassDef);
|
||||
if (rp->subpass_info->size < rp->subpassCount) {
|
||||
Sys_Printf ("warning:%s:%d: insufficient entries in "
|
||||
"subpass_info\n", rp->name, PL_Line (subpass_info));
|
||||
}
|
||||
if (!rp->subpassCount) {
|
||||
rp->subpassCount = rp->subpass_info->size;
|
||||
}
|
||||
}
|
||||
|
||||
plitem_t *color = PL_ObjectForKey (rp_info, "color");
|
||||
if (color) {
|
||||
QFV_ParseRGBA (ctx, (float *)&rp->color, color, rp->renderpassDef);
|
||||
}
|
||||
}
|
||||
if (!rp->subpassCount) {
|
||||
rp->subpassCount = 1;
|
||||
}
|
||||
|
||||
DARRAY_INIT (&rp->frames, 4);
|
||||
//DARRAY_RESIZE (&rp->frames, ctx->frames.size);
|
||||
for (size_t i = 0; i < rp->frames.size; i++) {
|
||||
init_renderframe (ctx, rp, &rp->frames.a[i]);
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
void
|
||||
QFV_RenderPass_Delete (qfv_orenderpass_t *renderpass)
|
||||
{
|
||||
vulkan_ctx_t *ctx = renderpass->vulkan_ctx;
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
destroy_attachments (ctx, renderpass);
|
||||
dfunc->vkDestroyRenderPass (device->dev, renderpass->renderpass, 0);
|
||||
destroy_renderframes (ctx, renderpass);
|
||||
if (renderpass->framebuffers) {
|
||||
destroy_framebuffers (ctx, renderpass);
|
||||
}
|
||||
|
||||
DARRAY_CLEAR (&renderpass->frames);
|
||||
free (renderpass->clearValues);
|
||||
free (renderpass);
|
||||
}
|
|
@ -54,7 +54,6 @@
|
|||
#include "QF/scene/entity.h"
|
||||
|
||||
#include "QF/Vulkan/qf_matrices.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_sprite.h"
|
||||
#include "QF/Vulkan/qf_texture.h"
|
||||
#include "QF/Vulkan/buffer.h"
|
||||
|
@ -234,8 +233,6 @@ Vulkan_Sprite_Init (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&sctx->frames, frames);
|
||||
sctx->frames.grow = 0;
|
||||
|
||||
sctx->depth = Vulkan_CreateGraphicsPipeline (ctx, "sprite_depth");
|
||||
sctx->gbuf = Vulkan_CreateGraphicsPipeline (ctx, "sprite_gbuf");
|
||||
sctx->layout = Vulkan_CreatePipelineLayout (ctx, "sprite_layout");
|
||||
sctx->sampler = Vulkan_CreateSampler (ctx, "sprite_sampler");
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_translucent.h"
|
||||
#include "QF/Vulkan/barrier.h"
|
||||
#include "QF/Vulkan/debug.h"
|
||||
|
@ -53,8 +52,10 @@
|
|||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/image.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
#include "QF/Vulkan/resource.h"
|
||||
#include "QF/Vulkan/staging.h"
|
||||
#include "QF/Vulkan/swapchain.h"
|
||||
|
||||
#include "r_internal.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
@ -154,24 +155,12 @@ Vulkan_Translucent_Init (vulkan_ctx_t *ctx)
|
|||
|
||||
__auto_type sets = QFV_AllocateDescriptorSet (device, pool, setLayout);
|
||||
for (size_t i = 0; i < frames; i++) {
|
||||
__auto_type tframe = &tctx->frames.a[i];
|
||||
|
||||
DARRAY_INIT (&tframe->cmdSet, QFV_translucentNumPasses);
|
||||
DARRAY_RESIZE (&tframe->cmdSet, QFV_translucentNumPasses);
|
||||
tframe->cmdSet.grow = 0;
|
||||
|
||||
QFV_AllocateCommandBuffers (device, ctx->cmdpool, 1, &tframe->cmdSet);
|
||||
|
||||
tframe->descriptors = sets->a[i];
|
||||
|
||||
for (int j = 0; j < QFV_translucentNumPasses; j++) {
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_COMMAND_BUFFER,
|
||||
tframe->cmdSet.a[j],
|
||||
va (ctx->va_ctx, "cmd:translucent:%zd:%s", i,
|
||||
translucent_pass_names[j]));
|
||||
}
|
||||
tctx->frames.a[i] = (translucentframe_t) {
|
||||
.descriptors = sets->a[i],
|
||||
};
|
||||
}
|
||||
free (sets);
|
||||
Vulkan_Translucent_CreateBuffers (ctx, ctx->swapchain->extent);//FIXME
|
||||
qfvPopDebug (ctx);
|
||||
}
|
||||
|
||||
|
@ -308,66 +297,3 @@ Vulkan_Translucent_CreateBuffers (vulkan_ctx_t *ctx, VkExtent2D extent)
|
|||
dfunc->vkUpdateDescriptorSets (device->dev, 2, write, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
translucent_clear (qfv_orenderframe_t *rFrame)
|
||||
{
|
||||
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
translucentctx_t *tctx = ctx->translucent_context;
|
||||
__auto_type tframe = &tctx->frames.a[ctx->curFrame];
|
||||
VkCommandBuffer cmd = tframe->cmdSet.a[QFV_translucentClear];
|
||||
|
||||
DARRAY_APPEND (&rFrame->subpassCmdSets[0], cmd);
|
||||
dfunc->vkResetCommandBuffer (cmd, 0);
|
||||
VkCommandBufferInheritanceInfo inherit = {
|
||||
VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
};
|
||||
VkCommandBufferBeginInfo beginInfo = {
|
||||
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, 0,
|
||||
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, &inherit,
|
||||
};
|
||||
dfunc->vkBeginCommandBuffer (cmd, &beginInfo);
|
||||
|
||||
qfv_imagebarrier_t ib = imageBarriers[qfv_LT_Undefined_to_TransferDst];
|
||||
ib.barrier.image = tframe->heads;
|
||||
ib.barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;
|
||||
dfunc->vkCmdPipelineBarrier (cmd, ib.srcStages, ib.dstStages,
|
||||
0, 0, 0, 0, 0,
|
||||
1, &ib.barrier);
|
||||
VkClearColorValue clear_color[] = {
|
||||
{ .int32 = {-1, -1, -1, -1} },
|
||||
};
|
||||
VkImageSubresourceRange ranges[] = {
|
||||
{ VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, VK_REMAINING_ARRAY_LAYERS },
|
||||
};
|
||||
dfunc->vkCmdClearColorImage (cmd, tframe->heads,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
clear_color, 1, ranges);
|
||||
ib = imageBarriers[qfv_LT_TransferDst_to_General];
|
||||
ib.barrier.image = tframe->heads;
|
||||
ib.barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;
|
||||
dfunc->vkCmdPipelineBarrier (cmd, ib.srcStages, ib.dstStages,
|
||||
0, 0, 0, 0, 0,
|
||||
1, &ib.barrier);
|
||||
|
||||
dfunc->vkEndCommandBuffer (cmd);
|
||||
|
||||
qfv_packet_t *packet = QFV_PacketAcquire (ctx->staging);
|
||||
qfv_transtate_t *state = QFV_PacketExtend (packet, 2 * sizeof (*state));
|
||||
*state = (qfv_transtate_t) { 0, tctx->maxFragments };
|
||||
__auto_type bb = &bufferBarriers[qfv_BB_TransferWrite_to_ShaderRW];
|
||||
QFV_PacketCopyBuffer (packet, tframe->state, 0, bb);
|
||||
QFV_PacketSubmit (packet);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Translucent_CreateRenderPasses (vulkan_ctx_t *ctx)
|
||||
{
|
||||
__auto_type rp = QFV_RenderPass_New (ctx, "translucent", translucent_clear);
|
||||
rp->order = QFV_rp_translucent;
|
||||
DARRAY_APPEND (&ctx->renderPasses, rp);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include "QF/Vulkan/qf_main.h"
|
||||
#include "QF/Vulkan/qf_output.h"
|
||||
#include "QF/Vulkan/qf_particles.h"
|
||||
#include "QF/Vulkan/qf_renderpass.h"
|
||||
#include "QF/Vulkan/qf_translucent.h"
|
||||
#include "QF/Vulkan/qf_vid.h"
|
||||
|
||||
|
@ -184,35 +183,6 @@ Vulkan_CreateSwapchain (vulkan_ctx_t *ctx)
|
|||
ctx->swapchain = QFV_CreateSwapchain (ctx, old_swapchain);
|
||||
}
|
||||
|
||||
static int
|
||||
renderpass_cmp (const void *_a, const void *_b)
|
||||
{
|
||||
__auto_type a = (const qfv_orenderpass_t **) _a;
|
||||
__auto_type b = (const qfv_orenderpass_t **) _b;
|
||||
return (*a)->order - (*b)->order;
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_CreateRenderPasses (vulkan_ctx_t *ctx)
|
||||
{
|
||||
Vulkan_Output_CreateRenderPasses (ctx);
|
||||
Vulkan_Main_CreateRenderPasses (ctx);
|
||||
Vulkan_Particles_CreateRenderPasses (ctx);
|
||||
Vulkan_Lighting_CreateRenderPasses (ctx);
|
||||
Vulkan_Translucent_CreateRenderPasses (ctx);
|
||||
|
||||
heapsort (ctx->renderPasses.a, ctx->renderPasses.size,
|
||||
sizeof (qfv_orenderpass_t *), renderpass_cmp);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_DestroyRenderPasses (vulkan_ctx_t *ctx)
|
||||
{
|
||||
for (size_t i = 0; i < ctx->renderPasses.size; i++) {
|
||||
QFV_RenderPass_Delete (ctx->renderPasses.a[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_CreateCapture (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue