mirror of
https://github.com/microsoft/DirectXTex
synced 2024-12-27 11:50:13 +00:00
Use brace initialization instead of memset 0
This commit is contained in:
parent
649c5e53dc
commit
de51bd7fcf
@ -969,8 +969,7 @@ static HRESULT CreateD3DResources( _In_ ID3D11Device* d3dDevice,
|
||||
{
|
||||
if (textureView != 0)
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc;
|
||||
memset( &SRVDesc, 0, sizeof( SRVDesc ) );
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
|
||||
SRVDesc.Format = format;
|
||||
|
||||
if (arraySize > 1)
|
||||
@ -1040,8 +1039,7 @@ static HRESULT CreateD3DResources( _In_ ID3D11Device* d3dDevice,
|
||||
{
|
||||
if (textureView != 0)
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc;
|
||||
memset( &SRVDesc, 0, sizeof( SRVDesc ) );
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
|
||||
SRVDesc.Format = format;
|
||||
|
||||
if ( isCubeMap )
|
||||
@ -1118,8 +1116,7 @@ static HRESULT CreateD3DResources( _In_ ID3D11Device* d3dDevice,
|
||||
{
|
||||
if (textureView != 0)
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc;
|
||||
memset( &SRVDesc, 0, sizeof( SRVDesc ) );
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
|
||||
SRVDesc.Format = format;
|
||||
|
||||
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
|
||||
|
@ -232,8 +232,7 @@ HRESULT GPUCompressBC::Prepare( size_t width, size_t height, DXGI_FORMAT format,
|
||||
// Create structured buffers
|
||||
size_t bufferSize = num_blocks * sizeof( BufferBC6HBC7 );
|
||||
{
|
||||
D3D11_BUFFER_DESC desc;
|
||||
memset( &desc, 0, sizeof(desc) );
|
||||
D3D11_BUFFER_DESC desc = {};
|
||||
desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
@ -261,8 +260,7 @@ HRESULT GPUCompressBC::Prepare( size_t width, size_t height, DXGI_FORMAT format,
|
||||
|
||||
// Create staging output buffer
|
||||
{
|
||||
D3D11_BUFFER_DESC desc;
|
||||
memset( &desc, 0, sizeof(desc) );
|
||||
D3D11_BUFFER_DESC desc = {};
|
||||
desc.Usage = D3D11_USAGE_STAGING;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
desc.ByteWidth = static_cast<UINT>( bufferSize );
|
||||
@ -276,8 +274,7 @@ HRESULT GPUCompressBC::Prepare( size_t width, size_t height, DXGI_FORMAT format,
|
||||
|
||||
// Create constant buffer
|
||||
{
|
||||
D3D11_BUFFER_DESC desc;
|
||||
memset( &desc, 0, sizeof(desc) );
|
||||
D3D11_BUFFER_DESC desc = {};
|
||||
desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
|
||||
desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
@ -292,8 +289,7 @@ HRESULT GPUCompressBC::Prepare( size_t width, size_t height, DXGI_FORMAT format,
|
||||
|
||||
// Create shader resource views
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC desc;
|
||||
memset( &desc, 0, sizeof(desc) );
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC desc = {};
|
||||
desc.Buffer.NumElements = static_cast<UINT>( num_blocks );
|
||||
desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
|
||||
@ -312,8 +308,7 @@ HRESULT GPUCompressBC::Prepare( size_t width, size_t height, DXGI_FORMAT format,
|
||||
|
||||
// Create unordered access views
|
||||
{
|
||||
D3D11_UNORDERED_ACCESS_VIEW_DESC desc;
|
||||
memset( &desc, 0, sizeof(desc) );
|
||||
D3D11_UNORDERED_ACCESS_VIEW_DESC desc = {};
|
||||
desc.Buffer.NumElements = static_cast<UINT>( num_blocks );
|
||||
desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
||||
|
||||
@ -367,8 +362,7 @@ HRESULT GPUCompressBC::Compress( const Image& srcImage, const Image& destImage )
|
||||
|
||||
ComPtr<ID3D11Texture2D> sourceTex;
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
memset( &desc, 0, sizeof(desc) );
|
||||
D3D11_TEXTURE2D_DESC desc = {};
|
||||
desc.Width = static_cast<UINT>( srcImage.width );
|
||||
desc.Height = static_cast<UINT>( srcImage.height );
|
||||
desc.MipLevels = 1;
|
||||
@ -392,8 +386,7 @@ HRESULT GPUCompressBC::Compress( const Image& srcImage, const Image& destImage )
|
||||
|
||||
ComPtr<ID3D11ShaderResourceView> sourceSRV;
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC desc;
|
||||
memset( &desc, 0, sizeof(desc) );
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC desc = {};
|
||||
desc.Texture2D.MipLevels = 1;
|
||||
desc.Format = inputFormat;
|
||||
desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
||||
|
@ -100,8 +100,7 @@ inline bool __cdecl IsSRGB(DXGI_FORMAT fmt)
|
||||
_Use_decl_annotations_
|
||||
inline HRESULT __cdecl SaveToDDSMemory(const Image& image, DWORD flags, Blob& blob)
|
||||
{
|
||||
TexMetadata mdata;
|
||||
memset( &mdata, 0, sizeof(mdata) );
|
||||
TexMetadata mdata = {};
|
||||
mdata.width = image.width;
|
||||
mdata.height = image.height;
|
||||
mdata.depth = 1;
|
||||
@ -116,8 +115,7 @@ inline HRESULT __cdecl SaveToDDSMemory(const Image& image, DWORD flags, Blob& bl
|
||||
_Use_decl_annotations_
|
||||
inline HRESULT __cdecl SaveToDDSFile(const Image& image, DWORD flags, LPCWSTR szFile)
|
||||
{
|
||||
TexMetadata mdata;
|
||||
memset( &mdata, 0, sizeof(mdata) );
|
||||
TexMetadata mdata = {};
|
||||
mdata.width = image.width;
|
||||
mdata.height = image.height;
|
||||
mdata.depth = 1;
|
||||
|
@ -611,8 +611,7 @@ HRESULT CreateShaderResourceViewEx( ID3D11Device* pDevice, const Image* srcImage
|
||||
|
||||
assert( resource );
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc;
|
||||
memset( &SRVDesc, 0, sizeof(SRVDesc) );
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
|
||||
if ( forceSRGB )
|
||||
SRVDesc.Format = MakeSRGB( metadata.format );
|
||||
else
|
||||
|
@ -2594,8 +2594,7 @@ HRESULT GenerateMipMaps( const Image& baseImage, DWORD filter, size_t levels, Sc
|
||||
else
|
||||
{
|
||||
//--- Use custom filters to generate mipmaps ----------------------------------
|
||||
TexMetadata mdata;
|
||||
memset( &mdata, 0, sizeof(mdata) );
|
||||
TexMetadata mdata = {};
|
||||
mdata.width = baseImage.width;
|
||||
if ( baseImage.height > 1 || !allow1D )
|
||||
{
|
||||
|
@ -640,8 +640,7 @@ static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice,
|
||||
{
|
||||
if (textureView != 0)
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc;
|
||||
memset( &SRVDesc, 0, sizeof( SRVDesc ) );
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
|
||||
SRVDesc.Format = desc.Format;
|
||||
|
||||
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
||||
|
Loading…
Reference in New Issue
Block a user