mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
[vulkan] Ensure msaa settings are consistent
I had forgotten that msaa samples was governed by the driver (as a max) and the renderpass setup code simply took the max. Thus why 1 vs 8 caused the display to render incorrectly.
This commit is contained in:
parent
79f22ffebf
commit
80aec45e35
4 changed files with 8 additions and 6 deletions
|
@ -41,6 +41,7 @@ typedef struct vulkan_ctx_s {
|
|||
struct qfv_instance_s *instance;
|
||||
struct qfv_device_s *device;
|
||||
struct qfv_swapchain_s *swapchain;
|
||||
VkSampleCountFlagBits msaaSamples; // FIXME not here?
|
||||
struct hashlink_s *hashlinks; //FIXME want per thread
|
||||
VkSurfaceKHR surface; //FIXME surface = window, so "contains" swapchain
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
{
|
||||
flags = 0;
|
||||
format = VK_FORMAT_D32_SFLOAT;
|
||||
samples = $cvars.msaaSamples;
|
||||
samples = $msaaSamples;
|
||||
loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||
stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
|
|
|
@ -275,6 +275,7 @@ QFV_ParseRenderPass (vulkan_ctx_t *ctx, plitem_t *plist)
|
|||
VkRenderPass renderpass;
|
||||
exprsym_t var_syms[] = {
|
||||
{"swapchain", &qfv_swapchain_t_type, ctx->swapchain},
|
||||
{"msaaSamples", &VkSampleCountFlagBits_type, &ctx->msaaSamples},
|
||||
{}
|
||||
};
|
||||
exprtab_t vars_tab = { var_syms, 0 };
|
||||
|
|
|
@ -117,7 +117,7 @@ Vulkan_Init_Cvars (void)
|
|||
CVAR_NONE, vulkan_presentation_mode_f,
|
||||
"desired presentation mode (may fall "
|
||||
"back to fifo).");
|
||||
msaaSamples = Cvar_Get ("msaaSamples", "VK_SAMPLE_COUNT_8_BIT",
|
||||
msaaSamples = Cvar_Get ("msaaSamples", "VK_SAMPLE_COUNT_1_BIT",
|
||||
CVAR_NONE, msaaSamples_f,
|
||||
"desired MSAA sample size.");
|
||||
}
|
||||
|
@ -284,13 +284,13 @@ Vulkan_CreateRenderPass (vulkan_ctx_t *ctx)
|
|||
|
||||
VkExtent3D extent = {sc->extent.width, sc->extent.height, 1};
|
||||
|
||||
VkSampleCountFlagBits msaaSamples
|
||||
= QFV_GetMaxSampleCount (device->physDev);
|
||||
//FIXME incorporate cvar setting
|
||||
ctx->msaaSamples = QFV_GetMaxSampleCount (device->physDev);
|
||||
|
||||
Sys_MaskPrintf (SYS_VULKAN, "color resource\n");
|
||||
colorImage->image
|
||||
= QFV_CreateImage (device, 0, VK_IMAGE_TYPE_2D,
|
||||
sc->format, extent, 1, 1, msaaSamples,
|
||||
sc->format, extent, 1, 1, ctx->msaaSamples,
|
||||
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
|
||||
| VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
|
||||
colorImage->object
|
||||
|
@ -308,7 +308,7 @@ Vulkan_CreateRenderPass (vulkan_ctx_t *ctx)
|
|||
VkFormat depthFormat = VK_FORMAT_D32_SFLOAT;
|
||||
depthImage->image
|
||||
= QFV_CreateImage (device, 0, VK_IMAGE_TYPE_2D,
|
||||
depthFormat, extent, 1, 1, msaaSamples,
|
||||
depthFormat, extent, 1, 1, ctx->msaaSamples,
|
||||
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
|
||||
depthImage->object
|
||||
= QFV_AllocImageMemory (device, depthImage->image,
|
||||
|
|
Loading…
Reference in a new issue