| // Copyright 2018 The NXT Authors |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| #include "backend/vulkan/PipelineLayoutVk.h" |
| |
| #include "backend/vulkan/FencedDeleter.h" |
| #include "backend/vulkan/VulkanBackend.h" |
| |
| namespace backend { namespace vulkan { |
| |
| PipelineLayout::PipelineLayout(PipelineLayoutBuilder* builder) |
| : PipelineLayoutBase(builder), mDevice(ToBackend(builder->GetDevice())) { |
| // Create an empty pipeline layout for now |
| // TODO(cwallez@chromium.org): Add support for descriptor sets, figure out push constants |
| VkPipelineLayoutCreateInfo createInfo; |
| createInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; |
| createInfo.pNext = nullptr; |
| createInfo.flags = 0; |
| createInfo.setLayoutCount = 0; |
| createInfo.pSetLayouts = nullptr; |
| createInfo.pushConstantRangeCount = 0; |
| createInfo.pPushConstantRanges = nullptr; |
| |
| if (mDevice->fn.CreatePipelineLayout(mDevice->GetVkDevice(), &createInfo, nullptr, |
| &mHandle) != VK_SUCCESS) { |
| ASSERT(false); |
| } |
| } |
| |
| PipelineLayout::~PipelineLayout() { |
| if (mHandle != VK_NULL_HANDLE) { |
| mDevice->GetFencedDeleter()->DeleteWhenUnused(mHandle); |
| mHandle = VK_NULL_HANDLE; |
| } |
| } |
| |
| VkPipelineLayout PipelineLayout::GetHandle() const { |
| return mHandle; |
| } |
| |
| }} // namespace backend::vulkan |