From 9d26031dcb2fc4cc5b8da43bf3270a58f07e1b26 Mon Sep 17 00:00:00 2001 From: Liam Middlebrook Date: Mon, 1 Apr 2019 13:51:08 -0700 Subject: [PATCH] [dxvk] Zero-Initialize SpecConstantData Ensure that specialization constant data passed into the driver is zero-initialized. Having the pData field in VkSpecializationInfo be zero-initialized helps to create more deterministic input to the driver, which is particularly useful when debugging shader issues. --- src/dxvk/dxvk_compute.cpp | 4 ++-- src/dxvk/dxvk_graphics.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dxvk/dxvk_compute.cpp b/src/dxvk/dxvk_compute.cpp index 65eb75e3..39f58e55 100644 --- a/src/dxvk/dxvk_compute.cpp +++ b/src/dxvk/dxvk_compute.cpp @@ -101,7 +101,7 @@ namespace dxvk { auto csm = m_cs->createShaderModule(m_vkd, m_slotMapping, moduleInfo); - DxvkSpecConstantData specData; + DxvkSpecConstantData specData = { }; for (uint32_t i = 0; i < MaxNumActiveBindings; i++) specData.activeBindings[i] = state.bsBindingMask.isBound(i) ? VK_TRUE : VK_FALSE; @@ -159,4 +159,4 @@ namespace dxvk { m_pipeMgr->m_stateCache->addComputePipeline(key, state); } -} \ No newline at end of file +} diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index cbb68a5a..ed45b637 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -184,7 +184,7 @@ namespace dxvk { sampleCount = VkSampleCountFlagBits(state.rsSampleCount); // Set up some specialization constants - DxvkSpecConstantData specData; + DxvkSpecConstantData specData = { }; specData.rasterizerSampleCount = uint32_t(sampleCount); specData.alphaTestEnable = state.xsAlphaCompareOp != VK_COMPARE_OP_ALWAYS; specData.alphaCompareOp = state.xsAlphaCompareOp;