mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-21 20:10:05 +00:00
Minor code cleanup
This commit is contained in:
parent
d536725320
commit
af90e04c71
@ -354,8 +354,7 @@ HRESULT InitDevice( const TexMetadata& mdata )
|
|||||||
};
|
};
|
||||||
UINT numFeatureLevels = ARRAYSIZE( featureLevels );
|
UINT numFeatureLevels = ARRAYSIZE( featureLevels );
|
||||||
|
|
||||||
DXGI_SWAP_CHAIN_DESC sd;
|
DXGI_SWAP_CHAIN_DESC sd = {};
|
||||||
ZeroMemory( &sd, sizeof( sd ) );
|
|
||||||
sd.BufferCount = 1;
|
sd.BufferCount = 1;
|
||||||
sd.BufferDesc.Width = width;
|
sd.BufferDesc.Width = width;
|
||||||
sd.BufferDesc.Height = height;
|
sd.BufferDesc.Height = height;
|
||||||
@ -385,8 +384,7 @@ HRESULT InitDevice( const TexMetadata& mdata )
|
|||||||
if( FAILED( hr ) )
|
if( FAILED( hr ) )
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
D3D11_RENDER_TARGET_VIEW_DESC vd;
|
D3D11_RENDER_TARGET_VIEW_DESC vd = {};
|
||||||
ZeroMemory(&vd, sizeof(vd));
|
|
||||||
vd.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
vd.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
||||||
vd.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
vd.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
||||||
hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, &vd, &g_pRenderTargetView );
|
hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, &vd, &g_pRenderTargetView );
|
||||||
@ -395,8 +393,7 @@ HRESULT InitDevice( const TexMetadata& mdata )
|
|||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
// Create depth stencil texture
|
// Create depth stencil texture
|
||||||
D3D11_TEXTURE2D_DESC descDepth;
|
D3D11_TEXTURE2D_DESC descDepth = {};
|
||||||
ZeroMemory( &descDepth, sizeof(descDepth) );
|
|
||||||
descDepth.Width = width;
|
descDepth.Width = width;
|
||||||
descDepth.Height = height;
|
descDepth.Height = height;
|
||||||
descDepth.MipLevels = 1;
|
descDepth.MipLevels = 1;
|
||||||
@ -413,8 +410,7 @@ HRESULT InitDevice( const TexMetadata& mdata )
|
|||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
// Create the depth stencil view
|
// Create the depth stencil view
|
||||||
D3D11_DEPTH_STENCIL_VIEW_DESC descDSV;
|
D3D11_DEPTH_STENCIL_VIEW_DESC descDSV = {};
|
||||||
ZeroMemory( &descDSV, sizeof(descDSV) );
|
|
||||||
descDSV.Format = descDepth.Format;
|
descDSV.Format = descDepth.Format;
|
||||||
descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
|
descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
|
||||||
descDSV.Texture2D.MipSlice = 0;
|
descDSV.Texture2D.MipSlice = 0;
|
||||||
@ -514,8 +510,7 @@ HRESULT InitDevice( const TexMetadata& mdata )
|
|||||||
|
|
||||||
// Create vertex buffer
|
// Create vertex buffer
|
||||||
UINT nverts;
|
UINT nverts;
|
||||||
D3D11_SUBRESOURCE_DATA InitData;
|
D3D11_SUBRESOURCE_DATA InitData = {};
|
||||||
ZeroMemory( &InitData, sizeof(InitData) );
|
|
||||||
|
|
||||||
static const SimpleVertex verticesCube[] =
|
static const SimpleVertex verticesCube[] =
|
||||||
{
|
{
|
||||||
@ -590,8 +585,7 @@ HRESULT InitDevice( const TexMetadata& mdata )
|
|||||||
InitData.pSysMem = vertices;
|
InitData.pSysMem = vertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D11_BUFFER_DESC bd;
|
D3D11_BUFFER_DESC bd = {};
|
||||||
ZeroMemory( &bd, sizeof(bd) );
|
|
||||||
bd.Usage = D3D11_USAGE_DEFAULT;
|
bd.Usage = D3D11_USAGE_DEFAULT;
|
||||||
bd.ByteWidth = sizeof( SimpleVertex ) * nverts;
|
bd.ByteWidth = sizeof( SimpleVertex ) * nverts;
|
||||||
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||||
@ -663,8 +657,7 @@ HRESULT InitDevice( const TexMetadata& mdata )
|
|||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
// Create the state objects
|
// Create the state objects
|
||||||
D3D11_SAMPLER_DESC sampDesc;
|
D3D11_SAMPLER_DESC sampDesc = {};
|
||||||
ZeroMemory( &sampDesc, sizeof(sampDesc) );
|
|
||||||
sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||||
sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
|
Loading…
Reference in New Issue
Block a user