瀏覽代碼

Merge pull request #46520 from lawnjelly/soft_skin_aa

Disallow antialiasing for software skinned 2d polys
Rémi Verschelde 4 年之前
父節點
當前提交
6b4abc6e17
共有 2 個文件被更改,包括 12 次插入2 次删除
  1. 1 0
      doc/classes/ProjectSettings.xml
  2. 11 2
      drivers/gles_common/rasterizer_canvas_batcher.h

+ 1 - 0
doc/classes/ProjectSettings.xml

@@ -1143,6 +1143,7 @@
 		<member name="rendering/quality/2d/use_software_skinning" type="bool" setter="" getter="" default="true">
 		<member name="rendering/quality/2d/use_software_skinning" type="bool" setter="" getter="" default="true">
 			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.
 			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.
 			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.
 		</member>
 		</member>
 		<member name="rendering/quality/2d/use_transform_snap" type="bool" setter="" getter="" default="false">
 		<member name="rendering/quality/2d/use_transform_snap" type="bool" setter="" getter="" default="false">
 			If [code]true[/code], forces snapping of 2D object transforms to the nearest whole coordinate.
 			If [code]true[/code], forces snapping of 2D object transforms to the nearest whole coordinate.

+ 11 - 2
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
 #ifdef GLES_OVER_GL
 				// anti aliasing not accelerated .. it is problematic because it requires a 2nd line drawn around the outside of each
 				// 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
 				// 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) {
 				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
 					// not accelerated
 					_prefill_default_batch(r_fill_state, command_num, *p_item);
 					_prefill_default_batch(r_fill_state, command_num, *p_item);
 				} else {
 				} else {
@@ -2298,9 +2307,9 @@ PREAMBLE(bool)::prefill_joined_item(FillState &r_fill_state, int &r_command_star
 						bool buffer_full = false;
 						bool buffer_full = false;
 
 
 						if (send_light_angles) {
 						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);
 							_prefill_default_batch(r_fill_state, command_num, *p_item);
-							//buffer_full = prefill_polygon<true>(polygon, r_fill_state, r_command_start, command_num, command_count, p_item, multiply_final_modulate);
 						} else
 						} else
 							buffer_full = _prefill_polygon<false>(polygon, r_fill_state, r_command_start, command_num, command_count, p_item, multiply_final_modulate);
 							buffer_full = _prefill_polygon<false>(polygon, r_fill_state, r_command_start, command_num, command_count, p_item, multiply_final_modulate);