From ca3908fa9dba0c8f724dc4433c5377d643ed3dec Mon Sep 17 00:00:00 2001 From: assiduous Date: Thu, 5 Oct 2023 22:08:09 -0700 Subject: [PATCH] ShaderSourceFactoryUtils: fixed missing const --- .../interface/ShaderSourceFactoryUtils.h | 20 ++++++++++--------- .../src/ShaderSourceFactoryUtils.cpp | 2 ++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Graphics/GraphicsTools/interface/ShaderSourceFactoryUtils.h b/Graphics/GraphicsTools/interface/ShaderSourceFactoryUtils.h index fefd2cfe6..add42d923 100644 --- a/Graphics/GraphicsTools/interface/ShaderSourceFactoryUtils.h +++ b/Graphics/GraphicsTools/interface/ShaderSourceFactoryUtils.h @@ -67,7 +67,7 @@ struct CompoundShaderSourceFactoryCreateInfo Uint32 NumFactories DEFAULT_INITIALIZER(0); /// An array of shader source file substitutes. - ShaderSourceFileSubstitueInfo* pFileSubstitutes DEFAULT_INITIALIZER(nullptr); + const ShaderSourceFileSubstitueInfo* pFileSubstitutes DEFAULT_INITIALIZER(nullptr); /// The number of file substitutes in pFileSubstitutes array. Uint32 NumFileSubstitutes DEFAULT_INITIALIZER(0); @@ -76,10 +76,10 @@ struct CompoundShaderSourceFactoryCreateInfo constexpr CompoundShaderSourceFactoryCreateInfo() noexcept {} - constexpr CompoundShaderSourceFactoryCreateInfo(IShaderSourceInputStreamFactory** _ppFactories, - Uint32 _NumFactories, - ShaderSourceFileSubstitueInfo* _pFileSubstitutes = nullptr, - Uint32 _NumFileSubstitutes = 0) noexcept : + constexpr CompoundShaderSourceFactoryCreateInfo(IShaderSourceInputStreamFactory** _ppFactories, + Uint32 _NumFactories, + const ShaderSourceFileSubstitueInfo* _pFileSubstitutes = nullptr, + Uint32 _NumFileSubstitutes = 0) noexcept : ppFactories{_ppFactories}, NumFactories{_NumFactories}, pFileSubstitutes{_pFileSubstitutes}, @@ -139,7 +139,7 @@ typedef struct MemoryShaderSourceFileInfo MemoryShaderSourceFileInfo; struct MemoryShaderSourceFactoryCreateInfo { /// An array of shader source files. - MemoryShaderSourceFileInfo* pSources DEFAULT_INITIALIZER(nullptr); + const MemoryShaderSourceFileInfo* pSources DEFAULT_INITIALIZER(nullptr); /// The number of files in pSources array. Uint32 NumSources DEFAULT_INITIALIZER(0); @@ -152,10 +152,12 @@ struct MemoryShaderSourceFactoryCreateInfo constexpr MemoryShaderSourceFactoryCreateInfo() noexcept {} - constexpr MemoryShaderSourceFactoryCreateInfo(MemoryShaderSourceFileInfo* _pSources, - Uint32 _NumSources) noexcept : + constexpr MemoryShaderSourceFactoryCreateInfo(const MemoryShaderSourceFileInfo* _pSources, + Uint32 _NumSources, + bool _CopySources = false) noexcept : pSources{_pSources}, - NumSources{_NumSources} + NumSources{_NumSources}, + CopySources{_CopySources} {} #endif }; diff --git a/Graphics/GraphicsTools/src/ShaderSourceFactoryUtils.cpp b/Graphics/GraphicsTools/src/ShaderSourceFactoryUtils.cpp index 17015bd33..c39a743cb 100644 --- a/Graphics/GraphicsTools/src/ShaderSourceFactoryUtils.cpp +++ b/Graphics/GraphicsTools/src/ShaderSourceFactoryUtils.cpp @@ -152,6 +152,8 @@ class MemoryShaderSourceFactory final : public ObjectBase