mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d9] Store buffer map mode in D3D9CommonBuffer
This commit is contained in:
parent
97ae14b6a0
commit
6d71eea516
@ -8,9 +8,9 @@ namespace dxvk {
|
|||||||
D3D9CommonBuffer::D3D9CommonBuffer(
|
D3D9CommonBuffer::D3D9CommonBuffer(
|
||||||
D3D9DeviceEx* pDevice,
|
D3D9DeviceEx* pDevice,
|
||||||
const D3D9_BUFFER_DESC* pDesc)
|
const D3D9_BUFFER_DESC* pDesc)
|
||||||
: m_parent ( pDevice ), m_desc ( *pDesc ) {
|
: m_parent ( pDevice ), m_desc ( *pDesc ), m_mapMode(DetermineMapMode()) {
|
||||||
m_buffer = CreateBuffer();
|
m_buffer = CreateBuffer();
|
||||||
if (GetMapMode() == D3D9_COMMON_BUFFER_MAP_MODE_BUFFER)
|
if (m_mapMode == D3D9_COMMON_BUFFER_MAP_MODE_BUFFER)
|
||||||
m_stagingBuffer = CreateStagingBuffer();
|
m_stagingBuffer = CreateStagingBuffer();
|
||||||
|
|
||||||
m_sliceHandle = GetMapBuffer()->getSliceHandle();
|
m_sliceHandle = GetMapBuffer()->getSliceHandle();
|
||||||
@ -83,7 +83,7 @@ namespace dxvk {
|
|||||||
info.access |= VK_ACCESS_INDEX_READ_BIT;
|
info.access |= VK_ACCESS_INDEX_READ_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetMapMode() == D3D9_COMMON_BUFFER_MAP_MODE_DIRECT) {
|
if (m_mapMode == D3D9_COMMON_BUFFER_MAP_MODE_DIRECT) {
|
||||||
info.stages |= VK_PIPELINE_STAGE_HOST_BIT;
|
info.stages |= VK_PIPELINE_STAGE_HOST_BIT;
|
||||||
info.access |= VK_ACCESS_HOST_WRITE_BIT;
|
info.access |= VK_ACCESS_HOST_WRITE_BIT;
|
||||||
|
|
||||||
|
@ -88,12 +88,19 @@ namespace dxvk {
|
|||||||
/**
|
/**
|
||||||
* \brief Determine the mapping mode of the buffer, (ie. direct mapping or backed)
|
* \brief Determine the mapping mode of the buffer, (ie. direct mapping or backed)
|
||||||
*/
|
*/
|
||||||
inline D3D9_COMMON_BUFFER_MAP_MODE GetMapMode() const {
|
inline D3D9_COMMON_BUFFER_MAP_MODE DetermineMapMode() const {
|
||||||
return (m_desc.Pool == D3DPOOL_DEFAULT && (m_desc.Usage & (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY)))
|
return (m_desc.Pool == D3DPOOL_DEFAULT && (m_desc.Usage & (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY)))
|
||||||
? D3D9_COMMON_BUFFER_MAP_MODE_DIRECT
|
? D3D9_COMMON_BUFFER_MAP_MODE_DIRECT
|
||||||
: D3D9_COMMON_BUFFER_MAP_MODE_BUFFER;
|
: D3D9_COMMON_BUFFER_MAP_MODE_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the mapping mode of the buffer, (ie. direct mapping or backed)
|
||||||
|
*/
|
||||||
|
inline D3D9_COMMON_BUFFER_MAP_MODE GetMapMode() const {
|
||||||
|
return m_mapMode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Abstraction for getting a type of buffer (mapping/staging/the real buffer) across mapping modes.
|
* \brief Abstraction for getting a type of buffer (mapping/staging/the real buffer) across mapping modes.
|
||||||
*/
|
*/
|
||||||
@ -231,6 +238,7 @@ namespace dxvk {
|
|||||||
DWORD m_mapFlags;
|
DWORD m_mapFlags;
|
||||||
bool m_wasWrittenByGPU = false;
|
bool m_wasWrittenByGPU = false;
|
||||||
bool m_uploadUsingStaging = false;
|
bool m_uploadUsingStaging = false;
|
||||||
|
D3D9_COMMON_BUFFER_MAP_MODE m_mapMode;
|
||||||
|
|
||||||
Rc<DxvkBuffer> m_buffer;
|
Rc<DxvkBuffer> m_buffer;
|
||||||
Rc<DxvkBuffer> m_stagingBuffer;
|
Rc<DxvkBuffer> m_stagingBuffer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user