• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 The Dawn Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef DAWNNATIVE_VULKAN_BINDGROUPVK_H_
16 #define DAWNNATIVE_VULKAN_BINDGROUPVK_H_
17 
18 #include "dawn_native/BindGroup.h"
19 
20 #include "common/PlacementAllocated.h"
21 #include "common/vulkan_platform.h"
22 #include "dawn_native/vulkan/BindGroupLayoutVk.h"
23 #include "dawn_native/vulkan/DescriptorSetAllocation.h"
24 
25 namespace dawn_native { namespace vulkan {
26 
27     class Device;
28 
29     class BindGroup final : public BindGroupBase, public PlacementAllocated {
30       public:
31         static ResultOrError<Ref<BindGroup>> Create(Device* device,
32                                                     const BindGroupDescriptor* descriptor);
33 
34         BindGroup(Device* device,
35                   const BindGroupDescriptor* descriptor,
36                   DescriptorSetAllocation descriptorSetAllocation);
37 
38         VkDescriptorSet GetHandle() const;
39 
40       private:
41         ~BindGroup() override;
42 
43         void DestroyImpl() override;
44 
45         // Dawn API
46         void SetLabelImpl() override;
47 
48         // The descriptor set in this allocation outlives the BindGroup because it is owned by
49         // the BindGroupLayout which is referenced by the BindGroup.
50         DescriptorSetAllocation mDescriptorSetAllocation;
51     };
52 
53 }}  // namespace dawn_native::vulkan
54 
55 #endif  // DAWNNATIVE_VULKAN_BINDGROUPVK_H_
56