Table of Contents

Upgrade to Stride 4.4

Upgrade steps

The steps that upgrade a project from a version older than 4.4, and from 4.4.0 or 4.4.1 to 4.4.2 and later.

You don't run these steps yourself: Game Studio runs them when you open a project made with an older version, and stride upgrade runs them from the command line. Each section says what its step changes, and how to make the change by hand when the step fails: the upgrade report (upgrade-report.md) links each step to its section. See the upgrade guide for how steps run and what to do when one fails.

Stride-4.4.0-C1 Read the PixelFormat helpers IsSRgb, IsHDR, Is32bppWithAlpha and SizeInBytes as properties

These extension methods of PixelFormat became extension properties. The step removes the parentheses of each call: format.IsSRgb() becomes format.IsSRgb, and format?.SizeInBytes() becomes format?.SizeInBytes. A cref loses its empty parameter list.

By hand: remove the () after IsSRgb, IsHDR, Is32bppWithAlpha and SizeInBytes where you call them on a PixelFormat. The compiler shows each call that is left (CS1955).

Stride-4.4.0-C2 Rename the parameter count of the IndexBufferBinding constructor to indexCount

The parameter was renamed, which breaks the calls that name it. The step renames it in these calls:

// Before
new IndexBufferBinding(buffer, is32Bit, count: 6)
// After
new IndexBufferBinding(buffer, is32Bit, indexCount: 6)

Calls without the name need no change.

By hand: rename the named argument count: to indexCount: in each IndexBufferBinding constructor call (CS1739).

Stride-4.4.0-C3 Move the memory helpers of Utilities to MemoryUtilities

The memory helpers of Stride.Core.Utilities moved to Stride.Core.MemoryUtilities, and some were renamed:

Before After
Utilities.CopyWithAlignmentFallback MemoryUtilities.CopyWithAlignmentFallback
Utilities.Clear MemoryUtilities.Clear
Utilities.Swap MemoryUtilities.Swap
Utilities.AllocateMemory(size, align:) MemoryUtilities.Allocate(size, alignment:)
Utilities.AllocateClearedMemory(size, clearValue, align:) MemoryUtilities.AllocateCleared(size, clearValue, alignment:)
Utilities.FreeMemory MemoryUtilities.Free
Utilities.IsMemoryAligned(memoryPtr:, align:) MemoryUtilities.IsAligned(memoryAddress:, alignment:)

By hand: replace each call as the table shows, with the new names of the named arguments.

Stride-4.4.0-C4 Remove the uses of the graphics device reload and reset hooks

Stride no longer recovers a lost graphics device, so the hooks for it are gone. The step removes:

  • the calls of Buffer.RecreateWith, which returned the buffer itself: buffer.RecreateWith(data) becomes buffer;
  • the assignments of GraphicsResourceBase.Reload;
  • the subscriptions to the DeviceReset and DeviceResetting events of IGraphicsDeviceService and GraphicsDeviceManager.

By hand: delete these statements. Code that the hooks called, to create a resource again, no longer runs: when a device is lost, the game stops.

Stride-4.4.0-C5 Remove the unused using directives of SharpDX, SharpFont, Vortice, Stride.Core.Shaders

Stride no longer ships these libraries to game projects. The step removes the using directives of these namespaces that the code doesn't use, which would no longer compile. A directive the code uses stays: that code needs a new library or API.

By hand: delete the using SharpDX..., using SharpFont..., using Vortice... and using Stride.Core.Shaders... directives. Code that used these libraries needs a package reference of its own (for example Vortice.Direct3D11), or Stride's API.

Stride-4.4.0-P1 Reference Stride.AssetCompiler, and rename the generated .sdsl.cs and .sdfx.cs files to .bak

The package Stride.Core.Assets.CompilerApp was renamed Stride.AssetCompiler, and a source generator now writes the C# of the shaders into obj/. The step:

  • renames the Stride.Core.Assets.CompilerApp reference to Stride.AssetCompiler, with IncludeAssets="build;buildTransitive" and without PrivateAssets;
  • renames each .sdsl.cs and .sdfx.cs file of the project (not those of bin/ and obj/) to .sdsl.cs.bak and .sdfx.cs.bak;
  • removes the items of the project file that name these files, and the Generator and LastGenOutput metadata of the .sdsl and .sdfx items.

By hand: make these changes in the .csproj, and delete (or rename) the .sdsl.cs and .sdfx.cs files: they would define each type twice (CS0101). Delete the .bak files once the project builds.

Stride-4.4.2-P1 Declare effects with effect instead of shader in .sdfx files

Stride 4.3 and older accepted shader to declare an effect in a .sdfx file, and 4.4 rejects it (SDSL0313). The step replaces the keyword in each .sdfx file of the project: shader MyEffect becomes effect MyEffect. A file it can't read or write is left as it was.

By hand: in each .sdfx file, replace shader with effect where it declares an effect. The shader build names each one that is left.