NAP
shaderconstantdeclaration.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // External Includes
8 #include <vulkan/vulkan_core.h>
9 #include <string>
10 #include <map>
11 #include <utility/dllexport.h>
12 #include <rtti/typeinfo.h>
13 #include <nap/numeric.h>
14 
15 
16 namespace nap
17 {
18  using ShaderConstantID = uint; // Shader constant ID within a specific shader stage
19  using ShaderConstantMap = std::map<ShaderConstantID, uint>; // Maps constant ID to a constant value
20  using ShaderStageConstantMap = std::map<VkShaderStageFlagBits, ShaderConstantMap>; // Maps shader stage to a constant map
21 
30  class NAPAPI ShaderConstantDeclaration final
31  {
32  RTTI_ENABLE()
33  public:
34  ShaderConstantDeclaration(const std::string& name, uint value, ShaderConstantID id, VkShaderStageFlagBits stage) :
35  mName(name), mValue(value), mConstantID(id), mStage(stage) {}
36 
37  std::string mName;
40  VkShaderStageFlagBits mStage;
41  };
42 
43  using ShaderConstantDeclarations = std::vector<ShaderConstantDeclaration>;
44 }
nap::uint
unsigned int uint
Definition: numeric.h:23
nap::ShaderConstantDeclaration
Definition: shaderconstantdeclaration.h:30
nap::ShaderConstantID
uint ShaderConstantID
Definition: shaderconstantdeclaration.h:18
nap::ShaderConstantMap
std::map< ShaderConstantID, uint > ShaderConstantMap
Definition: shaderconstantdeclaration.h:19
nap::ShaderConstantDeclaration::mName
std::string mName
Definition: shaderconstantdeclaration.h:37
nap::ShaderConstantDeclarations
std::vector< ShaderConstantDeclaration > ShaderConstantDeclarations
Definition: shaderconstantdeclaration.h:43
nap::ShaderConstantDeclaration::mStage
VkShaderStageFlagBits mStage
Definition: shaderconstantdeclaration.h:40
nap::ShaderConstantDeclaration::ShaderConstantDeclaration
ShaderConstantDeclaration(const std::string &name, uint value, ShaderConstantID id, VkShaderStageFlagBits stage)
Definition: shaderconstantdeclaration.h:34
nap::ShaderConstantDeclaration::mValue
uint mValue
Definition: shaderconstantdeclaration.h:38
nap
Definition: templateapp.h:17
nap::ShaderConstantDeclaration::mConstantID
ShaderConstantID mConstantID
Definition: shaderconstantdeclaration.h:39
nap::ShaderStageConstantMap
std::map< VkShaderStageFlagBits, ShaderConstantMap > ShaderStageConstantMap
Definition: shaderconstantdeclaration.h:20