2017-10-10 23:32:13 +02:00
|
|
|
#pragma once
|
|
|
|
|
2017-10-15 17:56:06 +02:00
|
|
|
#include "dxvk_buffer.h"
|
2017-10-13 03:19:23 +02:00
|
|
|
#include "dxvk_compute.h"
|
2017-11-20 13:21:27 +01:00
|
|
|
#include "dxvk_constant_state.h"
|
2017-10-11 23:29:05 +02:00
|
|
|
#include "dxvk_framebuffer.h"
|
2017-11-17 19:49:44 +01:00
|
|
|
#include "dxvk_graphics.h"
|
2017-10-15 17:56:06 +02:00
|
|
|
#include "dxvk_image.h"
|
2017-10-14 13:37:40 +02:00
|
|
|
#include "dxvk_limits.h"
|
2017-12-07 09:38:31 +01:00
|
|
|
#include "dxvk_pipelayout.h"
|
2017-12-03 20:23:26 +01:00
|
|
|
#include "dxvk_sampler.h"
|
2017-10-11 23:29:05 +02:00
|
|
|
#include "dxvk_shader.h"
|
2017-10-10 23:32:13 +02:00
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2017-10-13 03:19:23 +02:00
|
|
|
/**
|
|
|
|
* \brief Graphics pipeline state flags
|
|
|
|
*
|
2018-04-30 17:04:13 +02:00
|
|
|
* Stores some information on which state
|
|
|
|
* of the graphics and compute pipelines
|
|
|
|
* has changed and/or needs to be updated.
|
2017-10-13 03:19:23 +02:00
|
|
|
*/
|
2019-09-23 23:34:04 +02:00
|
|
|
enum class DxvkContextFlag : uint32_t {
|
2018-02-01 20:15:25 +01:00
|
|
|
GpRenderPassBound, ///< Render pass is currently bound
|
2019-03-24 01:36:46 +01:00
|
|
|
GpCondActive, ///< Conditional rendering is enabled
|
2018-07-24 17:08:32 +02:00
|
|
|
GpXfbActive, ///< Transform feedback is enabled
|
2018-04-30 17:04:13 +02:00
|
|
|
GpClearRenderTargets, ///< Render targets need to be cleared
|
2018-04-26 14:47:55 +02:00
|
|
|
GpDirtyFramebuffer, ///< Framebuffer binding is out of date
|
2018-02-01 20:15:25 +01:00
|
|
|
GpDirtyPipeline, ///< Graphics pipeline binding is out of date
|
|
|
|
GpDirtyPipelineState, ///< Graphics pipeline needs to be recompiled
|
|
|
|
GpDirtyResources, ///< Graphics pipeline resource bindings are out of date
|
2018-06-22 00:31:56 +02:00
|
|
|
GpDirtyDescriptorOffsets, ///< Graphics descriptor set needs to be rebound
|
|
|
|
GpDirtyDescriptorSet, ///< Graphics descriptor set needs to be updated
|
2018-02-01 20:15:25 +01:00
|
|
|
GpDirtyVertexBuffers, ///< Vertex buffer bindings are out of date
|
|
|
|
GpDirtyIndexBuffer, ///< Index buffer binding are out of date
|
2018-07-24 17:08:32 +02:00
|
|
|
GpDirtyXfbBuffers, ///< Transform feedback buffer bindings are out of date
|
2018-09-13 10:43:30 +02:00
|
|
|
GpDirtyXfbCounters, ///< Counter buffer values are dirty
|
2018-05-29 05:03:27 +02:00
|
|
|
GpDirtyBlendConstants, ///< Blend constants have changed
|
2019-01-16 20:55:41 +01:00
|
|
|
GpDirtyDepthBias, ///< Depth bias has changed
|
2019-04-24 22:39:51 +02:00
|
|
|
GpDirtyDepthBounds, ///< Depth bounds have changed
|
2018-05-29 05:03:27 +02:00
|
|
|
GpDirtyStencilRef, ///< Stencil reference has changed
|
|
|
|
GpDirtyViewport, ///< Viewport state has changed
|
2019-03-24 01:36:46 +01:00
|
|
|
GpDirtyPredicate, ///< Predicate has changed
|
2019-01-16 20:55:41 +01:00
|
|
|
GpDynamicBlendConstants, ///< Blend constants are dynamic
|
|
|
|
GpDynamicDepthBias, ///< Depth bias is dynamic
|
2019-04-24 22:39:51 +02:00
|
|
|
GpDynamicDepthBounds, ///< Depth bounds are dynamic
|
2019-01-16 20:55:41 +01:00
|
|
|
GpDynamicStencilRef, ///< Stencil reference is dynamic
|
2017-11-17 19:49:44 +01:00
|
|
|
|
2018-02-01 20:15:25 +01:00
|
|
|
CpDirtyPipeline, ///< Compute pipeline binding are out of date
|
|
|
|
CpDirtyPipelineState, ///< Compute pipeline needs to be recompiled
|
|
|
|
CpDirtyResources, ///< Compute pipeline resource bindings are out of date
|
2018-06-22 00:31:56 +02:00
|
|
|
CpDirtyDescriptorOffsets, ///< Compute descriptor set needs to be rebound
|
|
|
|
CpDirtyDescriptorSet, ///< Compute descriptor set needs to be updated
|
2019-01-16 20:55:41 +01:00
|
|
|
|
2018-10-08 09:23:11 +02:00
|
|
|
DirtyDrawBuffer, ///< Indirect argument buffer is dirty
|
2019-05-07 20:51:27 +02:00
|
|
|
DirtyPushConstants, ///< Push constant data has changed
|
2017-10-13 03:19:23 +02:00
|
|
|
};
|
|
|
|
|
2017-11-17 19:49:44 +01:00
|
|
|
using DxvkContextFlags = Flags<DxvkContextFlag>;
|
2018-10-08 09:23:11 +02:00
|
|
|
|
|
|
|
|
2019-02-06 22:28:48 +01:00
|
|
|
/**
|
|
|
|
* \brief Barrier control flags
|
|
|
|
*
|
|
|
|
* These flags specify what (not) to
|
|
|
|
* synchronize implicitly.
|
|
|
|
*/
|
|
|
|
enum class DxvkBarrierControl : uint32_t {
|
|
|
|
IgnoreWriteAfterWrite = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
using DxvkBarrierControlFlags = Flags<DxvkBarrierControl>;
|
|
|
|
|
|
|
|
|
2018-10-08 09:23:11 +02:00
|
|
|
struct DxvkIndirectDrawState {
|
|
|
|
DxvkBufferSlice argBuffer;
|
2019-04-24 21:50:34 +02:00
|
|
|
DxvkBufferSlice cntBuffer;
|
2018-10-08 09:23:11 +02:00
|
|
|
};
|
2017-10-13 03:19:23 +02:00
|
|
|
|
|
|
|
|
2017-11-20 13:21:27 +01:00
|
|
|
struct DxvkVertexInputState {
|
2017-12-14 15:24:43 +01:00
|
|
|
DxvkBufferSlice indexBuffer;
|
2018-02-01 13:29:57 +01:00
|
|
|
VkIndexType indexType = VK_INDEX_TYPE_UINT32;
|
2017-12-07 14:01:17 +01:00
|
|
|
|
2018-04-17 17:24:16 +02:00
|
|
|
std::array<DxvkBufferSlice, DxvkLimits::MaxNumVertexBindings> vertexBuffers = { };
|
|
|
|
std::array<uint32_t, DxvkLimits::MaxNumVertexBindings> vertexStrides = { };
|
2017-11-18 10:42:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-11-20 13:21:27 +01:00
|
|
|
struct DxvkViewportState {
|
2018-02-01 20:15:25 +01:00
|
|
|
std::array<VkViewport, DxvkLimits::MaxNumViewports> viewports = { };
|
|
|
|
std::array<VkRect2D, DxvkLimits::MaxNumViewports> scissorRects = { };
|
2017-11-18 10:42:27 +01:00
|
|
|
};
|
2018-06-06 12:45:45 +02:00
|
|
|
|
|
|
|
|
2017-11-17 19:49:44 +01:00
|
|
|
struct DxvkOutputMergerState {
|
2018-04-30 17:04:13 +02:00
|
|
|
std::array<VkClearValue, MaxNumRenderTargets + 1> clearValues = { };
|
2018-04-30 13:12:28 +02:00
|
|
|
|
2018-04-26 14:47:55 +02:00
|
|
|
DxvkRenderTargets renderTargets;
|
2018-04-30 13:12:28 +02:00
|
|
|
DxvkRenderPassOps renderPassOps;
|
2018-02-06 17:31:23 +01:00
|
|
|
Rc<DxvkFramebuffer> framebuffer = nullptr;
|
2017-10-13 03:19:23 +02:00
|
|
|
};
|
2018-07-24 17:08:32 +02:00
|
|
|
|
|
|
|
|
2019-05-07 20:51:27 +02:00
|
|
|
struct DxvkPushConstantState {
|
2019-05-15 03:07:05 +02:00
|
|
|
char data[MaxPushConstantSize];
|
2019-05-07 20:51:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-07-24 17:08:32 +02:00
|
|
|
struct DxvkXfbState {
|
|
|
|
std::array<DxvkBufferSlice, MaxNumXfbBuffers> buffers;
|
|
|
|
std::array<DxvkBufferSlice, MaxNumXfbBuffers> counters;
|
|
|
|
};
|
2017-10-13 03:19:23 +02:00
|
|
|
|
|
|
|
|
2017-12-07 09:38:31 +01:00
|
|
|
struct DxvkGraphicsPipelineState {
|
2019-07-23 12:54:25 +02:00
|
|
|
DxvkGraphicsPipelineShaders shaders;
|
2018-01-10 20:40:10 +01:00
|
|
|
DxvkGraphicsPipelineStateInfo state;
|
2018-10-29 10:52:04 +01:00
|
|
|
DxvkGraphicsPipelineFlags flags;
|
2019-07-23 13:15:06 +02:00
|
|
|
DxvkGraphicsPipeline* pipeline = nullptr;
|
2017-12-07 09:38:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct DxvkComputePipelineState {
|
2019-07-23 12:54:25 +02:00
|
|
|
DxvkComputePipelineShaders shaders;
|
2018-02-14 17:54:35 +01:00
|
|
|
DxvkComputePipelineStateInfo state;
|
2019-07-23 13:15:06 +02:00
|
|
|
DxvkComputePipeline* pipeline = nullptr;
|
2017-12-07 09:38:31 +01:00
|
|
|
};
|
2019-01-17 22:22:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
struct DxvkDynamicState {
|
2019-01-17 22:26:27 +01:00
|
|
|
DxvkBlendConstants blendConstants = { 0.0f, 0.0f, 0.0f, 0.0f };
|
|
|
|
DxvkDepthBias depthBias = { 0.0f, 0.0f, 0.0f };
|
2019-04-24 22:39:51 +02:00
|
|
|
DxvkDepthBounds depthBounds = { false, 0.0f, 1.0f };
|
2019-01-17 22:26:27 +01:00
|
|
|
uint32_t stencilReference = 0;
|
2019-01-17 22:22:23 +01:00
|
|
|
};
|
2019-03-24 01:36:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
struct DxvkCondRenderState {
|
|
|
|
DxvkBufferSlice predicate;
|
|
|
|
VkConditionalRenderingFlagsEXT flags;
|
|
|
|
};
|
2017-12-07 09:38:31 +01:00
|
|
|
|
|
|
|
|
2017-10-13 03:19:23 +02:00
|
|
|
/**
|
2017-11-17 19:49:44 +01:00
|
|
|
* \brief Pipeline state
|
2017-10-13 03:19:23 +02:00
|
|
|
*
|
2017-11-17 19:49:44 +01:00
|
|
|
* Stores all bound shaders, resources,
|
|
|
|
* and constant pipeline state objects.
|
2017-10-13 03:19:23 +02:00
|
|
|
*/
|
2017-10-11 23:29:05 +02:00
|
|
|
struct DxvkContextState {
|
2018-10-08 09:23:11 +02:00
|
|
|
DxvkIndirectDrawState id;
|
2017-12-08 01:06:48 +01:00
|
|
|
DxvkVertexInputState vi;
|
|
|
|
DxvkViewportState vp;
|
2017-11-17 19:49:44 +01:00
|
|
|
DxvkOutputMergerState om;
|
2019-05-07 20:51:27 +02:00
|
|
|
DxvkPushConstantState pc;
|
2018-07-24 17:08:32 +02:00
|
|
|
DxvkXfbState xfb;
|
2019-01-17 22:22:23 +01:00
|
|
|
DxvkDynamicState dyn;
|
2019-03-24 01:36:46 +01:00
|
|
|
DxvkCondRenderState cond;
|
2017-11-17 19:49:44 +01:00
|
|
|
|
2017-12-07 09:38:31 +01:00
|
|
|
DxvkGraphicsPipelineState gp;
|
|
|
|
DxvkComputePipelineState cp;
|
2017-10-11 23:29:05 +02:00
|
|
|
};
|
2017-10-10 23:32:13 +02:00
|
|
|
|
|
|
|
}
|