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-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-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
|
|
|
|
*
|
|
|
|
* Stores some information on which state of the
|
|
|
|
* graphics pipeline has changed and/or needs to
|
|
|
|
* be updated.
|
|
|
|
*/
|
2017-11-17 19:49:44 +01:00
|
|
|
enum class DxvkContextFlag : uint64_t {
|
|
|
|
GpRenderPassBound, ///< Render pass is currently bound
|
|
|
|
GpDirtyPipeline, ///< Graphics pipeline binding are out of date
|
|
|
|
GpDirtyPipelineState, ///< Graphics pipeline state (blending etc.) is dirty
|
|
|
|
GpDirtyResources, ///< Graphics pipeline resource bindings are out of date
|
|
|
|
GpDirtyVertexBuffers, ///< Vertex buffer bindings are out of date
|
2017-11-18 10:42:27 +01:00
|
|
|
GpDirtyIndexBuffer, ///< Index buffer binding are out of date
|
2017-11-17 19:49:44 +01:00
|
|
|
|
|
|
|
CpDirtyPipeline, ///< Compute pipeline binding are out of date
|
|
|
|
CpDirtyResources, ///< Compute pipeline resource bindings are out of date
|
2017-10-13 03:19:23 +02:00
|
|
|
};
|
|
|
|
|
2017-11-17 19:49:44 +01:00
|
|
|
using DxvkContextFlags = Flags<DxvkContextFlag>;
|
2017-10-13 03:19:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Shader state
|
|
|
|
*
|
2017-11-17 19:49:44 +01:00
|
|
|
* Stores the active shader and resources
|
|
|
|
* for a single shader stage. All stages
|
|
|
|
* support the same types of resources.
|
2017-10-13 03:19:23 +02:00
|
|
|
*/
|
2017-11-17 19:49:44 +01:00
|
|
|
struct DxvkShaderStageState {
|
|
|
|
Rc<DxvkShader> shader;
|
2017-10-11 23:29:05 +02:00
|
|
|
};
|
|
|
|
|
2017-10-13 03:19:23 +02:00
|
|
|
|
2017-11-18 10:42:27 +01:00
|
|
|
/**
|
|
|
|
* \brief Input assembly state
|
|
|
|
*
|
|
|
|
* Stores the primitive topology
|
|
|
|
* and the vertex input layout.
|
|
|
|
*/
|
|
|
|
struct DxvkInputAssemblyState {
|
|
|
|
VkPrimitiveTopology primitiveTopology;
|
|
|
|
VkBool32 primitiveRestart;
|
|
|
|
|
|
|
|
uint32_t numVertexBindings = 0;
|
|
|
|
uint32_t numVertexAttributes = 0;
|
|
|
|
|
|
|
|
std::array<VkVertexInputBindingDescription,
|
|
|
|
DxvkLimits::MaxNumVertexBuffers> vertexBindings;
|
|
|
|
|
|
|
|
std::array<VkVertexInputAttributeDescription,
|
|
|
|
DxvkLimits::MaxNumVertexBuffers> vertexAttributes;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Vertex input state
|
|
|
|
*
|
|
|
|
* Stores the currently bound index
|
|
|
|
* buffer and vertex buffers.
|
|
|
|
*/
|
|
|
|
struct DxvkVertexInputState {
|
|
|
|
Rc<DxvkBuffer> indexBuffer;
|
|
|
|
std::array<Rc<DxvkBuffer>,
|
|
|
|
DxvkLimits::MaxNumVertexBuffers> vertexBuffers;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-10-13 03:19:23 +02:00
|
|
|
/**
|
2017-11-17 19:49:44 +01:00
|
|
|
* \brief Output merger state
|
2017-10-13 03:19:23 +02:00
|
|
|
*
|
2017-11-17 19:49:44 +01:00
|
|
|
* Stores the active framebuffer and the current
|
|
|
|
* blend state, as well as the depth stencil state.
|
2017-10-13 03:19:23 +02:00
|
|
|
*/
|
2017-11-17 19:49:44 +01:00
|
|
|
struct DxvkOutputMergerState {
|
|
|
|
Rc<DxvkFramebuffer> framebuffer;
|
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 {
|
2017-11-17 19:49:44 +01:00
|
|
|
DxvkShaderStageState vs;
|
|
|
|
DxvkShaderStageState tcs;
|
|
|
|
DxvkShaderStageState tes;
|
|
|
|
DxvkShaderStageState gs;
|
|
|
|
DxvkShaderStageState fs;
|
|
|
|
DxvkShaderStageState cs;
|
|
|
|
|
2017-11-18 10:42:27 +01:00
|
|
|
DxvkInputAssemblyState ia;
|
|
|
|
DxvkVertexInputState vi;
|
2017-11-17 19:49:44 +01:00
|
|
|
DxvkOutputMergerState om;
|
|
|
|
|
|
|
|
Rc<DxvkGraphicsPipeline> activeGraphicsPipeline;
|
|
|
|
Rc<DxvkComputePipeline> activeComputePipeline;
|
|
|
|
|
|
|
|
DxvkContextFlags flags;
|
2017-10-11 23:29:05 +02:00
|
|
|
};
|
2017-10-10 23:32:13 +02:00
|
|
|
|
|
|
|
}
|