| 1 |
/* |
| 2 |
* Copyright 2023 Google LLC |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef skgpu_graphite_DescriptorTypes_DEFINED |
| 9 |
#define skgpu_graphite_DescriptorTypes_DEFINED |
| 10 |
|
| 11 |
#include "src/base/SkEnumBitMask.h" |
| 12 |
|
| 13 |
#include <cstdint> |
| 14 |
|
| 15 |
namespace skgpu::graphite { |
| 16 |
|
| 17 |
class Sampler; |
| 18 |
|
| 19 |
/** |
| 20 |
* Types of descriptors supported within graphite |
| 21 |
*/ |
| 22 |
enum class DescriptorType : uint8_t { |
| 23 |
kUniformBuffer = 0, |
| 24 |
kTextureSampler, |
| 25 |
kTexture, |
| 26 |
kCombinedTextureSampler, |
| 27 |
kStorageBuffer, |
| 28 |
kInputAttachment, |
| 29 |
|
| 30 |
kLast = kInputAttachment, |
| 31 |
}; |
| 32 |
static constexpr int kDescriptorTypeCount = (int)(DescriptorType::kLast) + 1; |
| 33 |
|
| 34 |
enum class PipelineStageFlags : uint8_t { |
| 35 |
kVertexShader = 0b001, |
| 36 |
kFragmentShader = 0b010, |
| 37 |
kCompute = 0b100, |
| 38 |
}; |
| 39 |
SK_MAKE_BITMASK_OPS(PipelineStageFlags) |
| 40 |
|
| 41 |
struct DescriptorData { |
| 42 |
DescriptorData(DescriptorType type, |
| 43 |
uint32_t count, |
| 44 |
int bindingIdx, |
| 45 |
SkEnumBitMask<PipelineStageFlags> stageFlags, |
| 46 |
const Sampler* immutableSampler = nullptr) |
| 47 |
: fType (type) |
| 48 |
, fCount (count) |
| 49 |
, fBindingIndex (bindingIdx) |
| 50 |
, fPipelineStageFlags(stageFlags) |
| 51 |
, fImmutableSampler(immutableSampler) {} |
| 52 |
|
| 53 |
DescriptorType fType; |
| 54 |
uint32_t fCount; |
| 55 |
int fBindingIndex; |
| 56 |
SkEnumBitMask<PipelineStageFlags> fPipelineStageFlags; |
| 57 |
const Sampler* fImmutableSampler; |
| 58 |
}; |
| 59 |
|
| 60 |
} // namespace skgpu::graphite |
| 61 |
|
| 62 |
#endif // skgpu_graphite_DescriptorTypes_DEFINED |