@ -12,39 +12,19 @@ namespace D3D12 {
class ShaderCache ;
static inline void ResourceBarrier ( ID3D12GraphicsCommandList * cmdlist , ID3D12Resource * resource ,
D3D12_RESOURCE_STATES from_state , D3D12_RESOURCE_STATES to_state )
{
const D3D12_RESOURCE_BARRIER barrier = { D3D12_RESOURCE_BARRIER_TYPE_TRANSITION ,
D3D12_RESOURCE_BARRIER_FLAG_NONE ,
{ { resource , D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES , from_state , to_state } } } ;
cmdlist - > ResourceBarrier ( 1 , & barrier ) ;
}
static inline void SetViewport ( ID3D12GraphicsCommandList * cmdlist , int x , int y , int width , int height ,
float min_depth = 0.0f , float max_depth = 1.0f )
{
const D3D12_VIEWPORT vp { static_cast < float > ( x ) ,
static_cast < float > ( y ) ,
static_cast < float > ( width ) ,
static_cast < float > ( height ) ,
min_depth ,
max_depth } ;
cmdlist - > RSSetViewports ( 1 , & vp ) ;
}
static inline void SetScissor ( ID3D12GraphicsCommandList * cmdlist , int x , int y , int width , int height )
{
const D3D12_RECT r { x , y , x + width , y + height } ;
cmdlist - > RSSetScissorRects ( 1 , & r ) ;
}
void ResourceBarrier ( ID3D12GraphicsCommandList * cmdlist , ID3D12Resource * resource , D3D12_RESOURCE_STATES from_state ,
D3D12_RESOURCE_STATES to_state ) ;
static inline void SetViewportAndScissor ( ID3D12GraphicsCommandList * cmdlist , int x , int y , int width , int height ,
float min_depth = 0.0f , float max_depth = 1.0f )
{
SetViewport ( cmdlist , x , y , width , height , min_depth , max_depth ) ;
SetScissor ( cmdlist , x , y , width , height ) ;
}
void SetViewport ( ID3D12GraphicsCommandList * cmdlist , int x , int y , int width , int height , float min_depth = 0.0f ,
float max_depth = 1.0f ) ;
void SetScissor ( ID3D12GraphicsCommandList * cmdlist , int x , int y , int width , int height ) ;
void SetViewportAndScissor ( ID3D12GraphicsCommandList * cmdlist , int x , int y , int width , int height ,
float min_depth = 0.0f , float max_depth = 1.0f ) ;
void SetViewportAndClampScissor ( ID3D12GraphicsCommandList * cmdlist , int x , int y , int width , int height ,
float min_depth = 0.0f , float max_depth = 1.0f ) ;
u32 GetTexelSize ( DXGI_FORMAT format ) ;