1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Use EmitCs for draw and dispatch calls

This commit is contained in:
Philip Rebohle 2018-01-20 18:26:17 +01:00
parent 4d17b1752f
commit e951a5ea0c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -595,9 +595,12 @@ namespace dxvk {
void STDMETHODCALLTYPE D3D11DeviceContext::Draw( void STDMETHODCALLTYPE D3D11DeviceContext::Draw(
UINT VertexCount, UINT VertexCount,
UINT StartVertexLocation) { UINT StartVertexLocation) {
m_context->draw( EmitCs([=] (DxvkContext* ctx) {
VertexCount, 1, ctx->draw(
StartVertexLocation, 0); VertexCount, 1,
StartVertexLocation, 0);
});
m_drawCount += 1; m_drawCount += 1;
} }
@ -606,10 +609,13 @@ namespace dxvk {
UINT IndexCount, UINT IndexCount,
UINT StartIndexLocation, UINT StartIndexLocation,
INT BaseVertexLocation) { INT BaseVertexLocation) {
m_context->drawIndexed( EmitCs([=] (DxvkContext* ctx) {
IndexCount, 1, ctx->drawIndexed(
StartIndexLocation, IndexCount, 1,
BaseVertexLocation, 0); StartIndexLocation,
BaseVertexLocation, 0);
});
m_drawCount += 1; m_drawCount += 1;
} }
@ -619,11 +625,14 @@ namespace dxvk {
UINT InstanceCount, UINT InstanceCount,
UINT StartVertexLocation, UINT StartVertexLocation,
UINT StartInstanceLocation) { UINT StartInstanceLocation) {
m_context->draw( EmitCs([=] (DxvkContext* ctx) {
VertexCountPerInstance, ctx->draw(
InstanceCount, VertexCountPerInstance,
StartVertexLocation, InstanceCount,
StartInstanceLocation); StartVertexLocation,
StartInstanceLocation);
});
m_drawCount += 1; m_drawCount += 1;
} }
@ -634,12 +643,15 @@ namespace dxvk {
UINT StartIndexLocation, UINT StartIndexLocation,
INT BaseVertexLocation, INT BaseVertexLocation,
UINT StartInstanceLocation) { UINT StartInstanceLocation) {
m_context->drawIndexed( EmitCs([=] (DxvkContext* ctx) {
IndexCountPerInstance, ctx->drawIndexed(
InstanceCount, IndexCountPerInstance,
StartIndexLocation, InstanceCount,
BaseVertexLocation, StartIndexLocation,
StartInstanceLocation); BaseVertexLocation,
StartInstanceLocation);
});
m_drawCount += 1; m_drawCount += 1;
} }
@ -648,9 +660,13 @@ namespace dxvk {
ID3D11Buffer* pBufferForArgs, ID3D11Buffer* pBufferForArgs,
UINT AlignedByteOffsetForArgs) { UINT AlignedByteOffsetForArgs) {
D3D11Buffer* buffer = static_cast<D3D11Buffer*>(pBufferForArgs); D3D11Buffer* buffer = static_cast<D3D11Buffer*>(pBufferForArgs);
DxvkBufferSlice bufferSlice = buffer->GetBufferSlice(AlignedByteOffsetForArgs);
m_context->drawIndexedIndirect(bufferSlice, 1, 0); EmitCs([bufferSlice = buffer->GetBufferSlice(AlignedByteOffsetForArgs)]
(DxvkContext* ctx) {
ctx->drawIndexedIndirect(
bufferSlice, 1, 0);
});
m_drawCount += 1; m_drawCount += 1;
} }
@ -659,9 +675,12 @@ namespace dxvk {
ID3D11Buffer* pBufferForArgs, ID3D11Buffer* pBufferForArgs,
UINT AlignedByteOffsetForArgs) { UINT AlignedByteOffsetForArgs) {
D3D11Buffer* buffer = static_cast<D3D11Buffer*>(pBufferForArgs); D3D11Buffer* buffer = static_cast<D3D11Buffer*>(pBufferForArgs);
DxvkBufferSlice bufferSlice = buffer->GetBufferSlice(AlignedByteOffsetForArgs);
m_context->drawIndirect(bufferSlice, 1, 0); EmitCs([bufferSlice = buffer->GetBufferSlice(AlignedByteOffsetForArgs)]
(DxvkContext* ctx) {
ctx->drawIndirect(bufferSlice, 1, 0);
});
m_drawCount += 1; m_drawCount += 1;
} }
@ -670,10 +689,13 @@ namespace dxvk {
UINT ThreadGroupCountX, UINT ThreadGroupCountX,
UINT ThreadGroupCountY, UINT ThreadGroupCountY,
UINT ThreadGroupCountZ) { UINT ThreadGroupCountZ) {
m_context->dispatch( EmitCs([=] (DxvkContext* ctx) {
ThreadGroupCountX, ctx->dispatch(
ThreadGroupCountY, ThreadGroupCountX,
ThreadGroupCountZ); ThreadGroupCountY,
ThreadGroupCountZ);
});
m_drawCount += 1; m_drawCount += 1;
} }
@ -682,9 +704,12 @@ namespace dxvk {
ID3D11Buffer* pBufferForArgs, ID3D11Buffer* pBufferForArgs,
UINT AlignedByteOffsetForArgs) { UINT AlignedByteOffsetForArgs) {
D3D11Buffer* buffer = static_cast<D3D11Buffer*>(pBufferForArgs); D3D11Buffer* buffer = static_cast<D3D11Buffer*>(pBufferForArgs);
DxvkBufferSlice bufferSlice = buffer->GetBufferSlice(AlignedByteOffsetForArgs);
m_context->dispatchIndirect(bufferSlice); EmitCs([bufferSlice = buffer->GetBufferSlice(AlignedByteOffsetForArgs)]
(DxvkContext* ctx) {
ctx->dispatchIndirect(bufferSlice);
});
m_drawCount += 1; m_drawCount += 1;
} }