mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
[vulkan] Add cvars to control vulkan 3d frame buffer size
Thanks to the 3d frame buffer output being separate from the swap chain, it's possible to have a different frame buffer size from the window size, allowing for a smaller buffer and thus my laptop can cope (mostly) with the vulkan renderer.
This commit is contained in:
parent
9b609469ed
commit
1d84d54509
3 changed files with 31 additions and 0 deletions
|
@ -98,4 +98,7 @@ void Vulkan_BeginEntityLabel (struct vulkan_ctx_s *ctx, VkCommandBuffer cmd,
|
|||
|
||||
struct plitem_s *Vulkan_GetConfig (struct vulkan_ctx_s *ctx, const char *name);
|
||||
|
||||
extern int vulkan_frame_width;
|
||||
extern int vulkan_frame_height;
|
||||
|
||||
#endif // __QF_Vulkan_vid_h
|
||||
|
|
|
@ -181,6 +181,12 @@ Vulkan_Main_CreateRenderPasses (vulkan_ctx_t *ctx)
|
|||
.extent = ctx->swapchain->extent,
|
||||
.frames = ctx->swapchain->numImages,
|
||||
};
|
||||
if (vulkan_frame_width > 0) {
|
||||
rp->output.extent.width = vulkan_frame_width;
|
||||
}
|
||||
if (vulkan_frame_height > 0) {
|
||||
rp->output.extent.height = vulkan_frame_height;
|
||||
}
|
||||
QFV_RenderPass_CreateAttachments (rp);
|
||||
QFV_RenderPass_CreateRenderPass (rp);
|
||||
QFV_RenderPass_CreateFramebuffer (rp);
|
||||
|
|
|
@ -63,6 +63,26 @@
|
|||
#include "vid_vulkan.h"
|
||||
#include "vkparse.h"
|
||||
|
||||
int vulkan_frame_width;
|
||||
static cvar_t vulkan_frame_width_cvar = {
|
||||
.name = "vulkan_frame_width",
|
||||
.description =
|
||||
"Width of 3D view buffer. Set to 0 for automatic sizing.",
|
||||
.default_value = "0",
|
||||
.flags = CVAR_NONE,
|
||||
.value = { .type = &cexpr_int, .value = &vulkan_frame_width },
|
||||
};
|
||||
|
||||
int vulkan_frame_height;
|
||||
static cvar_t vulkan_frame_height_cvar = {
|
||||
.name = "vulkan_frame_height",
|
||||
.description =
|
||||
"Height of 3D view buffer. Set to 0 for automatic sizing.",
|
||||
.default_value = "0",
|
||||
.flags = CVAR_NONE,
|
||||
.value = { .type = &cexpr_int, .value = &vulkan_frame_height },
|
||||
};
|
||||
|
||||
static const char *instance_extensions[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME,
|
||||
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
|
||||
|
@ -79,6 +99,8 @@ Vulkan_Init_Common (vulkan_ctx_t *ctx)
|
|||
{
|
||||
Sys_MaskPrintf (SYS_vulkan, "Vulkan_Init_Common\n");
|
||||
|
||||
Cvar_Register (&vulkan_frame_width_cvar, 0, 0);
|
||||
Cvar_Register (&vulkan_frame_height_cvar, 0, 0);
|
||||
Vulkan_Init_Cvars ();
|
||||
R_Init_Cvars ();
|
||||
Vulkan_Script_Init (ctx);
|
||||
|
|
Loading…
Reference in a new issue