Posts Tagged burst

Math.Abs vs. Mathf.Abs vs. math.abs vs. Custom

Tags: , ,

A reader recently asked what the fastest way to take an absolute value was. It occurred to me that there are a lot of ways to do this in Unity! So today we’ll try them all out and see which is best.

Read the rest of this article »

7 Comments

P/Invoke in Burst: No Safety Net

Tags: , ,

Calling into native code like C++ from C# is a powerful interoperability tool in Unity. As we move more and more code out of Mono and IL2CPP and into Burst, will we still have this tool available? Today we’ll find out!

Read the rest of this article »

4 Comments

Tuples in Burst

Tags: , ,

Tuples are a new feature in C# 7 and they’re backed by the ValueTuple struct, not class. Hopefully they’ll be supported by Burst, so let’s try them out!

Read the rest of this article »

3 Comments

How Burst Compiles Switches and Ref Parameters

Tags: , ,

Today we go back to basics and see how Burst compiles some fundamental language features: switch statements and ref parameters… with surprising results!

Read the rest of this article »

No Comments

Force Method Inlining in Burst

Tags: ,

Burst 1.0.1 is a patch-level update to the original 1.0.0 release, but it actually contains a useful new feature: we’re now able to force methods to be inlined. Read on to see how!

Read the rest of this article »

3 Comments

Adding Unions to Burst

Tags: , ,

We’ve seen how to add unions to C#, but does this work with the new Burst compiler? Today we’ll put it to the test and see if it can handle some of the more advanced struct customization features in C#!

Read the rest of this article »

2 Comments

Assertions in Burst

Tags: , , ,

Assertions are an incredibly handy tool, but do they work in Burst-compiled jobs? Today we’ll find out!

Read the rest of this article »

2 Comments

Dangers of Arrays in Burst

Tags: , ,

Normally Burst-compiled jobs can’t use managed arrays, but there’s an exception for static readonly fields. This comes with several dangers, which we’ll explore today.

Read the rest of this article »

2 Comments

How IL2CPP Calls Burst

Tags: , ,

Ever wonder how code compiled with IL2CPP can call code compiled by Burst? Today we’ll dive into the details and find out!

Read the rest of this article »

3 Comments

Throwing Exceptions in Burst-Compiled Jobs

Tags: , ,

Unity’s Burst compiler imposes an interesting subset of C#. The “no managed objects” rule of thumb is not always correct. Today we’ll look at eExceptions, which are managed objects but are partially supported by Burst. What’s allowed and what’s banned? Read on to find out.

Read the rest of this article »

1 Comment