mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[d3d11] Implemented ID3D11RasterizerState1 stub
This commit is contained in:
parent
0a473b4f86
commit
2591bbdabd
@ -1152,22 +1152,12 @@ namespace dxvk {
|
||||
HRESULT STDMETHODCALLTYPE D3D11Device::CreateRasterizerState(
|
||||
const D3D11_RASTERIZER_DESC* pRasterizerDesc,
|
||||
ID3D11RasterizerState** ppRasterizerState) {
|
||||
D3D11_RASTERIZER_DESC desc;
|
||||
D3D11_RASTERIZER_DESC1 desc = pRasterizerDesc != nullptr
|
||||
? D3D11RasterizerState::PromoteDesc(pRasterizerDesc)
|
||||
: D3D11RasterizerState::DefaultDesc();
|
||||
|
||||
if (pRasterizerDesc != nullptr) {
|
||||
desc = *pRasterizerDesc;
|
||||
} else {
|
||||
desc.FillMode = D3D11_FILL_SOLID;
|
||||
desc.CullMode = D3D11_CULL_BACK;
|
||||
desc.FrontCounterClockwise = FALSE;
|
||||
desc.DepthBias = 0;
|
||||
desc.SlopeScaledDepthBias = 0.0f;
|
||||
desc.DepthBiasClamp = 0.0f;
|
||||
desc.DepthClipEnable = TRUE;
|
||||
desc.ScissorEnable = FALSE;
|
||||
desc.MultisampleEnable = FALSE;
|
||||
desc.AntialiasedLineEnable = FALSE;
|
||||
}
|
||||
if (FAILED(D3D11RasterizerState::NormalizeDesc(&desc)))
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (ppRasterizerState != nullptr) {
|
||||
*ppRasterizerState = m_rsStateObjects.Create(this, desc);
|
||||
@ -1175,13 +1165,24 @@ namespace dxvk {
|
||||
} return S_FALSE;
|
||||
}
|
||||
|
||||
|
||||
HRESULT D3D11Device::CreateRasterizerState1(
|
||||
const D3D11_RASTERIZER_DESC1* pRasterizerDesc,
|
||||
ID3D11RasterizerState1** ppRasterizerState) {
|
||||
Logger::err("D3D11Device::CreateRasterizerState1: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
D3D11_RASTERIZER_DESC1 desc = pRasterizerDesc != nullptr
|
||||
? *pRasterizerDesc
|
||||
: D3D11RasterizerState::DefaultDesc();
|
||||
|
||||
if (FAILED(D3D11RasterizerState::NormalizeDesc(&desc)))
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (ppRasterizerState != nullptr) {
|
||||
*ppRasterizerState = m_rsStateObjects.Create(this, desc);
|
||||
return S_OK;
|
||||
} return S_FALSE;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11Device::CreateSamplerState(
|
||||
const D3D11_SAMPLER_DESC* pSamplerDesc,
|
||||
ID3D11SamplerState** ppSamplerState) {
|
||||
|
@ -5,7 +5,7 @@ namespace dxvk {
|
||||
|
||||
D3D11RasterizerState::D3D11RasterizerState(
|
||||
D3D11Device* device,
|
||||
const D3D11_RASTERIZER_DESC& desc)
|
||||
const D3D11_RASTERIZER_DESC1& desc)
|
||||
: m_device(device), m_desc(desc) {
|
||||
|
||||
// State that is not supported in D3D11
|
||||
@ -57,6 +57,9 @@ namespace dxvk {
|
||||
|
||||
if (desc.AntialiasedLineEnable)
|
||||
Logger::err("D3D11RasterizerState: Antialiased lines not supported");
|
||||
|
||||
if (desc.ForcedSampleCount)
|
||||
Logger::err("D3D11RasterizerState: Forced sample count not supported");
|
||||
}
|
||||
|
||||
|
||||
@ -82,6 +85,20 @@ namespace dxvk {
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11RasterizerState::GetDesc(D3D11_RASTERIZER_DESC* pDesc) {
|
||||
pDesc->FillMode = m_desc.FillMode;
|
||||
pDesc->CullMode = m_desc.CullMode;
|
||||
pDesc->FrontCounterClockwise = m_desc.FrontCounterClockwise;
|
||||
pDesc->DepthBias = m_desc.DepthBias;
|
||||
pDesc->DepthBiasClamp = m_desc.DepthBiasClamp;
|
||||
pDesc->SlopeScaledDepthBias = m_desc.SlopeScaledDepthBias;
|
||||
pDesc->DepthClipEnable = m_desc.DepthClipEnable;
|
||||
pDesc->ScissorEnable = m_desc.ScissorEnable;
|
||||
pDesc->MultisampleEnable = m_desc.MultisampleEnable;
|
||||
pDesc->AntialiasedLineEnable = m_desc.AntialiasedLineEnable;
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11RasterizerState::GetDesc1(D3D11_RASTERIZER_DESC1* pDesc) {
|
||||
*pDesc = m_desc;
|
||||
}
|
||||
|
||||
@ -90,4 +107,46 @@ namespace dxvk {
|
||||
ctx->setRasterizerState(m_state);
|
||||
}
|
||||
|
||||
|
||||
D3D11_RASTERIZER_DESC1 D3D11RasterizerState::DefaultDesc() {
|
||||
D3D11_RASTERIZER_DESC1 dstDesc;
|
||||
dstDesc.FillMode = D3D11_FILL_SOLID;
|
||||
dstDesc.CullMode = D3D11_CULL_BACK;
|
||||
dstDesc.FrontCounterClockwise = FALSE;
|
||||
dstDesc.DepthBias = 0;
|
||||
dstDesc.SlopeScaledDepthBias = 0.0f;
|
||||
dstDesc.DepthBiasClamp = 0.0f;
|
||||
dstDesc.DepthClipEnable = TRUE;
|
||||
dstDesc.ScissorEnable = FALSE;
|
||||
dstDesc.MultisampleEnable = FALSE;
|
||||
dstDesc.AntialiasedLineEnable = FALSE;
|
||||
dstDesc.ForcedSampleCount = 0;
|
||||
return dstDesc;
|
||||
}
|
||||
|
||||
|
||||
D3D11_RASTERIZER_DESC1 D3D11RasterizerState::PromoteDesc(
|
||||
const D3D11_RASTERIZER_DESC* pSrcDesc) {
|
||||
D3D11_RASTERIZER_DESC1 dstDesc;
|
||||
dstDesc.FillMode = pSrcDesc->FillMode;
|
||||
dstDesc.CullMode = pSrcDesc->CullMode;
|
||||
dstDesc.FrontCounterClockwise = pSrcDesc->FrontCounterClockwise;
|
||||
dstDesc.DepthBias = pSrcDesc->DepthBias;
|
||||
dstDesc.DepthBiasClamp = pSrcDesc->DepthBiasClamp;
|
||||
dstDesc.SlopeScaledDepthBias = pSrcDesc->SlopeScaledDepthBias;
|
||||
dstDesc.DepthClipEnable = pSrcDesc->DepthClipEnable;
|
||||
dstDesc.ScissorEnable = pSrcDesc->ScissorEnable;
|
||||
dstDesc.MultisampleEnable = pSrcDesc->MultisampleEnable;
|
||||
dstDesc.AntialiasedLineEnable = pSrcDesc->AntialiasedLineEnable;
|
||||
dstDesc.ForcedSampleCount = 0;
|
||||
return dstDesc;
|
||||
}
|
||||
|
||||
|
||||
HRESULT D3D11RasterizerState::NormalizeDesc(
|
||||
D3D11_RASTERIZER_DESC1* pDesc) {
|
||||
// TODO validate
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
@ -8,15 +8,15 @@ namespace dxvk {
|
||||
|
||||
class D3D11Device;
|
||||
|
||||
class D3D11RasterizerState : public D3D11DeviceChild<ID3D11RasterizerState> {
|
||||
class D3D11RasterizerState : public D3D11DeviceChild<ID3D11RasterizerState1> {
|
||||
|
||||
public:
|
||||
|
||||
using DescType = D3D11_RASTERIZER_DESC;
|
||||
using DescType = D3D11_RASTERIZER_DESC1;
|
||||
|
||||
D3D11RasterizerState(
|
||||
D3D11Device* device,
|
||||
const D3D11_RASTERIZER_DESC& desc);
|
||||
const D3D11_RASTERIZER_DESC1& desc);
|
||||
~D3D11RasterizerState();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
@ -29,14 +29,25 @@ namespace dxvk {
|
||||
void STDMETHODCALLTYPE GetDesc(
|
||||
D3D11_RASTERIZER_DESC* pDesc) final;
|
||||
|
||||
void STDMETHODCALLTYPE GetDesc1(
|
||||
D3D11_RASTERIZER_DESC1* pDesc) final;
|
||||
|
||||
void BindToContext(
|
||||
const Rc<DxvkContext>& ctx);
|
||||
|
||||
static D3D11_RASTERIZER_DESC1 DefaultDesc();
|
||||
|
||||
static D3D11_RASTERIZER_DESC1 PromoteDesc(
|
||||
const D3D11_RASTERIZER_DESC* pDesc);
|
||||
|
||||
static HRESULT NormalizeDesc(
|
||||
D3D11_RASTERIZER_DESC1* pDesc);
|
||||
|
||||
private:
|
||||
|
||||
D3D11Device* const m_device;
|
||||
D3D11_RASTERIZER_DESC m_desc;
|
||||
DxvkRasterizerState m_state;
|
||||
D3D11Device* const m_device;
|
||||
D3D11_RASTERIZER_DESC1 m_desc;
|
||||
DxvkRasterizerState m_state;
|
||||
|
||||
};
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
size_t D3D11StateDescHash::operator () (
|
||||
const D3D11_RASTERIZER_DESC& desc) const {
|
||||
const D3D11_RASTERIZER_DESC1& desc) const {
|
||||
DxvkHashState hash;
|
||||
hash.add(desc.FillMode);
|
||||
hash.add(desc.CullMode);
|
||||
@ -58,6 +58,7 @@ namespace dxvk {
|
||||
hash.add(desc.ScissorEnable);
|
||||
hash.add(desc.MultisampleEnable);
|
||||
hash.add(desc.AntialiasedLineEnable);
|
||||
hash.add(desc.ForcedSampleCount);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@ -139,8 +140,8 @@ namespace dxvk {
|
||||
|
||||
|
||||
bool D3D11StateDescEqual::operator () (
|
||||
const D3D11_RASTERIZER_DESC& a,
|
||||
const D3D11_RASTERIZER_DESC& b) const {
|
||||
const D3D11_RASTERIZER_DESC1& a,
|
||||
const D3D11_RASTERIZER_DESC1& b) const {
|
||||
return a.FillMode == b.FillMode
|
||||
&& a.CullMode == b.CullMode
|
||||
&& a.FrontCounterClockwise == b.FrontCounterClockwise
|
||||
@ -150,7 +151,8 @@ namespace dxvk {
|
||||
&& a.DepthClipEnable == b.DepthClipEnable
|
||||
&& a.ScissorEnable == b.ScissorEnable
|
||||
&& a.MultisampleEnable == b.MultisampleEnable
|
||||
&& a.AntialiasedLineEnable == b.AntialiasedLineEnable;
|
||||
&& a.AntialiasedLineEnable == b.AntialiasedLineEnable
|
||||
&& a.ForcedSampleCount == b.ForcedSampleCount;
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace dxvk {
|
||||
size_t operator () (const D3D11_BLEND_DESC& desc) const;
|
||||
size_t operator () (const D3D11_DEPTH_STENCILOP_DESC& desc) const;
|
||||
size_t operator () (const D3D11_DEPTH_STENCIL_DESC& desc) const;
|
||||
size_t operator () (const D3D11_RASTERIZER_DESC& desc) const;
|
||||
size_t operator () (const D3D11_RASTERIZER_DESC1& desc) const;
|
||||
size_t operator () (const D3D11_RENDER_TARGET_BLEND_DESC& desc) const;
|
||||
size_t operator () (const D3D11_SAMPLER_DESC& desc) const;
|
||||
};
|
||||
@ -25,7 +25,7 @@ namespace dxvk {
|
||||
bool operator () (const D3D11_BLEND_DESC& a, const D3D11_BLEND_DESC& b) const;
|
||||
bool operator () (const D3D11_DEPTH_STENCILOP_DESC& a, const D3D11_DEPTH_STENCILOP_DESC& b) const;
|
||||
bool operator () (const D3D11_DEPTH_STENCIL_DESC& a, const D3D11_DEPTH_STENCIL_DESC& b) const;
|
||||
bool operator () (const D3D11_RASTERIZER_DESC& a, const D3D11_RASTERIZER_DESC& b) const;
|
||||
bool operator () (const D3D11_RASTERIZER_DESC1& a, const D3D11_RASTERIZER_DESC1& b) const;
|
||||
bool operator () (const D3D11_RENDER_TARGET_BLEND_DESC& a, const D3D11_RENDER_TARGET_BLEND_DESC& b) const;
|
||||
bool operator () (const D3D11_SAMPLER_DESC& a, const D3D11_SAMPLER_DESC& b) const;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user