mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d9] Don't rebind user's vertex buffer/indices in DrawPrimitive[Indexed]UP
D3D9 doesn't do this, it instead sets them to NULL so we can simplify this logic a fair bit. Found via a Wine test.
This commit is contained in:
parent
3587bcdb9f
commit
722520a9f7
@ -2302,7 +2302,7 @@ namespace dxvk {
|
|||||||
UINT VertexStreamZeroStride) {
|
UINT VertexStreamZeroStride) {
|
||||||
D3D9DeviceLock lock = LockDevice();
|
D3D9DeviceLock lock = LockDevice();
|
||||||
|
|
||||||
PrepareDraw(PrimitiveType, true);
|
PrepareDraw(PrimitiveType);
|
||||||
|
|
||||||
auto drawInfo = GenerateDrawInfo(PrimitiveType, PrimitiveCount, 0);
|
auto drawInfo = GenerateDrawInfo(PrimitiveType, PrimitiveCount, 0);
|
||||||
|
|
||||||
@ -2326,9 +2326,12 @@ namespace dxvk {
|
|||||||
ctx->draw(
|
ctx->draw(
|
||||||
drawInfo.vertexCount, drawInfo.instanceCount,
|
drawInfo.vertexCount, drawInfo.instanceCount,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
ctx->bindVertexBuffer(0, DxvkBufferSlice(), 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
m_flags.set(D3D9DeviceFlag::UpDirtiedVertices);
|
m_state.vertexBuffers[0].vertexBuffer = nullptr;
|
||||||
|
m_state.vertexBuffers[0].offset = 0;
|
||||||
|
m_state.vertexBuffers[0].stride = 0;
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
@ -2345,7 +2348,7 @@ namespace dxvk {
|
|||||||
UINT VertexStreamZeroStride) {
|
UINT VertexStreamZeroStride) {
|
||||||
D3D9DeviceLock lock = LockDevice();
|
D3D9DeviceLock lock = LockDevice();
|
||||||
|
|
||||||
PrepareDraw(PrimitiveType, true);
|
PrepareDraw(PrimitiveType);
|
||||||
|
|
||||||
auto drawInfo = GenerateDrawInfo(PrimitiveType, PrimitiveCount, 0);
|
auto drawInfo = GenerateDrawInfo(PrimitiveType, PrimitiveCount, 0);
|
||||||
|
|
||||||
@ -2382,10 +2385,15 @@ namespace dxvk {
|
|||||||
drawInfo.vertexCount, drawInfo.instanceCount,
|
drawInfo.vertexCount, drawInfo.instanceCount,
|
||||||
0,
|
0,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
ctx->bindVertexBuffer(0, DxvkBufferSlice(), 0);
|
||||||
|
ctx->bindIndexBuffer(DxvkBufferSlice(), VK_INDEX_TYPE_UINT32);
|
||||||
});
|
});
|
||||||
|
|
||||||
m_flags.set(D3D9DeviceFlag::UpDirtiedVertices);
|
m_state.vertexBuffers[0].vertexBuffer = nullptr;
|
||||||
m_flags.set(D3D9DeviceFlag::UpDirtiedIndices);
|
m_state.vertexBuffers[0].offset = 0;
|
||||||
|
m_state.vertexBuffers[0].stride = 0;
|
||||||
|
|
||||||
|
m_state.indices = nullptr;
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
@ -2415,7 +2423,7 @@ namespace dxvk {
|
|||||||
D3D9CommonBuffer* dst = static_cast<D3D9VertexBuffer*>(pDestBuffer)->GetCommonBuffer();
|
D3D9CommonBuffer* dst = static_cast<D3D9VertexBuffer*>(pDestBuffer)->GetCommonBuffer();
|
||||||
D3D9VertexDecl* decl = static_cast<D3D9VertexDecl*> (pVertexDecl);
|
D3D9VertexDecl* decl = static_cast<D3D9VertexDecl*> (pVertexDecl);
|
||||||
|
|
||||||
PrepareDraw(D3DPT_FORCE_DWORD, false);
|
PrepareDraw(D3DPT_FORCE_DWORD);
|
||||||
|
|
||||||
if (decl == nullptr) {
|
if (decl == nullptr) {
|
||||||
DWORD FVF = dst->Desc()->FVF;
|
DWORD FVF = dst->Desc()->FVF;
|
||||||
@ -5425,7 +5433,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D3D9DeviceEx::PrepareDraw(D3DPRIMITIVETYPE PrimitiveType, bool up) {
|
void D3D9DeviceEx::PrepareDraw(D3DPRIMITIVETYPE PrimitiveType) {
|
||||||
if (unlikely(m_activeHazards != 0)) {
|
if (unlikely(m_activeHazards != 0)) {
|
||||||
EmitCs([](DxvkContext* ctx) {
|
EmitCs([](DxvkContext* ctx) {
|
||||||
ctx->emitRenderTargetReadbackBarrier();
|
ctx->emitRenderTargetReadbackBarrier();
|
||||||
@ -5488,20 +5496,6 @@ namespace dxvk {
|
|||||||
else if (m_lastPointMode != 0)
|
else if (m_lastPointMode != 0)
|
||||||
UpdatePointMode<false>();
|
UpdatePointMode<false>();
|
||||||
|
|
||||||
if (!up && m_flags.test(D3D9DeviceFlag::UpDirtiedVertices)) {
|
|
||||||
m_flags.clr(D3D9DeviceFlag::UpDirtiedVertices);
|
|
||||||
if (m_state.vertexBuffers[0].vertexBuffer != nullptr)
|
|
||||||
BindVertexBuffer(0,
|
|
||||||
m_state.vertexBuffers[0].vertexBuffer.ptr(),
|
|
||||||
m_state.vertexBuffers[0].offset,
|
|
||||||
m_state.vertexBuffers[0].stride);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!up && m_flags.test(D3D9DeviceFlag::UpDirtiedIndices)) {
|
|
||||||
m_flags.clr(D3D9DeviceFlag::UpDirtiedIndices);
|
|
||||||
BindIndices();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (likely(UseProgrammableVS())) {
|
if (likely(UseProgrammableVS())) {
|
||||||
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyProgVertexShader))) {
|
if (unlikely(m_flags.test(D3D9DeviceFlag::DirtyProgVertexShader))) {
|
||||||
m_flags.set(D3D9DeviceFlag::DirtyInputLayout);
|
m_flags.set(D3D9DeviceFlag::DirtyInputLayout);
|
||||||
|
@ -68,8 +68,6 @@ namespace dxvk {
|
|||||||
DirtyFFPixelData,
|
DirtyFFPixelData,
|
||||||
DirtyProgVertexShader,
|
DirtyProgVertexShader,
|
||||||
DirtySharedPixelShaderData,
|
DirtySharedPixelShaderData,
|
||||||
UpDirtiedVertices,
|
|
||||||
UpDirtiedIndices,
|
|
||||||
ValidSampleMask,
|
ValidSampleMask,
|
||||||
DirtyDepthBounds,
|
DirtyDepthBounds,
|
||||||
DirtyPointScale,
|
DirtyPointScale,
|
||||||
@ -837,7 +835,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
uint32_t GetInstanceCount() const;
|
uint32_t GetInstanceCount() const;
|
||||||
|
|
||||||
void PrepareDraw(D3DPRIMITIVETYPE PrimitiveType, bool up = false);
|
void PrepareDraw(D3DPRIMITIVETYPE PrimitiveType);
|
||||||
|
|
||||||
template <DxsoProgramType ShaderStage>
|
template <DxsoProgramType ShaderStage>
|
||||||
void BindShader(
|
void BindShader(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user