From 6896a3c7bae82319682f3bb0af80c20a0b907a1d Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 7 Jul 2018 15:40:03 -0700 Subject: Implemented mipmap generation in Vulkan --- Graphics/GraphicsEngine/include/DeviceObjectBase.h | 11 ++++++++- Graphics/GraphicsEngine/include/TextureBase.h | 5 ++-- Graphics/GraphicsEngine/interface/DeviceContext.h | 11 ++++++++- Graphics/GraphicsEngine/interface/GraphicsTypes.h | 27 +++++++++++----------- 4 files changed, 37 insertions(+), 17 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/DeviceObjectBase.h b/Graphics/GraphicsEngine/include/DeviceObjectBase.h index 37f7124a..522b40c1 100644 --- a/Graphics/GraphicsEngine/include/DeviceObjectBase.h +++ b/Graphics/GraphicsEngine/include/DeviceObjectBase.h @@ -26,6 +26,7 @@ /// \file /// Implementation of the Diligent::DeviceObjectBase template class +#include #include "RefCntAutoPtr.h" #include "ObjectBase.h" #include "UniqueIdentifier.h" @@ -59,7 +60,7 @@ public: // Do not keep strong reference to the device if the object is an internal device object m_spDevice( bIsDeviceInternal ? nullptr : pDevice ), m_pDevice( pDevice ), - m_ObjectNameCopy(ObjDesc.Name ? ObjDesc.Name : ""), + m_ObjectNameCopy(ObjDesc.Name ? ObjDesc.Name : ThisToString()), m_Desc( ObjDesc ) { m_Desc.Name = m_ObjectNameCopy.c_str(); @@ -145,6 +146,14 @@ protected: // Template argument is only used to separate counters for // different groups of objects UniqueIdHelper m_UniqueID; + +private: + String ThisToString()const + { + std::stringstream ss; + ss << this; + return ss.str(); + } }; } diff --git a/Graphics/GraphicsEngine/include/TextureBase.h b/Graphics/GraphicsEngine/include/TextureBase.h index c2f11245..bd2a7b71 100644 --- a/Graphics/GraphicsEngine/include/TextureBase.h +++ b/Graphics/GraphicsEngine/include/TextureBase.h @@ -237,9 +237,10 @@ void TextureBase :: Corre break; case RESOURCE_DIM_TEX_2D: - if(ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D ) + if(ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY && + ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D ) { - TEX_VIEW_VALIDATION_ERROR( "Incorrect texture type for Texture 2D view: only Texture 2D is allowed" ); + TEX_VIEW_VALIDATION_ERROR( "Incorrect texture type for Texture 2D view: only Texture 2D or Texture 2D Array are allowed" ); } break; diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h index 460291a5..09fe545d 100644 --- a/Graphics/GraphicsEngine/interface/DeviceContext.h +++ b/Graphics/GraphicsEngine/interface/DeviceContext.h @@ -206,7 +206,16 @@ enum COMMIT_SHADER_RESOURCES_FLAG /// If this flag is specified when IDeviceContext::CommitShaderResources() is called, /// the engine will transition all shader resources to the correct state. - COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES = 0x01 + COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES = 0x01, + + + /// Verify resource states + + /// The flag is used in debug and development builds to verify + /// that all resources are transitioned to correct states when + /// COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES flag is not set. + /// No resource state validation is performed in release build. + COMMIT_SHADER_RESOURCES_FLAG_VERIFY_STATES = 0x02 }; diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index beb8c8fa..f32afaf5 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -1295,19 +1295,20 @@ namespace Diligent /// see https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkPhysicalDeviceFeatures struct DeviceFeatures { - bool depthBiasClamp = false; - bool fillModeNonSolid = false; - bool depthClamp = false; - bool independentBlend = false; - bool samplerAnisotropy = true; - bool geometryShader = true; - bool tessellationShader = true; - bool dualSrcBlend = false; - bool multiViewport = false; - bool imageCubeArray = false; - bool textureCompressionBC = false; - bool vertexPipelineStoresAndAtomics = false; - bool fragmentStoresAndAtomics = false; + bool depthBiasClamp = false; + bool fillModeNonSolid = false; + bool depthClamp = false; + bool independentBlend = false; + bool samplerAnisotropy = true; + bool geometryShader = true; + bool tessellationShader = true; + bool dualSrcBlend = false; + bool multiViewport = false; + bool imageCubeArray = false; + bool textureCompressionBC = false; + bool vertexPipelineStoresAndAtomics = false; + bool fragmentStoresAndAtomics = false; + bool shaderStorageImageExtendedFormats = false; }EnabledFeatures; /// Descriptor pool size -- cgit v1.2.3