summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-02-13 15:53:32 +0100
committerRémi Verschelde <rverschelde@gmail.com>2020-02-14 10:02:31 +0100
commitd2537407efffde15372962ffca864b7400ade345 (patch)
tree4d99ff9f4814abc3e531a447794a62139ece1178 /servers
parent3679d49f4b709fd56e872633ead73008bc3e1c43 (diff)
Fix various GCC compilation warnings after Vulkan merge
Part of #36132.
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/rasterizer.h4
-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
-rw-r--r--servers/visual/rendering_device.cpp4
-rw-r--r--servers/visual/shader_language.cpp32
-rw-r--r--servers/visual/visual_server_raster.cpp2
8 files changed, 45 insertions, 33 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 72c9a7f913..08d2104f94 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -1080,8 +1080,8 @@ public:
const Item::CommandTransform *transform = static_cast<const Item::CommandTransform *>(c);
xf = transform->xform;
found_xform = true;
-
- } //passthrough
+ FALLTHROUGH;
+ }
default: {
c = c->next;
continue;
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];
diff --git a/servers/visual/rendering_device.cpp b/servers/visual/rendering_device.cpp
index dab936d9a9..d7c88d5671 100644
--- a/servers/visual/rendering_device.cpp
+++ b/servers/visual/rendering_device.cpp
@@ -60,9 +60,5 @@ PoolVector<uint8_t> RenderingDevice::shader_compile_from_source(ShaderStage p_st
}
RenderingDevice::RenderingDevice() {
-
- ShaderCompileFunction compile_function;
- ShaderCacheFunction cache_function;
-
singleton = this;
}
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 76348373c9..734abd7365 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -2708,31 +2708,43 @@ PropertyInfo ShaderLanguage::uniform_to_property_info(const ShaderNode::Uniform
pi.hint = PROPERTY_HINT_RESOURCE_TYPE;
pi.hint_string = "CubeMap";
} break;
+ case ShaderLanguage::TYPE_STRUCT: {
+ // FIXME: Implement this.
+ } break;
}
return pi;
}
uint32_t ShaderLanguage::get_type_size(DataType p_type) {
switch (p_type) {
+ case TYPE_VOID:
+ return 0;
case TYPE_BOOL:
case TYPE_INT:
case TYPE_UINT:
- case TYPE_FLOAT: return 4;
+ case TYPE_FLOAT:
+ return 4;
case TYPE_BVEC2:
case TYPE_IVEC2:
case TYPE_UVEC2:
- case TYPE_VEC2: return 8;
+ case TYPE_VEC2:
+ return 8;
case TYPE_BVEC3:
case TYPE_IVEC3:
case TYPE_UVEC3:
- case TYPE_VEC3: return 12;
+ case TYPE_VEC3:
+ return 12;
case TYPE_BVEC4:
case TYPE_IVEC4:
case TYPE_UVEC4:
- case TYPE_VEC4: return 16;
- case TYPE_MAT2: return 8;
- case TYPE_MAT3: return 12;
- case TYPE_MAT4: return 16;
+ case TYPE_VEC4:
+ return 16;
+ case TYPE_MAT2:
+ return 8;
+ case TYPE_MAT3:
+ return 12;
+ case TYPE_MAT4:
+ return 16;
case TYPE_SAMPLER2D:
case TYPE_ISAMPLER2D:
case TYPE_USAMPLER2D:
@@ -2742,7 +2754,11 @@ uint32_t ShaderLanguage::get_type_size(DataType p_type) {
case TYPE_SAMPLER3D:
case TYPE_ISAMPLER3D:
case TYPE_USAMPLER3D:
- case TYPE_SAMPLERCUBE: return 4; //not really, but useful for indices
+ case TYPE_SAMPLERCUBE:
+ return 4; //not really, but useful for indices
+ case TYPE_STRUCT:
+ // FIXME: Implement.
+ return 0;
}
return 0;
}
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 6599b9a2d2..b27c01cccc 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -139,7 +139,7 @@ void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) {
uint64_t base_cpu = VSG::storage->get_captured_timestamp_cpu_time(0);
uint64_t base_gpu = VSG::storage->get_captured_timestamp_gpu_time(0);
- for (int i = 0; i < VSG::storage->get_captured_timestamps_count(); i++) {
+ for (uint32_t i = 0; i < VSG::storage->get_captured_timestamps_count(); i++) {
uint64_t time_cpu = VSG::storage->get_captured_timestamp_cpu_time(i) - base_cpu;
uint64_t time_gpu = VSG::storage->get_captured_timestamp_gpu_time(i) - base_gpu;
new_profile.write[i].gpu_msec = float(time_gpu / 1000) / 1000.0;