Blender V4.3
vk_shader_interface.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
11#include "BLI_array.hh"
12
15
16#include "BLI_array.hh"
17
19#include "vk_push_constants.hh"
20
21namespace blender::gpu {
22
32
34 private:
36 Array<VKResourceBinding> resource_bindings_;
37 VKDescriptorSetLayoutInfo descriptor_set_layout_info_;
38
39 VKPushConstants::Layout push_constants_layout_;
40
41 shader::BuiltinBits shader_builtins_;
42
43 public:
44 VKShaderInterface() = default;
45
46 void init(const shader::ShaderCreateInfo &info);
47
49 const shader::ShaderCreateInfo::Resource &resource) const;
50 const std::optional<VKDescriptorSet::Location> descriptor_set_location(
51 const shader::ShaderCreateInfo::Resource::BindType &bind_type, int binding) const;
52
61 const VkAccessFlags access_mask(const shader::ShaderCreateInfo::Resource::BindType &bind_type,
62 int binding) const;
64 int binding) const;
65
68 {
69 return push_constants_layout_;
70 }
71
73 {
74 return descriptor_set_layout_info_;
75 }
76
77 shader::Type get_attribute_type(int location) const
78 {
79 return static_cast<shader::Type>(attr_types_[location]);
80 }
81
82 bool is_point_shader() const
83 {
85 }
86
88 {
89 return resource_bindings_;
90 }
91
92 private:
93 void init_descriptor_set_layout_info(const shader::ShaderCreateInfo &info,
94 int64_t resources_len,
96 VKPushConstants::StorageType push_constants_storage);
103 const ShaderInput *shader_input_get(const shader::ShaderCreateInfo::Resource &resource) const;
104 const ShaderInput *shader_input_get(
105 const shader::ShaderCreateInfo::Resource::BindType &bind_type, int binding) const;
106 const VKResourceBinding &resource_binding_info(const ShaderInput *shader_input) const;
107
108 void descriptor_set_location_update(
109 const ShaderInput *shader_input,
110 const VKDescriptorSet::Location location,
112 std::optional<const shader::ShaderCreateInfo::Resource> resource,
114};
115
116} // namespace blender::gpu
void init()
uint8_t attr_types_[GPU_VERT_ATTR_MAX_LEN]
const VKPushConstants::Layout & push_constants_layout_get() const
shader::Type get_attribute_type(int location) const
const Span< VKResourceBinding > resource_bindings_get() const
const VKDescriptorSetLayoutInfo & descriptor_set_layout_info_get() const
const VKImageViewArrayed arrayed(const shader::ShaderCreateInfo::Resource::BindType &bind_type, int binding) const
const VKDescriptorSet::Location descriptor_set_location(const shader::ShaderCreateInfo::Resource &resource) const
const VkAccessFlags access_mask(const shader::ShaderCreateInfo::Resource::BindType &bind_type, int binding) const
__int64 int64_t
Definition stdint.h:89
VKDescriptorSet::Location location
shader::ShaderCreateInfo::Resource::BindType bind_type
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...