Skip to content

Commit

Permalink
xrRender: fixed broken device reset on DX9 after OpenXRay#490
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY authored and eagleivg committed Nov 11, 2019
1 parent 333ab2c commit b9e6661
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Layers/xrRender/BufferUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class IndexStagingBuffer
IndexStagingBuffer();
~IndexStagingBuffer();

void Create(size_t size, bool allowReadBack = false);
void Create(size_t size, bool allowReadBack = false, bool managed = true);
bool IsValid() const;
void* Map(size_t offset = 0, size_t size = 0, bool read = false);
void Unmap(bool doFlush = false);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/R_Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void CBackend::CreateQuadIB()
constexpr auto idxCount = triCount * 2 * 3;
constexpr auto idxSize = idxCount * sizeof(u16);

QuadIB.Create(idxSize);
QuadIB.Create(idxSize, false, false);

u16* Indices = static_cast<u16*>(QuadIB.Map());
{
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderDX10/dx10BufferUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ IndexStagingBuffer::~IndexStagingBuffer()
Destroy();
}

void IndexStagingBuffer::Create(size_t size, bool allowReadBack /*= false*/)
void IndexStagingBuffer::Create(size_t size, bool allowReadBack /*= false*/, bool /*managed = true*/)
{
m_Size = size;
m_AllowReadBack = allowReadBack;
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRenderDX9/BufferUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ IndexStagingBuffer::~IndexStagingBuffer()
Destroy();
}

void IndexStagingBuffer::Create(size_t size, bool allowReadBack /*= false*/)
void IndexStagingBuffer::Create(size_t size, bool allowReadBack /*= false*/, bool managed /*= true*/)
{
m_Size = size;
m_AllowReadBack = allowReadBack;

u32 dwUsage = m_AllowReadBack ? 0 : D3DUSAGE_WRITEONLY;
if (HW.Caps.geometry.bSoftware)
dwUsage |= D3DUSAGE_SOFTWAREPROCESSING;
R_CHK(HW.pDevice->CreateIndexBuffer(size, dwUsage, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &m_DeviceBuffer, NULL));
R_CHK(HW.pDevice->CreateIndexBuffer(size, dwUsage, D3DFMT_INDEX16, managed ? D3DPOOL_MANAGED : D3DPOOL_DEFAULT, &m_DeviceBuffer, NULL));

HW.stats_manager.increment_stats_ib(m_DeviceBuffer);
AddRef();
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderGL/glBufferUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ IndexStagingBuffer::~IndexStagingBuffer()
Destroy();
}

void IndexStagingBuffer::Create(size_t size, bool allowReadBack /*= false*/)
void IndexStagingBuffer::Create(size_t size, bool allowReadBack /*= false*/, bool /*managed = true*/)
{
m_Size = size;
m_AllowReadBack = allowReadBack;
Expand Down

0 comments on commit b9e6661

Please sign in to comment.