[dxvk] Introduce bindResourceBufferRange

This commit is contained in:
Philip Rebohle 2022-07-14 14:56:13 +02:00
parent 57445227ac
commit ce3eae59a9
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 28 additions and 1 deletions

View File

@ -518,7 +518,18 @@ namespace dxvk {
return this->m_offset == other.m_offset
&& this->m_length == other.m_length;
}
/**
* \brief Sets buffer range
*
* \param [in] offset New offset
* \param [in] length New length
*/
void setRange(VkDeviceSize offset, VkDeviceSize length) {
m_offset = offset;
m_length = length;
}
private:
Rc<DxvkBuffer> m_buffer = nullptr;

View File

@ -165,6 +165,22 @@ namespace dxvk {
m_descriptorState.dirtyBuffers(stages);
}
/**
* \brief Changes bound range of a resource buffer
*
* Can be used to quickly bind a new sub-range of
* a buffer rather than re-binding the entire buffer.
*/
void bindResourceBufferRange(
VkShaderStageFlags stages,
uint32_t slot,
VkDeviceSize offset,
VkDeviceSize length) {
m_rc[slot].bufferSlice.setRange(offset, length);
m_descriptorState.dirtyBuffers(stages);
}
/**
* \brief Binds image or buffer view
*