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