From b3311e60b7dc6ee1581469e2d3ac8854cdcb5ba0 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 6 Jul 2018 10:41:55 -0700 Subject: Fixed Vulkan swapchain present error when window is minimized --- Graphics/GraphicsEngine/src/Texture.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/src/Texture.cpp b/Graphics/GraphicsEngine/src/Texture.cpp index b1769cf3..b8d30af8 100644 --- a/Graphics/GraphicsEngine/src/Texture.cpp +++ b/Graphics/GraphicsEngine/src/Texture.cpp @@ -37,12 +37,32 @@ void ValidateTextureDesc( const TextureDesc& Desc ) LOG_TEXTURE_ERROR_AND_THROW("Resource dimension is undefined"); } + if ( !(Desc.Type >= RESOURCE_DIM_TEX_1D && Desc.Type <= RESOURCE_DIM_TEX_CUBE_ARRAY) ) + { + LOG_TEXTURE_ERROR_AND_THROW("Unexpected resource dimension"); + } + + if (Desc.Width == 0) + { + LOG_TEXTURE_ERROR_AND_THROW("Texture width cannot be zero"); + } + // Perform some parameter correctness check if( Desc.Type == RESOURCE_DIM_TEX_1D || Desc.Type == RESOURCE_DIM_TEX_1D_ARRAY ) { if( Desc.Height != 1 ) LOG_TEXTURE_ERROR_AND_THROW("Height (", Desc.Height,") of Texture 1D/Texture 1D Array must be 1"); } + else + { + if (Desc.Height == 0) + LOG_TEXTURE_ERROR_AND_THROW("Texture height cannot be zero"); + } + + if( Desc.Type == RESOURCE_DIM_TEX_3D && Desc.Depth == 0 ) + { + LOG_TEXTURE_ERROR_AND_THROW("3D texture depth cannot be zero"); + } if( Desc.Type == RESOURCE_DIM_TEX_1D || Desc.Type == RESOURCE_DIM_TEX_2D ) { -- cgit v1.2.3