BCnEncoder.NET icon indicating copy to clipboard operation
BCnEncoder.NET copied to clipboard

.NET Framework Support

Open ameisen opened this issue 5 years ago • 16 comments

Any chance you could add a build configuration for .NET Framework (preferably 4.5)?

ameisen avatar Jan 03 '21 19:01 ameisen

Do you specifically need Framework 4.5? Would some netstandard target work? It might require a little effort since most of the internals use Span<T> but probably not impossible.

Nominom avatar Jan 03 '21 20:01 Nominom

I believe that NET Standard 1.1 or 1.2 would work (as those reflect 4.5 and 4.5.1).

I ended up implementing my own Span in my project.

ameisen avatar Jan 03 '21 20:01 ameisen

I'll see what I can do. (Also, nice cat.)

Nominom avatar Jan 03 '21 20:01 Nominom

Seems like ImageSharp (my dependency) only supports down to netstandard1.3. Would your project be able to upgrade to Framework 4.6 or 4.7?

Nominom avatar Jan 03 '21 21:01 Nominom

Unfortunately, no. It's a mod for a game that relies on XNA, so the framework is pretty locked.

What is needed in ImageSharp?

(He isn't in the room right now, but if he were he would respond probably by purring)

ameisen avatar Jan 04 '21 08:01 ameisen

ImageSharp is used for saving and loading standard image formats (jpg, png, tga..) and resizing the texture for mipmap creation. I am planning on replacing it with my own implementation eventually, but that's probably going to take a while.

If you have another way of feeding RGBA-data to the library and don't need mipmaps, then creating a dependency-free fork for net45 might be possible.

Nominom avatar Jan 04 '21 09:01 Nominom

I don't need mipmaps, and I have zero use for standard formats. The input data is raw data (BGRA, RGBA, BGR, RGB), and I expect raw BCn results (I only need BC1/2/3).

ameisen avatar Jan 04 '21 22:01 ameisen

I'll whip up a stripped-down version for net45 tonight then. Might be up on nuget by tomorrow. I probably won't be maintaining that one as actively but it's there until I can get rid of ImageSharp.

Nominom avatar Jan 05 '21 14:01 Nominom

Hey, the net45 version is up on nuget now: https://www.nuget.org/packages/BCnEncoder.Net45

Input data needs to be as a byte array in rgba format and there is no mipmap generation. For getting raw compressed bytes you can use the BcEncoder.EncodeToRawBytes API.

If you use it and find anything lacking or something not working correctly, hit me up with another issue.

Nominom avatar Jan 06 '21 12:01 Nominom

I haven't had a chance to use it yet, I've been very busy at work and haven't had an opportunity to work on this project.

ameisen avatar Jan 09 '21 02:01 ameisen

Alright. Let me know if you do and need anything changed. For now I think this issue can be marked as closed.

Nominom avatar Jan 09 '21 05:01 Nominom

hey @Nominom , any chance you plan on an update of the .NET Framework version to latest?

your library is very good, and i m trying to use it for my projects of reading game texture files but there are some problems with the .NET framework version wich got fixed at the (newer) .net standard version: i think issues in the alpha , and no BC6 support

i tried myself to convert the latest 2.1.0 version to .NET framework 4.7.2 (wich has support for .NET Standard 2.0) : but i didnt succeed and had empty textures

if you would find time (and energy), because i think you know your code better for this i would appreciate very much but anyway: still a great library ! :)

tokke001 avatar May 12 '22 16:05 tokke001

Hi!

I'm currently in the process of making version 3.0, which includes many major refactors and improvements. I could look into adding support for older .NET Standard versions in the same update. It would be quite a pain to manually import the new changes to the net45 branch since they are so different.

I can't promise anything concrete for now, but I'll reopen this issue and keep you posted!

Nominom avatar May 12 '22 17:05 Nominom

yes, i know what you mean, i noticed myself the changes between the two versions

thanks, i ll keep an eye on the project for sure !

tokke001 avatar May 12 '22 17:05 tokke001

I just made a .NET standard 2.0 port (with minimal changes), in order to use it in .NET Framework 4.8 projects. https://github.com/MonarchSolutions/BCnEncoder.NET

And here is the myget package so you can use it now: https://www.myget.org/feed/monarchsolutions/package/nuget/BCnEncoder.NetStd

Unit tests show 185/200 cases passed, so I guess maybe there are still something wrong? But at least the BC7 decode/encode is working for me. bcN-test

I should warn that I didn't measure the performance, and it should be very bad comparing to the original .NET standard 2.1 version, because I have to replace Nominom's carefully constructed high-performace span/memory codes to some very bad performance codes like Span<T>.ToArray(). My project don't care much about this performance at the moment.

UlyssesWu avatar Jul 03 '22 18:07 UlyssesWu

Is it possible to support netstandard2.0? I'm trying to write an shell extension using shellsharp which only support net framework. I can't consume netstandard2.1 from net framework.

RonaldZaZ avatar Feb 25 '23 01:02 RonaldZaZ