summaryrefslogtreecommitdiff
path: root/drivers/gles3/storage/mesh_storage.h
diff options
context:
space:
mode:
authorGordon MacPherson <gordon@gordonite.tech>2022-10-26 19:33:35 +0100
committerGordon MacPherson <gordon@gordonite.tech>2022-10-26 19:33:35 +0100
commit56df8d5f198a2ff0c1da0a9e46bedb0eb2db2813 (patch)
tree2c5b3e03019c4152428e0cab56ecd116c1b5cba8 /drivers/gles3/storage/mesh_storage.h
parent040f49ed6e71a6e7f23d763c4b56095cbf319ef7 (diff)
Fix EXE_BAD_ACCESS caused by optional argument
This argument is now non optional, but this never hits the same bad access. I voted to simplify the code here since the argument is never used optionally in our codebase.
Diffstat (limited to 'drivers/gles3/storage/mesh_storage.h')
-rw-r--r--drivers/gles3/storage/mesh_storage.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/gles3/storage/mesh_storage.h b/drivers/gles3/storage/mesh_storage.h
index 74f5800795..a31db24f2d 100644
--- a/drivers/gles3/storage/mesh_storage.h
+++ b/drivers/gles3/storage/mesh_storage.h
@@ -325,13 +325,12 @@ public:
return s->index_count ? s->index_count : s->vertex_count;
}
- _FORCE_INLINE_ uint32_t mesh_surface_get_lod(void *p_surface, float p_model_scale, float p_distance_threshold, float p_mesh_lod_threshold, uint32_t *r_index_count = nullptr) const {
+ _FORCE_INLINE_ uint32_t mesh_surface_get_lod(void *p_surface, float p_model_scale, float p_distance_threshold, float p_mesh_lod_threshold, uint32_t &r_index_count) const {
Mesh::Surface *s = reinterpret_cast<Mesh::Surface *>(p_surface);
int32_t current_lod = -1;
- if (r_index_count) {
- *r_index_count = s->index_count;
- }
+ r_index_count = s->index_count;
+
for (uint32_t i = 0; i < s->lod_count; i++) {
float screen_size = s->lods[i].edge_length * p_model_scale / p_distance_threshold;
if (screen_size > p_mesh_lod_threshold) {
@@ -342,9 +341,7 @@ public:
if (current_lod == -1) {
return 0;
} else {
- if (r_index_count) {
- *r_index_count = s->lods[current_lod].index_count;
- }
+ r_index_count = s->lods[current_lod].index_count;
return current_lod + 1;
}
}