Add D3D11 test helper for setting rasterizer state

This commit is contained in:
baldurk
2019-10-24 17:33:08 +01:00
parent cc0a539364
commit 43432a4650
3 changed files with 43 additions and 0 deletions
+2
View File
@@ -56,6 +56,8 @@ COM_SMARTPTR(ID3D11CommandList);
COM_SMARTPTR(ID3D11InputLayout);
COM_SMARTPTR(ID3D11Resource);
COM_SMARTPTR(ID3D11Buffer);
COM_SMARTPTR(ID3D11Query);
+38
View File
@@ -394,6 +394,44 @@ void D3D11GraphicsTest::RSSetViewport(D3D11_VIEWPORT view)
ctx->RSSetViewports(1, &view);
}
D3D11_RASTERIZER_DESC D3D11GraphicsTest::GetRasterState()
{
ID3D11RasterizerState *state = NULL;
ctx->RSGetState(&state);
D3D11_RASTERIZER_DESC ret;
if(state)
{
state->GetDesc(&ret);
return ret;
}
ret.FillMode = D3D11_FILL_SOLID;
ret.CullMode = D3D11_CULL_BACK;
ret.FrontCounterClockwise = FALSE;
ret.DepthBias = 0;
ret.DepthBiasClamp = 0.0f;
ret.SlopeScaledDepthBias = 0.0f;
ret.DepthClipEnable = TRUE;
ret.ScissorEnable = FALSE;
ret.MultisampleEnable = FALSE;
ret.AntialiasedLineEnable = FALSE;
return ret;
}
void D3D11GraphicsTest::SetRasterState(const D3D11_RASTERIZER_DESC &desc)
{
ID3D11RasterizerState *state = NULL;
ctx->RSGetState(&state);
rastState = NULL;
dev->CreateRasterizerState(&desc, &rastState);
ctx->RSSetState(rastState);
}
D3D11_DEPTH_STENCIL_DESC D3D11GraphicsTest::GetDepthState()
{
ID3D11DepthStencilState *state = NULL;
+3
View File
@@ -141,6 +141,8 @@ struct D3D11GraphicsTest : public GraphicsTest
void ClearRenderTargetView(ID3D11RenderTargetView *rt, Vec4f col);
D3D11_RASTERIZER_DESC GetRasterState();
void SetRasterState(const D3D11_RASTERIZER_DESC &desc);
void RSSetViewport(D3D11_VIEWPORT view);
D3D11_DEPTH_STENCIL_DESC GetDepthState();
@@ -161,6 +163,7 @@ struct D3D11GraphicsTest : public GraphicsTest
D3D11_FEATURE_DATA_D3D11_OPTIONS1 opts1;
ID3D11DepthStencilStatePtr depthState;
ID3D11RasterizerStatePtr rastState;
GraphicsWindow *mainWindow = NULL;