mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxvk] Introduce DxvkContextType
This commit is contained in:
parent
8dde72da06
commit
ab0c15ea54
@ -13,7 +13,7 @@ namespace dxvk {
|
||||
D3D11Device* pParent,
|
||||
const Rc<DxvkDevice>& Device)
|
||||
: D3D11DeviceContext(pParent, Device, DxvkCsChunkFlag::SingleUse),
|
||||
m_csThread(Device, Device->createContext()),
|
||||
m_csThread(Device, Device->createContext(DxvkContextType::Primary)),
|
||||
m_maxImplicitDiscardSize(pParent->GetOptions()->maxImplicitDiscardSize),
|
||||
m_videoContext(this, Device) {
|
||||
EmitCs([
|
||||
|
@ -9,7 +9,7 @@ namespace dxvk {
|
||||
D3D11Device* pParent)
|
||||
: m_parent(pParent),
|
||||
m_device(pParent->GetDXVKDevice()),
|
||||
m_context(m_device->createContext()) {
|
||||
m_context(m_device->createContext(DxvkContextType::Supplementary)) {
|
||||
m_context->beginRecording(
|
||||
m_device->createCommandList());
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace dxvk {
|
||||
m_window (hWnd),
|
||||
m_desc (*pDesc),
|
||||
m_device (pDevice->GetDXVKDevice()),
|
||||
m_context (m_device->createContext()),
|
||||
m_context (m_device->createContext(DxvkContextType::Supplementary)),
|
||||
m_frameLatencyCap(pDevice->GetOptions()->maxFrameLatency) {
|
||||
CreateFrameLatencyEvent();
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace dxvk {
|
||||
, m_d3d9Options ( dxvkDevice, pParent->GetInstance()->config() )
|
||||
, m_multithread ( BehaviorFlags & D3DCREATE_MULTITHREADED )
|
||||
, m_isSWVP ( (BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING) ? true : false )
|
||||
, m_csThread ( dxvkDevice, dxvkDevice->createContext() )
|
||||
, m_csThread ( dxvkDevice, dxvkDevice->createContext(DxvkContextType::Primary) )
|
||||
, m_csChunk ( AllocCsChunk() ) {
|
||||
// If we can SWVP, then we use an extended constant set
|
||||
// as SWVP has many more slots available than HWVP.
|
||||
|
@ -10,7 +10,7 @@
|
||||
namespace dxvk {
|
||||
|
||||
D3D9FormatHelper::D3D9FormatHelper(const Rc<DxvkDevice>& device)
|
||||
: m_device(device), m_context(m_device->createContext()) {
|
||||
: m_device(device), m_context(m_device->createContext(DxvkContextType::Supplementary)) {
|
||||
m_context->beginRecording(
|
||||
m_device->createCommandList());
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace dxvk {
|
||||
|
||||
D3D9Initializer::D3D9Initializer(
|
||||
const Rc<DxvkDevice>& Device)
|
||||
: m_device(Device), m_context(m_device->createContext()) {
|
||||
: m_device(Device), m_context(m_device->createContext(DxvkContextType::Supplementary)) {
|
||||
m_context->beginRecording(
|
||||
m_device->createCommandList());
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ namespace dxvk {
|
||||
const D3DDISPLAYMODEEX* pFullscreenDisplayMode)
|
||||
: D3D9SwapChainExBase(pDevice)
|
||||
, m_device (pDevice->GetDXVKDevice())
|
||||
, m_context (m_device->createContext())
|
||||
, m_context (m_device->createContext(DxvkContextType::Supplementary))
|
||||
, m_frameLatencyCap (pDevice->GetOptions()->maxFrameLatency)
|
||||
, m_frameLatencySignal(new sync::Fence(m_frameId))
|
||||
, m_dialog (pDevice->GetOptions()->enableDialogMode) {
|
||||
|
@ -7,8 +7,9 @@
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
DxvkContext::DxvkContext(const Rc<DxvkDevice>& device)
|
||||
DxvkContext::DxvkContext(const Rc<DxvkDevice>& device, DxvkContextType type)
|
||||
: m_device (device),
|
||||
m_type (type),
|
||||
m_common (&device->m_objects),
|
||||
m_sdmaAcquires(DxvkCmdBuffer::SdmaBuffer),
|
||||
m_sdmaBarriers(DxvkCmdBuffer::SdmaBuffer),
|
||||
|
@ -22,7 +22,7 @@ namespace dxvk {
|
||||
constexpr static VkDeviceSize StagingBufferSize = 4ull << 20;
|
||||
public:
|
||||
|
||||
DxvkContext(const Rc<DxvkDevice>& device);
|
||||
DxvkContext(const Rc<DxvkDevice>& device, DxvkContextType type);
|
||||
~DxvkContext();
|
||||
|
||||
/**
|
||||
@ -1038,6 +1038,7 @@ namespace dxvk {
|
||||
private:
|
||||
|
||||
Rc<DxvkDevice> m_device;
|
||||
DxvkContextType m_type;
|
||||
DxvkObjects* m_common;
|
||||
|
||||
Rc<DxvkCommandList> m_cmd;
|
||||
|
@ -8,6 +8,16 @@ namespace dxvk {
|
||||
|
||||
class DxvkDevice;
|
||||
|
||||
/**
|
||||
* \brief DXVK context type
|
||||
*
|
||||
* Used as a hint to optimize certain usage patterns.
|
||||
*/
|
||||
enum class DxvkContextType : uint32_t {
|
||||
Primary = 0,
|
||||
Supplementary = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Descriptor info
|
||||
*
|
||||
|
@ -94,8 +94,8 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkContext> DxvkDevice::createContext() {
|
||||
return new DxvkContext(this);
|
||||
Rc<DxvkContext> DxvkDevice::createContext(DxvkContextType type) {
|
||||
return new DxvkContext(this, type);
|
||||
}
|
||||
|
||||
|
||||
|
@ -244,9 +244,10 @@ namespace dxvk {
|
||||
*
|
||||
* Creates a context object that can
|
||||
* be used to record command buffers.
|
||||
* \param [in] type Context type
|
||||
* \returns The context object
|
||||
*/
|
||||
Rc<DxvkContext> createContext();
|
||||
Rc<DxvkContext> createContext(DxvkContextType type);
|
||||
|
||||
/**
|
||||
* \brief Creates a GPU event
|
||||
|
@ -21,7 +21,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkUnboundResources::clearResources(DxvkDevice* dev) {
|
||||
const Rc<DxvkContext> ctx = dev->createContext();
|
||||
const Rc<DxvkContext> ctx = dev->createContext(DxvkContextType::Supplementary);
|
||||
ctx->beginRecording(dev->createCommandList());
|
||||
|
||||
this->clearBuffer(ctx, m_buffer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user