[dxvk] Removed Recorder interface and deferred context

This commit is contained in:
Philip Rebohle 2017-12-01 09:50:47 +01:00
parent 004bc88e0c
commit 27905d0711
10 changed files with 31 additions and 200 deletions

View File

@ -33,8 +33,7 @@ namespace dxvk {
}
void DxvkBarrierSet::recordCommands(
DxvkRecorder& recorder) {
void DxvkBarrierSet::recordCommands(DxvkCommandList& commandList) {
if ((m_srcStages | m_dstStages) != 0) {
VkPipelineStageFlags srcFlags = m_srcStages;
VkPipelineStageFlags dstFlags = m_dstStages;
@ -42,7 +41,7 @@ namespace dxvk {
if (srcFlags == 0) srcFlags = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
if (dstFlags == 0) dstFlags = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
recorder.cmdPipelineBarrier(
commandList.cmdPipelineBarrier(
srcFlags, dstFlags, 0,
m_memBarriers.size(), m_memBarriers.data(),
m_bufBarriers.size(), m_bufBarriers.data(),

View File

@ -1,8 +1,8 @@
#pragma once
#include "dxvk_buffer.h"
#include "dxvk_cmdlist.h"
#include "dxvk_image.h"
#include "dxvk_recorder.h"
namespace dxvk {
@ -28,7 +28,7 @@ namespace dxvk {
VkAccessFlags access);
void recordCommands(
DxvkRecorder& recorder);
DxvkCommandList& commandList);
void reset();

View File

@ -4,7 +4,6 @@
#include "dxvk_descriptor.h"
#include "dxvk_lifetime.h"
#include "dxvk_recorder.h"
namespace dxvk {
@ -17,7 +16,7 @@ namespace dxvk {
* When the command list has completed execution, resources that
* are no longer used may get destroyed.
*/
class DxvkCommandList : public DxvkRecorder {
class DxvkCommandList : public RcObject {
public:
@ -40,7 +39,7 @@ namespace dxvk {
* Resets the command buffer and
* begins command buffer recording.
*/
void beginRecording() final;
void beginRecording();
/**
* \brief Ends recording
@ -48,7 +47,7 @@ namespace dxvk {
* Ends command buffer recording, making
* the command list ready for submission.
*/
void endRecording() final;
void endRecording();
/**
* \brief Adds a resource to track
@ -59,7 +58,7 @@ namespace dxvk {
* completed.
*/
void trackResource(
const Rc<DxvkResource>& rc) final;
const Rc<DxvkResource>& rc);
/**
* \brief Resets the command list
@ -69,72 +68,72 @@ namespace dxvk {
* command list to the device, this method will be called once
* the command list completes execution.
*/
void reset() final;
void reset();
void bindShaderResources(
VkPipelineBindPoint pipeline,
VkPipelineLayout pipelineLayout,
VkDescriptorSetLayout descriptorLayout,
uint32_t bindingCount,
const DxvkResourceBinding* bindings) final;
const DxvkResourceBinding* bindings);
void cmdBeginRenderPass(
const VkRenderPassBeginInfo* pRenderPassBegin,
VkSubpassContents contents) final;
VkSubpassContents contents);
void cmdBindIndexBuffer(
VkBuffer buffer,
VkDeviceSize offset,
VkIndexType indexType) final;
VkIndexType indexType);
void cmdBindPipeline(
VkPipelineBindPoint pipelineBindPoint,
VkPipeline pipeline) final;
VkPipeline pipeline);
void cmdBindVertexBuffers(
uint32_t firstBinding,
uint32_t bindingCount,
const VkBuffer* pBuffers,
const VkDeviceSize* pOffsets) final;
const VkDeviceSize* pOffsets);
void cmdClearAttachments(
uint32_t attachmentCount,
const VkClearAttachment* pAttachments,
uint32_t rectCount,
const VkClearRect* pRects) final;
const VkClearRect* pRects);
void cmdClearColorImage(
VkImage image,
VkImageLayout imageLayout,
const VkClearColorValue* pColor,
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges) final;
const VkImageSubresourceRange* pRanges);
void cmdCopyBuffer(
VkBuffer srcBuffer,
VkBuffer dstBuffer,
uint32_t regionCount,
const VkBufferCopy* pRegions) final;
const VkBufferCopy* pRegions);
void cmdDispatch(
uint32_t x,
uint32_t y,
uint32_t z) final;
uint32_t z);
void cmdDraw(
uint32_t vertexCount,
uint32_t instanceCount,
uint32_t firstVertex,
uint32_t firstInstance) final;
uint32_t firstInstance);
void cmdDrawIndexed(
uint32_t indexCount,
uint32_t instanceCount,
uint32_t firstIndex,
uint32_t vertexOffset,
uint32_t firstInstance) final;
uint32_t firstInstance);
void cmdEndRenderPass() final;
void cmdEndRenderPass();
void cmdPipelineBarrier(
VkPipelineStageFlags srcStageMask,
@ -145,17 +144,17 @@ namespace dxvk {
uint32_t bufferMemoryBarrierCount,
const VkBufferMemoryBarrier* pBufferMemoryBarriers,
uint32_t imageMemoryBarrierCount,
const VkImageMemoryBarrier* pImageMemoryBarriers) final;
const VkImageMemoryBarrier* pImageMemoryBarriers);
void cmdSetScissor(
uint32_t firstScissor,
uint32_t scissorCount,
const VkRect2D* scissors) final;
const VkRect2D* scissors);
void cmdSetViewport(
uint32_t firstViewport,
uint32_t viewportCount,
const VkViewport* viewports) final;
const VkViewport* viewports);
private:

