forked from Misaki/GhostEngine
feat(nativegen)!: refactor to struct-based native wrappers
Major overhaul of native wrapper generation for ufbx and nvtt. Replaces all hand-written and class-based wrappers with auto-generated partial struct wrappers that directly expose native API methods via pointers. Introduces a new JSON-driven configuration system using "remaps" and "actions" for flexible parameter/return mapping and method routing. Removes legacy config sections and helper classes, focusing solely on method wrappers. Updates all usages and tests to use the new pointer-based API. Cleans up obsolete code and ensures resource management is handled via struct Dispose methods. The result is a thinner, more direct, and maintainable interop layer. BREAKING CHANGE: All managed wrapper classes and helpers are removed in favor of struct-based pointer wrappers. API usage and resource management patterns have changed.
This commit is contained in:
174
src/ThridParty/Ghost.Nvtt/Wrapper/NvttContext.nativegen.cs
Normal file
174
src/ThridParty/Ghost.Nvtt/Wrapper/NvttContext.nativegen.cs
Normal file
@@ -0,0 +1,174 @@
|
||||
// <auto-generated>
|
||||
// This file is generated by Ghost.NativeWrapperGen. Do not edit manually.
|
||||
// </auto-generated>
|
||||
|
||||
namespace Ghost.Nvtt;
|
||||
|
||||
public unsafe partial struct NvttContext : System.IDisposable
|
||||
{
|
||||
// From: nvttCreateContext()
|
||||
public static NvttContext* Create()
|
||||
{
|
||||
return Api.nvttCreateContext();
|
||||
}
|
||||
|
||||
// From: nvttDestroyContext(NvttContext*)
|
||||
public void Dispose()
|
||||
{
|
||||
Api.nvttDestroyContext((NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
// From: nvttSetContextCudaAcceleration(NvttContext*, NvttBoolean)
|
||||
public void SetCudaAcceleration(NvttBoolean enable)
|
||||
{
|
||||
Api.nvttSetContextCudaAcceleration(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
enable);
|
||||
}
|
||||
|
||||
// From: nvttContextIsCudaAccelerationEnabled(NvttContext*)
|
||||
public NvttBoolean IsCudaAccelerationEnabled()
|
||||
{
|
||||
return Api.nvttContextIsCudaAccelerationEnabled((NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
// From: nvttContextOutputHeader(NvttContext*, NvttSurface*, int, NvttCompressionOptions*, NvttOutputOptions*)
|
||||
public NvttBoolean OutputHeader(NvttSurface* img, int mipmapCount, NvttCompressionOptions* compressionOptions, NvttOutputOptions* outputOptions)
|
||||
{
|
||||
return Api.nvttContextOutputHeader(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
img,
|
||||
mipmapCount,
|
||||
compressionOptions,
|
||||
outputOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextCompress(NvttContext*, NvttSurface*, int, int, NvttCompressionOptions*, NvttOutputOptions*)
|
||||
public NvttBoolean Compress(NvttSurface* img, int face, int mipmap, NvttCompressionOptions* compressionOptions, NvttOutputOptions* outputOptions)
|
||||
{
|
||||
return Api.nvttContextCompress(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
img,
|
||||
face,
|
||||
mipmap,
|
||||
compressionOptions,
|
||||
outputOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextEstimateSize(NvttContext*, NvttSurface*, int, NvttCompressionOptions*)
|
||||
public int EstimateSize(NvttSurface* img, int mipmapCount, NvttCompressionOptions* compressionOptions)
|
||||
{
|
||||
return Api.nvttContextEstimateSize(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
img,
|
||||
mipmapCount,
|
||||
compressionOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextQuantize(NvttContext*, NvttSurface*, NvttCompressionOptions*)
|
||||
public void Quantize(NvttSurface* tex, NvttCompressionOptions* compressionOptions)
|
||||
{
|
||||
Api.nvttContextQuantize(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
tex,
|
||||
compressionOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextOutputHeaderCube(NvttContext*, NvttCubeSurface*, int, NvttCompressionOptions*, NvttOutputOptions*)
|
||||
public NvttBoolean OutputHeaderCube(NvttCubeSurface* img, int mipmapCount, NvttCompressionOptions* compressionOptions, NvttOutputOptions* outputOptions)
|
||||
{
|
||||
return Api.nvttContextOutputHeaderCube(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
img,
|
||||
mipmapCount,
|
||||
compressionOptions,
|
||||
outputOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextCompressCube(NvttContext*, NvttCubeSurface*, int, NvttCompressionOptions*, NvttOutputOptions*)
|
||||
public NvttBoolean CompressCube(NvttCubeSurface* img, int mipmap, NvttCompressionOptions* compressionOptions, NvttOutputOptions* outputOptions)
|
||||
{
|
||||
return Api.nvttContextCompressCube(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
img,
|
||||
mipmap,
|
||||
compressionOptions,
|
||||
outputOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextEstimateSizeCube(NvttContext*, NvttCubeSurface*, int, NvttCompressionOptions*)
|
||||
public int EstimateSizeCube(NvttCubeSurface* img, int mipmapCount, NvttCompressionOptions* compressionOptions)
|
||||
{
|
||||
return Api.nvttContextEstimateSizeCube(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
img,
|
||||
mipmapCount,
|
||||
compressionOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextOutputHeaderData(NvttContext*, NvttTextureType, int, int, int, int, NvttBoolean, NvttCompressionOptions*, NvttOutputOptions*)
|
||||
public NvttBoolean OutputHeaderData(NvttTextureType type, int w, int h, int d, int mipmapCount, NvttBoolean isNormalMap, NvttCompressionOptions* compressionOptions, NvttOutputOptions* outputOptions)
|
||||
{
|
||||
return Api.nvttContextOutputHeaderData(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
type,
|
||||
w,
|
||||
h,
|
||||
d,
|
||||
mipmapCount,
|
||||
isNormalMap,
|
||||
compressionOptions,
|
||||
outputOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextCompressData(NvttContext*, int, int, int, int, int, float*, NvttCompressionOptions*, NvttOutputOptions*)
|
||||
public NvttBoolean CompressData(int w, int h, int d, int face, int mipmap, float* rgba, NvttCompressionOptions* compressionOptions, NvttOutputOptions* outputOptions)
|
||||
{
|
||||
return Api.nvttContextCompressData(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
w,
|
||||
h,
|
||||
d,
|
||||
face,
|
||||
mipmap,
|
||||
rgba,
|
||||
compressionOptions,
|
||||
outputOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextEstimateSizeData(NvttContext*, int, int, int, int, NvttCompressionOptions*)
|
||||
public int EstimateSizeData(int w, int h, int d, int mipmapCount, NvttCompressionOptions* compressionOptions)
|
||||
{
|
||||
return Api.nvttContextEstimateSizeData(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
w,
|
||||
h,
|
||||
d,
|
||||
mipmapCount,
|
||||
compressionOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextCompressBatch(NvttContext*, NvttBatchList*, NvttCompressionOptions*)
|
||||
public NvttBoolean CompressBatch(NvttBatchList* lst, NvttCompressionOptions* compressionOptions)
|
||||
{
|
||||
return Api.nvttContextCompressBatch(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
lst,
|
||||
compressionOptions);
|
||||
}
|
||||
|
||||
// From: nvttContextEnableTiming(NvttContext*, NvttBoolean, int)
|
||||
public void EnableTiming(NvttBoolean enable, int detailLevel)
|
||||
{
|
||||
Api.nvttContextEnableTiming(
|
||||
(NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
|
||||
enable,
|
||||
detailLevel);
|
||||
}
|
||||
|
||||
// From: nvttContextGetTimingContext(NvttContext*)
|
||||
public NvttTimingContext* GetTiming()
|
||||
{
|
||||
return Api.nvttContextGetTimingContext((NvttContext*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user