Renderer: Move depth state to VideoCommon and seperate from bpmem

This commit is contained in:
Stenzek
2017-04-30 15:54:45 +10:00
parent 4d36f0cc87
commit 2869c570f1
20 changed files with 80 additions and 104 deletions

View File

@ -456,10 +456,9 @@ ID3D11RasterizerState* StateCache::Get(RasterizerState state)
return res;
}
ID3D11DepthStencilState* StateCache::Get(ZMode state)
ID3D11DepthStencilState* StateCache::Get(DepthState state)
{
auto it = m_depth.find(state.hex);
if (it != m_depth.end())
return it->second;
@ -472,6 +471,7 @@ ID3D11DepthStencilState* StateCache::Get(ZMode state)
depthdc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
depthdc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
// Less/greater are swapped due to inverted depth.
const D3D11_COMPARISON_FUNC d3dCmpFuncs[8] = {
D3D11_COMPARISON_NEVER, D3D11_COMPARISON_GREATER, D3D11_COMPARISON_EQUAL,
D3D11_COMPARISON_GREATER_EQUAL, D3D11_COMPARISON_LESS, D3D11_COMPARISON_NOT_EQUAL,

View File

@ -49,7 +49,7 @@ public:
ID3D11SamplerState* Get(SamplerState state);
ID3D11BlendState* Get(BlendingState state);
ID3D11RasterizerState* Get(RasterizerState state);
ID3D11DepthStencilState* Get(ZMode state);
ID3D11DepthStencilState* Get(DepthState state);
// Release all cached states and clear hash tables.
void Clear();

View File

@ -60,7 +60,7 @@ struct GXPipelineState
{
std::array<SamplerState, 8> samplers;
BlendingState blend;
ZMode zmode;
DepthState zmode;
RasterizerState raster;
};
@ -916,9 +916,9 @@ void Renderer::SetGenerationMode()
s_gx_state.raster.cull_mode = d3d_cull_modes[bpmem.genMode.cullmode];
}
void Renderer::SetDepthMode()
void Renderer::SetDepthState(const DepthState& state)
{
s_gx_state.zmode.hex = bpmem.zmode.hex;
s_gx_state.zmode.hex = state.hex;
}
void Renderer::SetSamplerState(int stage, int texindex, bool custom_tex)

View File

@ -22,7 +22,7 @@ public:
void SetBlendingState(const BlendingState& state) override;
void SetScissorRect(const EFBRectangle& rc) override;
void SetGenerationMode() override;
void SetDepthMode() override;
void SetDepthState(const DepthState& state) override;
void SetSamplerState(int stage, int texindex, bool custom_tex) override;
void SetInterlacingMode() override;
void SetViewport() override;