diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-07-18 02:11:52 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-07-18 02:11:52 +0000 |
| commit | 0c2a28444d74dcd16ed7f5571fbf95050ae09f4a (patch) | |
| tree | 652b90beb3405b86f482c2719b581990a87d08c6 /Graphics/GraphicsEngine | |
| parent | Vk backend: disabled warning about missing SPV_GOOGLE_hlsl_functionality1 ext... (diff) | |
| download | DiligentCore-0c2a28444d74dcd16ed7f5571fbf95050ae09f4a.tar.gz DiligentCore-0c2a28444d74dcd16ed7f5571fbf95050ae09f4a.zip | |
Added CREATE_SHADER_SOURCE_INPUT_STREAM_FLAGS enum and IShaderSourceInputStreamFactory::CreateInputStream2 method (API Version 240064)
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/interface/APIInfo.h | 2 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/Shader.h | 20 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp | 19 |
3 files changed, 37 insertions, 4 deletions
diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h index 18833f81..c355b315 100644 --- a/Graphics/GraphicsEngine/interface/APIInfo.h +++ b/Graphics/GraphicsEngine/interface/APIInfo.h @@ -30,7 +30,7 @@ /// \file /// Diligent API information -#define DILIGENT_API_VERSION 240063 +#define DILIGENT_API_VERSION 240064 #include "../../../Primitives/interface/BasicTypes.h" diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h index 8a10757f..eacd35f0 100644 --- a/Graphics/GraphicsEngine/interface/Shader.h +++ b/Graphics/GraphicsEngine/interface/Shader.h @@ -77,6 +77,18 @@ DILIGENT_TYPED_ENUM(SHADER_SOURCE_LANGUAGE, Uint32) SHADER_SOURCE_LANGUAGE_GLSL_VERBATIM }; +/// Describes the flags that can be passed over to IShaderSourceInputStreamFactory::CreateInputStream2() function. +DILIGENT_TYPED_ENUM(CREATE_SHADER_SOURCE_INPUT_STREAM_FLAGS, Uint32) +{ + /// No flag. + CREATE_SHADER_SOURCE_INPUT_STREAM_FLAG_NONE = 0x00, + + /// Do not output any messages if the file is not found or + /// other errors occur. + CREATE_SHADER_SOURCE_INPUT_STREAM_FLAG_SILENT = 0x01, +}; +DEFINE_FLAG_ENUM_OPERATORS(CREATE_SHADER_SOURCE_INPUT_STREAM_FLAGS); + /// Shader description struct ShaderDesc DILIGENT_DERIVE(DeviceObjectAttribs) @@ -107,6 +119,11 @@ DILIGENT_BEGIN_INTERFACE(IShaderSourceInputStreamFactory, IObject) VIRTUAL void METHOD(CreateInputStream)(THIS_ const Char* Name, IFileStream** ppStream) PURE; + + VIRTUAL void METHOD(CreateInputStream2)(THIS_ + const Char* Name, + CREATE_SHADER_SOURCE_INPUT_STREAM_FLAGS Flags, + IFileStream** ppStream) PURE; }; DILIGENT_END_INTERFACE @@ -116,7 +133,8 @@ DILIGENT_END_INTERFACE // clang-format on -# define IShaderSourceInputStreamFactory_CreateInputStream(This, ...) CALL_IFACE_METHOD(ShaderSourceInputStreamFactory, CreateInputStream, This, __VA_ARGS__) +# define IShaderSourceInputStreamFactory_CreateInputStream(This, ...) CALL_IFACE_METHOD(ShaderSourceInputStreamFactory, CreateInputStream, This, __VA_ARGS__) +# define IShaderSourceInputStreamFactory_CreateInputStream2(This, ...) CALL_IFACE_METHOD(ShaderSourceInputStreamFactory, CreateInputStream2, This, __VA_ARGS__) #endif diff --git a/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp b/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp index 9c2e1d15..b14a1707 100644 --- a/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp +++ b/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp @@ -42,6 +42,10 @@ public: virtual void DILIGENT_CALL_TYPE CreateInputStream(const Char* Name, IFileStream** ppStream) override final; + virtual void DILIGENT_CALL_TYPE CreateInputStream2(const Char* Name, + CREATE_SHADER_SOURCE_INPUT_STREAM_FLAGS Flags, + IFileStream** ppStream) override final; + IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_IShaderSourceInputStreamFactory, ObjectBase<IShaderSourceInputStreamFactory>); private: @@ -76,7 +80,15 @@ DefaultShaderSourceStreamFactory::DefaultShaderSourceStreamFactory(IReferenceCou m_SearchDirectories.push_back(""); } -void DefaultShaderSourceStreamFactory::CreateInputStream(const Diligent::Char* Name, IFileStream** ppStream) +void DefaultShaderSourceStreamFactory::CreateInputStream(const Char* Name, + IFileStream** ppStream) +{ + CreateInputStream2(Name, CREATE_SHADER_SOURCE_INPUT_STREAM_FLAG_NONE, ppStream); +} + +void DefaultShaderSourceStreamFactory::CreateInputStream2(const Char* Name, + CREATE_SHADER_SOURCE_INPUT_STREAM_FLAGS Flags, + IFileStream** ppStream) { bool bFileCreated = false; Diligent::RefCntAutoPtr<BasicFileStream> pBasicFileStream; @@ -103,7 +115,10 @@ void DefaultShaderSourceStreamFactory::CreateInputStream(const Diligent::Char* N else { *ppStream = nullptr; - LOG_ERROR("Failed to create input stream for source file ", Name); + if ((Flags & CREATE_SHADER_SOURCE_INPUT_STREAM_FLAG_SILENT) == 0) + { + LOG_ERROR("Failed to create input stream for source file ", Name); + } } } |
