2017-10-11 09:51:48 +02:00
|
|
|
#pragma once
|
|
|
|
|
2017-12-20 22:17:14 +01:00
|
|
|
#include "../dxvk/dxvk_adapter.h"
|
2018-01-20 15:29:10 +01:00
|
|
|
#include "../dxvk/dxvk_cs.h"
|
2017-12-20 22:17:14 +01:00
|
|
|
#include "../dxvk/dxvk_device.h"
|
2022-02-12 16:47:40 +01:00
|
|
|
#include "../dxvk/dxvk_staging.h"
|
2017-12-20 22:17:14 +01:00
|
|
|
|
2018-11-29 20:59:40 +01:00
|
|
|
#include "../d3d10/d3d10_multithread.h"
|
|
|
|
|
2018-06-11 14:29:47 +02:00
|
|
|
#include "d3d11_annotation.h"
|
2019-01-10 16:58:01 +01:00
|
|
|
#include "d3d11_cmd.h"
|
2019-04-24 19:44:12 +02:00
|
|
|
#include "d3d11_context_ext.h"
|
2017-11-29 20:19:40 +01:00
|
|
|
#include "d3d11_context_state.h"
|
2017-10-11 09:51:48 +02:00
|
|
|
#include "d3d11_device_child.h"
|
2018-10-01 16:53:32 +02:00
|
|
|
#include "d3d11_texture.h"
|
2017-10-11 09:51:48 +02:00
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
class D3D11Device;
|
|
|
|
|
2019-09-16 13:17:00 +02:00
|
|
|
class D3D11DeviceContext : public D3D11DeviceChild<ID3D11DeviceContext4> {
|
2022-02-12 16:47:40 +01:00
|
|
|
|
2017-10-11 09:51:48 +02:00
|
|
|
public:
|
2022-08-03 21:24:06 +02:00
|
|
|
|
2017-10-11 15:32:24 +02:00
|
|
|
D3D11DeviceContext(
|
2022-08-03 21:29:06 +02:00
|
|
|
D3D11Device* pParent);
|
2022-08-03 21:24:06 +02:00
|
|
|
|
2017-10-11 09:51:48 +02:00
|
|
|
~D3D11DeviceContext();
|
2020-01-15 23:41:09 +01:00
|
|
|
|
2018-01-20 13:22:44 +01:00
|
|
|
protected:
|
2017-10-11 09:51:48 +02:00
|
|
|
|
2019-07-17 11:34:21 +02:00
|
|
|
VkClearValue ConvertColorValue(
|
|
|
|
const FLOAT Color[4],
|
|
|
|
const DxvkFormatInfo* pFormatInfo);
|
|
|
|
|
2019-10-13 22:09:55 +02:00
|
|
|
static void InitDefaultPrimitiveTopology(
|
|
|
|
DxvkInputAssemblyState* pIaState);
|
|
|
|
|
2019-10-13 22:40:41 +02:00
|
|
|
static void InitDefaultRasterizerState(
|
|
|
|
DxvkRasterizerState* pRsState);
|
|
|
|
|
2019-10-13 22:48:06 +02:00
|
|
|
static void InitDefaultDepthStencilState(
|
|
|
|
DxvkDepthStencilState* pDsState);
|
|
|
|
|
2019-10-13 23:04:15 +02:00
|
|
|
static void InitDefaultBlendState(
|
|
|
|
DxvkBlendMode* pCbState,
|
|
|
|
DxvkLogicOpState* pLoState,
|
|
|
|
DxvkMultisampleState* pMsState,
|
|
|
|
UINT SampleMask);
|
|
|
|
|
2018-07-30 19:34:48 +02:00
|
|
|
template<typename T>
|
|
|
|
const D3D11CommonShader* GetCommonShader(T* pShader) const {
|
|
|
|
return pShader != nullptr ? pShader->GetCommonShader() : nullptr;
|
|
|
|
}
|
|
|
|
|
2020-11-21 05:39:05 +01:00
|
|
|
static uint32_t GetIndirectCommandStride(const D3D11CmdDrawIndirectData* cmdData, uint32_t offset, uint32_t minStride) {
|
|
|
|
if (likely(cmdData->stride))
|
|
|
|
return cmdData->offset + cmdData->count * cmdData->stride == offset ? cmdData->stride : 0;
|
|
|
|
|
|
|
|
uint32_t stride = offset - cmdData->offset;
|
|
|
|
return stride >= minStride && stride <= 32 ? stride : 0;
|
|
|
|
}
|
2021-09-11 19:38:24 +02:00
|
|
|
|
|
|
|
static bool ValidateDrawBufferSize(ID3D11Buffer* pBuffer, UINT Offset, UINT Size) {
|
|
|
|
UINT bufferSize = 0;
|
|
|
|
|
|
|
|
if (likely(pBuffer != nullptr))
|
|
|
|
bufferSize = static_cast<D3D11Buffer*>(pBuffer)->Desc()->ByteWidth;
|
|
|
|
|
|
|
|
return bufferSize >= Offset + Size;
|
|
|
|
}
|
2022-02-09 02:54:32 +01:00
|
|
|
|
2017-10-11 09:51:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|