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
|
|
|
*/
|
2017-11-17 19:49:44 +01:00
|
|
|
enum class DxvkContextFlag : uint64_t {
|
2018-02-01 20:15:25 +01:00
|
|
|
GpRenderPassBound, ///< Render pass is currently bound
|
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-05-29 05:03:27 +02:00
|
|
|
GpDirtyBlendConstants, ///< Blend constants have changed
|
|
|
|
GpDirtyStencilRef, ///< Stencil reference has changed
|
|
|
|
GpDirtyViewport, ///< Viewport state has changed
|
2018-06-06 12:45:45 +02:00
|
|
|
GpDirtyDepthBias, ///< Depth bias has changed
|
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
|
2018-10-08 09:23:11 +02:00
|
|
|
|
|
|
|
DirtyDrawBuffer, ///< Indirect argument buffer is dirty
|
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
|
|
|
|
|
|
|
|
|
|
|
struct DxvkIndirectDrawState {
|
|
|
|
DxvkBufferSlice argBuffer;
|
|
|
|
};
|
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;
|
|
|
|
uint32_t bindingMask = 0;
|
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
|
|
|
|
|
|
|
|
|
|
|
struct DxvkDynamicDepthState {
|
|
|
|
float depthBiasConstant = 0.0f;
|
|
|
|
float depthBiasClamp = 0.0f;
|
|
|
|
float depthBiasSlope = 0.0f;
|
|
|
|
};
|
2017-11-18 10:42:27 +01: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-12-08 00:51:10 +01:00
|
|
|
|
2018-02-01 20:15:25 +01:00
|
|
|
DxvkBlendConstants blendConstants = { 0.0f, 0.0f, 0.0f, 0.0f };
|
|
|
|
uint32_t stencilReference = 0;
|
2017-10-13 03:19:23 +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 DxvkShaderStage {
|
|
|
|
Rc<DxvkShader> shader;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct DxvkGraphicsPipelineState {
|
2018-02-14 17:54:35 +01:00
|
|
|
DxvkShaderStage vs;
|
|
|
|
DxvkShaderStage tcs;
|
|
|
|
DxvkShaderStage tes;
|
|
|
|
DxvkShaderStage gs;
|
|
|
|
DxvkShaderStage fs;
|
2018-02-01 20:15:25 +01:00
|
|
|
|
2018-01-10 20:40:10 +01:00
|
|
|
DxvkGraphicsPipelineStateInfo state;
|
2018-02-01 20:15:25 +01:00
|
|
|
Rc<DxvkGraphicsPipeline> pipeline;
|
2017-12-07 09:38:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct DxvkComputePipelineState {
|
2018-02-14 17:54:35 +01:00
|
|
|
DxvkShaderStage cs;
|
|
|
|
|
|
|
|
DxvkComputePipelineStateInfo state;
|
|
|
|
Rc<DxvkComputePipeline> pipeline;
|
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;
|
2018-06-06 12:45:45 +02:00
|
|
|
DxvkDynamicDepthState ds;
|
2017-11-17 19:49:44 +01:00
|
|
|
DxvkOutputMergerState om;
|
2018-07-24 17:08:32 +02:00
|
|
|
DxvkXfbState xfb;
|
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
|
|
|
|
|
|
|
}
|