summaryrefslogtreecommitdiff
path: root/drivers/gles2/rasterizer_storage_gles2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles2/rasterizer_storage_gles2.cpp')
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 70f1173a7d..b08202ae45 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -811,7 +811,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer)
data.resize(data_size);
- Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1 ? true : false, real_format, data));
+ Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1, real_format, data));
return Ref<Image>(img);
#else
@@ -2427,6 +2427,18 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
}
surface->data = array;
surface->index_data = p_index_array;
+#else
+ // Even on non-tools builds, a copy of the surface->data is needed in certain circumstances.
+ // Rigged meshes using the USE_SKELETON_SOFTWARE path need to read bone data
+ // from surface->data.
+
+ // if USE_SKELETON_SOFTWARE is active
+ if (!config.float_texture_supported) {
+ // if this geometry is used specifically for skinning
+ if (p_format & (VS::ARRAY_FORMAT_BONES | VS::ARRAY_FORMAT_WEIGHTS))
+ surface->data = array;
+ }
+ // An alternative is to always make a copy of surface->data.
#endif
surface->total_data_size += surface->array_byte_size + surface->index_array_byte_size;
@@ -4514,9 +4526,7 @@ void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene
ERR_FAIL_COND(!inst);
} break;
default: {
- if (!inst) {
- ERR_FAIL();
- }
+ ERR_FAIL();
}
}
@@ -4561,15 +4571,10 @@ void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerSc
ERR_FAIL_COND(!inst);
} break;
default: {
-
- if (!inst) {
- ERR_FAIL();
- }
+ ERR_FAIL();
}
}
- ERR_FAIL_COND(!inst);
-
inst->instance_list.remove(&p_instance->dependency_item);
}