summaryrefslogtreecommitdiff
path: root/servers/visual/rasterizer_rd
diff options
context:
space:
mode:
Diffstat (limited to 'servers/visual/rasterizer_rd')
-rw-r--r--servers/visual/rasterizer_rd/light_cluster_builder.cpp4
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp16
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp12
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_storage_rd.h4
4 files changed, 18 insertions, 18 deletions
diff --git a/servers/visual/rasterizer_rd/light_cluster_builder.cpp b/servers/visual/rasterizer_rd/light_cluster_builder.cpp
index 5fe734e82d..78011c22cc 100644
--- a/servers/visual/rasterizer_rd/light_cluster_builder.cpp
+++ b/servers/visual/rasterizer_rd/light_cluster_builder.cpp
@@ -112,8 +112,8 @@ void LightClusterBuilder::bake_cluster() {
int sx = MAX(0, from_x);
int sy = MAX(0, from_y);
- int dx = MIN(width - 1, to_x);
- int dy = MIN(height - 1, to_y);
+ int dx = MIN((int)width - 1, to_x);
+ int dy = MIN((int)height - 1, to_y);
//print_line(itos(j) + " - " + Vector2i(sx, sy) + " -> " + Vector2i(dx, dy));
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
index f029cddc79..cf54c36a45 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
@@ -1409,7 +1409,7 @@ void RasterizerSceneHighEndRD::_setup_reflections(RID *p_reflection_probe_cull_r
}
if (p_reflection_probe_cull_count) {
- RD::get_singleton()->buffer_update(scene_state.reflection_buffer, 0, MIN(scene_state.max_reflections, p_reflection_probe_cull_count) * sizeof(ReflectionData), scene_state.reflections, true);
+ RD::get_singleton()->buffer_update(scene_state.reflection_buffer, 0, MIN(scene_state.max_reflections, (unsigned int)p_reflection_probe_cull_count) * sizeof(ReflectionData), scene_state.reflections, true);
}
}
@@ -1566,10 +1566,10 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
light_data.attenuation_energy[0] = Math::make_half_float(storage->light_get_param(base, VS::LIGHT_PARAM_ATTENUATION));
light_data.attenuation_energy[1] = Math::make_half_float(sign * storage->light_get_param(base, VS::LIGHT_PARAM_ENERGY) * Math_PI);
- light_data.color_specular[0] = CLAMP(uint32_t(linear_col.r * 255), 0, 255);
- light_data.color_specular[1] = CLAMP(uint32_t(linear_col.g * 255), 0, 255);
- light_data.color_specular[2] = CLAMP(uint32_t(linear_col.b * 255), 0, 255);
- light_data.color_specular[3] = CLAMP(uint32_t(storage->light_get_param(base, VS::LIGHT_PARAM_SPECULAR) * 255), 0, 255);
+ light_data.color_specular[0] = MIN(uint32_t(linear_col.r * 255), 255);
+ light_data.color_specular[1] = MIN(uint32_t(linear_col.g * 255), 255);
+ light_data.color_specular[2] = MIN(uint32_t(linear_col.b * 255), 255);
+ light_data.color_specular[3] = MIN(uint32_t(storage->light_get_param(base, VS::LIGHT_PARAM_SPECULAR) * 255), 255);
float radius = MAX(0.001, storage->light_get_param(base, VS::LIGHT_PARAM_RANGE));
light_data.inv_radius = 1.0 / radius;
@@ -1595,9 +1595,9 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
Color shadow_color = storage->light_get_shadow_color(base);
bool has_shadow = p_using_shadows && storage->light_has_shadow(base);
- light_data.shadow_color_enabled[0] = CLAMP(uint32_t(shadow_color.r * 255), 0, 255);
- light_data.shadow_color_enabled[1] = CLAMP(uint32_t(shadow_color.g * 255), 0, 255);
- light_data.shadow_color_enabled[2] = CLAMP(uint32_t(shadow_color.b * 255), 0, 255);
+ light_data.shadow_color_enabled[0] = MIN(uint32_t(shadow_color.r * 255), 255);
+ light_data.shadow_color_enabled[1] = MIN(uint32_t(shadow_color.g * 255), 255);
+ light_data.shadow_color_enabled[2] = MIN(uint32_t(shadow_color.b * 255), 255);
light_data.shadow_color_enabled[3] = has_shadow ? 255 : 0;
light_data.atlas_rect[0] = 0;
diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp
index c92400c188..4a3960be1c 100644
--- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -1958,7 +1958,7 @@ VS::BlendShapeMode RasterizerStorageRD::mesh_get_blend_shape_mode(RID p_mesh) co
void RasterizerStorageRD::mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND(!mesh);
- ERR_FAIL_INDEX((uint32_t)p_surface, mesh->surface_count);
+ ERR_FAIL_UNSIGNED_INDEX((uint32_t)p_surface, mesh->surface_count);
ERR_FAIL_COND(p_data.size() == 0);
uint64_t data_size = p_data.size();
PoolVector<uint8_t>::Read r = p_data.read();
@@ -1969,7 +1969,7 @@ void RasterizerStorageRD::mesh_surface_update_region(RID p_mesh, int p_surface,
void RasterizerStorageRD::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND(!mesh);
- ERR_FAIL_INDEX((uint32_t)p_surface, mesh->surface_count);
+ ERR_FAIL_UNSIGNED_INDEX((uint32_t)p_surface, mesh->surface_count);
mesh->surfaces[p_surface]->material = p_material;
mesh->instance_dependency.instance_notify_changed(false, true);
@@ -1978,7 +1978,7 @@ void RasterizerStorageRD::mesh_surface_set_material(RID p_mesh, int p_surface, R
RID RasterizerStorageRD::mesh_surface_get_material(RID p_mesh, int p_surface) const {
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND_V(!mesh, RID());
- ERR_FAIL_INDEX_V((uint32_t)p_surface, mesh->surface_count, RID());
+ ERR_FAIL_UNSIGNED_INDEX_V((uint32_t)p_surface, mesh->surface_count, RID());
return mesh->surfaces[p_surface]->material;
}
@@ -1987,7 +1987,7 @@ VS::SurfaceData RasterizerStorageRD::mesh_get_surface(RID p_mesh, int p_surface)
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND_V(!mesh, VS::SurfaceData());
- ERR_FAIL_INDEX_V((uint32_t)p_surface, mesh->surface_count, VS::SurfaceData());
+ ERR_FAIL_UNSIGNED_INDEX_V((uint32_t)p_surface, mesh->surface_count, VS::SurfaceData());
Mesh::Surface &s = *mesh->surfaces[p_surface];
@@ -2468,7 +2468,7 @@ void RasterizerStorageRD::_multimesh_mark_dirty(MultiMesh *multimesh, int p_inde
uint32_t region_index = p_index / MULTIMESH_DIRTY_REGION_SIZE;
#ifdef DEBUG_ENABLED
uint32_t data_cache_dirty_region_count = (multimesh->instances - 1) / MULTIMESH_DIRTY_REGION_SIZE + 1;
- ERR_FAIL_INDEX(region_index, data_cache_dirty_region_count); //bug
+ ERR_FAIL_UNSIGNED_INDEX(region_index, data_cache_dirty_region_count); //bug
#endif
if (!multimesh->data_cache_dirty_regions[region_index]) {
multimesh->data_cache_dirty_regions[p_index] = true;
@@ -3581,7 +3581,7 @@ void RasterizerStorageRD::gi_probe_allocate(RID p_gi_probe, const Transform &p_t
uint32_t cell_count = p_octree_cells.size() / 32;
- ERR_FAIL_COND(p_data_cells.size() != cell_count * 16); //see that data size matches
+ ERR_FAIL_COND(p_data_cells.size() != (int)cell_count * 16); //see that data size matches
gi_probe->cell_count = cell_count;
gi_probe->octree_buffer = RD::get_singleton()->storage_buffer_create(p_octree_cells.size(), p_octree_cells);
diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.h b/servers/visual/rasterizer_rd/rasterizer_storage_rd.h
index 7ab8b904ad..055737d65d 100644
--- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.h
+++ b/servers/visual/rasterizer_rd/rasterizer_storage_rd.h
@@ -657,7 +657,7 @@ public:
_FORCE_INLINE_ VS::PrimitiveType mesh_surface_get_primitive(RID p_mesh, uint32_t p_surface_index) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND_V(!mesh, VS::PRIMITIVE_MAX);
- ERR_FAIL_INDEX_V(p_surface_index, mesh->surface_count, VS::PRIMITIVE_MAX);
+ ERR_FAIL_UNSIGNED_INDEX_V(p_surface_index, mesh->surface_count, VS::PRIMITIVE_MAX);
return mesh->surfaces[p_surface_index]->primitive;
}
@@ -665,7 +665,7 @@ public:
_FORCE_INLINE_ void mesh_surface_get_arrays_and_format(RID p_mesh, uint32_t p_surface_index, uint32_t p_input_mask, RID &r_vertex_array_rd, RID &r_index_array_rd, RD::VertexFormatID &r_vertex_format) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND(!mesh);
- ERR_FAIL_INDEX(p_surface_index, mesh->surface_count);
+ ERR_FAIL_UNSIGNED_INDEX(p_surface_index, mesh->surface_count);
Mesh::Surface *s = mesh->surfaces[p_surface_index];