1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[dxvk] Use new spec constant structure for pipeline compilation

This commit is contained in:
Philip Rebohle 2018-05-26 14:54:29 +02:00
parent d79f39b963
commit a2d9874b26
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 17 additions and 20 deletions

View File

@ -3,6 +3,7 @@
#include "dxvk_compute.h" #include "dxvk_compute.h"
#include "dxvk_device.h" #include "dxvk_device.h"
#include "dxvk_spec_const.h"
namespace dxvk { namespace dxvk {
@ -99,19 +100,16 @@ namespace dxvk {
Logger::debug(str::format(" cs : ", m_cs->shader()->debugName())); Logger::debug(str::format(" cs : ", m_cs->shader()->debugName()));
} }
std::array<VkBool32, MaxNumActiveBindings> specData; DxvkSpecConstantData specData;
std::array<VkSpecializationMapEntry, MaxNumActiveBindings> specMap;
for (uint32_t i = 0; i < MaxNumActiveBindings; i++) { for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
specData[i] = state.bsBindingState.isBound(i) ? VK_TRUE : VK_FALSE; specData.activeBindings[i] = state.bsBindingState.isBound(i) ? VK_TRUE : VK_FALSE;
specMap [i] = { i, static_cast<uint32_t>(sizeof(VkBool32)) * i, sizeof(VkBool32) };
}
VkSpecializationInfo specInfo; VkSpecializationInfo specInfo;
specInfo.mapEntryCount = specMap.size(); specInfo.mapEntryCount = g_specConstantMap.mapEntryCount();
specInfo.pMapEntries = specMap.data(); specInfo.pMapEntries = g_specConstantMap.mapEntryData();
specInfo.dataSize = specData.size() * sizeof(VkBool32); specInfo.dataSize = sizeof(specData);
specInfo.pData = specData.data(); specInfo.pData = &specData;
VkComputePipelineCreateInfo info; VkComputePipelineCreateInfo info;
info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO; info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;

View File

@ -3,6 +3,7 @@
#include "dxvk_device.h" #include "dxvk_device.h"
#include "dxvk_graphics.h" #include "dxvk_graphics.h"
#include "dxvk_spec_const.h"
namespace dxvk { namespace dxvk {
@ -203,19 +204,17 @@ namespace dxvk {
VK_DYNAMIC_STATE_STENCIL_REFERENCE, VK_DYNAMIC_STATE_STENCIL_REFERENCE,
}; };
std::array<VkBool32, MaxNumActiveBindings> specData; DxvkSpecConstantData specData;
std::array<VkSpecializationMapEntry, MaxNumActiveBindings> specMap; specData.rasterizerSampleCount = uint32_t(state.msSampleCount);
for (uint32_t i = 0; i < MaxNumActiveBindings; i++) { for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
specData[i] = state.bsBindingState.isBound(i) ? VK_TRUE : VK_FALSE; specData.activeBindings[i] = state.bsBindingState.isBound(i) ? VK_TRUE : VK_FALSE;
specMap [i] = { i, static_cast<uint32_t>(sizeof(VkBool32)) * i, sizeof(VkBool32) };
}
VkSpecializationInfo specInfo; VkSpecializationInfo specInfo;
specInfo.mapEntryCount = specMap.size(); specInfo.mapEntryCount = g_specConstantMap.mapEntryCount();
specInfo.pMapEntries = specMap.data(); specInfo.pMapEntries = g_specConstantMap.mapEntryData();
specInfo.dataSize = specData.size() * sizeof(VkBool32); specInfo.dataSize = sizeof(specData);
specInfo.pData = specData.data(); specInfo.pData = &specData;
std::vector<VkPipelineShaderStageCreateInfo> stages; std::vector<VkPipelineShaderStageCreateInfo> stages;