diff --git a/codemp/rd-vulkan/tr_init.cpp b/codemp/rd-vulkan/tr_init.cpp index 879fe6f297..2d7decd382 100644 --- a/codemp/rd-vulkan/tr_init.cpp +++ b/codemp/rd-vulkan/tr_init.cpp @@ -182,7 +182,7 @@ cvar_t *cl_ratioFix; // Vulkan cvar_t *r_defaultImage; cvar_t *r_device; -cvar_t *r_stencilbits; +//cvar_t *r_stencilbits; cvar_t *r_ext_multisample; cvar_t *r_ext_supersample; cvar_t *r_ext_alpha_to_coverage; @@ -926,7 +926,7 @@ void R_Register( void ) ri.Cvar_CheckRange(r_device, -2, 8, qtrue); r_device->modified = qfalse; - r_stencilbits = ri.Cvar_Get("r_stencilbits", "8", CVAR_ARCHIVE_ND | CVAR_LATCH, ""); + //r_stencilbits = ri.Cvar_Get("r_stencilbits", "8", CVAR_ARCHIVE_ND | CVAR_LATCH, ""); r_ext_multisample = ri.Cvar_Get("r_ext_multisample", "0", CVAR_ARCHIVE_ND | CVAR_LATCH, ""); ri.Cvar_CheckRange(r_ext_multisample, 0, 64, qtrue); r_ext_supersample = ri.Cvar_Get("r_ext_supersample", "0", CVAR_ARCHIVE_ND | CVAR_LATCH, ""); diff --git a/codemp/rd-vulkan/vk_attachments.cpp b/codemp/rd-vulkan/vk_attachments.cpp index 1275051112..87161d1be9 100644 --- a/codemp/rd-vulkan/vk_attachments.cpp +++ b/codemp/rd-vulkan/vk_attachments.cpp @@ -291,7 +291,7 @@ static void create_depth_attachment( uint32_t width, uint32_t height, VkSampleCo desc.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; image_aspect_flags = VK_IMAGE_ASPECT_DEPTH_BIT; - if (r_stencilbits->integer) + if ( glConfig.stencilBits > 0 ) image_aspect_flags |= VK_IMAGE_ASPECT_STENCIL_BIT; VK_CHECK(qvkCreateImage(vk.device, &desc, NULL, image)); @@ -501,7 +501,7 @@ void vk_clear_depthstencil_attachments( qboolean clear_stencil ) { #endif attachment.clearValue.depthStencil.stencil = 0; - if ( clear_stencil && r_stencilbits->integer ) { + if ( clear_stencil && glConfig.stencilBits > 0 ) { attachment.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; } else { diff --git a/codemp/rd-vulkan/vk_frame.cpp b/codemp/rd-vulkan/vk_frame.cpp index d6a4424862..f1f56f8628 100644 --- a/codemp/rd-vulkan/vk_frame.cpp +++ b/codemp/rd-vulkan/vk_frame.cpp @@ -112,11 +112,11 @@ void vk_create_render_passes() attachments[1].samples = (VkSampleCountFlagBits)vkSamples; attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; //attachments[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; - attachments[1].stencilLoadOp = r_stencilbits->integer ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_DONT_CARE; + attachments[1].stencilLoadOp = glConfig.stencilBits ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_DONT_CARE; if ( vk.bloomActive || vk.dglowActive || vk.refractionActive ) { attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_STORE; // keep it for post-bloom/dynamic-glow pass //attachments[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE; - attachments[1].stencilStoreOp = r_stencilbits->integer ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE; + attachments[1].stencilStoreOp = glConfig.stencilBits ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE; } else { attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; diff --git a/codemp/rd-vulkan/vk_instance.cpp b/codemp/rd-vulkan/vk_instance.cpp index 89aefde77d..f3376644ec 100644 --- a/codemp/rd-vulkan/vk_instance.cpp +++ b/codemp/rd-vulkan/vk_instance.cpp @@ -376,15 +376,13 @@ static VkFormat get_depth_format( VkPhysicalDevice physical_device ) { VkFormat formats[2]; uint32_t i; - if (r_stencilbits->integer > 0) { + if ( glConfig.stencilBits > 0 ) { formats[0] = glConfig.depthBits == 16 ? VK_FORMAT_D16_UNORM_S8_UINT : VK_FORMAT_D24_UNORM_S8_UINT; formats[1] = VK_FORMAT_D32_SFLOAT_S8_UINT; - glConfig.stencilBits = 8; } else { formats[0] = glConfig.depthBits == 16 ? VK_FORMAT_D16_UNORM : VK_FORMAT_X8_D24_UNORM_PACK32; formats[1] = VK_FORMAT_D32_SFLOAT; - glConfig.stencilBits = 0; } for (i = 0; i < ARRAY_LEN(formats); i++) {