I'm implementing a D3D10 version of my renderer (not porting to avoid losing Windows XP support). I didn't go straight to D3D11 because MSDN and other sources recommend upgrading to 10 and then to 11.
From what I've read so far, what used to be done with IDirect3D9::SetRenderState
is done in D3D10 with ID3D10RasterizerState
, ID3D10BlendState
and ID3D10DepthStencilState
. You declare and fill a descriptor structure, tell the device to create a state object, and then bind it to the device. For example:
//D3D9
m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
//D3D10
//This defines the ID3D10RasterizerStatePtr type used below
_COM_SMARTPTR_TYPEDEF(ID3D10RasterizerState, __uuidof(ID3D10RasterizerState) );
//...
ID3D10RasterizerStatePtr pRasterState;
D3D10_RASTERIZER_DESC rasterDesc;
rasterDesc.CullMode = D3D10_CULL_NONE;
if( !CheckErrorCode( m_pImpl->pDevice->CreateRasterizerState( &rasterDesc, &pRasterState ), "InitDevice", "CreateRasterizerState" ) )
return false;
m_pImpl->pDevice->RSSetState( pRasterState );
However, now that I have to "port" the line...
m_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
... I cannot find a related property in any of the descriptors. From what I've seen, most examples implement lighting in HLSL, so perhaps I don't need to explicitly disable lighting, because my shaders don't do it?
This is a desktop app, no fancy Metro stuff. Using unmanaged C++.