74 if (visited_bindings[
attribute.binding]) {
77 visited_bindings[
attribute.binding].set(
true);
80 VkDeviceSize offset = 0;
87 if (resource.
vk_handle == VK_NULL_HANDLE) {
112 fill_unused_bindings(interface, 0);
115 for (
int v = 0;
v < GPU_BATCH_VBO_MAX_LEN;
v++) {
123void VKVertexAttributeObject::fill_unused_bindings(
const VKShaderInterface &interface,
129 if (occupied_attributes & location_mask) {
140 VkVertexInputAttributeDescription2EXT attribute_description = {
141 VK_STRUCTURE_TYPE_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION_2_EXT,
nullptr};
142 attribute_description.binding = binding;
143 attribute_description.location = location;
144 attribute_description.offset = 0;
145 attribute_description.format =
to_vk_format(attribute_type);
148 VkVertexInputBindingDescription2EXT vk_binding_descriptor = {
149 VK_STRUCTURE_TYPE_VERTEX_INPUT_BINDING_DESCRIPTION_2_EXT,
nullptr};
150 vk_binding_descriptor.binding = binding;
151 vk_binding_descriptor.stride = 0;
152 vk_binding_descriptor.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
153 vk_binding_descriptor.divisor = 1;
164 fill_unused_bindings(interface, 0);
173 occupied_attributes);
182 BLI_assert(vertex_buffer || immediate_vertex_buffer);
183 BLI_assert(!(vertex_buffer && immediate_vertex_buffer));
195 bool add_vbo =
false;
197 for (
uint32_t attribute_index = 0; attribute_index < vertex_format.
attr_len; attribute_index++) {
200 buffer_offset += ((attribute_index == 0) ?
212 const ShaderInput *shader_input = interface.
attr_get(name);
213 if (shader_input ==
nullptr || shader_input->location == -1) {
219 if (r_occupied_attributes & attribute_mask) {
223 r_occupied_attributes |= attribute_mask;
245 if (immediate_vertex_buffer) {
246 buffers[target_binding] = *immediate_vertex_buffer;
253 vbos.append(vertex_buffer);
265 std::cout << __FILE__ <<
"::" << __func__ <<
"\n";
269 std::cout <<
" - attribute(binding=" <<
attribute.binding
270 <<
", location=" <<
attribute.location <<
")";
272 if (visited_bindings[
attribute.binding]) {
273 std::cout <<
" WARNING: Already bound\n";
276 visited_bindings[
attribute.binding].set(
true);
279 std::cout <<
" Attach to Buffer\n";
282 std::cout <<
" WARNING: Attach to dummy\n";
constexpr IndexRange()=default
const ShaderInput * attr_get(const StringRefNull name) const
uint16_t enabled_attr_mask_
VKVertexBuffer * vertex_buffer_get(int index) const
const VKResourceWithHandle< VkBuffer > & resource() const
shader::Type get_attribute_type(int location) const
Vector< VKBufferWithOffset > buffers
VKVertexAttributeObject()
VKVertexAttributeObject & operator=(const VKVertexAttributeObject &other)
VKVertexInputDescription vertex_input
void update_bindings(const VKContext &context, VKBatch &batch)
void bind(render_graph::VKVertexBufferBindings &r_vertex_buffer_bindings) const
VKVertexInputDescriptionPool::Key vertex_input_key
Vector< VKVertexBuffer * > vbos
void update_vertex_input_key(VKVertexInputDescriptionPool &pool)
const VKResourceWithHandle< VkBuffer > & resource() const
#define interface_get(create_info, _res)
VkFormat to_vk_format(const TextureFormat format)
BLI_INLINE MTLTexture * unwrap(Texture *tex)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
BLI_INLINE const char * GPU_vertformat_attr_name_get(const GPUVertFormat *format, const GPUVertAttr *attr, uint n_idx)
MINLINE int max_ii(int a, int b)
ATTR_WARN_UNUSED_RESULT const BMVert * v
struct blender::GPUVertAttr::Type type
ResourceHandle resource_handles[16]