1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[d3d11] Move SO* methods to D3D11CommonContext

This commit is contained in:
Philip Rebohle 2022-08-03 20:31:33 +02:00
parent 4d498851a8
commit efea51c254
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 81 additions and 78 deletions

View File

@ -1168,70 +1168,6 @@ namespace dxvk {
}
void STDMETHODCALLTYPE D3D11DeviceContext::SOSetTargets(
UINT NumBuffers,
ID3D11Buffer* const* ppSOTargets,
const UINT* pOffsets) {
D3D10DeviceLock lock = LockContext();
for (uint32_t i = 0; i < NumBuffers; i++) {
D3D11Buffer* buffer = static_cast<D3D11Buffer*>(ppSOTargets[i]);
UINT offset = pOffsets != nullptr ? pOffsets[i] : 0;
m_state.so.targets[i].buffer = buffer;
m_state.so.targets[i].offset = offset;
}
for (uint32_t i = NumBuffers; i < D3D11_SO_BUFFER_SLOT_COUNT; i++) {
m_state.so.targets[i].buffer = nullptr;
m_state.so.targets[i].offset = 0;
}
for (uint32_t i = 0; i < D3D11_SO_BUFFER_SLOT_COUNT; i++) {
BindXfbBuffer(i,
m_state.so.targets[i].buffer.ptr(),
m_state.so.targets[i].offset);
}
}
void STDMETHODCALLTYPE D3D11DeviceContext::SOGetTargets(
UINT NumBuffers,
ID3D11Buffer** ppSOTargets) {
D3D10DeviceLock lock = LockContext();
for (uint32_t i = 0; i < NumBuffers; i++) {
ppSOTargets[i] = i < m_state.so.targets.size()
? m_state.so.targets[i].buffer.ref()
: nullptr;
}
}
void STDMETHODCALLTYPE D3D11DeviceContext::SOGetTargetsWithOffsets(
UINT NumBuffers,
ID3D11Buffer** ppSOTargets,
UINT* pOffsets) {
D3D10DeviceLock lock = LockContext();
for (uint32_t i = 0; i < NumBuffers; i++) {
const bool inRange = i < m_state.so.targets.size();
if (ppSOTargets != nullptr) {
ppSOTargets[i] = inRange
? m_state.so.targets[i].buffer.ref()
: nullptr;
}
if (pOffsets != nullptr) {
pOffsets[i] = inRange
? m_state.so.targets[i].offset
: 0u;
}
}
}
void STDMETHODCALLTYPE D3D11DeviceContext::SetMarkerInt(
LPCWSTR pLabel,
INT Data) {

View File

@ -206,20 +206,6 @@ namespace dxvk {
ID3D11Buffer* pBufferForArgs,
UINT AlignedByteOffsetForArgs);
void STDMETHODCALLTYPE SOSetTargets(
UINT NumBuffers,
ID3D11Buffer* const* ppSOTargets,
const UINT* pOffsets);
void STDMETHODCALLTYPE SOGetTargets(
UINT NumBuffers,
ID3D11Buffer** ppSOTargets);
void STDMETHODCALLTYPE SOGetTargetsWithOffsets(
UINT NumBuffers,
ID3D11Buffer** ppSOTargets,
UINT* pOffsets);
void STDMETHODCALLTYPE SetMarkerInt(
LPCWSTR pLabel,
INT Data);

View File

@ -1660,6 +1660,73 @@ namespace dxvk {
}
template<typename ContextType>
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::SOSetTargets(
UINT NumBuffers,
ID3D11Buffer* const* ppSOTargets,
const UINT* pOffsets) {
D3D10DeviceLock lock = LockContext();
for (uint32_t i = 0; i < NumBuffers; i++) {
D3D11Buffer* buffer = static_cast<D3D11Buffer*>(ppSOTargets[i]);
UINT offset = pOffsets != nullptr ? pOffsets[i] : 0;
m_state.so.targets[i].buffer = buffer;
m_state.so.targets[i].offset = offset;
}
for (uint32_t i = NumBuffers; i < D3D11_SO_BUFFER_SLOT_COUNT; i++) {
m_state.so.targets[i].buffer = nullptr;
m_state.so.targets[i].offset = 0;
}
for (uint32_t i = 0; i < D3D11_SO_BUFFER_SLOT_COUNT; i++) {
BindXfbBuffer(i,
m_state.so.targets[i].buffer.ptr(),
m_state.so.targets[i].offset);
}
}
template<typename ContextType>
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::SOGetTargets(
UINT NumBuffers,
ID3D11Buffer** ppSOTargets) {
D3D10DeviceLock lock = LockContext();
for (uint32_t i = 0; i < NumBuffers; i++) {
ppSOTargets[i] = i < m_state.so.targets.size()
? m_state.so.targets[i].buffer.ref()
: nullptr;
}
}
template<typename ContextType>
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::SOGetTargetsWithOffsets(
UINT NumBuffers,
ID3D11Buffer** ppSOTargets,
UINT* pOffsets) {
D3D10DeviceLock lock = LockContext();
for (uint32_t i = 0; i < NumBuffers; i++) {
const bool inRange = i < m_state.so.targets.size();
if (ppSOTargets) {
ppSOTargets[i] = inRange
? m_state.so.targets[i].buffer.ref()
: nullptr;
}
if (pOffsets) {
pOffsets[i] = inRange
? m_state.so.targets[i].offset
: 0u;
}
}
}
template<typename ContextType>
BOOL STDMETHODCALLTYPE D3D11CommonContext<ContextType>::IsAnnotationEnabled() {
return m_annotation.GetStatus();

View File

@ -525,6 +525,20 @@ namespace dxvk {
UINT* pNumRects,
D3D11_RECT* pRects);
void STDMETHODCALLTYPE SOSetTargets(
UINT NumBuffers,
ID3D11Buffer* const* ppSOTargets,
const UINT* pOffsets);
void STDMETHODCALLTYPE SOGetTargets(
UINT NumBuffers,
ID3D11Buffer** ppSOTargets);
void STDMETHODCALLTYPE SOGetTargetsWithOffsets(
UINT NumBuffers,
ID3D11Buffer** ppSOTargets,
UINT* pOffsets);
BOOL STDMETHODCALLTYPE IsAnnotationEnabled();
protected: