Create a .NET 6 code path for GlobalMemory#609
Merged
Perksey merged 6 commits intodotnet:mainfrom Sep 6, 2021
DmitryGolubenkov:create-net6-code-path-for-global-memory
Merged
Create a .NET 6 code path for GlobalMemory#609Perksey merged 6 commits intodotnet:mainfrom DmitryGolubenkov:create-net6-code-path-for-global-memory
Perksey merged 6 commits intodotnet:mainfrom
DmitryGolubenkov:create-net6-code-path-for-global-memory
Conversation
Member
|
Thank you for you contribution! |
Contributor
Author
|
Should I make another PR to make these changes to whole Silk.NET.Core? Or just commit everything to this? |
Member
|
Committing to this is fine |
Perksey
approved these changes
Sep 6, 2021
Member
|
Thanks again for the shear volume of contributions as of late! Really appreciate it :) |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the PR
Silk.NET.Core.csprojNativeMemoryPointerinside a preprocessorNET6_0_OR_GREATERGlobalMemory.FreeandGlobalMemory.Allocateto use the new struct.Related issues, Discord discussions, or proposals
#597
Further Comments
I don't know if this PR require testing or contain breaking changes as I am not aware of any possible problems.
I had to add
unsafetoGlobalMemory.Freeto useNativeMemorybecause that is required. And this change will affect .NET 5 and .NET Standart versions even if this change is only for .NET 6.Also: maybe it is better to use
NET6_0_OR_GREATERdirective inGlobalMemory.Free? BecauseNET6_0targets only one version, and I think next year someone will have to do this change anyway.NativeMemoryPtrrequires minimum .NET 6 too. Also I had to make some convertions line(nint)and(nuint)to be able to useNativeMemory.I think that
GlobalMemory.Allocaterequires a little work, because the preprocesor directives now are.. Confusing.Now it is:
#if NET6_0#elif !NET5_0#elseI think it is better to make
#if NET6_0#elif NET5_0#elseand make according changes to the code. Only to make the code more readable.