summaryrefslogtreecommitdiff
path: root/drivers/gles3/storage
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-26 01:16:52 +0200
committerGitHub <noreply@github.com>2022-05-26 01:16:52 +0200
commit20a1b8558970fb93404b2b37cb8625950f5b70df (patch)
tree27f40497c08b0b2ee5c06a26f19eb9cae475bfce /drivers/gles3/storage
parentff75a49227d8d81f99b728fc89b1e4e6e79ed5be (diff)
parentfb860265e0f0c93166f87fecb4c0fb4a7965d45d (diff)
Merge pull request #61425 from clayjohn/GLES3-2D
Diffstat (limited to 'drivers/gles3/storage')
-rw-r--r--drivers/gles3/storage/mesh_storage.cpp13
-rw-r--r--drivers/gles3/storage/mesh_storage.h20
2 files changed, 32 insertions, 1 deletions
diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp
index 3be1792868..822be25337 100644
--- a/drivers/gles3/storage/mesh_storage.cpp
+++ b/drivers/gles3/storage/mesh_storage.cpp
@@ -722,6 +722,18 @@ void MeshStorage::_mesh_surface_generate_version_for_input_mask(Mesh::Surface::V
for (int i = 0; i < RS::ARRAY_INDEX; i++) {
if (!attribs[i].enabled) {
+ glDisableVertexAttribArray(i);
+ if (s->format & RS::ARRAY_FLAG_USE_2D_VERTICES) {
+ if (i == RS::ARRAY_COLOR) {
+ glVertexAttrib4f(i, 1, 1, 1, 1);
+ } else if (i == RS::ARRAY_TEX_UV) {
+ glVertexAttrib2f(i, 1, 1);
+ } else if (i == RS::ARRAY_BONES) {
+ glVertexAttrib4f(i, 1, 1, 1, 1);
+ } else if (i == RS::ARRAY_WEIGHTS) {
+ glVertexAttrib4f(i, 1, 1, 1, 1);
+ }
+ }
continue;
}
if (i <= RS::ARRAY_TANGENT) {
@@ -941,7 +953,6 @@ void MeshStorage::multimesh_allocate_data(RID p_multimesh, int p_instances, RS::
multimesh->stride_cache = multimesh->custom_data_offset_cache + (p_use_custom_data ? 4 : 0);
multimesh->buffer_set = false;
- //print_line("allocate, elements: " + itos(p_instances) + " 2D: " + itos(p_transform_format == RS::MULTIMESH_TRANSFORM_2D) + " colors " + itos(multimesh->uses_colors) + " data " + itos(multimesh->uses_custom_data) + " stride " + itos(multimesh->stride_cache) + " total size " + itos(multimesh->stride_cache * multimesh->instances));
multimesh->data_cache = Vector<float>();
multimesh->aabb = AABB();
multimesh->aabb_dirty = false;
diff --git a/drivers/gles3/storage/mesh_storage.h b/drivers/gles3/storage/mesh_storage.h
index 991777842f..068aa2fe40 100644
--- a/drivers/gles3/storage/mesh_storage.h
+++ b/drivers/gles3/storage/mesh_storage.h
@@ -493,6 +493,26 @@ public:
return multimesh->instances;
}
+ _FORCE_INLINE_ GLuint multimesh_get_gl_buffer(RID p_multimesh) const {
+ MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
+ return multimesh->buffer;
+ }
+
+ _FORCE_INLINE_ uint32_t multimesh_get_stride(RID p_multimesh) const {
+ MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
+ return multimesh->stride_cache;
+ }
+
+ _FORCE_INLINE_ uint32_t multimesh_get_color_offset(RID p_multimesh) const {
+ MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
+ return multimesh->color_offset_cache;
+ }
+
+ _FORCE_INLINE_ uint32_t multimesh_get_custom_data_offset(RID p_multimesh) const {
+ MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
+ return multimesh->custom_data_offset_cache;
+ }
+
/* SKELETON API */
Skeleton *get_skeleton(RID p_rid) { return skeleton_owner.get_or_null(p_rid); };