From 7d5cf601490e345be7c1a1d82c96f55bec8ceb79 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Sun, 28 Feb 2021 17:27:01 +0000 Subject: [PATCH] Disallow antialiasing for software skinned 2d polys Antialiasing is not supported for batched polys. Currently due to the fallback mechanism, skinned antialiased polys will be rendered without applying animation. This PR simply treats such polys as if antialiasing had not been selected. The class reference is updated to reflect this. --- doc/classes/ProjectSettings.xml | 1 + drivers/gles_common/rasterizer_canvas_batcher.h | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 02a056c5508..f7c0671bb6c 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -1143,6 +1143,7 @@ If [code]true[/code], performs 2D skinning on the CPU rather than the GPU. This provides greater compatibility with a wide range of hardware, and also may be faster in some circumstances. Currently only available when [member rendering/batching/options/use_batching] is active. + [b]Note:[/b] Antialiased software skinned polys are not supported, and will be rendered without antialiasing. If [code]true[/code], forces snapping of 2D object transforms to the nearest whole coordinate. diff --git a/drivers/gles_common/rasterizer_canvas_batcher.h b/drivers/gles_common/rasterizer_canvas_batcher.h index 9def2b95f39..d0c1acf3304 100644 --- a/drivers/gles_common/rasterizer_canvas_batcher.h +++ b/drivers/gles_common/rasterizer_canvas_batcher.h @@ -2282,7 +2282,16 @@ PREAMBLE(bool)::prefill_joined_item(FillState &r_fill_state, int &r_command_star #ifdef GLES_OVER_GL // anti aliasing not accelerated .. it is problematic because it requires a 2nd line drawn around the outside of each // poly, which would require either a second list of indices or a second list of vertices for this step + bool use_legacy_path = false; + if (polygon->antialiased) { + // anti aliasing is also not supported for software skinned meshes. + // we can't easily revert, so we force software skinned meshes to run through + // batching path with no AA. + use_legacy_path = !bdata.settings_use_software_skinning || p_item->skeleton == RID(); + } + + if (use_legacy_path) { // not accelerated _prefill_default_batch(r_fill_state, command_num, *p_item); } else { @@ -2298,9 +2307,9 @@ PREAMBLE(bool)::prefill_joined_item(FillState &r_fill_state, int &r_command_star bool buffer_full = false; if (send_light_angles) { - // NYI + // polygon with light angles is not yet implemented + // for batching .. this means software skinned with light angles won't work _prefill_default_batch(r_fill_state, command_num, *p_item); - //buffer_full = prefill_polygon(polygon, r_fill_state, r_command_start, command_num, command_count, p_item, multiply_final_modulate); } else buffer_full = _prefill_polygon(polygon, r_fill_state, r_command_start, command_num, command_count, p_item, multiply_final_modulate);