forked from LukasBanana/LLGL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[D3D11] Refactored secondary command buffers in D3D11 backend.
- Added virtual command encoding for D3D11 secondary command buffers (similar to GL and Metal backends). - Moved some commands into D3D11CommandContext class. - Added restriction to definition of CopyTextureFromFramebuffer() function: Must only be used inside render pass. - Fixed CommandBufferSecondary test for D3D11.
- Loading branch information
1 parent
3bb9c69
commit f2b153b
Showing
24 changed files
with
2,145 additions
and
712 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
* D3D11Command.h | ||
* | ||
* Copyright (c) 2015 Lukas Hermanns. All rights reserved. | ||
* Licensed under the terms of the BSD 3-Clause license (see LICENSE.txt). | ||
*/ | ||
|
||
#ifndef LLGL_D3D11_COMMAND_H | ||
#define LLGL_D3D11_COMMAND_H | ||
|
||
|
||
#include "../Direct3D11.h" | ||
#include <cstdint> | ||
|
||
|
||
namespace LLGL | ||
{ | ||
|
||
|
||
class Resource; | ||
class ResourceHeap; | ||
class D3D11Buffer; | ||
class D3D11BufferArray; | ||
class D3D11ResourceHeap; | ||
class D3D11PipelineState; | ||
|
||
struct D3D11CmdSetVertexBuffer | ||
{ | ||
D3D11Buffer* buffer; | ||
}; | ||
|
||
struct D3D11CmdSetVertexBufferArray | ||
{ | ||
D3D11BufferArray* bufferArray; | ||
}; | ||
|
||
struct D3D11CmdSetIndexBuffer | ||
{ | ||
D3D11Buffer* buffer; | ||
DXGI_FORMAT format; | ||
UINT offset; | ||
}; | ||
|
||
struct D3D11CmdSetResourceHeap | ||
{ | ||
D3D11ResourceHeap* resourceHeap; | ||
std::uint32_t descriptorSet; | ||
}; | ||
|
||
struct D3D11CmdSetResource | ||
{ | ||
std::uint32_t descriptor; | ||
Resource* resource; | ||
}; | ||
|
||
struct D3D11CmdSetPipelineState | ||
{ | ||
D3D11PipelineState* pipelineState; | ||
}; | ||
|
||
struct D3D11CmdSetBlendFactor | ||
{ | ||
FLOAT color[4]; | ||
}; | ||
|
||
struct D3D11CmdSetStencilRef | ||
{ | ||
UINT stencilRef; | ||
}; | ||
|
||
struct D3D11CmdSetUniforms | ||
{ | ||
std::uint32_t first; | ||
std::uint16_t dataSize; | ||
// char data[dataSize]; | ||
}; | ||
|
||
struct D3D11CmdDraw | ||
{ | ||
UINT vertexCount; | ||
UINT startVertexLocation; | ||
}; | ||
|
||
struct D3D11CmdDrawIndexed | ||
{ | ||
UINT indexCount; | ||
UINT startIndexLocation; | ||
INT baseVertexLocation; | ||
}; | ||
|
||
struct D3D11CmdDrawInstanced | ||
{ | ||
UINT vertexCountPerInstance; | ||
UINT instanceCount; | ||
UINT startVertexLocation; | ||
UINT startInstanceLocation; | ||
}; | ||
|
||
struct D3D11CmdDrawIndexedInstanced | ||
{ | ||
UINT indexCountPerInstance; | ||
UINT instanceCount; | ||
UINT startIndexLocation; | ||
INT baseVertexLocation; | ||
UINT startInstanceLocation; | ||
}; | ||
|
||
struct D3D11CmdDrawInstancedIndirect | ||
{ | ||
ID3D11Buffer* bufferForArgs; | ||
UINT alignedByteOffsetForArgs; | ||
UINT numCommands; | ||
UINT stride; | ||
}; | ||
|
||
//D3D11CmdDrawIndexedInstancedIndirect = D3D11CmdDrawInstancedIndirect | ||
|
||
struct D3D11CmdDispatch | ||
{ | ||
UINT threadGroupCountX; | ||
UINT threadGroupCountY; | ||
UINT threadGroupCountZ; | ||
}; | ||
|
||
struct D3D11CmdDispatchIndirect | ||
{ | ||
ID3D11Buffer* bufferForArgs; | ||
UINT alignedByteOffsetForArgs; | ||
}; | ||
|
||
|
||
} // /namespace LLGL | ||
|
||
|
||
#endif | ||
|
||
|
||
|
||
// ================================================================================ |
25 changes: 25 additions & 0 deletions
25
sources/Renderer/Direct3D11/Command/D3D11CommandBuffer.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* D3D11CommandBuffer.cpp | ||
* | ||
* Copyright (c) 2015 Lukas Hermanns. All rights reserved. | ||
* Licensed under the terms of the BSD 3-Clause license (see LICENSE.txt). | ||
*/ | ||
|
||
#include "D3D11CommandBuffer.h" | ||
|
||
|
||
namespace LLGL | ||
{ | ||
|
||
|
||
D3D11CommandBuffer::D3D11CommandBuffer(bool isSecondaryCmdBuffer) : | ||
isSecondaryCmdBuffer_ { isSecondaryCmdBuffer } | ||
{ | ||
} | ||
|
||
|
||
} // /namespace LLGL | ||
|
||
|
||
|
||
// ================================================================================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* D3D11CommandBuffer.h | ||
* | ||
* Copyright (c) 2015 Lukas Hermanns. All rights reserved. | ||
* Licensed under the terms of the BSD 3-Clause license (see LICENSE.txt). | ||
*/ | ||
|
||
#ifndef LLGL_D3D11_COMMAND_BUFFER_H | ||
#define LLGL_D3D11_COMMAND_BUFFER_H | ||
|
||
|
||
#include <LLGL/CommandBuffer.h> | ||
#include "../../DXCommon/ComPtr.h" | ||
#include "../../DXCommon/DXCore.h" | ||
#include "../Direct3D11.h" | ||
#include <dxgi.h> | ||
#include <vector> | ||
#include <cstddef> | ||
|
||
|
||
namespace LLGL | ||
{ | ||
|
||
|
||
class D3D11Buffer; | ||
class D3D11StateManager; | ||
class D3D11BindingTable; | ||
class D3D11RenderTarget; | ||
class D3D11SwapChain; | ||
class D3D11RenderPass; | ||
class D3D11PipelineState; | ||
class D3D11PipelineLayout; | ||
class D3D11ConstantsCache; | ||
class D3D11RenderTargetHandles; | ||
|
||
class D3D11CommandBuffer : public CommandBuffer | ||
{ | ||
|
||
public: | ||
|
||
D3D11CommandBuffer(bool isSecondaryCmdBuffer); | ||
|
||
public: | ||
|
||
// Returns true if this is a secondary command buffer that can be executed within a primary command buffer. | ||
inline bool IsSecondaryCmdBuffer() const | ||
{ | ||
return isSecondaryCmdBuffer_; | ||
} | ||
|
||
private: | ||
|
||
const bool isSecondaryCmdBuffer_ = false; | ||
|
||
}; | ||
|
||
|
||
} // /namespace LLGL | ||
|
||
|
||
#endif | ||
|
||
|
||
|
||
// ================================================================================ |
Oops, something went wrong.