WIP: Vulkan: Workbench #107886
|
@ -58,6 +58,15 @@ void VKDescriptorSetTracker::bind_as_ssbo(VKVertexBuffer &buffer,
|
|||
binding.buffer_size = buffer.size_used_get();
|
||||
}
|
||||
|
||||
void VKDescriptorSetTracker::bind_as_texture(VKVertexBuffer &buffer,
|
||||
const VKDescriptorSet::Location location)
|
||||
{
|
||||
Binding &binding = ensure_location(location);
|
||||
binding.type = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER;
|
||||
binding.vk_buffer = buffer.vk_handle();
|
||||
binding.buffer_size = buffer.size_used_get();
|
||||
}
|
||||
|
||||
void VKDescriptorSetTracker::bind(VKUniformBuffer &buffer,
|
||||
const VKDescriptorSet::Location location)
|
||||
{
|
||||
|
@ -115,6 +124,7 @@ void VKDescriptorSetTracker::update(VKContext &context)
|
|||
tracked_resource_for(context, !bindings_.is_empty());
|
||||
std::unique_ptr<VKDescriptorSet> &descriptor_set = active_descriptor_set();
|
||||
VkDescriptorSet vk_descriptor_set = descriptor_set->vk_handle();
|
||||
BLI_assert(vk_descriptor_set != VK_NULL_HANDLE);
|
||||
|
||||
Vector<VkDescriptorBufferInfo> buffer_infos;
|
||||
Vector<VkWriteDescriptorSet> descriptor_writes;
|
||||
|
|
|
@ -83,12 +83,14 @@ class VKDescriptorSet : NonCopyable {
|
|||
VKDescriptorSet(VkDescriptorPool vk_descriptor_pool, VkDescriptorSet vk_descriptor_set)
|
||||
: vk_descriptor_pool_(vk_descriptor_pool), vk_descriptor_set_(vk_descriptor_set)
|
||||
{
|
||||
BLI_assert(vk_descriptor_set_ != VK_NULL_HANDLE);
|
||||
}
|
||||
VKDescriptorSet(VKDescriptorSet &&other);
|
||||
virtual ~VKDescriptorSet();
|
||||
|
||||
VKDescriptorSet &operator=(VKDescriptorSet &&other)
|
||||
{
|
||||
BLI_assert(other.vk_descriptor_set_ != VK_NULL_HANDLE);
|
||||
vk_descriptor_set_ = other.vk_descriptor_set_;
|
||||
vk_descriptor_pool_ = other.vk_descriptor_pool_;
|
||||
other.mark_freed();
|
||||
|
@ -154,6 +156,7 @@ class VKDescriptorSetTracker : protected VKResourceTracker<VKDescriptorSet> {
|
|||
VKDescriptorSetTracker(VkDescriptorSetLayout layout) : layout_(layout) {}
|
||||
|
||||
void bind_as_ssbo(VKVertexBuffer &buffer, VKDescriptorSet::Location location);
|
||||
void bind_as_texture(VKVertexBuffer &buffer, VKDescriptorSet::Location location);
|
||||
void bind_as_ssbo(VKIndexBuffer &buffer, VKDescriptorSet::Location location);
|
||||
void bind(VKStorageBuffer &buffer, VKDescriptorSet::Location location);
|
||||
void bind(VKUniformBuffer &buffer, VKDescriptorSet::Location location);
|
||||
|
|
|
@ -35,9 +35,20 @@ void VKVertexBuffer::bind_as_ssbo(uint binding)
|
|||
shader->pipeline_get().descriptor_set_get().bind_as_ssbo(*this, *location);
|
||||
}
|
||||
|
||||
void VKVertexBuffer::bind_as_texture(uint /*binding*/)
|
||||
void VKVertexBuffer::bind_as_texture(uint binding)
|
||||
{
|
||||
NOT_YET_IMPLEMENTED
|
||||
if (!buffer_.is_allocated()) {
|
||||
allocate();
|
||||
}
|
||||
|
||||
VKContext &context = *VKContext::get();
|
||||
VKShader *shader = static_cast<VKShader *>(context.shader);
|
||||
const VKShaderInterface &shader_interface = shader->interface_get();
|
||||
const std::optional<VKDescriptorSet::Location> location =
|
||||
shader_interface.descriptor_set_location(
|
||||
shader::ShaderCreateInfo::Resource::BindType::SAMPLER, binding);
|
||||
BLI_assert_msg(location, "Locations to texel buffers should always exist.");
|
||||
shader->pipeline_get().descriptor_set_get().bind_as_texture(*this, *location);
|
||||
}
|
||||
|
||||
void VKVertexBuffer::wrap_handle(uint64_t /*handle*/)
|
||||
|
|
Loading…
Reference in New Issue