2017-12-11 13:03:07 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <dxvk_device.h>
|
|
|
|
|
|
|
|
#include "d3d11_device_child.h"
|
|
|
|
#include "d3d11_util.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
class D3D11Device;
|
|
|
|
|
2018-03-18 23:27:29 +01:00
|
|
|
class D3D11BlendState : public D3D11DeviceChild<ID3D11BlendState1> {
|
2017-12-11 13:03:07 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2018-03-18 23:27:29 +01:00
|
|
|
using DescType = D3D11_BLEND_DESC1;
|
2017-12-11 13:03:07 +01:00
|
|
|
|
|
|
|
D3D11BlendState(
|
2018-03-18 23:27:29 +01:00
|
|
|
D3D11Device* device,
|
|
|
|
const D3D11_BLEND_DESC1& desc);
|
2017-12-11 13:03:07 +01:00
|
|
|
~D3D11BlendState();
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(
|
2017-12-11 13:03:07 +01:00
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
void STDMETHODCALLTYPE GetDevice(
|
2017-12-11 13:03:07 +01:00
|
|
|
ID3D11Device **ppDevice) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
void STDMETHODCALLTYPE GetDesc(
|
2017-12-11 13:03:07 +01:00
|
|
|
D3D11_BLEND_DESC* pDesc) final;
|
|
|
|
|
2018-03-18 23:27:29 +01:00
|
|
|
void STDMETHODCALLTYPE GetDesc1(
|
|
|
|
D3D11_BLEND_DESC1* pDesc) final;
|
|
|
|
|
2017-12-11 13:03:07 +01:00
|
|
|
void BindToContext(
|
|
|
|
const Rc<DxvkContext>& ctx,
|
2017-12-11 14:11:18 +01:00
|
|
|
UINT sampleMask) const;
|
2017-12-11 13:03:07 +01:00
|
|
|
|
2018-03-18 23:27:29 +01:00
|
|
|
static D3D11_BLEND_DESC1 DefaultDesc();
|
|
|
|
|
|
|
|
static D3D11_BLEND_DESC1 PromoteDesc(
|
|
|
|
const D3D11_BLEND_DESC* pSrcDesc);
|
|
|
|
|
|
|
|
static HRESULT NormalizeDesc(
|
|
|
|
D3D11_BLEND_DESC1* pDesc);
|
2018-04-30 10:41:57 +02:00
|
|
|
|
|
|
|
|
2018-03-18 23:27:29 +01:00
|
|
|
|
2017-12-11 13:03:07 +01:00
|
|
|
private:
|
|
|
|
|
|
|
|
D3D11Device* const m_device;
|
2018-03-18 23:27:29 +01:00
|
|
|
D3D11_BLEND_DESC1 m_desc;
|
2017-12-11 13:03:07 +01:00
|
|
|
|
|
|
|
std::array<DxvkBlendMode, 8> m_blendModes;
|
|
|
|
DxvkMultisampleState m_msState;
|
2017-12-11 14:11:18 +01:00
|
|
|
DxvkLogicOpState m_loState;
|
2017-12-11 13:03:07 +01:00
|
|
|
|
|
|
|
static DxvkBlendMode DecodeBlendMode(
|
2018-03-18 23:27:29 +01:00
|
|
|
const D3D11_RENDER_TARGET_BLEND_DESC1& BlendDesc);
|
2017-12-11 13:03:07 +01:00
|
|
|
|
|
|
|
static VkBlendFactor DecodeBlendFactor(
|
2018-01-16 20:10:49 +01:00
|
|
|
D3D11_BLEND BlendFactor,
|
|
|
|
bool IsAlpha);
|
2017-12-11 13:03:07 +01:00
|
|
|
|
|
|
|
static VkBlendOp DecodeBlendOp(
|
2018-01-16 20:10:49 +01:00
|
|
|
D3D11_BLEND_OP BlendOp);
|
2017-12-11 13:03:07 +01:00
|
|
|
|
2018-03-18 23:27:29 +01:00
|
|
|
static VkLogicOp DecodeLogicOp(
|
|
|
|
D3D11_LOGIC_OP LogicOp);
|
2018-04-30 10:41:57 +02:00
|
|
|
|
|
|
|
static bool ValidateBlendFactor(
|
|
|
|
D3D11_BLEND Blend);
|
|
|
|
|
|
|
|
static bool ValidateBlendFactorAlpha(
|
|
|
|
D3D11_BLEND BlendAlpha);
|
|
|
|
|
|
|
|
static bool ValidateBlendOp(
|
|
|
|
D3D11_BLEND_OP BlendOp);
|
|
|
|
|
|
|
|
static bool ValidateLogicOp(
|
|
|
|
D3D11_LOGIC_OP LogicOp);
|
|
|
|
|
|
|
|
static bool ValidateBlendOperations(
|
|
|
|
D3D11_BLEND SrcBlend,
|
|
|
|
D3D11_BLEND SrcBlendAlpha,
|
|
|
|
D3D11_BLEND SestBlend,
|
|
|
|
D3D11_BLEND DestBlendAlpha,
|
|
|
|
D3D11_BLEND_OP BlendOp,
|
|
|
|
D3D11_BLEND_OP BlendOpAlpha);
|
2017-12-11 13:03:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|