1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +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_device.h"
#include "dxvk_spec_const.h"
namespace dxvk {
@ -99,19 +100,16 @@ namespace dxvk {
Logger::debug(str::format(" cs : ", m_cs->shader()->debugName()));
}
std::array<VkBool32, MaxNumActiveBindings> specData;
std::array<VkSpecializationMapEntry, MaxNumActiveBindings> specMap;
DxvkSpecConstantData specData;
for (uint32_t i = 0; i < MaxNumActiveBindings; i++) {
specData[i] = state.bsBindingState.isBound(i) ? VK_TRUE : VK_FALSE;
specMap [i] = { i, static_cast<uint32_t>(sizeof(VkBool32)) * i, sizeof(VkBool32) };
}
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
specData.activeBindings[i] = state.bsBindingState.isBound(i) ? VK_TRUE : VK_FALSE;
VkSpecializationInfo specInfo;
specInfo.mapEntryCount = specMap.size();
specInfo.pMapEntries = specMap.data();
specInfo.dataSize = specData.size() * sizeof(VkBool32);
specInfo.pData = specData.data();
specInfo.mapEntryCount = g_specConstantMap.mapEntryCount();
specInfo.pMapEntries = g_specConstantMap.mapEntryData();
specInfo.dataSize = sizeof(specData);
specInfo.pData = &specData;
VkComputePipelineCreateInfo info;
info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;

View File

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