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

[d3d11] Create shader constant buffer if necessary

This commit is contained in:
Philip Rebohle 2018-07-30 20:24:53 +02:00
parent c31e646921
commit bf912d0a5f
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -85,6 +85,28 @@ namespace dxvk {
if (readStream)
m_shader->read(readStream);
}
// Create shader constant buffer if necessary
if (m_shader->shaderConstants().data() != nullptr) {
DxvkBufferCreateInfo info;
info.size = m_shader->shaderConstants().sizeInBytes();
info.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
info.stages = util::pipelineStages(m_shader->stage())
| VK_PIPELINE_STAGE_HOST_BIT;
info.access = VK_ACCESS_UNIFORM_READ_BIT
| VK_ACCESS_HOST_WRITE_BIT;
VkMemoryPropertyFlags memFlags
= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
| VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
m_buffer = pDevice->GetDXVKDevice()->createBuffer(info, memFlags);
std::memcpy(m_buffer->mapPtr(0),
m_shader->shaderConstants().data(),
m_shader->shaderConstants().sizeInBytes());
}
}