NAP
samplerdeclaration.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 <vector>
9 #include <assert.h>
10 
11 #include "vulkan/vulkan_core.h"
12 #include "rtti/typeinfo.h"
13 
14 namespace nap
15 {
16  class NAPAPI SamplerDeclaration final
17  {
18  RTTI_ENABLE()
19 
20  public:
21  enum class EType : uint8_t
22  {
23  Type_1D,
24  Type_2D,
25  Type_3D,
26  Type_Cube
27  };
28 
29  SamplerDeclaration(const std::string& name, int binding, VkShaderStageFlagBits stage, EType type) :
30  mName(name), mBinding(binding), mStage(stage), mType(type), mIsArray(false), mNumElements(1) {}
31 
32  SamplerDeclaration(const std::string& name, int binding, VkShaderStageFlagBits stage, EType type, bool isArray, int numElements) :
33  mName(name), mBinding(binding), mStage(stage), mType(type), mIsArray(isArray), mNumElements(numElements)
34  {
35  assert(mNumElements > 0);
36  }
37 
38  std::string mName;
39  int mBinding = -1;
40  VkShaderStageFlagBits mStage;
41  EType mType = EType::Type_2D;
42  bool mIsArray = false;
43  int mNumElements = 1;
44  };
45 
46  using SamplerDeclarations = std::vector<SamplerDeclaration>;
47 }
nap::SamplerDeclaration::SamplerDeclaration
SamplerDeclaration(const std::string &name, int binding, VkShaderStageFlagBits stage, EType type)
Definition: samplerdeclaration.h:29
nap::SamplerDeclaration::mName
std::string mName
Definition: samplerdeclaration.h:38
nap::SamplerDeclaration::EType
EType
Definition: samplerdeclaration.h:21
nap::SamplerDeclaration::mStage
VkShaderStageFlagBits mStage
Definition: samplerdeclaration.h:40
nap::SamplerDeclaration
Definition: samplerdeclaration.h:16
nap
Definition: templateapp.h:17
nap::SamplerDeclarations
std::vector< SamplerDeclaration > SamplerDeclarations
Definition: samplerdeclaration.h:46
nap::SamplerDeclaration::SamplerDeclaration
SamplerDeclaration(const std::string &name, int binding, VkShaderStageFlagBits stage, EType type, bool isArray, int numElements)
Definition: samplerdeclaration.h:32