diff --git a/include/vid_vulkan.h b/include/vid_vulkan.h index 411fcf4db..1886730c6 100644 --- a/include/vid_vulkan.h +++ b/include/vid_vulkan.h @@ -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 diff --git a/libs/video/renderer/vulkan/qfpipeline.plist b/libs/video/renderer/vulkan/qfpipeline.plist index a8e1c36c9..66c9e0adb 100644 --- a/libs/video/renderer/vulkan/qfpipeline.plist +++ b/libs/video/renderer/vulkan/qfpipeline.plist @@ -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; diff --git a/libs/video/renderer/vulkan/vkparse.c b/libs/video/renderer/vulkan/vkparse.c index b6512d041..b62637796 100644 --- a/libs/video/renderer/vulkan/vkparse.c +++ b/libs/video/renderer/vulkan/vkparse.c @@ -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 }; diff --git a/libs/video/renderer/vulkan/vulkan_vid_common.c b/libs/video/renderer/vulkan/vulkan_vid_common.c index ee0a209a1..9c2b021f4 100644 --- a/libs/video/renderer/vulkan/vulkan_vid_common.c +++ b/libs/video/renderer/vulkan/vulkan_vid_common.c @@ -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,