mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 12:42:32 +00:00
[vulkan] Parameterize a few more forward vs deferred
Just scene and config load to go.
This commit is contained in:
parent
778ffadd54
commit
8138b69186
5 changed files with 36 additions and 17 deletions
|
@ -328,6 +328,7 @@ typedef enum {
|
|||
|
||||
typedef enum {
|
||||
QFV_bspMain,
|
||||
QFV_bspLightmap, // same as main, but using lightmaps
|
||||
QFV_bspShadow,
|
||||
QFV_bspDebug,
|
||||
|
||||
|
|
|
@ -570,6 +570,7 @@ properties = {
|
|||
descriptorSets = (matrix_set, texture_set, oit_set);
|
||||
pushConstants = {
|
||||
vertex = { Model = mat4; };
|
||||
fragment = { fog = vec4; };
|
||||
};
|
||||
};
|
||||
physics = {
|
||||
|
@ -1898,7 +1899,8 @@ renderpasses = {
|
|||
|
||||
color = $color.compose;
|
||||
tasks = (
|
||||
{ func = compose_draw; },
|
||||
{ func = compose_draw;
|
||||
params = (0); },
|
||||
);
|
||||
|
||||
stages = (
|
||||
|
|
|
@ -1112,7 +1112,7 @@ renderpasses = {
|
|||
color = $color.bsp;
|
||||
tasks = (
|
||||
{ func = bsp_draw_queue;
|
||||
params = (main, solid, 1); },
|
||||
params = (lightmap, solid, 1); },
|
||||
);
|
||||
|
||||
stages = (
|
||||
|
@ -1191,7 +1191,7 @@ renderpasses = {
|
|||
tasks = (
|
||||
// FIXME sky should not use OIT
|
||||
{ func = bsp_draw_queue;
|
||||
params = (main, sky, 1); },
|
||||
params = (lightmap, sky, 1); },
|
||||
);
|
||||
|
||||
stages = (
|
||||
|
@ -1207,7 +1207,7 @@ renderpasses = {
|
|||
tasks = (
|
||||
// FIXME sky should not use OIT
|
||||
{ func = bsp_draw_queue;
|
||||
params = (main, sky, 1); },
|
||||
params = (lightmap, sky, 1); },
|
||||
);
|
||||
|
||||
stages = (
|
||||
|
@ -1222,9 +1222,9 @@ renderpasses = {
|
|||
color = $color.bsp;
|
||||
tasks = (
|
||||
{ func = bsp_draw_queue;
|
||||
params = (main, translucent, 1); },
|
||||
params = (lightmap, translucent, 1); },
|
||||
{ func = bsp_draw_queue;
|
||||
params = (main, turbulent, 1); },
|
||||
params = (lightmap, turbulent, 1); },
|
||||
);
|
||||
stages = (
|
||||
$brush.shader.quake_vertex,
|
||||
|
@ -1274,7 +1274,8 @@ renderpasses = {
|
|||
|
||||
color = $color.compose;
|
||||
tasks = (
|
||||
{ func = compose_draw; },
|
||||
{ func = compose_draw;
|
||||
params = (1); },
|
||||
);
|
||||
stages = (
|
||||
$fstriangle.shader.vertex,
|
||||
|
|
|
@ -931,7 +931,8 @@ dynamic:
|
|||
}
|
||||
|
||||
static void
|
||||
queue_faces (bsp_pass_t *pass, const bspctx_t *bctx, bspframe_t *bframe)
|
||||
queue_faces (bsp_pass_t *pass, QFV_BspPass pass_ind,
|
||||
const bspctx_t *bctx, bspframe_t *bframe)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
uint32_t base = bframe->index_count;
|
||||
|
@ -992,7 +993,7 @@ queue_faces (bsp_pass_t *pass, const bspctx_t *bctx, bspframe_t *bframe)
|
|||
draw->index_count += f.index_count;
|
||||
pass->index_count += f.index_count;
|
||||
|
||||
if (dq == QFV_bspSolid) {
|
||||
if (pass_ind == QFV_bspLightmap && dq == QFV_bspSolid) {
|
||||
update_lightmap (pass, bctx, is);
|
||||
}
|
||||
}
|
||||
|
@ -1265,6 +1266,7 @@ bsp_draw_queue (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
|
||||
auto pass = (bsp_pass_t *[]) {
|
||||
[QFV_bspMain] = &bctx->main_pass,
|
||||
[QFV_bspLightmap] = &bctx->main_pass,
|
||||
[QFV_bspShadow] = &bctx->shadow_pass,
|
||||
[QFV_bspDebug] = &bctx->debug_pass,
|
||||
} [pass_ind];
|
||||
|
@ -1304,7 +1306,7 @@ bsp_draw_queue (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
if (queue == QFV_bspSky) {
|
||||
vulktex_t skybox = { .descriptor = bctx->skybox_descriptor };
|
||||
bind_texture (&skybox, SKYBOX_SET, layout, dfunc, cmd);
|
||||
} else {
|
||||
} else if (pass_ind == QFV_bspLightmap) {
|
||||
vulktex_t lightmap = { .descriptor = bctx->lightmap_descriptor };
|
||||
bind_texture (&lightmap, LIGHTMAP_SET, layout, dfunc, cmd);
|
||||
}
|
||||
|
@ -1324,11 +1326,12 @@ bsp_visit_world (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
|
||||
auto pass = (bsp_pass_t *[]) {
|
||||
[QFV_bspMain] = &bctx->main_pass,
|
||||
[QFV_bspLightmap] = &bctx->main_pass,
|
||||
[QFV_bspShadow] = &bctx->shadow_pass,
|
||||
[QFV_bspDebug] = &bctx->debug_pass,
|
||||
} [pass_ind];
|
||||
|
||||
if (pass_ind == QFV_bspMain) {
|
||||
if (pass_ind == QFV_bspMain || pass_ind == QFV_bspLightmap) {
|
||||
pass->entqueue = r_ent_queue;
|
||||
pass->position = r_refdef.frame.position;
|
||||
pass->vis_frame = r_visstate.visframecount;
|
||||
|
@ -1361,6 +1364,7 @@ bsp_visit_world (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
}
|
||||
R_VisitWorldNodes (pass, ctx, (typeof(visit_node_bfcull)*[]) {
|
||||
[QFV_bspMain] = visit_node_bfcull,
|
||||
[QFV_bspLightmap] = visit_node_bfcull,
|
||||
[QFV_bspShadow] = visit_node_no_bfcull,
|
||||
[QFV_bspDebug] = visit_node_no_bfcull,
|
||||
}[pass_ind]);
|
||||
|
@ -1376,7 +1380,7 @@ bsp_visit_world (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
}
|
||||
}
|
||||
|
||||
queue_faces (pass, bctx, bframe);
|
||||
queue_faces (pass, pass_ind, bctx, bframe);
|
||||
|
||||
bframe->entid_count = pass->entid_count;
|
||||
|
||||
|
@ -1392,13 +1396,15 @@ static exprtype_t bsp_pass_type = {
|
|||
};
|
||||
static int bsp_pass_values[] = {
|
||||
QFV_bspMain,
|
||||
QFV_bspLightmap,
|
||||
QFV_bspShadow,
|
||||
QFV_bspDebug,
|
||||
};
|
||||
static exprsym_t bsp_pass_symbols[] = {
|
||||
{"main", &bsp_pass_type, bsp_pass_values + 0},
|
||||
{"shadow", &bsp_pass_type, bsp_pass_values + 1},
|
||||
{"debug", &bsp_pass_type, bsp_pass_values + 2},
|
||||
{"lightmap", &bsp_pass_type, bsp_pass_values + 1},
|
||||
{"shadow", &bsp_pass_type, bsp_pass_values + 2},
|
||||
{"debug", &bsp_pass_type, bsp_pass_values + 3},
|
||||
{}
|
||||
};
|
||||
static exprtab_t bsp_pass_symtab = { .symbols = bsp_pass_symbols };
|
||||
|
@ -1698,6 +1704,7 @@ Vulkan_Bsp_GetPass (struct vulkan_ctx_s *ctx, QFV_BspPass pass_ind)
|
|||
}
|
||||
auto pass = (bsp_pass_t *[]) {
|
||||
[QFV_bspMain] = &bctx->main_pass,
|
||||
[QFV_bspLightmap] = &bctx->main_pass,
|
||||
[QFV_bspShadow] = &bctx->shadow_pass,
|
||||
[QFV_bspDebug] = &bctx->debug_pass,
|
||||
}[pass_ind];
|
||||
|
|
|
@ -72,6 +72,8 @@ compose_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
{
|
||||
qfZoneNamed (zone, true);
|
||||
auto taskctx = (qfv_taskctx_t *) ectx;
|
||||
int color_only = *(int *) params[0]->value;
|
||||
|
||||
auto ctx = taskctx->ctx;
|
||||
auto device = ctx->device;
|
||||
auto dfunc = device->funcs;
|
||||
|
@ -87,8 +89,10 @@ compose_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
cframe->imageInfo[2].imageView = fb->views[QFV_attachEmission];
|
||||
dfunc->vkUpdateDescriptorSets (device->dev, 1,
|
||||
cframe->descriptors, 0, 0);
|
||||
//dfunc->vkUpdateDescriptorSets (device->dev, COMPOSE_IMAGE_INFOS,
|
||||
// cframe->descriptors, 0, 0);
|
||||
if (!color_only) {
|
||||
dfunc->vkUpdateDescriptorSets (device->dev, COMPOSE_IMAGE_INFOS,
|
||||
cframe->descriptors, 0, 0);
|
||||
}
|
||||
|
||||
VkDescriptorSet sets[] = {
|
||||
cframe->descriptors[0].dstSet,
|
||||
|
@ -100,8 +104,12 @@ compose_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
dfunc->vkCmdDraw (cmd, 3, 1, 0, 0);
|
||||
}
|
||||
|
||||
static exprtype_t *compose_draw_params[] = {
|
||||
&cexpr_int,
|
||||
};
|
||||
static exprfunc_t compose_draw_func[] = {
|
||||
{ .func = compose_draw },
|
||||
{ .func = compose_draw, .num_params = 1,
|
||||
.param_types = compose_draw_params },
|
||||
{}
|
||||
};
|
||||
static exprsym_t compose_task_syms[] = {
|
||||
|
|
Loading…
Reference in a new issue