Blender V5.0
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
8
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
39
48
50 private:
52 Array<VKResourceBinding> resource_bindings_;
53 VKDescriptorSetLayoutInfo descriptor_set_layout_info_;
54
55 VKPushConstants::Layout push_constants_layout_;
56
57 shader::BuiltinBits shader_builtins_;
58
59 public:
60 VKShaderInterface() = default;
61
62 void init(const shader::ShaderCreateInfo &info);
63
66 const std::optional<VKDescriptorSet::Location> descriptor_set_location(
67 const shader::ShaderCreateInfo::Resource::BindType &bind_type, int binding) const;
68
71 {
72 return push_constants_layout_;
73 }
74
76 {
77 return descriptor_set_layout_info_;
78 }
79
80 shader::Type get_attribute_type(int location) const
81 {
82 return static_cast<shader::Type>(attr_types_[location]);
83 }
84
85 bool is_point_shader() const
86 {
88 }
89
91 {
92 return resource_bindings_;
93 }
94
95 private:
96 void init_descriptor_set_layout_info(const shader::ShaderCreateInfo &info,
97 int64_t resources_len,
99 VKPushConstants::StorageType push_constants_storage);
106 const ShaderInput *shader_input_get(const shader::ShaderCreateInfo::Resource &resource) const;
107 const ShaderInput *shader_input_get(
108 const shader::ShaderCreateInfo::Resource::BindType &bind_type, int binding) const;
109 const VKResourceBinding &resource_binding_info(const ShaderInput *shader_input) const;
110
111 void descriptor_set_location_update(
112 const ShaderInput *shader_input,
113 const VKDescriptorSet::Location location,
114 const VKBindType bind_type,
115 std::optional<const shader::ShaderCreateInfo::Resource> resource,
116 VKImageViewArrayed arrayed);
117};
118
119} // namespace blender::gpu
void init()
long long int int64_t
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 VKDescriptorSet::Location descriptor_set_location(const shader::ShaderCreateInfo::Resource &resource) const
#define resource
VKDescriptorSet::Location location
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...