Metal: Fix crash when using `batch_for_shader`.

`batch_for_shader` is an utility function that creates the correct
vertex buffer based on the given shader. In the shader interface
the `attr_types_` contains the GPUType for each location in the
vertex buffer.

When using Metal, the `attr_types_` was never updated, resulting
in using incorrect or non-existing data types. This patch fixes
this by updating the `attr_types_` when building the shader
interface.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D17042
This commit is contained in:
Jeroen Bakker 2023-01-19 15:10:49 +01:00 committed by Jeroen Bakker
parent 203bacbe4a
commit 7f81d18ffe
1 changed files with 4 additions and 0 deletions

View File

@ -2607,6 +2607,10 @@ MTLShaderInterface *MSLGeneratorInterface::bake_shader_interface(const char *nam
c_offset);
c_offset += size;
}
/* Used in `GPU_shader_get_attribute_info`. */
interface->attr_types_[this->vertex_input_attributes[attribute].layout_location] = uint8_t(
this->vertex_input_attributes[attribute].type);
}
/* Prepare Interface Default Uniform Block. */