summaryrefslogtreecommitdiff
path: root/chromium/third_party/dawn/src/dawn_native/BindGroup.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-16 11:45:35 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-17 08:59:23 +0000
commit552906b0f222c5d5dd11b9fd73829d510980461a (patch)
tree3a11e6ed0538a81dd83b20cf3a4783e297f26d91 /chromium/third_party/dawn/src/dawn_native/BindGroup.h
parent1b05827804eaf047779b597718c03e7d38344261 (diff)
downloadqtwebengine-chromium-552906b0f222c5d5dd11b9fd73829d510980461a.tar.gz
BASELINE: Update Chromium to 83.0.4103.122
Change-Id: Ie3a82f5bb0076eec2a7c6a6162326b4301ee291e Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/dawn/src/dawn_native/BindGroup.h')
-rw-r--r--chromium/third_party/dawn/src/dawn_native/BindGroup.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/chromium/third_party/dawn/src/dawn_native/BindGroup.h b/chromium/third_party/dawn/src/dawn_native/BindGroup.h
index fae804d1235..becb39ee753 100644
--- a/chromium/third_party/dawn/src/dawn_native/BindGroup.h
+++ b/chromium/third_party/dawn/src/dawn_native/BindGroup.h
@@ -16,6 +16,7 @@
#define DAWNNATIVE_BINDGROUP_H_
#include "common/Constants.h"
+#include "common/Math.h"
#include "dawn_native/BindGroupLayout.h"
#include "dawn_native/Error.h"
#include "dawn_native/Forward.h"
@@ -40,22 +41,40 @@ namespace dawn_native {
class BindGroupBase : public ObjectBase {
public:
- BindGroupBase(DeviceBase* device, const BindGroupDescriptor* descriptor);
+ ~BindGroupBase() override;
static BindGroupBase* MakeError(DeviceBase* device);
BindGroupLayoutBase* GetLayout();
- BufferBinding GetBindingAsBufferBinding(size_t binding);
- SamplerBase* GetBindingAsSampler(size_t binding);
- TextureViewBase* GetBindingAsTextureView(size_t binding);
+ BufferBinding GetBindingAsBufferBinding(BindingIndex bindingIndex);
+ SamplerBase* GetBindingAsSampler(BindingIndex bindingIndex);
+ TextureViewBase* GetBindingAsTextureView(BindingIndex bindingIndex);
+
+ protected:
+ // To save memory, the size of a bind group is dynamically determined and the bind group is
+ // placement-allocated into memory big enough to hold the bind group with its
+ // dynamically-sized bindings after it. The pointer of the memory of the beginning of the
+ // binding data should be passed as |bindingDataStart|.
+ BindGroupBase(DeviceBase* device,
+ const BindGroupDescriptor* descriptor,
+ void* bindingDataStart);
+
+ // Helper to instantiate BindGroupBase. We pass in |derived| because BindGroupBase may not
+ // be first in the allocation. The binding data is stored after the Derived class.
+ template <typename Derived>
+ BindGroupBase(Derived* derived, DeviceBase* device, const BindGroupDescriptor* descriptor)
+ : BindGroupBase(device,
+ descriptor,
+ AlignPtr(reinterpret_cast<char*>(derived) + sizeof(Derived),
+ descriptor->layout->GetBindingDataAlignment())) {
+ static_assert(std::is_base_of<BindGroupBase, Derived>::value, "");
+ }
private:
BindGroupBase(DeviceBase* device, ObjectBase::ErrorTag tag);
Ref<BindGroupLayoutBase> mLayout;
- std::array<Ref<ObjectBase>, kMaxBindingsPerGroup> mBindings;
- std::array<uint32_t, kMaxBindingsPerGroup> mOffsets;
- std::array<uint32_t, kMaxBindingsPerGroup> mSizes;
+ BindGroupLayoutBase::BindingDataPointers mBindingData;
};
} // namespace dawn_native