View File

@ -18,9 +18,8 @@ namespace dxvk {
}
void DxvkContext::beginRecording(
const Rc<DxvkRecorder>& recorder) {
m_cmd = recorder;
void DxvkContext::beginRecording(const Rc<DxvkCommandList>& cmdList) {
m_cmd = cmdList;
m_cmd->beginRecording();
// The current state of the internal command buffer is

View File

@ -3,7 +3,6 @@
#include "dxvk_barrier.h"
#include "dxvk_cmdlist.h"
#include "dxvk_context_state.h"
#include "dxvk_deferred.h"
#include "dxvk_pipemgr.h"
#include "dxvk_util.h"
@ -31,10 +30,10 @@ namespace dxvk {
* Begins recording a command list. This does
* not alter any context state other than the
* active command list.
* \param [in] recorder Target recorder
* \param [in] cmdList Target command list
*/
void beginRecording(
const Rc<DxvkRecorder>& recorder);
const Rc<DxvkCommandList>& cmdList);
/**
* \brief Ends command buffer recording
@ -225,9 +224,9 @@ namespace dxvk {
const Rc<DxvkDevice> m_device;
const Rc<DxvkPipelineManager> m_pipeMgr;
Rc<DxvkRecorder> m_cmd;
DxvkContextState m_state;
DxvkBarrierSet m_barriers;
Rc<DxvkCommandList> m_cmd;
DxvkContextState m_state;
DxvkBarrierSet m_barriers;
void renderPassBegin();
void renderPassEnd();

View File

@ -1,8 +0,0 @@
#include "dxvk_deferred.h"
namespace dxvk {
DxvkDeferredCommands:: DxvkDeferredCommands() { }
DxvkDeferredCommands::~DxvkDeferredCommands() { }
}

View File

@ -1,27 +0,0 @@
#pragma once
#include <unordered_set>
#include "dxvk_lifetime.h"
#include "dxvk_recorder.h"
namespace dxvk {
/**
* \brief DXVK deferred command list
*
* Buffers Vulkan commands so that they can be recorded
* into an actual Vulkan command buffer later. This is
* used to implement D3D11 Deferred Contexts, which do
* not map particularly well to Vulkan's command buffers.
*/
class DxvkDeferredCommands : public DxvkRecorder {
public:
DxvkDeferredCommands();
~DxvkDeferredCommands();
};
}

View File

@ -1,9 +0,0 @@
#include "dxvk_recorder.h"
namespace dxvk {
DxvkRecorder::~DxvkRecorder() {
}
}

View File

@ -1,119 +0,0 @@
#pragma once
#include "dxvk_descriptor.h"
#include "dxvk_lifetime.h"
namespace dxvk {
/**
* \brief DXVK command recorder
*
* An interface that wraps Vulkan calls. \ref DxvkCommandList
* implements this interface to record Vulkan commands into a
* primary command buffer, whereas \ref DxvkDeferredCommands
* buffers the calls and provides methods to record them into
* a \ref DxvkCommandList on demand.
*/
class DxvkRecorder : public RcObject {
public:
virtual ~DxvkRecorder();
virtual void beginRecording() = 0;
virtual void endRecording() = 0;
virtual void trackResource(
const Rc<DxvkResource>& rc) = 0;
virtual void reset() = 0;
virtual void bindShaderResources(
VkPipelineBindPoint pipeline,
VkPipelineLayout pipelineLayout,
VkDescriptorSetLayout descriptorLayout,
uint32_t bindingCount,
const DxvkResourceBinding* bindings) = 0;
virtual void cmdBeginRenderPass(
const VkRenderPassBeginInfo* pRenderPassBegin,
VkSubpassContents contents) = 0;
virtual void cmdBindIndexBuffer(
VkBuffer buffer,
VkDeviceSize offset,
VkIndexType indexType) = 0;
virtual void cmdBindPipeline(
VkPipelineBindPoint pipelineBindPoint,
VkPipeline pipeline) = 0;
virtual void cmdBindVertexBuffers(
uint32_t firstBinding,
uint32_t bindingCount,
const VkBuffer* pBuffers,
const VkDeviceSize* pOffsets) = 0;
virtual void cmdClearAttachments(
uint32_t attachmentCount,
const VkClearAttachment* pAttachments,
uint32_t rectCount,
const VkClearRect* pRects) = 0;
virtual void cmdClearColorImage(
VkImage image,
VkImageLayout imageLayout,
const VkClearColorValue* pColor,
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges) = 0;
virtual void cmdCopyBuffer(
VkBuffer srcBuffer,
VkBuffer dstBuffer,
uint32_t regionCount,
const VkBufferCopy* pRegions) = 0;
virtual void cmdDispatch(
uint32_t x,
uint32_t y,
uint32_t z) = 0;
virtual void cmdDraw(
uint32_t vertexCount,
uint32_t instanceCount,
uint32_t firstVertex,
uint32_t firstInstance) = 0;
virtual void cmdDrawIndexed(
uint32_t indexCount,
uint32_t instanceCount,
uint32_t firstIndex,
uint32_t vertexOffset,
uint32_t firstInstance) = 0;
virtual void cmdEndRenderPass() = 0;
virtual void cmdPipelineBarrier(
VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags dstStageMask,
VkDependencyFlags dependencyFlags,
uint32_t memoryBarrierCount,
const VkMemoryBarrier* pMemoryBarriers,
uint32_t bufferMemoryBarrierCount,
const VkBufferMemoryBarrier* pBufferMemoryBarriers,
uint32_t imageMemoryBarrierCount,
const VkImageMemoryBarrier* pImageMemoryBarriers) = 0;
virtual void cmdSetScissor(
uint32_t firstScissor,
uint32_t scissorCount,
const VkRect2D* scissors) = 0;
virtual void cmdSetViewport(
uint32_t firstViewport,
uint32_t viewportCount,
const VkViewport* viewports) = 0;
};
}

View File

@ -6,7 +6,6 @@ dxvk_src = files([
'dxvk_compute.cpp',
'dxvk_constant_state.cpp',
'dxvk_context.cpp',
'dxvk_deferred.cpp',
'dxvk_descriptor.cpp',
'dxvk_device.cpp',
'dxvk_framebuffer.cpp',
@ -17,7 +16,6 @@ dxvk_src = files([
'dxvk_main.cpp',
'dxvk_memory.cpp',
'dxvk_pipemgr.cpp',
'dxvk_recorder.cpp',
'dxvk_renderpass.cpp',
'dxvk_resource.cpp',
'dxvk_shader.cpp',