更改D3D11中的单个状态设置

bob*_*obo 8 render direct3d11

似乎D3D11的api有点笨重,或者我没有正确使用它.

这是否是在D3D11中更改单个光栅化器状态的最小步骤集(我将使用更改为线框模式渲染作为示例)

  // variables to hold the current rasterizer state and its description
  ID3D11RasterizerState * rState ;
  D3D11_RASTERIZER_DESC rDesc ;

  // cd3d is the ID3D11DeviceContext  
  cd3d->RSGetState( &rState ) ; // retrieve the current state
  rState->GetDesc( &rDesc ) ;    // get the desc of the state
  rDesc.FillMode = D3D11_FILL_WIREFRAME ; // change the ONE setting

  // create a whole new rasterizer state
  // d3d is the ID3D11Device
  d3d->CreateRasterizerState( &rDesc, &rState ) ;

  cd3d->RSSetState( rState );    // set the new rasterizer state

似乎比9年代长很多

  cd3d->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME ) ;

小智 7

或者你可以将状态desc'全局'保存到你的代码或类中,然后只需更改fillmode并使用RSSetState设置(原始状态有新的更改)?而不是检索和设置.