Move mDevice from PipelineLayoutVk to PipelineLayoutBase
This commit is contained in:
parent
c5711ecd93
commit
11fc210487
|
@ -34,8 +34,9 @@ namespace backend {
|
|||
|
||||
// PipelineLayoutBase
|
||||
|
||||
PipelineLayoutBase::PipelineLayoutBase(DeviceBase*,
|
||||
const nxt::PipelineLayoutDescriptor* descriptor) {
|
||||
PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device,
|
||||
const nxt::PipelineLayoutDescriptor* descriptor)
|
||||
: mDevice(device) {
|
||||
ASSERT(descriptor->numBindGroupLayouts <= kMaxBindGroups);
|
||||
for (uint32_t group = 0; group < descriptor->numBindGroupLayouts; ++group) {
|
||||
mBindGroupLayouts[group] =
|
||||
|
@ -67,4 +68,8 @@ namespace backend {
|
|||
return kMaxBindGroups + 1;
|
||||
}
|
||||
|
||||
DeviceBase* PipelineLayoutBase::GetDevice() const {
|
||||
return mDevice;
|
||||
}
|
||||
|
||||
} // namespace backend
|
||||
|
|
|
@ -47,7 +47,10 @@ namespace backend {
|
|||
// [1, kMaxBindGroups + 1]
|
||||
uint32_t GroupsInheritUpTo(const PipelineLayoutBase* other) const;
|
||||
|
||||
DeviceBase* GetDevice() const;
|
||||
|
||||
protected:
|
||||
DeviceBase* mDevice;
|
||||
BindGroupLayoutArray mBindGroupLayouts;
|
||||
std::bitset<kMaxBindGroups> mMask;
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
namespace backend { namespace vulkan {
|
||||
|
||||
PipelineLayout::PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor)
|
||||
: PipelineLayoutBase(device, descriptor), mDevice(device) {
|
||||
: PipelineLayoutBase(device, descriptor) {
|
||||
// Compute the array of VkDescriptorSetLayouts that will be chained in the create info.
|
||||
// TODO(cwallez@chromium.org) Vulkan doesn't allow holes in this array, should we expose
|
||||
// this constraints at the NXT level?
|
||||
|
@ -50,15 +50,15 @@ namespace backend { namespace vulkan {
|
|||
createInfo.pushConstantRangeCount = 1;
|
||||
createInfo.pPushConstantRanges = &pushConstantRange;
|
||||
|
||||
if (mDevice->fn.CreatePipelineLayout(mDevice->GetVkDevice(), &createInfo, nullptr,
|
||||
&mHandle) != VK_SUCCESS) {
|
||||
if (device->fn.CreatePipelineLayout(device->GetVkDevice(), &createInfo, nullptr,
|
||||
&mHandle) != VK_SUCCESS) {
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
PipelineLayout::~PipelineLayout() {
|
||||
if (mHandle != VK_NULL_HANDLE) {
|
||||
mDevice->GetFencedDeleter()->DeleteWhenUnused(mHandle);
|
||||
ToBackend(GetDevice())->GetFencedDeleter()->DeleteWhenUnused(mHandle);
|
||||
mHandle = VK_NULL_HANDLE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ namespace backend { namespace vulkan {
|
|||
|
||||
private:
|
||||
VkPipelineLayout mHandle = VK_NULL_HANDLE;
|
||||
|
||||
Device* mDevice = nullptr;
|
||||
};
|
||||
|
||||
}} // namespace backend::vulkan
|
||||
|
|
Loading…
Reference in New Issue