From bc11fc970f7d7b0cbec70ef74732cbd49f23ccd1 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 2 May 2019 21:45:01 -0700 Subject: Fixed default ctor of TextureLoadInfo struct --- TextureLoader/interface/TextureLoader.h | 30 +++++++++++++++--------------- TextureLoader/src/TextureLoader.cpp | 20 ++++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'TextureLoader') diff --git a/TextureLoader/interface/TextureLoader.h b/TextureLoader/interface/TextureLoader.h index 499e741..8522d17 100644 --- a/TextureLoader/interface/TextureLoader.h +++ b/TextureLoader/interface/TextureLoader.h @@ -34,37 +34,37 @@ namespace Diligent struct TextureLoadInfo { /// Texture name passed over to the texture creation method - const Char *Name; + const Char* Name = nullptr; /// Usage - USAGE Usage; + USAGE Usage = USAGE_STATIC; /// Bind flags - BIND_FLAGS BindFlags; + BIND_FLAGS BindFlags = BIND_SHADER_RESOURCE; /// Number of mip levels - Uint32 MipLevels; + Uint32 MipLevels = 0; /// CPU access flags - CPU_ACCESS_FLAGS CPUAccessFlags; + CPU_ACCESS_FLAGS CPUAccessFlags = CPU_ACCESS_NONE; /// Flag indicating if this texture uses sRGB gamma encoding - Bool IsSRGB; + Bool IsSRGB = False; /// Flag indicating that the procedure should generate lower mip levels - Bool GenerateMips; + Bool GenerateMips = True; /// Texture format - TEXTURE_FORMAT Format; + TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN; explicit TextureLoadInfo(const Char* _Name, - USAGE _Usage = USAGE_STATIC, - BIND_FLAGS _BindFlags = BIND_SHADER_RESOURCE, - Uint32 _MipLevels = 0, - CPU_ACCESS_FLAGS _CPUAccessFlags = CPU_ACCESS_NONE, - Bool _IsSRGB = False, - Bool _GenerateMips = True, - TEXTURE_FORMAT _Format = TEX_FORMAT_UNKNOWN) : + USAGE _Usage = TextureLoadInfo{}.Usage, + BIND_FLAGS _BindFlags = TextureLoadInfo{}.BindFlags, + Uint32 _MipLevels = TextureLoadInfo{}.MipLevels, + CPU_ACCESS_FLAGS _CPUAccessFlags = TextureLoadInfo{}.CPUAccessFlags, + Bool _IsSRGB = TextureLoadInfo{}.IsSRGB, + Bool _GenerateMips = TextureLoadInfo{}.GenerateMips, + TEXTURE_FORMAT _Format = TextureLoadInfo{}.Format) : Name (_Name), Usage (_Usage), BindFlags (_BindFlags), diff --git a/TextureLoader/src/TextureLoader.cpp b/TextureLoader/src/TextureLoader.cpp index 50ba00a..f2dd427 100644 --- a/TextureLoader/src/TextureLoader.cpp +++ b/TextureLoader/src/TextureLoader.cpp @@ -103,22 +103,22 @@ void RGBToRGBA(const void* pRGBData, } void CreateTextureFromImage( Image* pSrcImage, - const TextureLoadInfo& TexLoadInfo, - IRenderDevice* pDevice, - ITexture** ppTexture ) + const TextureLoadInfo& TexLoadInfo, + IRenderDevice* pDevice, + ITexture** ppTexture ) { const auto& ImgDesc = pSrcImage->GetDesc(); TextureDesc TexDesc; - TexDesc.Name = TexLoadInfo.Name; - TexDesc.Type = RESOURCE_DIM_TEX_2D; - TexDesc.Width = ImgDesc.Width; - TexDesc.Height = ImgDesc.Height; + TexDesc.Name = TexLoadInfo.Name; + TexDesc.Type = RESOURCE_DIM_TEX_2D; + TexDesc.Width = ImgDesc.Width; + TexDesc.Height = ImgDesc.Height; TexDesc.MipLevels = ComputeMipLevelsCount( TexDesc.Width, TexDesc.Height ); if( TexLoadInfo.MipLevels > 0 ) TexDesc.MipLevels = std::min(TexDesc.MipLevels, TexLoadInfo.MipLevels); - TexDesc.Usage = TexLoadInfo.Usage; - TexDesc.BindFlags = TexLoadInfo.BindFlags; - TexDesc.Format = TexLoadInfo.Format; + TexDesc.Usage = TexLoadInfo.Usage; + TexDesc.BindFlags = TexLoadInfo.BindFlags; + TexDesc.Format = TexLoadInfo.Format; TexDesc.CPUAccessFlags = TexLoadInfo.CPUAccessFlags; auto ChannelDepth = ImgDesc.BitsPerPixel / ImgDesc.NumComponents; -- cgit v1.2.3