Commit 352d00db authored by Joshua Ashton's avatar Joshua Ashton 🐸

Merge branch 'd3d9-dev' of https://git.froggi.es/joshua/dxup into d3d9-dev

parents 67945466 b2e8c4c5
Pipeline #48 failed with stage
in 22 seconds
......@@ -30,17 +30,38 @@ namespace dxup {
}
void DXUPResource::MarkDirty(UINT slice, UINT mip) {
m_dirtySubresources[slice] = 1 << mip;
m_dirtySubresources[slice] = 1ull << mip;
}
void DXUPResource::MakeClean() {
bool dirty = false;
for (uint32_t slice = 0; slice < m_slices; slice++) {
uint64_t dirtyFlags = m_dirtySubresources[slice];
if (m_dirtySubresources[slice] != 0)
dirty = true;
}
if (!dirty)
return;
// This is needed for RTs, we only want staging buffers for them if they NEED them.
if (GetStaging() == nullptr) {
D3D11_TEXTURE2D_DESC desc;
ID3D11Texture2D* tex = GetResourceAs<ID3D11Texture2D>();
tex->GetDesc(&desc);
makeStagingDesc(desc, 0, D3DFMT_UNKNOWN);
m_device->GetD3D11Device()->CreateTexture2D(&desc, nullptr, (ID3D11Texture2D**)&m_staging);
}
for (uint32_t slice = 0; slice < m_slices; slice++) {
uint64_t* dirtyFlags = &m_dirtySubresources[slice];
for (uint64_t mip = 0; mip < m_mips; mip++) {
UINT subresource = D3D11CalcSubresource(mip, slice, m_mips);
if (dirtyFlags & (1ull << mip))
m_device->GetContext()->CopySubresourceRegion(GetMapping(), subresource, 0, 0, 0, GetResource(), subresource, nullptr);
if (*dirtyFlags & (1ull << mip))
m_device->GetContext()->CopySubresourceRegion(GetStaging(), subresource, 0, 0, 0, GetResource(), subresource, nullptr);
}
*dirtyFlags = 0;
}
}
......@@ -60,7 +81,7 @@ namespace dxup {
else
m_stagingRects[subresource] = *pRect;
if (HasStaging() && !(Flags & D3DLOCK_DISCARD) && !(Flags & D3DLOCK_NOOVERWRITE) && !(Usage & D3DUSAGE_WRITEONLY))
if (!(Flags & D3DLOCK_DISCARD) && !(Flags & D3DLOCK_NOOVERWRITE) && !(Usage & D3DUSAGE_WRITEONLY))
MakeClean();
D3D11_MAPPED_SUBRESOURCE res;
......
......@@ -109,18 +109,18 @@ namespace dxup {
uint16_t* originalIndices = reinterpret_cast<uint16_t*>(res.pData);
for (UINT i = 0; i < PrimitiveCount; i++) {
data[3 * i + 0] = originalIndices[StartIndex + 0];
data[3 * i + 1] = originalIndices[StartIndex + i + 1];
data[3 * i + 2] = originalIndices[StartIndex + i + 2];
data[3 * i + 0] = originalIndices[StartIndex + i + 1];
data[3 * i + 1] = originalIndices[StartIndex + i + 2];
data[3 * i + 2] = originalIndices[StartIndex + 0];
}
m_context->Unmap(originalIndexBuffer, 0);
}
else {
for (UINT i = 0; i < PrimitiveCount; i++) {
data[3 * i + 0] = 0;
data[3 * i + 1] = i + 1;
data[3 * i + 2] = i + 2;
data[3 * i + 0] = i + 1;
data[3 * i + 1] = i + 2;
data[3 * i + 2] = 0;
}
}
......
......@@ -111,7 +111,7 @@ namespace dxup {
const DX9Operand* dst = operation.getOperandByType(optype::Dst);
const DX9Operand* src0 = operation.getOperandByType(optype::Src0);
if (dst->getRegType() == D3DSPR_ADDR)
if (src0->getRegType() != D3DSPR_CONSTINT && dst->getRegType() == D3DSPR_ADDR && getMajorVersion() == 1 && getMinorVersion() == 1)
return handleMova(operation);
DXBCOperand dstOp = { *this, operation, *dst, 0 };
......@@ -129,6 +129,9 @@ namespace dxup {
const DX9Operand* dst = operation.getOperandByType(optype::Dst);
const DX9Operand* src0 = operation.getOperandByType(optype::Src0);
if (src0->getRegType() == D3DSPR_CONSTINT)
return handleMov(operation);
DXBCOperand dstOp = { *this, operation, *dst, 0 };
DXBCOperand srcOp = { *this, operation, *src0, 0 };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment