mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-13 16:08:50 +01:00
[dxvk] Add method to query shader stages that can access a buffer
This commit is contained in:
parent
893183a7cc
commit
db85de8c91
@ -14,7 +14,8 @@ namespace dxvk {
|
|||||||
: m_device (device),
|
: m_device (device),
|
||||||
m_info (createInfo),
|
m_info (createInfo),
|
||||||
m_memAlloc (&memAlloc),
|
m_memAlloc (&memAlloc),
|
||||||
m_memFlags (memFlags) {
|
m_memFlags (memFlags),
|
||||||
|
m_shaderStages (util::shaderStages(createInfo.stages)) {
|
||||||
// Align slices so that we don't violate any alignment
|
// Align slices so that we don't violate any alignment
|
||||||
// requirements imposed by the Vulkan device/driver
|
// requirements imposed by the Vulkan device/driver
|
||||||
VkDeviceSize sliceAlignment = computeSliceAlignment();
|
VkDeviceSize sliceAlignment = computeSliceAlignment();
|
||||||
|
@ -143,6 +143,16 @@ namespace dxvk {
|
|||||||
return reinterpret_cast<char*>(m_physSlice.mapPtr) + offset;
|
return reinterpret_cast<char*>(m_physSlice.mapPtr) + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Queries shader stages that can access this buffer
|
||||||
|
*
|
||||||
|
* Derived from the pipeline stage mask passed in during creation.
|
||||||
|
* \returns Shader stages that may access this buffer
|
||||||
|
*/
|
||||||
|
VkShaderStageFlags getShaderStages() const {
|
||||||
|
return m_shaderStages;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retrieves slice handle
|
* \brief Retrieves slice handle
|
||||||
* \returns Buffer slice handle
|
* \returns Buffer slice handle
|
||||||
@ -286,6 +296,7 @@ namespace dxvk {
|
|||||||
DxvkBufferCreateInfo m_info;
|
DxvkBufferCreateInfo m_info;
|
||||||
DxvkMemoryAllocator* m_memAlloc;
|
DxvkMemoryAllocator* m_memAlloc;
|
||||||
VkMemoryPropertyFlags m_memFlags;
|
VkMemoryPropertyFlags m_memFlags;
|
||||||
|
VkShaderStageFlags m_shaderStages;
|
||||||
|
|
||||||
DxvkBufferHandle m_buffer;
|
DxvkBufferHandle m_buffer;
|
||||||
DxvkBufferSliceHandle m_physSlice;
|
DxvkBufferSliceHandle m_physSlice;
|
||||||
|
@ -16,6 +16,18 @@ namespace dxvk::util {
|
|||||||
| (shaderStages & VK_SHADER_STAGE_COMPUTE_BIT) << 6;
|
| (shaderStages & VK_SHADER_STAGE_COMPUTE_BIT) << 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Gets shader stage flags included in pipeline stages
|
||||||
|
*
|
||||||
|
* \param [in] pipelineStages Pipeline stage flags
|
||||||
|
* \returns Corresponding shader stage flags, if any
|
||||||
|
*/
|
||||||
|
inline VkShaderStageFlags shaderStages(
|
||||||
|
VkPipelineStageFlags pipelineStages) {
|
||||||
|
return ((pipelineStages >> 3) & VK_SHADER_STAGE_ALL_GRAPHICS)
|
||||||
|
| ((pipelineStages >> 6) & VK_SHADER_STAGE_COMPUTE_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Computes number of mip levels for an image
|
* \brief Computes number of mip levels for an image
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user