This PR hooks up the vulkan backend with the render graph for drawing. It can run Blender better than the previous implementation so we also flipped it to be the default implementation. **Some highlights** - Adds support for framebuffer load/store operations - Adds support for framebuffer subpass transitions - Fixes workbench shadows - Performance is just below OpenGL performance when comparing fps. But the screen feels more fluent when using complex scenes. - Current performance is without doing any optimizations so will improve in the future. - EEVEE will not crash but has artifacts and many parts that require more work. **Related to** - #121648 - #118330 **Known Limitation** - Similar to previous implementation resources can be freed when still in use crashing Blender. This is typically the case when playing back an animation or updating a material icon. **Next steps** - Remove old implementation - Get EEVEE to work - Fix double resource freeing - Improve performance by identifying hotspots and change them Pull Request: https://projects.blender.org/blender/blender/pulls/121787
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
/* SPDX-FileCopyrightText: 2022 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup gpu
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "GPU_index_buffer.hh"
|
|
|
|
#include "vk_bindable_resource.hh"
|
|
#include "vk_buffer.hh"
|
|
|
|
namespace blender::gpu {
|
|
|
|
class VKIndexBuffer : public IndexBuf, public VKBindableResource {
|
|
VKBuffer buffer_;
|
|
|
|
public:
|
|
void upload_data() override;
|
|
|
|
void bind_as_ssbo(uint binding) override;
|
|
void bind(VKContext &context);
|
|
void add_to_descriptor_set(AddToDescriptorSetContext &data,
|
|
int binding,
|
|
shader::ShaderCreateInfo::Resource::BindType bind_type,
|
|
const GPUSamplerState sampler_state) override;
|
|
|
|
void read(uint32_t *data) const override;
|
|
|
|
void update_sub(uint start, uint len, const void *data) override;
|
|
|
|
VkBuffer vk_handle() const
|
|
{
|
|
return buffer_get().vk_handle();
|
|
}
|
|
VkIndexType vk_index_type() const
|
|
{
|
|
return to_vk_index_type(index_type_);
|
|
}
|
|
|
|
private:
|
|
void strip_restart_indices() override;
|
|
void allocate();
|
|
void ensure_updated();
|
|
VKBuffer &buffer_get();
|
|
const VKBuffer &buffer_get() const;
|
|
};
|
|
|
|
static inline VKIndexBuffer *unwrap(IndexBuf *index_buffer)
|
|
{
|
|
return static_cast<VKIndexBuffer *>(index_buffer);
|
|
}
|
|
|
|
} // namespace blender::gpu
|