mellinoe / vk

Low-level Vulkan bindings for .NET.
Other
176 stars 35 forks source link

Upgrade to .NET Core 2.0? #12

Closed Krakean closed 6 years ago

Krakean commented 6 years ago

@mellinoe Hi. Can you please update projects files to .NET Core 2.0? I haven't .NET Core 1.1, so can't compile library actually: 3>------ Build started: Project: vk.rewrite, Configuration: Release Any CPU ------ 1>It was not possible to find any compatible framework version 1> 1>The specified framework 'Microsoft.NETCore.App', version '1.1.0' was not found. 1> 1> - Check application dependencies and target a framework version installed at: 1> 1> \ 1> 1> - Alternatively, install the framework version '1.1.0'. 1> 1>D:...\MellinoE\Vk\src\vk\vk.csproj(32,5): error MSB3073: The command "dotnet D:...\MellinoE\Vk\bin/Release/vk.generator/netcoreapp2.0/vk.generator.dll --out D:...\MellinoE\Vk\src\vk\Generated" exited with code -2147450749. 1>Done building project "vk.csproj" -- FAILED.

mellinoe commented 6 years ago

Are you not able to install version 1.1? https://www.microsoft.com/net/download/thank-you/dotnet-runtime-1.1.6-windows-x64-installer

More download options

Krakean commented 6 years ago

Why not just upgrade it to 2.0? Less dependencies, especially if your project rely on 2.0 only

mellinoe commented 6 years ago

I certainly could, I was just wondering if there's a reason you can't install 1.1. There won't be much of a difference for me (I usually have both installed), but if 2.0 is easier for folks to install than 1.1 than I'll upgrade it.

Krakean commented 6 years ago

I certainly could, I was just wondering if there's a reason you can't install 1.1

Reason is actually simple - what's the point, if we have 2.0 already and 2.1 is coming? :)

but if 2.0 is easier for folks to install than 1.1 than I'll upgrade it.

Yes, please! Upgrade it to 2.0 :) Will be nice if you do it today :)

mellinoe commented 6 years ago

I've updated it. I will probably stick with 2.0 for the forseeable future, even as newer versions are released. I could probably get the build tools to work with 1.1, 2.0, 2.1, 2.2 etc. at the same time, but it will be more effort than it is worth, IMO.

Krakean commented 6 years ago

@mellinoe Thanks. NuGet also updated, or not yet? :)

P.S. What's purpose of vk.rewrite? Is it mandatory to 'vk' function, or I can just grab sources within "vk" folder (with generated files produced by generator), copy it to my project and work with it? Point is, I trying to reduce amount of dlls within binary folder, so I grab all modules that I work with and compile it just under big one dll.

mellinoe commented 6 years ago

The two projects which target netcoreapp (vk.generator and vk.rewrite) are build tools. The actual output assembly (vk.dll) is not affected by this change at all, so there's no need to update the NuGet package. vk.dll targets netstandard1.4 -- it can effectively be used anywhere from the existing NuGet package.

What's purpose of vk.rewrite?

vk.rewrite is a post-processing tool that operates on the fully-compiled output of vk.csproj. It locates all of the native function pointers and rewrites the public wrappers for them to use the calli IL instruction. If you don't run vk.rewrite, then vk.dll will not be usable, because all of the public wrappers with throw an exception. This is an optimization which could be made optional if you wanted to use vk.dll without the rewriter. Previously, the library could be used without the rewriter, but I stopped maintaining it because there didn't seem to be much need for it. Instead of generating a bunch of IntPtr fields that contain the function pointers, you would need to change vk.generator to spit out a bunch of typed delegates which are loaded with Marshal.GetDelegateForFunctionPointer<TDelegate>(IntPtr). The public wrappers could then just invoke those delegates.

mellinoe commented 6 years ago

Here's what the generator used to do when it supported a "no-rewrite" mode: https://github.com/mellinoe/vk/commit/5b7a8d542c9fed8560cd441869d0f9d2e69a14f3#diff-ab517194efcb916f975e0f9b93990adbR84

Krakean commented 6 years ago

@mellinoe Thanks for answers