|
@@ -764,14 +764,17 @@ void MeshStorage::_mesh_surface_generate_version_for_input_mask(Mesh::Surface::V
|
|
int skin_stride = 0;
|
|
int skin_stride = 0;
|
|
|
|
|
|
for (int i = 0; i < RS::ARRAY_INDEX; i++) {
|
|
for (int i = 0; i < RS::ARRAY_INDEX; i++) {
|
|
|
|
+ attribs[i].enabled = false;
|
|
|
|
+ attribs[i].integer = false;
|
|
if (!(s->format & (1ULL << i))) {
|
|
if (!(s->format & (1ULL << i))) {
|
|
- attribs[i].enabled = false;
|
|
|
|
- attribs[i].integer = false;
|
|
|
|
continue;
|
|
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) {
|
|
switch (i) {
|
|
case RS::ARRAY_VERTEX: {
|
|
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) {
|
|
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.
|
|
// Add in the bones and weights.
|
|
glBindBuffer(GL_ARRAY_BUFFER, p_mi->mesh->surfaces[p_surface]->skin_buffer);
|
|
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);
|
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
GLuint vertex_array_gl = 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);
|
|
mesh_surface_get_vertex_arrays_and_format(mi->mesh->surfaces[i], format, vertex_array_gl);
|
|
glBindVertexArray(vertex_array_gl);
|
|
glBindVertexArray(vertex_array_gl);
|
|
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, mi->surfaces[i].vertex_buffers[0]);
|
|
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);
|
|
skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::INVERSE_TRANSFORM_OFFSET, inverse_transform[2], skeleton_shader.shader_version, variant, specialization);
|
|
|
|
|
|
GLuint vertex_array_gl = 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);
|
|
mesh_surface_get_vertex_arrays_and_format(mi->mesh->surfaces[i], format, vertex_array_gl);
|
|
glBindVertexArray(vertex_array_gl);
|
|
glBindVertexArray(vertex_array_gl);
|
|
_compute_skeleton(mi, sk, i);
|
|
_compute_skeleton(mi, sk, i);
|