mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-05 19:46:15 +01:00
[d3d11] Move remaining D3D11DeviceContext members to D3D11CommonContext
This commit is contained in:
parent
b20bfe763e
commit
a3ed84c0c1
@ -11,11 +11,8 @@
|
|||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
D3D11DeviceContext::D3D11DeviceContext(
|
D3D11DeviceContext::D3D11DeviceContext(
|
||||||
D3D11Device* pParent,
|
D3D11Device* pParent)
|
||||||
const Rc<DxvkDevice>& Device)
|
: D3D11DeviceChild<ID3D11DeviceContext4>(pParent) {
|
||||||
: D3D11DeviceChild<ID3D11DeviceContext4>(pParent),
|
|
||||||
m_device (Device),
|
|
||||||
m_staging (Device, StagingBufferSize) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,39 +45,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DxvkDataSlice D3D11DeviceContext::AllocUpdateBufferSlice(size_t Size) {
|
|
||||||
constexpr size_t UpdateBufferSize = 1 * 1024 * 1024;
|
|
||||||
|
|
||||||
if (Size >= UpdateBufferSize) {
|
|
||||||
Rc<DxvkDataBuffer> buffer = new DxvkDataBuffer(Size);
|
|
||||||
return buffer->alloc(Size);
|
|
||||||
} else {
|
|
||||||
if (m_updateBuffer == nullptr)
|
|
||||||
m_updateBuffer = new DxvkDataBuffer(UpdateBufferSize);
|
|
||||||
|
|
||||||
DxvkDataSlice slice = m_updateBuffer->alloc(Size);
|
|
||||||
|
|
||||||
if (slice.ptr() == nullptr) {
|
|
||||||
m_updateBuffer = new DxvkDataBuffer(UpdateBufferSize);
|
|
||||||
slice = m_updateBuffer->alloc(Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return slice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkBufferSlice D3D11DeviceContext::AllocStagingBuffer(
|
|
||||||
VkDeviceSize Size) {
|
|
||||||
return m_staging.alloc(256, Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void D3D11DeviceContext::ResetStagingBuffer() {
|
|
||||||
m_staging.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void D3D11DeviceContext::InitDefaultPrimitiveTopology(
|
void D3D11DeviceContext::InitDefaultPrimitiveTopology(
|
||||||
DxvkInputAssemblyState* pIaState) {
|
DxvkInputAssemblyState* pIaState) {
|
||||||
pIaState->primitiveTopology = VK_PRIMITIVE_TOPOLOGY_MAX_ENUM;
|
pIaState->primitiveTopology = VK_PRIMITIVE_TOPOLOGY_MAX_ENUM;
|
||||||
|
@ -19,41 +19,20 @@ namespace dxvk {
|
|||||||
class D3D11Device;
|
class D3D11Device;
|
||||||
|
|
||||||
class D3D11DeviceContext : public D3D11DeviceChild<ID3D11DeviceContext4> {
|
class D3D11DeviceContext : public D3D11DeviceChild<ID3D11DeviceContext4> {
|
||||||
template<typename T>
|
|
||||||
friend class D3D11DeviceContextExt;
|
|
||||||
// Needed in order to call EmitCs for pushing markers
|
|
||||||
template<typename T>
|
|
||||||
friend class D3D11UserDefinedAnnotation;
|
|
||||||
|
|
||||||
constexpr static VkDeviceSize StagingBufferSize = 4ull << 20;
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
D3D11DeviceContext(
|
D3D11DeviceContext(
|
||||||
D3D11Device* pParent,
|
D3D11Device* pParent);
|
||||||
const Rc<DxvkDevice>& Device);
|
|
||||||
|
|
||||||
~D3D11DeviceContext();
|
~D3D11DeviceContext();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Rc<DxvkDevice> m_device;
|
|
||||||
Rc<DxvkDataBuffer> m_updateBuffer;
|
|
||||||
|
|
||||||
DxvkStagingBuffer m_staging;
|
|
||||||
|
|
||||||
D3D11ContextState m_state;
|
|
||||||
|
|
||||||
VkClearValue ConvertColorValue(
|
VkClearValue ConvertColorValue(
|
||||||
const FLOAT Color[4],
|
const FLOAT Color[4],
|
||||||
const DxvkFormatInfo* pFormatInfo);
|
const DxvkFormatInfo* pFormatInfo);
|
||||||
|
|
||||||
DxvkDataSlice AllocUpdateBufferSlice(size_t Size);
|
|
||||||
|
|
||||||
DxvkBufferSlice AllocStagingBuffer(
|
|
||||||
VkDeviceSize Size);
|
|
||||||
|
|
||||||
void ResetStagingBuffer();
|
|
||||||
|
|
||||||
static void InitDefaultPrimitiveTopology(
|
static void InitDefaultPrimitiveTopology(
|
||||||
DxvkInputAssemblyState* pIaState);
|
DxvkInputAssemblyState* pIaState);
|
||||||
|
|
||||||
|
@ -9,10 +9,12 @@ namespace dxvk {
|
|||||||
D3D11Device* pParent,
|
D3D11Device* pParent,
|
||||||
const Rc<DxvkDevice>& Device,
|
const Rc<DxvkDevice>& Device,
|
||||||
DxvkCsChunkFlags CsFlags)
|
DxvkCsChunkFlags CsFlags)
|
||||||
: D3D11DeviceContext(pParent, Device),
|
: D3D11DeviceContext(pParent),
|
||||||
m_contextExt(GetTypedContext()),
|
m_contextExt(GetTypedContext()),
|
||||||
m_annotation(GetTypedContext(), Device),
|
m_annotation(GetTypedContext(), Device),
|
||||||
m_multithread(this, false),
|
m_multithread(this, false),
|
||||||
|
m_device (Device),
|
||||||
|
m_staging (Device, StagingBufferSize),
|
||||||
m_csFlags (CsFlags),
|
m_csFlags (CsFlags),
|
||||||
m_csChunk (AllocCsChunk()),
|
m_csChunk (AllocCsChunk()),
|
||||||
m_cmdData (nullptr) {
|
m_cmdData (nullptr) {
|
||||||
@ -2987,7 +2989,37 @@ namespace dxvk {
|
|||||||
DxvkCsChunkRef D3D11CommonContext<ContextType>::AllocCsChunk() {
|
DxvkCsChunkRef D3D11CommonContext<ContextType>::AllocCsChunk() {
|
||||||
return m_parent->AllocCsChunk(m_csFlags);
|
return m_parent->AllocCsChunk(m_csFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename ContextType>
|
||||||
|
DxvkDataSlice D3D11CommonContext<ContextType>::AllocUpdateBufferSlice(size_t Size) {
|
||||||
|
constexpr size_t UpdateBufferSize = 1 * 1024 * 1024;
|
||||||
|
|
||||||
|
if (Size >= UpdateBufferSize) {
|
||||||
|
Rc<DxvkDataBuffer> buffer = new DxvkDataBuffer(Size);
|
||||||
|
return buffer->alloc(Size);
|
||||||
|
} else {
|
||||||
|
if (m_updateBuffer == nullptr)
|
||||||
|
m_updateBuffer = new DxvkDataBuffer(UpdateBufferSize);
|
||||||
|
|
||||||
|
DxvkDataSlice slice = m_updateBuffer->alloc(Size);
|
||||||
|
|
||||||
|
if (slice.ptr() == nullptr) {
|
||||||
|
m_updateBuffer = new DxvkDataBuffer(UpdateBufferSize);
|
||||||
|
slice = m_updateBuffer->alloc(Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
return slice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename ContextType>
|
||||||
|
DxvkBufferSlice D3D11CommonContext<ContextType>::AllocStagingBuffer(
|
||||||
|
VkDeviceSize Size) {
|
||||||
|
return m_staging.alloc(256, Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename ContextType>
|
template<typename ContextType>
|
||||||
void D3D11CommonContext<ContextType>::ApplyInputLayout() {
|
void D3D11CommonContext<ContextType>::ApplyInputLayout() {
|
||||||
@ -3890,6 +3922,12 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename ContextType>
|
||||||
|
void D3D11CommonContext<ContextType>::ResetStagingBuffer() {
|
||||||
|
m_staging.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename ContextType>
|
template<typename ContextType>
|
||||||
void D3D11CommonContext<ContextType>::ResetState() {
|
void D3D11CommonContext<ContextType>::ResetState() {
|
||||||
EmitCs([] (DxvkContext* ctx) {
|
EmitCs([] (DxvkContext* ctx) {
|
||||||
|
@ -58,6 +58,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
template<typename T> friend class D3D11DeviceContextExt;
|
template<typename T> friend class D3D11DeviceContextExt;
|
||||||
template<typename T> friend class D3D11UserDefinedAnnotation;
|
template<typename T> friend class D3D11UserDefinedAnnotation;
|
||||||
|
|
||||||
|
constexpr static VkDeviceSize StagingBufferSize = 4ull << 20;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
D3D11CommonContext(
|
D3D11CommonContext(
|
||||||
@ -748,12 +750,24 @@ namespace dxvk {
|
|||||||
D3D11UserDefinedAnnotation<ContextType> m_annotation;
|
D3D11UserDefinedAnnotation<ContextType> m_annotation;
|
||||||
D3D10Multithread m_multithread;
|
D3D10Multithread m_multithread;
|
||||||
|
|
||||||
|
Rc<DxvkDevice> m_device;
|
||||||
|
|
||||||
|
D3D11ContextState m_state;
|
||||||
|
|
||||||
|
DxvkStagingBuffer m_staging;
|
||||||
|
Rc<DxvkDataBuffer> m_updateBuffer;
|
||||||
|
|
||||||
DxvkCsChunkFlags m_csFlags;
|
DxvkCsChunkFlags m_csFlags;
|
||||||
DxvkCsChunkRef m_csChunk;
|
DxvkCsChunkRef m_csChunk;
|
||||||
D3D11CmdData* m_cmdData;
|
D3D11CmdData* m_cmdData;
|
||||||
|
|
||||||
DxvkCsChunkRef AllocCsChunk();
|
DxvkCsChunkRef AllocCsChunk();
|
||||||
|
|
||||||
|
DxvkDataSlice AllocUpdateBufferSlice(size_t Size);
|
||||||
|
|
||||||
|
DxvkBufferSlice AllocStagingBuffer(
|
||||||
|
VkDeviceSize Size);
|
||||||
|
|
||||||
void ApplyInputLayout();
|
void ApplyInputLayout();
|
||||||
|
|
||||||
void ApplyPrimitiveTopology();
|
void ApplyPrimitiveTopology();
|
||||||
@ -871,6 +885,8 @@ namespace dxvk {
|
|||||||
UINT NumSamplers,
|
UINT NumSamplers,
|
||||||
ID3D11SamplerState** ppSamplers);
|
ID3D11SamplerState** ppSamplers);
|
||||||
|
|
||||||
|
void ResetStagingBuffer();
|
||||||
|
|
||||||
void ResetState();
|
void ResetState();
|
||||||
|
|
||||||
template<DxbcProgramType ShaderStage, typename T>
|
template<DxbcProgramType ShaderStage, typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user