arrow_back_ios Back to List

Your First Offload Block

Offload KB - getting-started

Old Content Alert

Please note that this is a old document archive and the will most likely be out-dated or superseded by various other products and is purely here for historical purposes.

Regardless of how you decided to install Offload™, the first offload block that is attempted is a good sanity test for your installation.

Whether you decide to jump right in and integrate Offload™ with your current project, or you would rather create a project from scratch, it is advisable to start small and ensure the installation is working as is expected!

The first step is to create an C++ file, which will be compiled with Offload™. Once you have the given C++ file created, the next step is to set it to use Offload™. When using the Visual Studio 2008 integration, you can right-click on the desired file and select 'Activate Offload', or you could use a custom build step as either a Visual Studio custom build step, or within a makefile.

Create a function within your file:


#include
#include
void offloadTestBlock()
{
	__blockingoffload()
	{
		printf("Hello world from the SPU!");
	};
}

By creating a corresponding header file to expose the function elsewhere in your code, or simply by using an extern offloadTestBlock();, you can link the offloaded function with your normal game code.When using Visual Studio 2008 Integration, compiling the file as is normal will suffice to build the example.

Content Has been removed.

Now compiling this example will create a blocking SPU job which simply prints 'Hello world!' to the console.