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:
parent
c31e646921
commit
bf912d0a5f
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user