diff options
author | LinuxUserGD <hugegameartgd@gmail.com> | 2022-07-25 17:14:33 +0200 |
---|---|---|
committer | Linux User <34406967+LinuxUserGD@users.noreply.github.com> | 2022-07-29 19:45:22 +0200 |
commit | 6e6569aa784ac81384330a6c62605f05be9edec3 (patch) | |
tree | cae7d1f3f936d6003a9890a749fcd9349736f477 | |
parent | 6ba7dacf6bde082e906ec7ff94d3e4f7975b0697 (diff) |
fix 'Comparison result is always the same' warnings
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 6 | ||||
-rw-r--r-- | drivers/gles3/storage/material_storage.cpp | 24 | ||||
-rw-r--r-- | modules/cvtt/image_compress_cvtt.cpp | 38 | ||||
-rw-r--r-- | modules/multiplayer/scene_cache_interface.cpp | 3 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/material_storage.cpp | 24 |
5 files changed, 3 insertions, 92 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index abbc11847f..d4ac3c993a 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -815,10 +815,8 @@ void RasterizerCanvasGLES3::_render_item(RID p_render_target, const Item *p_item _bind_canvas_texture(texture, current_filter, current_repeat, r_index); if (instance_count == 1) { GLES3::MaterialStorage::get_singleton()->shaders.canvas_shader.version_bind_shader(state.current_shader_version, CanvasShaderGLES3::MODE_ATTRIBUTES); - } else if (instance_count > 1) { - GLES3::MaterialStorage::get_singleton()->shaders.canvas_shader.version_bind_shader(state.current_shader_version, CanvasShaderGLES3::MODE_INSTANCED); } else { - ERR_PRINT("Must have at least one mesh instance to draw mesh"); + GLES3::MaterialStorage::get_singleton()->shaders.canvas_shader.version_bind_shader(state.current_shader_version, CanvasShaderGLES3::MODE_INSTANCED); } uint32_t surf_count = mesh_storage->mesh_get_surface_count(mesh); @@ -882,7 +880,7 @@ void RasterizerCanvasGLES3::_render_item(RID p_render_target, const Item *p_item } else { glDrawArrays(primitive_gl, 0, mesh_storage->mesh_surface_get_vertices_drawn_count(surface)); } - } else if (instance_count > 1) { + } else { if (use_index_buffer) { glDrawElementsInstanced(primitive_gl, mesh_storage->mesh_surface_get_vertices_drawn_count(surface), mesh_storage->mesh_surface_get_index_type(surface), 0, instance_count); } else { diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index 117481faf5..68045930b0 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -180,10 +180,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 2 * p_array_size; const int *r = iv.ptr(); @@ -210,10 +206,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 3 * p_array_size; const int *r = iv.ptr(); @@ -242,10 +234,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 4 * p_array_size; const int *r = iv.ptr(); @@ -298,10 +286,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 2 * p_array_size; const int *r = iv.ptr(); @@ -328,10 +312,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 3 * p_array_size; const int *r = iv.ptr(); @@ -360,10 +340,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 4 * p_array_size; const int *r = iv.ptr(); diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp index a7cfcaa262..3322ff0a1b 100644 --- a/modules/cvtt/image_compress_cvtt.cpp +++ b/modules/cvtt/image_compress_cvtt.cpp @@ -129,14 +129,6 @@ static void _digest_row_task(const CVTTCompressionJobParams &p_job_params, const } } -static void _digest_job_queue(void *p_job_queue) { - CVTTCompressionJobQueue *job_queue = static_cast<CVTTCompressionJobQueue *>(p_job_queue); - - for (uint32_t next_task = job_queue->current_task.increment(); next_task <= job_queue->num_tasks; next_task = job_queue->current_task.increment()) { - _digest_row_task(job_queue->job_params, job_queue->job_tasks[next_task - 1]); - } -} - void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChannels p_channels) { if (p_image->get_format() >= Image::FORMAT_BPTC_RGBA) { return; //do not compress, already compressed @@ -202,7 +194,6 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChann job_queue.job_params.bytes_per_pixel = is_hdr ? 6 : 4; cvtt::Kernels::ConfigureBC7EncodingPlanFromQuality(job_queue.job_params.bc7_plan, 5); - int num_job_threads = 0; // Amdahl's law (Wikipedia) // If a program needs 20 hours to complete using a single thread, but a one-hour portion of the program cannot be parallelized, // therefore only the remaining 19 hours (p = 0.95) of execution time can be parallelized, then regardless of how many threads are devoted @@ -229,11 +220,7 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChann row_task.in_mm_bytes = in_bytes; row_task.out_mm_bytes = out_bytes; - if (num_job_threads > 0) { - tasks.push_back(row_task); - } else { - _digest_row_task(job_queue.job_params, row_task); - } + _digest_row_task(job_queue.job_params, row_task); out_bytes += 16 * (bw / 4); } @@ -243,29 +230,6 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChann h = MAX(h / 2, 1); } - if (num_job_threads > 0) { - Vector<Thread *> threads; - threads.resize(num_job_threads); - - Thread **threads_wb = threads.ptrw(); - - const CVTTCompressionRowTask *tasks_rb = tasks.ptr(); - - job_queue.job_tasks = &tasks_rb[0]; - job_queue.current_task.set(0); - job_queue.num_tasks = static_cast<uint32_t>(tasks.size()); - - for (int i = 0; i < num_job_threads; i++) { - threads_wb[i] = memnew(Thread); - threads_wb[i]->start(_digest_job_queue, &job_queue); - } - _digest_job_queue(&job_queue); - - for (int i = 0; i < num_job_threads; i++) { - threads_wb[i]->wait_to_finish(); - memdelete(threads_wb[i]); - } - } p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data); } diff --git a/modules/multiplayer/scene_cache_interface.cpp b/modules/multiplayer/scene_cache_interface.cpp index 4dc01321b9..b3b642f815 100644 --- a/modules/multiplayer/scene_cache_interface.cpp +++ b/modules/multiplayer/scene_cache_interface.cpp @@ -223,9 +223,6 @@ bool SceneCacheInterface::send_object_cache(Object *p_obj, int p_peer_id, int &r if (p_peer_id < 0 && E == -p_peer_id) { continue; // Continue, excluded. } - if (p_peer_id > 0 && E != p_peer_id) { - continue; // Continue, not for this peer. - } HashMap<int, bool>::Iterator F = psc->confirmed_peers.find(E); if (!F) { diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp index 0bac26213b..815b7a1fda 100644 --- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp @@ -176,10 +176,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 2 * p_array_size; const int *r = iv.ptr(); @@ -205,10 +201,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 3 * p_array_size; const int *r = iv.ptr(); @@ -236,10 +228,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 4 * p_array_size; const int *r = iv.ptr(); @@ -292,10 +280,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 2 * p_array_size; const int *r = iv.ptr(); @@ -321,10 +305,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 3 * p_array_size; const int *r = iv.ptr(); @@ -352,10 +332,6 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (p_array_size > 0) { Vector<int> iv = value; int s = iv.size(); - - if (p_array_size <= 0) { - p_array_size = 1; - } int count = 4 * p_array_size; const int *r = iv.ptr(); |