stride icon indicating copy to clipboard operation
stride copied to clipboard

refactor: Move FreeImage into separate project

Open Jklawreszuk opened this issue 9 months ago • 6 comments

PR Details

As the name suggests my PR separates FreeImage wrapper from TextureWrapper project just for sake of #2689 to prevent circular dependencies error. I've also changed namespace styling.

Types of changes

  • [x] Docs change / refactoring / dependency upgrade
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [ ] My change requires a change to the documentation.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.
  • [x] I have built and run the editor to try this change out.

Jklawreszuk avatar Mar 28 '25 18:03 Jklawreszuk

~~I'm not sure but seems like my new Stride.FreeImage package doesn't include the runtimes folder with freeimage.dll :( . If anyone has an idea what is wrong I would appreciate it~~

Jklawreszuk avatar Mar 29 '25 14:03 Jklawreszuk

Pr is ready for review, I tested the changes using the JumpyJet project. No regression so far 😄

Jklawreszuk avatar Mar 30 '25 17:03 Jklawreszuk

I did a quick rebuild with the following steps:

  • git clean -xfd
  • dotnet clean
  • rebuild

And it seems to have broken the Test projects but I can confirm the GameStudio seems to run as expected.

[AssetCompiler] Exception in command [DdsMaskBC3] Stride.Assets.Textures.TextureConvertParameters: Stride.TextureConverter.TextureToolsException: Loading dds file D:/dev/GitControlledProjects/stride/sources/data/tests/SmallDdsMaskBC3.dds failed: E_FAIL

Im wondering if there is a reference to the new project missed for the tests somewhere?

Doprez avatar Mar 30 '25 20:03 Doprez

Oh that's because my branch is not up-to-date. One moment please hah

Jklawreszuk avatar Mar 30 '25 20:03 Jklawreszuk

@Doprez There you go

Jklawreszuk avatar Mar 30 '25 20:03 Jklawreszuk

That seems to have fixed! Looks like everything is working on my end.

I did get a new crash but it seems unrelated to your changes but Ill log it here just in case:

Exception: ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Threading.ThreadLocal`1[[Stride.Core.MicroThreading.MicroThread, Stride.Core.MicroThreading, Version=4.2.0.1, Culture=neutral, PublicKeyToken=null]]'.
   at System.Threading.ThreadLocal`1.GetValueSlow()
   at Stride.Core.MicroThreading.Scheduler.get_RunningMicroThread() in D:\dev\GitControlledProjects\stride\sources\core\Stride.Core.MicroThreading\Scheduler.cs:line 79
   at Stride.Core.MicroThreading.MicroThreadSynchronizationContext.Post(SendOrPostCallback d, Object state) in D:\dev\GitControlledProjects\stride\sources\core\Stride.Core.MicroThreading\MicroThreadSynchronizationContext.cs:line 29
   at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

Log: 1: BasicCameraController(0,0): []: Fatal: The asset BasicCameraController is missing or incorrectly indexed in the package. Please report this issue.
2: MyGameApp(0,0): []: Fatal: The asset MyGameApp is missing or incorrectly indexed in the package. Please report this issue.

It looks like a threading issue due to incorrectly disposed assets so I think you're fine for this PR, likely just an existing issue.

Doprez avatar Mar 30 '25 20:03 Doprez

Okay, so my PR is now ready for review. I also used git mv to make my changes more transparent 😅

Jklawreszuk avatar Oct 29 '25 18:10 Jklawreszuk

LGTM.

Just FYI git mv doesn't change in any way how files are renamed. It's just a nice wrapper that stages the file after renaming it.

Kryptos-FR avatar Oct 29 '25 21:10 Kryptos-FR

Actually I had to move GetFormatParameters(...) method to avoid circular dependency issue for Stride.csproj project

Jklawreszuk avatar Oct 29 '25 22:10 Jklawreszuk

The last change is failing the build. Is it necessary?

Kryptos-FR avatar Oct 30 '25 21:10 Kryptos-FR

Looks like not necessarily, I have already rolled back the change

Jklawreszuk avatar Oct 30 '25 21:10 Jklawreszuk

Hadn't noticed this one, thanks for the contribution @Jklawreszuk !

Eideren avatar Nov 14 '25 13:11 Eideren