mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-07 18:01:30 +00:00
[vulkan] Add a cvar to select between deferred and forward
Finally. However, it has effect only when no render config is provided. When a config is provided, things will break currently as nothing is done yet, but getting a config in will take some work in qwaq and also the render graph system as I want to make the startup functions configurable.
This commit is contained in:
parent
f5e39ba263
commit
8e3532d543
3 changed files with 23 additions and 8 deletions
|
@ -463,8 +463,8 @@ void QFV_RunRenderPassCmd (VkCommandBuffer cmd, struct vulkan_ctx_s *ctx,
|
|||
void QFV_RunRenderPass (struct vulkan_ctx_s *ctx, qfv_renderpass_t *renderpass,
|
||||
uint32_t width, uint32_t height, void *data);
|
||||
void QFV_RunRenderJob (struct vulkan_ctx_s *ctx);
|
||||
void QFV_LoadRenderInfo (struct vulkan_ctx_s *ctx, const char *name);
|
||||
void QFV_LoadSamplerInfo (struct vulkan_ctx_s *ctx, const char *name);
|
||||
void QFV_LoadRenderInfo (struct vulkan_ctx_s *ctx, struct plitem_s *item);
|
||||
void QFV_LoadSamplerInfo (struct vulkan_ctx_s *ctx, struct plitem_s *item);
|
||||
void QFV_BuildRender (struct vulkan_ctx_s *ctx);
|
||||
void QFV_Render_Init (struct vulkan_ctx_s *ctx);
|
||||
void QFV_Render_Shutdown (struct vulkan_ctx_s *ctx);
|
||||
|
|
|
@ -83,6 +83,16 @@
|
|||
|
||||
static vulkan_ctx_t *vulkan_ctx;
|
||||
|
||||
static int vulkan_render_mode;
|
||||
static cvar_t vulkan_render_mode_cvar = {
|
||||
.name = "vulkan_render_mode",
|
||||
.description =
|
||||
"Use deferred (1) or forward (0) rendering for quake.",
|
||||
.default_value = "1",
|
||||
.flags = CVAR_ROM,
|
||||
.value = { .type = &cexpr_int, .value = &vulkan_render_mode },
|
||||
};
|
||||
|
||||
static struct psystem_s *
|
||||
vulkan_ParticleSystem (void)
|
||||
{
|
||||
|
@ -116,8 +126,14 @@ vulkan_R_Init (struct plitem_s *config)
|
|||
Vulkan_Translucent_Init (vulkan_ctx);
|
||||
Vulkan_Compose_Init (vulkan_ctx);
|
||||
|
||||
QFV_LoadRenderInfo (vulkan_ctx, "main_def");
|
||||
QFV_LoadSamplerInfo (vulkan_ctx, "smp_quake");
|
||||
if (config) {
|
||||
} else {
|
||||
const char *mode = vulkan_render_mode ? "main_def" : "main_fwd";
|
||||
auto render_graph = Vulkan_GetConfig (vulkan_ctx, mode);
|
||||
auto samplers = Vulkan_GetConfig (vulkan_ctx, "smp_quake");
|
||||
QFV_LoadRenderInfo (vulkan_ctx, render_graph);
|
||||
QFV_LoadSamplerInfo (vulkan_ctx, samplers);
|
||||
}
|
||||
QFV_BuildRender (vulkan_ctx);
|
||||
|
||||
Vulkan_Texture_Setup (vulkan_ctx);
|
||||
|
@ -543,6 +559,7 @@ vulkan_vid_render_init (void)
|
|||
vulkan_ctx = vi->vulkan_context (vi);
|
||||
vulkan_ctx->load_vulkan (vulkan_ctx);
|
||||
|
||||
Cvar_Register (&vulkan_render_mode_cvar, 0, 0);
|
||||
Vulkan_Init_Common (vulkan_ctx);
|
||||
|
||||
vi->set_palette = set_palette;
|
||||
|
|
|
@ -73,11 +73,10 @@ get_output (vulkan_ctx_t *ctx, plitem_t *item)
|
|||
}
|
||||
|
||||
void
|
||||
QFV_LoadRenderInfo (vulkan_ctx_t *ctx, const char *name)
|
||||
QFV_LoadRenderInfo (vulkan_ctx_t *ctx, plitem_t *item)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto rctx = ctx->render_context;
|
||||
auto item = Vulkan_GetConfig (ctx, name);
|
||||
auto output = get_output (ctx, item);
|
||||
Vulkan_Script_SetOutput (ctx, &output);
|
||||
rctx->jobinfo = QFV_ParseJobInfo (ctx, item, rctx);
|
||||
|
@ -87,11 +86,10 @@ QFV_LoadRenderInfo (vulkan_ctx_t *ctx, const char *name)
|
|||
}
|
||||
|
||||
void
|
||||
QFV_LoadSamplerInfo (vulkan_ctx_t *ctx, const char *name)
|
||||
QFV_LoadSamplerInfo (vulkan_ctx_t *ctx, plitem_t *item)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto rctx = ctx->render_context;
|
||||
auto item = Vulkan_GetConfig (ctx, name);
|
||||
rctx->samplerinfo = QFV_ParseSamplerInfo (ctx, item, rctx);
|
||||
if (rctx->samplerinfo) {
|
||||
rctx->samplerinfo->plitem = item;
|
||||
|
|
Loading…
Reference in a new issue