Merge pull request #67912 from RevoluPowered/fix-exeception-bad-access
Fix EXE_BAD_ACCESS caused by optional argument
This commit is contained in:
commit
03e5de37ae
5 changed files with 13 additions and 20 deletions
|
@ -1189,8 +1189,8 @@ void RasterizerSceneGLES3::_fill_render_list(RenderListType p_render_list, const
|
||||||
distance = 1.0;
|
distance = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t indices;
|
uint32_t indices = 0;
|
||||||
surf->lod_index = mesh_storage->mesh_surface_get_lod(surf->surface, inst->lod_model_scale * inst->lod_bias, distance * p_render_data->lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold, &indices);
|
surf->lod_index = mesh_storage->mesh_surface_get_lod(surf->surface, inst->lod_model_scale * inst->lod_bias, distance * p_render_data->lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold, indices);
|
||||||
/*
|
/*
|
||||||
if (p_render_data->render_info) {
|
if (p_render_data->render_info) {
|
||||||
indices = _indices_to_primitives(surf->primitive, indices);
|
indices = _indices_to_primitives(surf->primitive, indices);
|
||||||
|
|
|
@ -325,13 +325,12 @@ public:
|
||||||
return s->index_count ? s->index_count : s->vertex_count;
|
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);
|
Mesh::Surface *s = reinterpret_cast<Mesh::Surface *>(p_surface);
|
||||||
|
|
||||||
int32_t current_lod = -1;
|
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++) {
|
for (uint32_t i = 0; i < s->lod_count; i++) {
|
||||||
float screen_size = s->lods[i].edge_length * p_model_scale / p_distance_threshold;
|
float screen_size = s->lods[i].edge_length * p_model_scale / p_distance_threshold;
|
||||||
if (screen_size > p_mesh_lod_threshold) {
|
if (screen_size > p_mesh_lod_threshold) {
|
||||||
|
@ -342,9 +341,7 @@ public:
|
||||||
if (current_lod == -1) {
|
if (current_lod == -1) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} 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;
|
return current_lod + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -963,8 +963,8 @@ void RenderForwardClustered::_fill_render_list(RenderListType p_render_list, con
|
||||||
distance = 1.0;
|
distance = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t indices;
|
uint32_t indices = 0;
|
||||||
surf->sort.lod_index = mesh_storage->mesh_surface_get_lod(surf->surface, inst->lod_model_scale * inst->lod_bias, distance * p_render_data->scene_data->lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, &indices);
|
surf->sort.lod_index = mesh_storage->mesh_surface_get_lod(surf->surface, inst->lod_model_scale * inst->lod_bias, distance * p_render_data->scene_data->lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, indices);
|
||||||
if (p_render_data->render_info) {
|
if (p_render_data->render_info) {
|
||||||
indices = _indices_to_primitives(surf->primitive, indices);
|
indices = _indices_to_primitives(surf->primitive, indices);
|
||||||
if (p_render_list == RENDER_LIST_OPAQUE) { //opaque
|
if (p_render_list == RENDER_LIST_OPAQUE) { //opaque
|
||||||
|
|
|
@ -1830,8 +1830,8 @@ void RenderForwardMobile::_fill_render_list(RenderListType p_render_list, const
|
||||||
distance = 1.0;
|
distance = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t indices;
|
uint32_t indices = 0;
|
||||||
surf->lod_index = mesh_storage->mesh_surface_get_lod(surf->surface, inst->lod_model_scale * inst->lod_bias, distance * p_render_data->scene_data->lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, &indices);
|
surf->lod_index = mesh_storage->mesh_surface_get_lod(surf->surface, inst->lod_model_scale * inst->lod_bias, distance * p_render_data->scene_data->lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, indices);
|
||||||
if (p_render_data->render_info) {
|
if (p_render_data->render_info) {
|
||||||
indices = _indices_to_primitives(surf->primitive, indices);
|
indices = _indices_to_primitives(surf->primitive, indices);
|
||||||
if (p_render_list == RENDER_LIST_OPAQUE) { //opaque
|
if (p_render_list == RENDER_LIST_OPAQUE) { //opaque
|
||||||
|
|
|
@ -398,13 +398,11 @@ public:
|
||||||
return s->index_count ? s->index_count : s->vertex_count;
|
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);
|
Mesh::Surface *s = reinterpret_cast<Mesh::Surface *>(p_surface);
|
||||||
|
|
||||||
int32_t current_lod = -1;
|
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++) {
|
for (uint32_t i = 0; i < s->lod_count; i++) {
|
||||||
float screen_size = s->lods[i].edge_length * p_model_scale / p_distance_threshold;
|
float screen_size = s->lods[i].edge_length * p_model_scale / p_distance_threshold;
|
||||||
if (screen_size > p_mesh_lod_threshold) {
|
if (screen_size > p_mesh_lod_threshold) {
|
||||||
|
@ -415,9 +413,7 @@ public:
|
||||||
if (current_lod == -1) {
|
if (current_lod == -1) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} 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;
|
return current_lod + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue