You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Use vertex input mask for creating vertex arrays
Also fix bug in creation of vertex input mask
(cherry picked from commit c0c1efc5da)
This commit is contained in:
committed by
Rémi Verschelde
parent
d93fcf824f
commit
bca878ffd9
@@ -764,14 +764,17 @@ void MeshStorage::_mesh_surface_generate_version_for_input_mask(Mesh::Surface::V
|
||||
int skin_stride = 0;
|
||||
|
||||
for (int i = 0; i < RS::ARRAY_INDEX; i++) {
|
||||
attribs[i].enabled = false;
|
||||
attribs[i].integer = false;
|
||||
if (!(s->format & (1ULL << i))) {
|
||||
attribs[i].enabled = false;
|
||||
attribs[i].integer = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
attribs[i].enabled = true;
|
||||
attribs[i].integer = false;
|
||||
if ((p_input_mask & (1ULL << i))) {
|
||||
// Only enable if it matches input mask.
|
||||
// Iterate over all anyway, so we can calculate stride.
|
||||
attribs[i].enabled = true;
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case RS::ARRAY_VERTEX: {
|
||||
@@ -1108,8 +1111,6 @@ void MeshStorage::_blend_shape_bind_mesh_instance_buffer(MeshInstance *p_mi, uin
|
||||
}
|
||||
|
||||
void MeshStorage::_compute_skeleton(MeshInstance *p_mi, Skeleton *p_sk, uint32_t p_surface) {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
// Add in the bones and weights.
|
||||
glBindBuffer(GL_ARRAY_BUFFER, p_mi->mesh->surfaces[p_surface]->skin_buffer);
|
||||
|
||||
@@ -1200,9 +1201,8 @@ void MeshStorage::update_mesh_instances() {
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
GLuint vertex_array_gl = 0;
|
||||
uint64_t mask = ((1 << 10) - 1) << 3; // Mask from ARRAY_FORMAT_COLOR to ARRAY_FORMAT_INDEX.
|
||||
mask = ~mask;
|
||||
uint64_t format = mi->surfaces[i].format_cache & mask; // Format should only have vertex, normal, tangent (as necessary) + compressions.
|
||||
uint64_t mask = RS::ARRAY_FORMAT_VERTEX | RS::ARRAY_FORMAT_NORMAL | RS::ARRAY_FORMAT_VERTEX;
|
||||
uint64_t format = mi->mesh->surfaces[i]->format & mask; // Format should only have vertex, normal, tangent (as necessary).
|
||||
mesh_surface_get_vertex_arrays_and_format(mi->mesh->surfaces[i], format, vertex_array_gl);
|
||||
glBindVertexArray(vertex_array_gl);
|
||||
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, mi->surfaces[i].vertex_buffers[0]);
|
||||
@@ -1315,9 +1315,8 @@ void MeshStorage::update_mesh_instances() {
|
||||
skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::INVERSE_TRANSFORM_OFFSET, inverse_transform[2], skeleton_shader.shader_version, variant, specialization);
|
||||
|
||||
GLuint vertex_array_gl = 0;
|
||||
uint64_t mask = ((1 << 10) - 1) << 3; // Mask from ARRAY_FORMAT_COLOR to ARRAY_FORMAT_INDEX.
|
||||
mask = ~mask;
|
||||
uint64_t format = mi->surfaces[i].format_cache & mask; // Format should only have vertex, normal, tangent (as necessary) + compressions.
|
||||
uint64_t mask = RS::ARRAY_FORMAT_VERTEX | RS::ARRAY_FORMAT_NORMAL | RS::ARRAY_FORMAT_VERTEX;
|
||||
uint64_t format = mi->mesh->surfaces[i]->format & mask; // Format should only have vertex, normal, tangent (as necessary).
|
||||
mesh_surface_get_vertex_arrays_and_format(mi->mesh->surfaces[i], format, vertex_array_gl);
|
||||
glBindVertexArray(vertex_array_gl);
|
||||
_compute_skeleton(mi, sk, i);
|
||||
|
||||
Reference in New Issue
Block a user