diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-12-14 02:07:22 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-12-14 02:07:22 +0000 |
| commit | 26a40fd8ba59b0861b81b9ff0d9c3800656b910b (patch) | |
| tree | bfb6ebc845c1e27098e13b40078fd2b70b5b0eea /Graphics/GraphicsTools | |
| parent | Few updated to BufferSuballocator and DynamicTextureAtlas (diff) | |
| download | DiligentCore-26a40fd8ba59b0861b81b9ff0d9c3800656b910b.tar.gz DiligentCore-26a40fd8ba59b0861b81b9ff0d9c3800656b910b.zip | |
Updated ShaderMacroHelper
Diffstat (limited to 'Graphics/GraphicsTools')
| -rw-r--r-- | Graphics/GraphicsTools/interface/ShaderMacroHelper.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Graphics/GraphicsTools/interface/ShaderMacroHelper.hpp b/Graphics/GraphicsTools/interface/ShaderMacroHelper.hpp index fb964abd..0fee26b0 100644 --- a/Graphics/GraphicsTools/interface/ShaderMacroHelper.hpp +++ b/Graphics/GraphicsTools/interface/ShaderMacroHelper.hpp @@ -59,6 +59,15 @@ public: template <typename DefintionType> void AddShaderMacro(const Char* Name, DefintionType Definition) { +#if DILIGENT_DEBUG + for (size_t i = 0; i < m_Macros.size() && m_Macros[i].Definition != nullptr; ++i) + { + if (strcmp(m_Macros[i].Name, Name) == 0) + { + UNEXPECTED("Macro '", Name, "' already exists. Use UpdateMacro() to update the macro value."); + } + } +#endif std::ostringstream ss; ss << Definition; AddShaderMacro<const Char*>(Name, ss.str().c_str()); @@ -171,4 +180,6 @@ inline void ShaderMacroHelper::AddShaderMacro(const Char* Name, Uint8 Definition AddShaderMacro(Name, Uint32{Definition}); } +#define ADD_SHADER_MACRO_ENUM_VALUE(Helper, EnumValue) Helper.AddShaderMacro(#EnumValue, static_cast<int>(EnumValue)); + } // namespace Diligent |
