本文整理汇总了C++中DevicePtr::vk_device方法的典型用法代码示例。如果您正苦于以下问题:C++ DevicePtr::vk_device方法的具体用法?C++ DevicePtr::vk_device怎么用?C++ DevicePtr::vk_device使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevicePtr
的用法示例。
在下文中一共展示了DevicePtr::vk_device方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static vk::DescriptorSet create_descriptor_set(DevicePtr dptr, vk::DescriptorPool pool, vk::DescriptorSetLayout layout) {
return dptr->vk_device().allocateDescriptorSets(vk::DescriptorSetAllocateInfo()
.setDescriptorPool(pool)
.setDescriptorSetCount(1)
.setPSetLayouts(&layout)
).front();
}
示例2: ShaderModule
static vk::ShaderModule create_shader_module(DevicePtr dptr, const SpirVData& data) {
if(data.is_empty()) {
return vk::ShaderModule();
}
return dptr->vk_device().createShaderModule(vk::ShaderModuleCreateInfo()
.setCodeSize(data.size())
.setPCode(data.data())
);
}
示例3: maxUniformBufferRange
static vk::Buffer create_buffer(DevicePtr dptr, usize byte_size, vk::BufferUsageFlags usage) {
y_debug_assert(byte_size);
if(usage & vk::BufferUsageFlagBits::eUniformBuffer) {
if(byte_size > dptr->vk_limits().maxUniformBufferRange) {
y_fatal("Uniform buffer size exceeds maxUniformBufferRange (%).", dptr->vk_limits().maxUniformBufferRange);
}
}
return dptr->vk_device().createBuffer(vk::BufferCreateInfo()
.setSize(byte_size)
.setUsage(usage)
.setSharingMode(vk::SharingMode::eExclusive)
);
}
示例4: DescriptorPoolSize
static vk::DescriptorPool create_descriptor_pool(DevicePtr dptr, const std::unordered_map<vk::DescriptorType, u32>& binding_counts) {
auto sizes = core::vector_with_capacity<vk::DescriptorPoolSize>(binding_counts.size());
std::transform(binding_counts.begin(), binding_counts.end(), std::back_inserter(sizes), [](const auto& count) {
return vk::DescriptorPoolSize()
.setType(count.first)
.setDescriptorCount(count.second)
;
});
return dptr->vk_device().createDescriptorPool(vk::DescriptorPoolCreateInfo()
.setPoolSizeCount(sizes.size())
.setPPoolSizes(sizes.begin())
.setMaxSets(1)
);
}
示例5: update_sets
static void update_sets(DevicePtr dptr, vk::DescriptorSet set, const core::Vector<vk::DescriptorSetLayoutBinding>& /*layout_binding*/, const core::ArrayView<Binding>& bindings) {
auto writes = core::vector_with_capacity<vk::WriteDescriptorSet>(bindings.size());
for(const auto& binding : bindings) {
auto w = vk::WriteDescriptorSet()
.setDstSet(set)
.setDstBinding(u32(writes.size()))
.setDstArrayElement(0)
.setDescriptorCount(1)
.setDescriptorType(binding.vk_descriptor_type())
;
if(binding.is_buffer()) {
w.setPBufferInfo(&binding.descriptor_info().buffer);
} else if(binding.is_image()) {
w.setPImageInfo(&binding.descriptor_info().image);
} else {
y_fatal("Unknown descriptor type.");
}
writes << w;
}
dptr->vk_device().updateDescriptorSets(u32(writes.size()), writes.begin(), 0, nullptr);
}
示例6: bind_buffer_memory
static void bind_buffer_memory(DevicePtr dptr, vk::Buffer buffer, const DeviceMemory& memory) {
dptr->vk_device().bindBufferMemory(buffer, memory.vk_memory(), memory.vk_offset());
}