2017-10-10 23:32:13 +02:00
|
|
|
#pragma once
|
|
|
|
|
2017-10-15 17:56:06 +02:00
|
|
|
#include "dxvk_barrier.h"
|
2017-12-03 20:23:26 +01:00
|
|
|
#include "dxvk_binding.h"
|
2017-10-10 23:32:13 +02:00
|
|
|
#include "dxvk_cmdlist.h"
|
2017-10-11 23:29:05 +02:00
|
|
|
#include "dxvk_context_state.h"
|
2017-12-01 17:52:05 +01:00
|
|
|
#include "dxvk_data.h"
|
2017-10-15 17:56:06 +02:00
|
|
|
#include "dxvk_util.h"
|
2017-10-10 23:32:13 +02:00
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief DXVk context
|
|
|
|
*
|
|
|
|
* Tracks pipeline state and records command lists.
|
|
|
|
* This is where the actual rendering commands are
|
|
|
|
* recorded.
|
|
|
|
*/
|
|
|
|
class DxvkContext : public RcObject {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2017-12-03 00:40:58 +01:00
|
|
|
DxvkContext(const Rc<DxvkDevice>& device);
|
2017-10-10 23:32:13 +02:00
|
|
|
~DxvkContext();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Begins command buffer recording
|
|
|
|
*
|
|
|
|
* Begins recording a command list. This does
|
|
|
|
* not alter any context state other than the
|
|
|
|
* active command list.
|
2017-12-01 09:50:47 +01:00
|
|
|
* \param [in] cmdList Target command list
|
2017-10-10 23:32:13 +02:00
|
|
|
*/
|
|
|
|
void beginRecording(
|
2017-12-01 09:50:47 +01:00
|
|
|
const Rc<DxvkCommandList>& cmdList);
|
2017-10-10 23:32:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Ends command buffer recording
|
|
|
|
*
|
|
|
|
* Finishes recording the active command list.
|
|
|
|
* The command list can then be submitted to
|
|
|
|
* the device.
|
|
|
|
*
|
|
|
|
* This will not change any context state
|
|
|
|
* other than the active command list.
|
2017-12-01 10:08:49 +01:00
|
|
|
* \returns Active command list
|
2017-10-10 23:32:13 +02:00
|
|
|
*/
|
2017-12-01 10:08:49 +01:00
|
|
|
Rc<DxvkCommandList> endRecording();
|
2017-10-10 23:32:13 +02:00
|
|
|
|
2017-10-15 17:56:06 +02:00
|
|
|
/**
|
|
|
|
* \brief Sets framebuffer
|
|
|
|
* \param [in] fb Framebuffer
|
|
|
|
*/
|
|
|
|
void bindFramebuffer(
|
|
|
|
const Rc<DxvkFramebuffer>& fb);
|
|
|
|
|
2017-11-20 13:21:27 +01:00
|
|
|
/**
|
|
|
|
* \brief Binds index buffer
|
2017-12-03 20:23:26 +01:00
|
|
|
*
|
|
|
|
* The index buffer will be used when
|
|
|
|
* issuing \c drawIndexed commands.
|
2017-11-20 13:21:27 +01:00
|
|
|
* \param [in] buffer New index buffer
|
2017-12-07 14:01:17 +01:00
|
|
|
* \param [in] indexType Index type
|
2017-11-20 13:21:27 +01:00
|
|
|
*/
|
|
|
|
void bindIndexBuffer(
|
2017-12-14 15:24:43 +01:00
|
|
|
const DxvkBufferSlice& buffer,
|
2017-12-07 14:01:17 +01:00
|
|
|
VkIndexType indexType);
|
2017-11-20 13:21:27 +01:00
|
|
|
|
2017-10-15 17:56:06 +02:00
|
|
|
/**
|
2017-12-03 20:23:26 +01:00
|
|
|
* \brief Binds buffer as a shader resource
|
2017-10-15 17:56:06 +02:00
|
|
|
*
|
2017-12-03 20:23:26 +01:00
|
|
|
* Can be used for uniform and storage buffers.
|
|
|
|
* \param [in] slot Resource binding slot
|
|
|
|
* \param [in] buffer Buffer to bind
|
2017-10-15 17:56:06 +02:00
|
|
|
*/
|
2017-12-03 20:23:26 +01:00
|
|
|
void bindResourceBuffer(
|
|
|
|
uint32_t slot,
|
2017-12-14 15:24:43 +01:00
|
|
|
const DxvkBufferSlice& buffer);
|
2017-12-03 00:40:58 +01:00
|
|
|
|
|
|
|
/**
|
2017-12-03 20:23:26 +01:00
|
|
|
* \brief Binds texel buffer view
|
2017-12-03 00:40:58 +01:00
|
|
|
*
|
2017-12-03 20:23:26 +01:00
|
|
|
* Can be used for both uniform texel
|
|
|
|
* buffers and storage texel buffers.
|
|
|
|
* \param [in] slot Resource binding slot
|
|
|
|
* \param [in] bufferView Buffer view to bind
|
2017-12-03 00:40:58 +01:00
|
|
|
*/
|
2017-12-03 20:23:26 +01:00
|
|
|
void bindResourceTexelBuffer(
|
|
|
|
uint32_t slot,
|
|
|
|
const Rc<DxvkBufferView>& bufferView);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Binds image view
|
|
|
|
*
|
|
|
|
* Can be used for sampled images with a
|
|
|
|
* dedicated sampler and storage images.
|
|
|
|
* \param [in] slot Resource binding slot
|
|
|
|
* \param [in] imageView Image view to bind
|
|
|
|
*/
|
|
|
|
void bindResourceImage(
|
|
|
|
uint32_t slot,
|
|
|
|
const Rc<DxvkImageView>& image);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Binds image sampler
|
|
|
|
*
|
|
|
|
* Binds a sampler that can be used together with
|
|
|
|
* an image in order to read from a texture.
|
|
|
|
* \param [in] slot Resource binding slot
|
|
|
|
* \param [in] sampler Sampler view to bind
|
|
|
|
*/
|
|
|
|
void bindResourceSampler(
|
|
|
|
uint32_t slot,
|
|
|
|
const Rc<DxvkSampler>& sampler);
|
2017-10-15 17:56:06 +02:00
|
|
|
|
2017-12-07 09:38:31 +01:00
|
|
|
/**
|
|
|
|
* \brief Binds a shader to a given state
|
|
|
|
*
|
|
|
|
* \param [in] stage Target shader stage
|
|
|
|
* \param [in] shader The shader to bind
|
|
|
|
*/
|
|
|
|
void bindShader(
|
|
|
|
VkShaderStageFlagBits stage,
|
|
|
|
const Rc<DxvkShader>& shader);
|
|
|
|
|
2017-11-20 13:21:27 +01:00
|
|
|
/**
|
|
|
|
* \brief Binds vertex buffer
|
|
|
|
*
|
|
|
|
* \param [in] binding Vertex buffer binding
|
|
|
|
* \param [in] buffer New vertex buffer
|
2017-12-07 11:39:59 +01:00
|
|
|
* \param [in] stride Stride between vertices
|
2017-11-20 13:21:27 +01:00
|
|
|
*/
|
|
|
|
void bindVertexBuffer(
|
|
|
|
uint32_t binding,
|
2017-12-14 15:24:43 +01:00
|
|
|
const DxvkBufferSlice& buffer,
|
2017-12-07 21:47:38 +01:00
|
|
|
uint32_t stride);
|
2017-11-20 13:21:27 +01:00
|
|
|
|
2017-12-01 00:52:13 +01:00
|
|
|
/**
|
2017-12-05 13:00:06 +01:00
|
|
|
* \brief Clears subresources of a color image
|
2017-12-01 00:52:13 +01:00
|
|
|
*
|
|
|
|
* \param [in] image The image to clear
|
|
|
|
* \param [in] value Clear value
|
|
|
|
* \param [in] subresources Subresources to clear
|
|
|
|
*/
|
|
|
|
void clearColorImage(
|
|
|
|
const Rc<DxvkImage>& image,
|
|
|
|
const VkClearColorValue& value,
|
|
|
|
const VkImageSubresourceRange& subresources);
|
|
|
|
|
2017-12-09 03:53:42 +01:00
|
|
|
/**
|
|
|
|
* \brief Clears subresources of a depth-stencil image
|
|
|
|
*
|
|
|
|
* \param [in] image The image to clear
|
|
|
|
* \param [in] value Clear value
|
|
|
|
* \param [in] subresources Subresources to clear
|
|
|
|
*/
|
|
|
|
void clearDepthStencilImage(
|
|
|
|
const Rc<DxvkImage>& image,
|
|
|
|
const VkClearDepthStencilValue& value,
|
|
|
|
const VkImageSubresourceRange& subresources);
|
|
|
|
|
2017-10-11 23:29:05 +02:00
|
|
|
/**
|
|
|
|
* \brief Clears an active render target
|
|
|
|
*
|
|
|
|
* \param [in] attachment Attachment to clear
|
|
|
|
* \param [in] clearArea Rectangular area to clear
|
|
|
|
*/
|
|
|
|
void clearRenderTarget(
|
|
|
|
const VkClearAttachment& attachment,
|
|
|
|
const VkClearRect& clearArea);
|
|
|
|
|
2017-11-26 13:24:01 +01:00
|
|
|
/**
|
|
|
|
* \brief Copies data from one buffer to another
|
|
|
|
*
|
|
|
|
* \param [in] dstBuffer Destination buffer
|
|
|
|
* \param [in] dstOffset Destination data offset
|
|
|
|
* \param [in] srcBuffer Source buffer
|
|
|
|
* \param [in] srcOffset Source data offset
|
|
|
|
* \param [in] numBytes Number of bytes to copy
|
|
|
|
*/
|
|
|
|
void copyBuffer(
|
|
|
|
const Rc<DxvkBuffer>& dstBuffer,
|
|
|
|
VkDeviceSize dstOffset,
|
|
|
|
const Rc<DxvkBuffer>& srcBuffer,
|
|
|
|
VkDeviceSize srcOffset,
|
|
|
|
VkDeviceSize numBytes);
|
|
|
|
|
2018-01-05 03:01:19 +01:00
|
|
|
/**
|
|
|
|
* \brief Copies data from a buffer to an image
|
|
|
|
*
|
|
|
|
* \param [in] dstImage Destination image
|
|
|
|
* \param [in] dstSubresource Destination subresource
|
|
|
|
* \param [in] dstOffset Destination area offset
|
|
|
|
* \param [in] dstExtent Destination area size
|
|
|
|
* \param [in] srcBuffer Source buffer
|
|
|
|
* \param [in] srcOffset Source offset, in bytes
|
|
|
|
* \param [in] srcExtent Source data extent
|
|
|
|
*/
|
|
|
|
void copyBufferToImage(
|
|
|
|
const Rc<DxvkImage>& dstImage,
|
|
|
|
VkImageSubresourceLayers dstSubresource,
|
|
|
|
VkOffset3D dstOffset,
|
|
|
|
VkExtent3D dstExtent,
|
|
|
|
const Rc<DxvkBuffer>& srcBuffer,
|
|
|
|
VkDeviceSize srcOffset,
|
|
|
|
VkExtent2D srcExtent);
|
|
|
|
|
2017-12-30 19:10:45 +01:00
|
|
|
/**
|
|
|
|
* \brief Copies data from one image to another
|
|
|
|
*
|
|
|
|
* \param [in] dstImage Destination image
|
|
|
|
* \param [in] dstSubresource Destination subresource
|
|
|
|
* \param [in] dstOffset Destination area offset
|
|
|
|
* \param [in] srcImage Source image
|
|
|
|
* \param [in] srcSubresource Source subresource
|
|
|
|
* \param [in] srcOffset Source area offset
|
|
|
|
* \param [in] extent Size of the area to copy
|
|
|
|
*/
|
|
|
|
void copyImage(
|
|
|
|
const Rc<DxvkImage>& dstImage,
|
|
|
|
VkImageSubresourceLayers dstSubresource,
|
|
|
|
VkOffset3D dstOffset,
|
|
|
|
const Rc<DxvkImage>& srcImage,
|
|
|
|
VkImageSubresourceLayers srcSubresource,
|
|
|
|
VkOffset3D srcOffset,
|
|
|
|
VkExtent3D extent);
|
2018-01-19 18:09:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Copies data from an image into a buffer
|
|
|
|
*
|
|
|
|
* \param [in] dstBuffer Destination buffer
|
|
|
|
* \param [in] dstOffset Destination offset, in bytes
|
|
|
|
* \param [in] dstExtent Destination data extent
|
|
|
|
* \param [in] srcImage Source image
|
|
|
|
* \param [in] srcSubresource Source subresource
|
|
|
|
* \param [in] srcOffset Source area offset
|
|
|
|
* \param [in] srcExtent Source area size
|
|
|
|
*/
|
|
|
|
void copyImageToBuffer(
|
|
|
|
const Rc<DxvkBuffer>& dstBuffer,
|
|
|
|
VkDeviceSize dstOffset,
|
|
|
|
VkExtent2D dstExtent,
|
|
|
|
const Rc<DxvkImage>& srcImage,
|
|
|
|
VkImageSubresourceLayers srcSubresource,
|
|
|
|
VkOffset3D srcOffset,
|
|
|
|
VkExtent3D srcExtent);
|
|
|
|
|
2017-11-23 14:24:00 +01:00
|
|
|
/**
|
|
|
|
* \brief Starts compute jobs
|
|
|
|
*
|
|
|
|
* \param [in] x Number of threads in X direction
|
|
|
|
* \param [in] y Number of threads in Y direction
|
|
|
|
* \param [in] z Number of threads in Z direction
|
|
|
|
*/
|
|
|
|
void dispatch(
|
|
|
|
uint32_t x,
|
|
|
|
uint32_t y,
|
|
|
|
uint32_t z);
|
|
|
|
|
2017-12-31 01:31:08 +01:00
|
|
|
/**
|
|
|
|
* \brief Indirect dispatch call
|
|
|
|
*
|
|
|
|
* Takes arguments from a buffer. The buffer must contain
|
|
|
|
* a structure of the type \c VkDispatchIndirectCommand.
|
|
|
|
* \param [in] buffer The buffer slice
|
|
|
|
*/
|
|
|
|
void dispatchIndirect(
|
|
|
|
const DxvkBufferSlice& buffer);
|
|
|
|
|
2017-10-11 23:29:05 +02:00
|
|
|
/**
|
|
|
|
* \brief Draws primitive without using an index buffer
|
|
|
|
*
|
|
|
|
* \param [in] vertexCount Number of vertices to draw
|
|
|
|
* \param [in] instanceCount Number of instances to render
|
|
|
|
* \param [in] firstVertex First vertex in vertex buffer
|
|
|
|
* \param [in] firstInstance First instance ID
|
|
|
|
*/
|
|
|
|
void draw(
|
|
|
|
uint32_t vertexCount,
|
|
|
|
uint32_t instanceCount,
|
|
|
|
uint32_t firstVertex,
|
|
|
|
uint32_t firstInstance);
|
|
|
|
|
2017-12-31 01:31:08 +01:00
|
|
|
/**
|
|
|
|
* \brief Indirect indexed draw call
|
|
|
|
*
|
|
|
|
* Takes arguments from a buffer. The structure stored
|
|
|
|
* in the buffer must be of type \c VkDrawIndirectCommand.
|
|
|
|
* \param [in] buffer The buffer slice
|
|
|
|
* \param [in] count Number of dispatch calls
|
|
|
|
* \param [in] stride Stride between dispatch calls
|
|
|
|
*/
|
|
|
|
void drawIndirect(
|
|
|
|
const DxvkBufferSlice& buffer,
|
|
|
|
uint32_t count,
|
|
|
|
uint32_t stride);
|
|
|
|
|
2017-10-11 23:29:05 +02:00
|
|
|
/**
|
|
|
|
* \brief Draws primitives using an index buffer
|
|
|
|
*
|
|
|
|
* \param [in] indexCount Number of indices to draw
|
|
|
|
* \param [in] instanceCount Number of instances to render
|
|
|
|
* \param [in] firstIndex First index within the index buffer
|
|
|
|
* \param [in] vertexOffset Vertex ID that corresponds to index 0
|
|
|
|
* \param [in] firstInstance First instance ID
|
|
|
|
*/
|
|
|
|
void drawIndexed(
|
|
|
|
uint32_t indexCount,
|
|
|
|
uint32_t instanceCount,
|
|
|
|
uint32_t firstIndex,
|
|
|
|
uint32_t vertexOffset,
|
|
|
|
uint32_t firstInstance);
|
|
|
|
|
2017-12-31 01:31:08 +01:00
|
|
|
/**
|
|
|
|
* \brief Indirect indexed draw call
|
|
|
|
*
|
|
|
|
* Takes arguments from a buffer. The structure type for
|
|
|
|
* the draw buffer is \c VkDrawIndexedIndirectCommand.
|
|
|
|
* \param [in] buffer The buffer slice
|
|
|
|
* \param [in] count Number of dispatch calls
|
|
|
|
* \param [in] stride Stride between dispatch calls
|
|
|
|
*/
|
|
|
|
void drawIndexedIndirect(
|
|
|
|
const DxvkBufferSlice& buffer,
|
|
|
|
uint32_t count,
|
|
|
|
uint32_t stride);
|
|
|
|
|
2018-01-20 09:46:54 +01:00
|
|
|
/**
|
|
|
|
* \brief Generates mip maps
|
|
|
|
*
|
|
|
|
* Uses blitting to generate lower mip levels from
|
|
|
|
* the top-most mip level passed to this method.
|
|
|
|
* \param [in] image The image to generate mips for
|
|
|
|
* \param [in] subresource The subresource range
|
|
|
|
*/
|
|
|
|
void generateMipmaps(
|
|
|
|
const Rc<DxvkImage>& image,
|
|
|
|
const VkImageSubresourceRange& subresources);
|
|
|
|
|
2017-12-01 17:52:05 +01:00
|
|
|
/**
|
2017-12-05 13:00:06 +01:00
|
|
|
* \brief Initializes or invalidates an image
|
2017-12-01 17:52:05 +01:00
|
|
|
*
|
|
|
|
* Sets up the image layout for future operations
|
2017-12-05 13:00:06 +01:00
|
|
|
* while discarding any previous contents.
|
2017-12-01 17:52:05 +01:00
|
|
|
* \param [in] image The image to initialize
|
2017-12-05 13:00:06 +01:00
|
|
|
* \param [in] subresources Image subresources
|
2017-12-01 17:52:05 +01:00
|
|
|
*/
|
|
|
|
void initImage(
|
2017-12-16 13:21:11 +01:00
|
|
|
const Rc<DxvkImage>& image,
|
|
|
|
const VkImageSubresourceRange& subresources);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Invalidates a buffer's contents
|
|
|
|
*
|
2018-01-20 21:42:11 +01:00
|
|
|
* Discards a buffer's contents by replacing the
|
2017-12-16 13:21:11 +01:00
|
|
|
* backing resource. This allows the host to access
|
|
|
|
* the buffer while the GPU is still accessing the
|
|
|
|
* original backing resource.
|
|
|
|
*
|
|
|
|
* \warning If the buffer is used by another context,
|
|
|
|
* invalidating it will result in undefined behaviour.
|
|
|
|
* \param [in] buffer The buffer to invalidate
|
2018-01-20 21:42:11 +01:00
|
|
|
* \param [in] slice New physical buffer slice
|
2017-12-16 13:21:11 +01:00
|
|
|
*/
|
|
|
|
void invalidateBuffer(
|
2018-01-20 21:42:11 +01:00
|
|
|
const Rc<DxvkBuffer>& buffer,
|
|
|
|
const DxvkPhysicalBufferSlice& slice);
|
2017-12-01 17:52:05 +01:00
|
|
|
|
2017-12-12 00:27:49 +01:00
|
|
|
/**
|
|
|
|
* \brief Resolves a multisampled image resource
|
|
|
|
*
|
|
|
|
* Resolves a multisampled image into a non-multisampled
|
|
|
|
* image. The subresources of both images must have the
|
|
|
|
* same size and compatible formats
|
|
|
|
* \param [in] dstImage Destination image
|
|
|
|
* \param [in] dstSubresources Subresources to write to
|
|
|
|
* \param [in] srcImage Source image
|
|
|
|
* \param [in] srcSubresources Subresources to read from
|
|
|
|
*/
|
|
|
|
void resolveImage(
|
|
|
|
const Rc<DxvkImage>& dstImage,
|
|
|
|
const VkImageSubresourceLayers& dstSubresources,
|
|
|
|
const Rc<DxvkImage>& srcImage,
|
|
|
|
const VkImageSubresourceLayers& srcSubresources);
|
|
|
|
|
2017-12-07 18:51:41 +01:00
|
|
|
/**
|
|
|
|
* \brief Updates a buffer
|
|
|
|
*
|
|
|
|
* Copies data from the host into a buffer.
|
|
|
|
* \param [in] buffer Destination buffer
|
|
|
|
* \param [in] offset Offset of sub range to update
|
|
|
|
* \param [in] size Length of sub range to update
|
|
|
|
* \param [in] data Data to upload
|
|
|
|
*/
|
|
|
|
void updateBuffer(
|
|
|
|
const Rc<DxvkBuffer>& buffer,
|
|
|
|
VkDeviceSize offset,
|
|
|
|
VkDeviceSize size,
|
|
|
|
const void* data);
|
|
|
|
|
2017-12-10 15:57:51 +01:00
|
|
|
/**
|
|
|
|
* \brief Updates an image
|
|
|
|
*
|
|
|
|
* Copies data from the host into an image.
|
|
|
|
* \param [in] image Destination image
|
|
|
|
* \param [in] subsresources Image subresources to update
|
|
|
|
* \param [in] imageOffset Offset of the image area to update
|
|
|
|
* \param [in] imageExtent Size of the image area to update
|
|
|
|
* \param [in] data Source data
|
|
|
|
* \param [in] pitchPerRow Row pitch of the source data
|
|
|
|
* \param [in] pitchPerLayer Layer pitch of the source data
|
|
|
|
*/
|
|
|
|
void updateImage(
|
|
|
|
const Rc<DxvkImage>& image,
|
|
|
|
const VkImageSubresourceLayers& subresources,
|
|
|
|
VkOffset3D imageOffset,
|
|
|
|
VkExtent3D imageExtent,
|
|
|
|
const void* data,
|
|
|
|
VkDeviceSize pitchPerRow,
|
|
|
|
VkDeviceSize pitchPerLayer);
|
|
|
|
|
2017-11-20 15:35:29 +01:00
|
|
|
/**
|
|
|
|
* \brief Sets viewports
|
|
|
|
*
|
|
|
|
* \param [in] viewportCount Number of viewports
|
|
|
|
* \param [in] viewports The viewports
|
|
|
|
* \param [in] scissorRects Schissor rectangles
|
|
|
|
*/
|
|
|
|
void setViewports(
|
|
|
|
uint32_t viewportCount,
|
|
|
|
const VkViewport* viewports,
|
|
|
|
const VkRect2D* scissorRects);
|
|
|
|
|
2017-12-11 14:11:18 +01:00
|
|
|
/**
|
|
|
|
* \brief Sets blend constants
|
|
|
|
*
|
|
|
|
* Blend constants are a set of four floating
|
|
|
|
* point numbers that may be used as an input
|
|
|
|
* for blending operations.
|
|
|
|
* \param [in] blendConstants Blend constants
|
|
|
|
*/
|
|
|
|
void setBlendConstants(
|
2018-01-20 15:41:06 +01:00
|
|
|
const DxvkBlendConstants& blendConstants);
|
2017-12-11 14:11:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Sets stencil reference
|
|
|
|
*
|
|
|
|
* Sets the reference value for stencil compare operations.
|
|
|
|
* \param [in] reference Reference value
|
|
|
|
*/
|
|
|
|
void setStencilReference(
|
|
|
|
const uint32_t reference);
|
|
|
|
|
2017-11-20 13:38:24 +01:00
|
|
|
/**
|
|
|
|
* \brief Sets input assembly state
|
2018-01-10 20:40:10 +01:00
|
|
|
* \param [in] ia New state object
|
2017-11-20 13:38:24 +01:00
|
|
|
*/
|
|
|
|
void setInputAssemblyState(
|
2018-01-10 20:40:10 +01:00
|
|
|
const DxvkInputAssemblyState& ia);
|
2017-11-20 13:38:24 +01:00
|
|
|
|
|
|
|
/**
|
2017-12-08 00:44:58 +01:00
|
|
|
* \brief Sets input layout
|
|
|
|
*
|
|
|
|
* \param [in] attributeCount Number of vertex attributes
|
|
|
|
* \param [in] attributes The vertex attributes
|
|
|
|
* \param [in] bindingCount Number of buffer bindings
|
|
|
|
* \param [in] bindings Vertex buffer bindigs
|
2017-11-20 13:38:24 +01:00
|
|
|
*/
|
|
|
|
void setInputLayout(
|
2017-12-08 00:44:58 +01:00
|
|
|
uint32_t attributeCount,
|
|
|
|
const DxvkVertexAttribute* attributes,
|
|
|
|
uint32_t bindingCount,
|
|
|
|
const DxvkVertexBinding* bindings);
|
2017-11-20 13:38:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Sets rasterizer state
|
2018-01-10 20:40:10 +01:00
|
|
|
* \param [in] rs New state object
|
2017-11-20 13:38:24 +01:00
|
|
|
*/
|
|
|
|
void setRasterizerState(
|
2018-01-10 20:40:10 +01:00
|
|
|
const DxvkRasterizerState& rs);
|
2017-11-20 13:38:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Sets multisample state
|
2018-01-10 20:40:10 +01:00
|
|
|
* \param [in] ms New state object
|
2017-11-20 13:38:24 +01:00
|
|
|
*/
|
|
|
|
void setMultisampleState(
|
2018-01-10 20:40:10 +01:00
|
|
|
const DxvkMultisampleState& ms);
|
2017-11-20 13:38:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Sets depth stencil state
|
2018-01-10 20:40:10 +01:00
|
|
|
* \param [in] ds New state object
|
2017-11-20 13:38:24 +01:00
|
|
|
*/
|
|
|
|
void setDepthStencilState(
|
2018-01-10 20:40:10 +01:00
|
|
|
const DxvkDepthStencilState& ds);
|
2017-11-20 13:38:24 +01:00
|
|
|
|
|
|
|
/**
|
2017-12-08 00:51:10 +01:00
|
|
|
* \brief Sets logic op state
|
2018-01-10 20:40:10 +01:00
|
|
|
* \param [in] lo New state object
|
2017-11-20 13:38:24 +01:00
|
|
|
*/
|
2017-12-08 00:51:10 +01:00
|
|
|
void setLogicOpState(
|
2018-01-10 20:40:10 +01:00
|
|
|
const DxvkLogicOpState& lo);
|
2017-12-08 00:51:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Sets blend mode for an attachment
|
|
|
|
*
|
|
|
|
* \param [in] attachment The attachment index
|
|
|
|
* \param [in] blendMode The blend mode
|
|
|
|
*/
|
|
|
|
void setBlendMode(
|
|
|
|
uint32_t attachment,
|
|
|
|
const DxvkBlendMode& blendMode);
|
2017-11-20 13:38:24 +01:00
|
|
|
|
2017-10-10 23:32:13 +02:00
|
|
|
private:
|
|
|
|
|
2017-12-03 00:40:58 +01:00
|
|
|
const Rc<DxvkDevice> m_device;
|
2017-10-14 23:52:47 +02:00
|
|
|
|
2017-12-01 09:50:47 +01:00
|
|
|
Rc<DxvkCommandList> m_cmd;
|
2017-12-01 10:27:33 +01:00
|
|
|
DxvkContextFlags m_flags;
|
2017-12-01 09:50:47 +01:00
|
|
|
DxvkContextState m_state;
|
|
|
|
DxvkBarrierSet m_barriers;
|
2017-10-11 23:29:05 +02:00
|
|
|
|
2018-01-12 14:25:26 +01:00
|
|
|
VkPipeline m_gpActivePipeline = VK_NULL_HANDLE;
|
|
|
|
// VkPipeline m_cpActivePipeline = VK_NULL_HANDLE; /* will be used later */
|
|
|
|
|
2017-12-20 12:13:08 +01:00
|
|
|
std::array<DxvkShaderResourceSlot, MaxNumResourceSlots> m_rc;
|
|
|
|
std::array<DxvkDescriptorInfo, MaxNumResourceSlots> m_descriptors;
|
2017-12-19 19:36:44 +01:00
|
|
|
|
2017-11-17 19:49:44 +01:00
|
|
|
void renderPassBegin();
|
|
|
|
void renderPassEnd();
|
2017-10-10 23:32:13 +02:00
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
void updateComputePipeline();
|
2018-01-10 12:13:46 +01:00
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
void updateGraphicsPipeline();
|
2018-01-10 12:13:46 +01:00
|
|
|
void updateGraphicsPipelineState();
|
2017-12-03 20:23:26 +01:00
|
|
|
|
|
|
|
void updateComputeShaderResources();
|
2018-01-10 12:13:46 +01:00
|
|
|
void updateComputeShaderDescriptors();
|
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
void updateGraphicsShaderResources();
|
2018-01-10 12:13:46 +01:00
|
|
|
void updateGraphicsShaderDescriptors();
|
2017-11-21 19:50:57 +01:00
|
|
|
|
2017-12-23 15:11:23 +01:00
|
|
|
void updateShaderResources(
|
|
|
|
VkPipelineBindPoint bindPoint,
|
|
|
|
const Rc<DxvkBindingLayout>& layout);
|
|
|
|
|
2018-01-10 12:13:46 +01:00
|
|
|
void updateShaderDescriptors(
|
|
|
|
VkPipelineBindPoint bindPoint,
|
|
|
|
const DxvkBindingState& bindingState,
|
|
|
|
const Rc<DxvkBindingLayout>& layout);
|
|
|
|
|
2017-11-21 19:50:57 +01:00
|
|
|
void updateDynamicState();
|
|
|
|
void updateViewports();
|
2017-12-11 14:11:18 +01:00
|
|
|
void updateBlendConstants();
|
|
|
|
void updateStencilReference();
|
2017-11-21 19:50:57 +01:00
|
|
|
|
|
|
|
void updateIndexBufferBinding();
|
|
|
|
void updateVertexBufferBindings();
|
2017-10-15 17:56:06 +02:00
|
|
|
|
2017-11-23 14:24:00 +01:00
|
|
|
void commitComputeState();
|
2017-11-20 14:11:09 +01:00
|
|
|
void commitGraphicsState();
|
2017-12-03 20:23:26 +01:00
|
|
|
|
|
|
|
void commitComputeBarriers();
|
|
|
|
|
2017-10-10 23:32:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|