Refactor folder structure

This commit is contained in:
2026-02-18 00:50:46 +09:00
parent 426786397c
commit db8ca971a8
413 changed files with 2885 additions and 3634 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,189 @@
/* ============================================================================================== */
/* FMOD Core / Studio API - Error string header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2025. */
/* */
/* Use this header if you want to store or display a string version / english explanation */
/* of the FMOD error codes. */
/* */
/* For more detail visit: */
/* https://fmod.com/docs/2.03/api/core-api-common.html#fmod_result */
/* =============================================================================================== */
namespace Ghost.FMOD.Core
{
public class Error
{
public static string String(RESULT errcode)
{
switch (errcode)
{
case RESULT.OK:
return "No errors.";
case RESULT.ERR_BADCOMMAND:
return "Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound).";
case RESULT.ERR_CHANNEL_ALLOC:
return "Error trying to allocate a channel.";
case RESULT.ERR_CHANNEL_STOLEN:
return "The specified channel has been reused to play another sound.";
case RESULT.ERR_DMA:
return "DMA Failure. See debug output for more information.";
case RESULT.ERR_DSP_CONNECTION:
return "DSP connection error. Connection possibly caused a cyclic dependency or connected dsps with incompatible buffer counts.";
case RESULT.ERR_DSP_DONTPROCESS:
return "DSP return code from a DSP process query callback. Tells mixer not to call the process callback and therefore not consume CPU. Use this to optimize the DSP graph.";
case RESULT.ERR_DSP_FORMAT:
return "DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format, or a matrix may have been set with the wrong size if the target unit has a specified channel map.";
case RESULT.ERR_DSP_INUSE:
return "DSP is already in the mixer's DSP network. It must be removed before being reinserted or released.";
case RESULT.ERR_DSP_NOTFOUND:
return "DSP connection error. Couldn't find the DSP unit specified.";
case RESULT.ERR_DSP_RESERVED:
return "DSP operation error. Cannot perform operation on this DSP as it is reserved by the system.";
case RESULT.ERR_DSP_SILENCE:
return "DSP return code from a DSP process query callback. Tells mixer silence would be produced from read, so go idle and not consume CPU. Use this to optimize the DSP graph.";
case RESULT.ERR_DSP_TYPE:
return "DSP operation cannot be performed on a DSP of this type.";
case RESULT.ERR_FILE_BAD:
return "Error loading file.";
case RESULT.ERR_FILE_COULDNOTSEEK:
return "Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format.";
case RESULT.ERR_FILE_DISKEJECTED:
return "Media was ejected while reading.";
case RESULT.ERR_FILE_EOF:
return "End of file unexpectedly reached while trying to read essential data (truncated?).";
case RESULT.ERR_FILE_ENDOFDATA:
return "End of current chunk reached while trying to read data.";
case RESULT.ERR_FILE_NOTFOUND:
return "File not found.";
case RESULT.ERR_FORMAT:
return "Unsupported file or audio format.";
case RESULT.ERR_HEADER_MISMATCH:
return "There is a version mismatch between the FMOD header and either the FMOD Studio library or the FMOD Low Level library.";
case RESULT.ERR_HTTP:
return "A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere.";
case RESULT.ERR_HTTP_ACCESS:
return "The specified resource requires authentication or is forbidden.";
case RESULT.ERR_HTTP_PROXY_AUTH:
return "Proxy authentication is required to access the specified resource.";
case RESULT.ERR_HTTP_SERVER_ERROR:
return "A HTTP server error occurred.";
case RESULT.ERR_HTTP_TIMEOUT:
return "The HTTP request timed out.";
case RESULT.ERR_INITIALIZATION:
return "FMOD was not initialized correctly to support this function.";
case RESULT.ERR_INITIALIZED:
return "Cannot call this command after System::init.";
case RESULT.ERR_INTERNAL:
return "An error occured in the FMOD system. Use the logging version of FMOD for more information.";
case RESULT.ERR_INVALID_FLOAT:
return "Value passed in was a NaN, Inf or denormalized float.";
case RESULT.ERR_INVALID_HANDLE:
return "An invalid object handle was used.";
case RESULT.ERR_INVALID_PARAM:
return "An invalid parameter was passed to this function.";
case RESULT.ERR_INVALID_POSITION:
return "An invalid seek position was passed to this function.";
case RESULT.ERR_INVALID_SPEAKER:
return "An invalid speaker was passed to this function based on the current speaker mode.";
case RESULT.ERR_INVALID_SYNCPOINT:
return "The syncpoint did not come from this sound handle.";
case RESULT.ERR_INVALID_THREAD:
return "Tried to call a function on a thread that is not supported.";
case RESULT.ERR_INVALID_VECTOR:
return "The vectors passed in are not unit length, or perpendicular.";
case RESULT.ERR_MAXAUDIBLE:
return "Reached maximum audible playback count for this sound's soundgroup.";
case RESULT.ERR_MEMORY:
return "Not enough memory or resources.";
case RESULT.ERR_MEMORY_CANTPOINT:
return "Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used.";
case RESULT.ERR_NEEDS3D:
return "Tried to call a command on a 2d sound when the command was meant for 3d sound.";
case RESULT.ERR_NEEDSHARDWARE:
return "Tried to use a feature that requires hardware support.";
case RESULT.ERR_NET_CONNECT:
return "Couldn't connect to the specified host.";
case RESULT.ERR_NET_SOCKET_ERROR:
return "A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere.";
case RESULT.ERR_NET_URL:
return "The specified URL couldn't be resolved.";
case RESULT.ERR_NET_WOULD_BLOCK:
return "Operation on a non-blocking socket could not complete immediately.";
case RESULT.ERR_NOTREADY:
return "Operation could not be performed because specified sound/DSP connection is not ready.";
case RESULT.ERR_OUTPUT_ALLOCATED:
return "Error initializing output device, but more specifically, the output device is already in use and cannot be reused.";
case RESULT.ERR_OUTPUT_CREATEBUFFER:
return "Error creating hardware sound buffer.";
case RESULT.ERR_OUTPUT_DRIVERCALL:
return "A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted.";
case RESULT.ERR_OUTPUT_FORMAT:
return "Soundcard does not support the specified format.";
case RESULT.ERR_OUTPUT_INIT:
return "Error initializing output device.";
case RESULT.ERR_OUTPUT_NODRIVERS:
return "The output device has no drivers installed. If pre-init, FMOD_OUTPUT_NOSOUND is selected as the output mode. If post-init, the function just fails.";
case RESULT.ERR_PLUGIN:
return "An unspecified error has been returned from a plugin.";
case RESULT.ERR_PLUGIN_MISSING:
return "A requested output, dsp unit type or codec was not available.";
case RESULT.ERR_PLUGIN_RESOURCE:
return "A resource that the plugin requires cannot be allocated or found. (ie the DLS file for MIDI playback)";
case RESULT.ERR_PLUGIN_VERSION:
return "A plugin was built with an unsupported SDK version.";
case RESULT.ERR_RECORD:
return "An error occurred trying to initialize the recording device.";
case RESULT.ERR_REVERB_CHANNELGROUP:
return "Reverb properties cannot be set on this channel because a parent channelgroup owns the reverb connection.";
case RESULT.ERR_REVERB_INSTANCE:
return "Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesn't exist.";
case RESULT.ERR_SUBSOUNDS:
return "The error occurred because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound.";
case RESULT.ERR_SUBSOUND_ALLOCATED:
return "This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first.";
case RESULT.ERR_SUBSOUND_CANTMOVE:
return "Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file.";
case RESULT.ERR_TAGNOTFOUND:
return "The specified tag could not be found or there are no tags.";
case RESULT.ERR_TOOMANYCHANNELS:
return "The sound created exceeds the allowable input channel count. This can be increased using the 'maxinputchannels' parameter in System::setSoftwareFormat.";
case RESULT.ERR_TRUNCATED:
return "The retrieved string is too long to fit in the supplied buffer and has been truncated.";
case RESULT.ERR_UNIMPLEMENTED:
return "Something in FMOD hasn't been implemented when it should be. Contact support.";
case RESULT.ERR_UNINITIALIZED:
return "This command failed because System::init or System::setDriver was not called.";
case RESULT.ERR_UNSUPPORTED:
return "A command issued was not supported by this object. Possibly a plugin without certain callbacks specified.";
case RESULT.ERR_VERSION:
return "The version number of this file format is not supported.";
case RESULT.ERR_EVENT_ALREADY_LOADED:
return "The specified bank has already been loaded.";
case RESULT.ERR_EVENT_LIVEUPDATE_BUSY:
return "The live update connection failed due to the game already being connected.";
case RESULT.ERR_EVENT_LIVEUPDATE_MISMATCH:
return "The live update connection failed due to the game data being out of sync with the tool.";
case RESULT.ERR_EVENT_LIVEUPDATE_TIMEOUT:
return "The live update connection timed out.";
case RESULT.ERR_EVENT_NOTFOUND:
return "The requested event, bus or vca could not be found.";
case RESULT.ERR_STUDIO_UNINITIALIZED:
return "The Studio::System object is not yet initialized.";
case RESULT.ERR_STUDIO_NOT_LOADED:
return "The specified resource is not loaded, so it can't be unloaded.";
case RESULT.ERR_INVALID_STRING:
return "An invalid string was passed to this function.";
case RESULT.ERR_ALREADY_LOCKED:
return "The specified resource is already locked.";
case RESULT.ERR_NOT_LOCKED:
return "The specified resource is not locked, so it can't be unlocked.";
case RESULT.ERR_RECORD_DISCONNECTED:
return "The specified recording driver has been disconnected.";
case RESULT.ERR_TOOMANYSAMPLES:
return "The length provided exceed the allowable limit.";
default:
return "Unknown error.";
}
}
}
}

View File

@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<IsAotCompatible>True</IsAotCompatible>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<IsAotCompatible>True</IsAotCompatible>
</PropertyGroup>
<ItemGroup>
<None Remove="fmod.dll" />
<None Remove="fmodstudio.dll" />
</ItemGroup>
<ItemGroup>
<Content Include="runtime\win-x64\native\fmod.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="runtime\win-x64\native\fmodstudio.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,283 @@
using System.Runtime.InteropServices;
namespace Ghost.MeshOptimizer;
public static unsafe partial class Api
{
private const string _DLL_NAME = "meshoptimizer";
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_generateVertexRemap([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const void *")] void* vertices, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_generateVertexRemapMulti([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("const struct meshopt_Stream *")] meshopt_Stream* streams, [NativeTypeName("size_t")] nuint stream_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_generateVertexRemapCustom([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, [NativeTypeName("int (*)(void *, unsigned int, unsigned int)")] delegate* unmanaged[Cdecl]<void*, uint, uint, int> callback, void* context);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_remapVertexBuffer(void* destination, [NativeTypeName("const void *")] void* vertices, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_size, [NativeTypeName("const unsigned int *")] uint* remap);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_remapIndexBuffer([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const unsigned int *")] uint* remap);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_generateShadowIndexBuffer([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const void *")] void* vertices, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_size, [NativeTypeName("size_t")] nuint vertex_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_generateShadowIndexBufferMulti([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("const struct meshopt_Stream *")] meshopt_Stream* streams, [NativeTypeName("size_t")] nuint stream_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_generatePositionRemap([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_generateAdjacencyIndexBuffer([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_generateTessellationIndexBuffer([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_generateProvokingIndexBuffer([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("unsigned int *")] uint* reorder, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_optimizeVertexCache([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_optimizeVertexCacheStrip([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_optimizeVertexCacheFifo([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("unsigned int")] uint cache_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_optimizeOverdraw([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, float threshold);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_optimizeVertexFetch(void* destination, [NativeTypeName("unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const void *")] void* vertices, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_optimizeVertexFetchRemap([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_encodeIndexBuffer([NativeTypeName("unsigned char *")] byte* buffer, [NativeTypeName("size_t")] nuint buffer_size, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_encodeIndexBufferBound([NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_encodeIndexVersion(int version);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int meshopt_decodeIndexBuffer(void* destination, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint index_size, [NativeTypeName("const unsigned char *")] byte* buffer, [NativeTypeName("size_t")] nuint buffer_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int meshopt_decodeIndexVersion([NativeTypeName("const unsigned char *")] byte* buffer, [NativeTypeName("size_t")] nuint buffer_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_encodeIndexSequence([NativeTypeName("unsigned char *")] byte* buffer, [NativeTypeName("size_t")] nuint buffer_size, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_encodeIndexSequenceBound([NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int meshopt_decodeIndexSequence(void* destination, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint index_size, [NativeTypeName("const unsigned char *")] byte* buffer, [NativeTypeName("size_t")] nuint buffer_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_encodeVertexBuffer([NativeTypeName("unsigned char *")] byte* buffer, [NativeTypeName("size_t")] nuint buffer_size, [NativeTypeName("const void *")] void* vertices, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_encodeVertexBufferBound([NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_encodeVertexBufferLevel([NativeTypeName("unsigned char *")] byte* buffer, [NativeTypeName("size_t")] nuint buffer_size, [NativeTypeName("const void *")] void* vertices, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_size, int level, int version);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_encodeVertexVersion(int version);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int meshopt_decodeVertexBuffer(void* destination, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_size, [NativeTypeName("const unsigned char *")] byte* buffer, [NativeTypeName("size_t")] nuint buffer_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int meshopt_decodeVertexVersion([NativeTypeName("const unsigned char *")] byte* buffer, [NativeTypeName("size_t")] nuint buffer_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_decodeFilterOct(void* buffer, [NativeTypeName("size_t")] nuint count, [NativeTypeName("size_t")] nuint stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_decodeFilterQuat(void* buffer, [NativeTypeName("size_t")] nuint count, [NativeTypeName("size_t")] nuint stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_decodeFilterExp(void* buffer, [NativeTypeName("size_t")] nuint count, [NativeTypeName("size_t")] nuint stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_decodeFilterColor(void* buffer, [NativeTypeName("size_t")] nuint count, [NativeTypeName("size_t")] nuint stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_encodeFilterOct(void* destination, [NativeTypeName("size_t")] nuint count, [NativeTypeName("size_t")] nuint stride, int bits, [NativeTypeName("const float *")] float* data);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_encodeFilterQuat(void* destination, [NativeTypeName("size_t")] nuint count, [NativeTypeName("size_t")] nuint stride, int bits, [NativeTypeName("const float *")] float* data);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_encodeFilterExp(void* destination, [NativeTypeName("size_t")] nuint count, [NativeTypeName("size_t")] nuint stride, int bits, [NativeTypeName("const float *")] float* data, [NativeTypeName("enum meshopt_EncodeExpMode")] meshopt_EncodeExpMode mode);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_encodeFilterColor(void* destination, [NativeTypeName("size_t")] nuint count, [NativeTypeName("size_t")] nuint stride, int bits, [NativeTypeName("const float *")] float* data);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_simplify([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, [NativeTypeName("size_t")] nuint target_index_count, float target_error, [NativeTypeName("unsigned int")] uint options, float* result_error);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_simplifyWithAttributes([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, [NativeTypeName("const float *")] float* vertex_attributes, [NativeTypeName("size_t")] nuint vertex_attributes_stride, [NativeTypeName("const float *")] float* attribute_weights, [NativeTypeName("size_t")] nuint attribute_count, [NativeTypeName("const unsigned char *")] byte* vertex_lock, [NativeTypeName("size_t")] nuint target_index_count, float target_error, [NativeTypeName("unsigned int")] uint options, float* result_error);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_simplifyWithUpdate([NativeTypeName("unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, float* vertex_attributes, [NativeTypeName("size_t")] nuint vertex_attributes_stride, [NativeTypeName("const float *")] float* attribute_weights, [NativeTypeName("size_t")] nuint attribute_count, [NativeTypeName("const unsigned char *")] byte* vertex_lock, [NativeTypeName("size_t")] nuint target_index_count, float target_error, [NativeTypeName("unsigned int")] uint options, float* result_error);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_simplifySloppy([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, [NativeTypeName("const unsigned char *")] byte* vertex_lock, [NativeTypeName("size_t")] nuint target_index_count, float target_error, float* result_error);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_simplifyPrune([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, float target_error);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_simplifyPoints([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, [NativeTypeName("const float *")] float* vertex_colors, [NativeTypeName("size_t")] nuint vertex_colors_stride, float color_weight, [NativeTypeName("size_t")] nuint target_vertex_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float meshopt_simplifyScale([NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_stripify([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("unsigned int")] uint restart_index);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_stripifyBound([NativeTypeName("size_t")] nuint index_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_unstripify([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("unsigned int")] uint restart_index);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_unstripifyBound([NativeTypeName("size_t")] nuint index_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("struct meshopt_VertexCacheStatistics")]
public static extern meshopt_VertexCacheStatistics meshopt_analyzeVertexCache([NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("unsigned int")] uint cache_size, [NativeTypeName("unsigned int")] uint warp_size, [NativeTypeName("unsigned int")] uint primgroup_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("struct meshopt_VertexFetchStatistics")]
public static extern meshopt_VertexFetchStatistics meshopt_analyzeVertexFetch([NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("struct meshopt_OverdrawStatistics")]
public static extern meshopt_OverdrawStatistics meshopt_analyzeOverdraw([NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("struct meshopt_CoverageStatistics")]
public static extern meshopt_CoverageStatistics meshopt_analyzeCoverage([NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_buildMeshlets([NativeTypeName("struct meshopt_Meshlet *")] meshopt_Meshlet* meshlets, [NativeTypeName("unsigned int *")] uint* meshlet_vertices, [NativeTypeName("unsigned char *")] byte* meshlet_triangles, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, [NativeTypeName("size_t")] nuint max_vertices, [NativeTypeName("size_t")] nuint max_triangles, float cone_weight);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_buildMeshletsScan([NativeTypeName("struct meshopt_Meshlet *")] meshopt_Meshlet* meshlets, [NativeTypeName("unsigned int *")] uint* meshlet_vertices, [NativeTypeName("unsigned char *")] byte* meshlet_triangles, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint max_vertices, [NativeTypeName("size_t")] nuint max_triangles);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_buildMeshletsBound([NativeTypeName("size_t")] nuint index_count, [NativeTypeName("size_t")] nuint max_vertices, [NativeTypeName("size_t")] nuint max_triangles);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_buildMeshletsFlex([NativeTypeName("struct meshopt_Meshlet *")] meshopt_Meshlet* meshlets, [NativeTypeName("unsigned int *")] uint* meshlet_vertices, [NativeTypeName("unsigned char *")] byte* meshlet_triangles, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, [NativeTypeName("size_t")] nuint max_vertices, [NativeTypeName("size_t")] nuint min_triangles, [NativeTypeName("size_t")] nuint max_triangles, float cone_weight, float split_factor);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_buildMeshletsSpatial([NativeTypeName("struct meshopt_Meshlet *")] meshopt_Meshlet* meshlets, [NativeTypeName("unsigned int *")] uint* meshlet_vertices, [NativeTypeName("unsigned char *")] byte* meshlet_triangles, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, [NativeTypeName("size_t")] nuint max_vertices, [NativeTypeName("size_t")] nuint min_triangles, [NativeTypeName("size_t")] nuint max_triangles, float fill_weight);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_optimizeMeshlet([NativeTypeName("unsigned int *")] uint* meshlet_vertices, [NativeTypeName("unsigned char *")] byte* meshlet_triangles, [NativeTypeName("size_t")] nuint triangle_count, [NativeTypeName("size_t")] nuint vertex_count);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("struct meshopt_Bounds")]
public static extern meshopt_Bounds meshopt_computeClusterBounds([NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("struct meshopt_Bounds")]
public static extern meshopt_Bounds meshopt_computeMeshletBounds([NativeTypeName("const unsigned int *")] uint* meshlet_vertices, [NativeTypeName("const unsigned char *")] byte* meshlet_triangles, [NativeTypeName("size_t")] nuint triangle_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("struct meshopt_Bounds")]
public static extern meshopt_Bounds meshopt_computeSphereBounds([NativeTypeName("const float *")] float* positions, [NativeTypeName("size_t")] nuint count, [NativeTypeName("size_t")] nuint positions_stride, [NativeTypeName("const float *")] float* radii, [NativeTypeName("size_t")] nuint radii_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint meshopt_partitionClusters([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* cluster_indices, [NativeTypeName("size_t")] nuint total_index_count, [NativeTypeName("const unsigned int *")] uint* cluster_index_counts, [NativeTypeName("size_t")] nuint cluster_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, [NativeTypeName("size_t")] nuint target_partition_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_spatialSortRemap([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_spatialSortTriangles([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const unsigned int *")] uint* indices, [NativeTypeName("size_t")] nuint index_count, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_spatialClusterPoints([NativeTypeName("unsigned int *")] uint* destination, [NativeTypeName("const float *")] float* vertex_positions, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_positions_stride, [NativeTypeName("size_t")] nuint cluster_size);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("unsigned short")]
public static extern ushort meshopt_quantizeHalf(float v);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float meshopt_quantizeFloat(float v, int N);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float meshopt_dequantizeHalf([NativeTypeName("unsigned short")] ushort h);
[DllImport(_DLL_NAME, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void meshopt_setAllocator([NativeTypeName("void *(*)(size_t) __attribute__((cdecl))")] delegate* unmanaged[Cdecl]<nuint, void*> allocate, [NativeTypeName("void (*)(void *) __attribute__((cdecl))")] delegate* unmanaged[Cdecl]<void*, void> deallocate);
public static int meshopt_quantizeUnorm(float v, int N)
{
var scale = (float)((1 << N) - 1);
v = (v >= 0) ? v : 0;
v = (v <= 1) ? v : 1;
return (int)(v * scale + 0.5f);
}
public static int meshopt_quantizeSnorm(float v, int N)
{
var scale = (float)((1 << (N - 1)) - 1);
var round = (v >= 0 ? 0.5f : -0.5f);
v = (v >= -1) ? v : -1;
v = (v <= +1) ? v : +1;
return (int)(v * scale + round);
}
[return: NativeTypeName("size_t")]
public static nuint meshopt_encodeVertexBufferLevel([NativeTypeName("unsigned char *")] byte* buffer, [NativeTypeName("size_t")] nuint buffer_size, [NativeTypeName("const void *")] void* vertices, [NativeTypeName("size_t")] nuint vertex_count, [NativeTypeName("size_t")] nuint vertex_size, int level)
{
return meshopt_encodeVertexBufferLevel(buffer, buffer_size, vertices, vertex_count, vertex_size, level, unchecked(-1));
}
}

View File

@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<IsAotCompatible>True</IsAotCompatible>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<IsAotCompatible>True</IsAotCompatible>
</PropertyGroup>
<ItemGroup>
<Content Include="runtime\win-x64\native\meshoptimizer.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,22 @@
using System.Diagnostics;
namespace Ghost.MeshOptimizer
{
/// <summary>Defines the annotation found in a native declaration.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
[Conditional("DEBUG")]
internal sealed partial class NativeAnnotationAttribute : Attribute
{
private readonly string _annotation;
/// <summary>Initializes a new instance of the <see cref="NativeAnnotationAttribute" /> class.</summary>
/// <param name="annotation">The annotation that was used in the native declaration.</param>
public NativeAnnotationAttribute(string annotation)
{
_annotation = annotation;
}
/// <summary>Gets the annotation that was used in the native declaration.</summary>
public string Annotation => _annotation;
}
}

View File

@@ -0,0 +1,22 @@
using System.Diagnostics;
namespace Ghost.MeshOptimizer
{
/// <summary>Defines the type of a member as it was used in the native signature.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = true)]
[Conditional("DEBUG")]
internal sealed partial class NativeTypeNameAttribute : Attribute
{
private readonly string _name;
/// <summary>Initializes a new instance of the <see cref="NativeTypeNameAttribute" /> class.</summary>
/// <param name="name">The name of the type that was used in the native signature.</param>
public NativeTypeNameAttribute(string name)
{
_name = name;
}
/// <summary>Gets the name of the type that was used in the native signature.</summary>
public string Name => _name;
}
}

View File

@@ -0,0 +1,120 @@
using Ghost.Zeux.MeshOptimizer;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Ghost.MeshOptimizer
{
public unsafe partial struct meshopt_Allocator
{
private static readonly Storage s_storage;
[NativeTypeName("void *[24]")]
private _blocks_e__FixedBuffer _blocks;
[NativeTypeName("size_t")]
private nuint _count;
static meshopt_Allocator()
{
s_storage = new Storage
{
// Use .NET's unmanaged memory functions.
allocate = &NativeMemory_Alloc,
deallocate = &NativeMemory_Free,
};
}
public meshopt_Allocator()
{
_count = 0;
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static void* NativeMemory_Alloc(nuint size)
{
return NativeMemory.Alloc(size);
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static void NativeMemory_Free(void* ptr)
{
NativeMemory.Free(ptr);
}
public T* allocate<T>(nuint size) where T : unmanaged
{
Debug.Assert(_count < 24, "Allocator block limit reached");
// Calculate total bytes needed
var bytes = size * (nuint)sizeof(T);
var result = (T*)s_storage.allocate(bytes);
_blocks[_count++] = result;
return result;
}
public void deallocate(void* ptr)
{
Debug.Assert(_count > 0 && _blocks[_count - 1] == ptr, "Deallocation is not in LIFO order");
s_storage.deallocate(ptr);
_count--;
}
public unsafe partial struct Storage
{
[NativeTypeName("void *(*)(size_t) __attribute__((cdecl))")]
public delegate* unmanaged[Cdecl]<nuint, void*> allocate;
[NativeTypeName("void (*)(void *) __attribute__((cdecl))")]
public delegate* unmanaged[Cdecl]<void*, void> deallocate;
}
public void Dispose()
{
for (var i = _count; i > 0; --i)
{
s_storage.deallocate(_blocks[i - 1]);
}
}
private unsafe partial struct _blocks_e__FixedBuffer
{
private void* e0;
private void* e1;
private void* e2;
private void* e3;
private void* e4;
private void* e5;
private void* e6;
private void* e7;
private void* e8;
private void* e9;
private void* e10;
private void* e11;
private void* e12;
private void* e13;
private void* e14;
private void* e15;
private void* e16;
private void* e17;
private void* e18;
private void* e19;
private void* e20;
private void* e21;
private void* e22;
private void* e23;
public ref void* this[nuint index]
{
get
{
fixed (void** pThis = &e0)
{
return ref pThis[index];
}
}
}
}
}
}

View File

@@ -0,0 +1,51 @@
using Ghost.Zeux.MeshOptimizer;
using System.Runtime.CompilerServices;
namespace Ghost.MeshOptimizer
{
public partial struct meshopt_Bounds
{
[NativeTypeName("float[3]")]
public _center_e__FixedBuffer center;
public float radius;
[NativeTypeName("float[3]")]
public _cone_apex_e__FixedBuffer cone_apex;
[NativeTypeName("float[3]")]
public _cone_axis_e__FixedBuffer cone_axis;
public float cone_cutoff;
[NativeTypeName("signed char[3]")]
public _cone_axis_s8_e__FixedBuffer cone_axis_s8;
[NativeTypeName("signed char")]
public sbyte cone_cutoff_s8;
[InlineArray(3)]
public partial struct _center_e__FixedBuffer
{
public float e0;
}
[InlineArray(3)]
public partial struct _cone_apex_e__FixedBuffer
{
public float e0;
}
[InlineArray(3)]
public partial struct _cone_axis_e__FixedBuffer
{
public float e0;
}
[InlineArray(3)]
public partial struct _cone_axis_s8_e__FixedBuffer
{
public sbyte e0;
}
}
}

View File

@@ -0,0 +1,19 @@
using Ghost.Zeux.MeshOptimizer;
using System.Runtime.CompilerServices;
namespace Ghost.MeshOptimizer
{
public partial struct meshopt_CoverageStatistics
{
[NativeTypeName("float[3]")]
public _coverage_e__FixedBuffer coverage;
public float extent;
[InlineArray(3)]
public partial struct _coverage_e__FixedBuffer
{
public float e0;
}
}
}

View File

@@ -0,0 +1,10 @@
namespace Ghost.MeshOptimizer
{
public enum meshopt_EncodeExpMode
{
meshopt_EncodeExpSeparate,
meshopt_EncodeExpSharedVector,
meshopt_EncodeExpSharedComponent,
meshopt_EncodeExpClamped,
}
}

View File

@@ -0,0 +1,19 @@
using Ghost.Zeux.MeshOptimizer;
namespace Ghost.MeshOptimizer
{
public partial struct meshopt_Meshlet
{
[NativeTypeName("unsigned int")]
public uint vertex_offset;
[NativeTypeName("unsigned int")]
public uint triangle_offset;
[NativeTypeName("unsigned int")]
public uint vertex_count;
[NativeTypeName("unsigned int")]
public uint triangle_count;
}
}

View File

@@ -0,0 +1,15 @@
using Ghost.Zeux.MeshOptimizer;
namespace Ghost.MeshOptimizer
{
public partial struct meshopt_OverdrawStatistics
{
[NativeTypeName("unsigned int")]
public uint pixels_covered;
[NativeTypeName("unsigned int")]
public uint pixels_shaded;
public float overdraw;
}
}

View File

@@ -0,0 +1,12 @@
namespace Ghost.MeshOptimizer
{
public enum meshopt_SimplifyOptions
{
meshopt_SimplifyLockBorder = 1 << 0,
meshopt_SimplifySparse = 1 << 1,
meshopt_SimplifyErrorAbsolute = 1 << 2,
meshopt_SimplifyPrune = 1 << 3,
meshopt_SimplifyRegularize = 1 << 4,
meshopt_SimplifyPermissive = 1 << 5,
}
}

View File

@@ -0,0 +1,8 @@
namespace Ghost.MeshOptimizer
{
public enum meshopt_SimplifyVertexFlags
{
meshopt_SimplifyVertex_Lock = 1 << 0,
meshopt_SimplifyVertex_Protect = 1 << 1,
}
}

View File

@@ -0,0 +1,16 @@
using Ghost.Zeux.MeshOptimizer;
namespace Ghost.MeshOptimizer
{
public unsafe partial struct meshopt_Stream
{
[NativeTypeName("const void *")]
public void* data;
[NativeTypeName("size_t")]
public nuint size;
[NativeTypeName("size_t")]
public nuint stride;
}
}

View File

@@ -0,0 +1,17 @@
using Ghost.Zeux.MeshOptimizer;
namespace Ghost.MeshOptimizer
{
public partial struct meshopt_VertexCacheStatistics
{
[NativeTypeName("unsigned int")]
public uint vertices_transformed;
[NativeTypeName("unsigned int")]
public uint warps_executed;
public float acmr;
public float atvr;
}
}

View File

@@ -0,0 +1,12 @@
using Ghost.Zeux.MeshOptimizer;
namespace Ghost.MeshOptimizer
{
public partial struct meshopt_VertexFetchStatistics
{
[NativeTypeName("unsigned int")]
public uint bytes_fetched;
public float overfetch;
}
}

View File

@@ -0,0 +1,721 @@
using System.Runtime.InteropServices;
namespace Ghost.Nvtt
{
public static unsafe partial class Api
{
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttIsCudaSupported();
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttUseCurrentDevice();
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttCPUInputBuffer* nvttCreateCPUInputBuffer([NativeTypeName("const NvttRefImage *")] NvttRefImage* images, NvttValueType value_type, int numImages, int tile_w, int tile_h, float WeightR, float WeightG, float WeightB, float WeightA, NvttTimingContext* tc, [NativeTypeName("unsigned int *")] uint* num_tiles);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttDestroyCPUInputBuffer(NvttCPUInputBuffer* input);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttCPUInputBufferNumTiles([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttCPUInputBufferTileSize([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, int* tile_w, int* tile_h);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttValueType nvttCPUInputBufferType([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttGPUInputBuffer* nvttCreateGPUInputBuffer([NativeTypeName("const NvttRefImage *")] NvttRefImage* images, NvttValueType value_type, int numImages, int tile_w, int tile_h, float WeightR, float WeightG, float WeightB, float WeightA, NvttTimingContext* tc, [NativeTypeName("unsigned int *")] uint* num_tiles);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttDestroyGPUInputBuffer(NvttGPUInputBuffer* input);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttGPUInputBufferNumTiles([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttGPUInputBufferTileSize([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, int* tile_w, int* tile_h);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttValueType nvttGPUInputBufferType([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttEncodeCPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, void* output, [NativeTypeName("const NvttEncodeSettings *")] NvttEncodeSettings* settings);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttEncodeGPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, void* output, [NativeTypeName("const NvttEncodeSettings *")] NvttEncodeSettings* settings);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC1CPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean fast_mode, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC1GPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, NvttBoolean fast_mode, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC1ACPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean fast_mode, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC1AGPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC2CPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean fast_mode, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC2GPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC3CPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean fast_mode, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC3GPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC3NCPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, int qualityLevel, void* output, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC3RGBMCPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC4CPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean slow_mode, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC4GPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC4SCPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean slow_mode, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC4SGPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeATI2CPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean slow_mode, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeATI2GPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC5CPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean slow_mode, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC5GPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC5SCPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean slow_mode, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC5SGPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC6HCPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean slow_mode, NvttBoolean is_signed, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC6HGPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, NvttBoolean is_signed, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC7CPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, NvttBoolean slow_mode, NvttBoolean imageHasAlpha, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeBC7GPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, NvttBoolean imageHasAlpha, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeASTCCPU([NativeTypeName("const NvttCPUInputBuffer *")] NvttCPUInputBuffer* input, int qualityLevel, NvttBoolean imageHasAlpha, void* output, NvttBoolean useGpu, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttEncodeASTCGPU([NativeTypeName("const NvttGPUInputBuffer *")] NvttGPUInputBuffer* input, int qualityLevel, NvttBoolean imageHasAlpha, void* output, NvttBoolean to_device_mem, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttCompressionOptions* nvttCreateCompressionOptions();
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttDestroyCompressionOptions(NvttCompressionOptions* compressionOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttResetCompressionOptions(NvttCompressionOptions* compressionOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetCompressionOptionsFormat(NvttCompressionOptions* compressionOptions, NvttFormat format);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetCompressionOptionsQuality(NvttCompressionOptions* compressionOptions, NvttQuality quality);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions* compressionOptions, float red, float green, float blue, float alpha);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions* compressionOptions, [NativeTypeName("unsigned int")] uint bitcount, [NativeTypeName("unsigned int")] uint rmask, [NativeTypeName("unsigned int")] uint gmask, [NativeTypeName("unsigned int")] uint bmask, [NativeTypeName("unsigned int")] uint amask);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetCompressionOptionsPixelType(NvttCompressionOptions* compressionOptions, NvttPixelType pixelType);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetCompressionOptionsPitchAlignment(NvttCompressionOptions* compressionOptions, int pitchAlignment);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetCompressionOptionsQuantization(NvttCompressionOptions* compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("unsigned int")]
public static extern uint nvttGetCompressionOptionsD3D9Format([NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttOutputOptions* nvttCreateOutputOptions();
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttDestroyOutputOptions(NvttOutputOptions* outputOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttResetOutputOptions(NvttOutputOptions* outputOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetOutputOptionsFileName(NvttOutputOptions* outputOptions, [NativeTypeName("const char *")] sbyte* fileName);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetOutputOptionsFileHandle(NvttOutputOptions* outputOptions, void* fp);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetOutputOptionsOutputHandler(NvttOutputOptions* outputOptions, [NativeTypeName("nvttBeginImageHandler")] delegate* unmanaged[Cdecl]<int, int, int, int, int, int, void> beginImageHandler, [NativeTypeName("nvttOutputHandler")] delegate* unmanaged[Cdecl]<void*, int, NvttBoolean> outputHandler, [NativeTypeName("nvttEndImageHandler")] IntPtr endImageHandler);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetOutputOptionsErrorHandler(NvttOutputOptions* outputOptions, [NativeTypeName("nvttErrorHandler")] delegate* unmanaged[Cdecl]<NvttError, void> errorHandler);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetOutputOptionsOutputHeader(NvttOutputOptions* outputOptions, NvttBoolean b);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetOutputOptionsContainer(NvttOutputOptions* outputOptions, NvttContainer container);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetOutputOptionsUserVersion(NvttOutputOptions* outputOptions, int version);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetOutputOptionsSrgbFlag(NvttOutputOptions* outputOptions, NvttBoolean b);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttContext* nvttCreateContext();
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttDestroyContext(NvttContext* context);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetContextCudaAcceleration(NvttContext* context, NvttBoolean enable);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttContextIsCudaAccelerationEnabled([NativeTypeName("const NvttContext *")] NvttContext* context);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttContextOutputHeader([NativeTypeName("const NvttContext *")] NvttContext* context, [NativeTypeName("const NvttSurface *")] NvttSurface* img, int mipmapCount, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions, [NativeTypeName("const NvttOutputOptions *")] NvttOutputOptions* outputOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttContextCompress([NativeTypeName("const NvttContext *")] NvttContext* context, [NativeTypeName("const NvttSurface *")] NvttSurface* img, int face, int mipmap, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions, [NativeTypeName("const NvttOutputOptions *")] NvttOutputOptions* outputOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttContextEstimateSize([NativeTypeName("const NvttContext *")] NvttContext* context, [NativeTypeName("const NvttSurface *")] NvttSurface* img, int mipmapCount, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttContextQuantize([NativeTypeName("const NvttContext *")] NvttContext* context, NvttSurface* tex, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttContextOutputHeaderCube([NativeTypeName("const NvttContext *")] NvttContext* context, [NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* img, int mipmapCount, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions, [NativeTypeName("const NvttOutputOptions *")] NvttOutputOptions* outputOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttContextCompressCube([NativeTypeName("const NvttContext *")] NvttContext* context, [NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* img, int mipmap, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions, [NativeTypeName("const NvttOutputOptions *")] NvttOutputOptions* outputOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttContextEstimateSizeCube([NativeTypeName("const NvttContext *")] NvttContext* context, [NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* img, int mipmapCount, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttContextOutputHeaderData([NativeTypeName("const NvttContext *")] NvttContext* context, NvttTextureType type, int w, int h, int d, int mipmapCount, NvttBoolean isNormalMap, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions, [NativeTypeName("const NvttOutputOptions *")] NvttOutputOptions* outputOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttContextCompressData([NativeTypeName("const NvttContext *")] NvttContext* context, int w, int h, int d, int face, int mipmap, [NativeTypeName("const float *")] float* rgba, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions, [NativeTypeName("const NvttOutputOptions *")] NvttOutputOptions* outputOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttContextEstimateSizeData([NativeTypeName("const NvttContext *")] NvttContext* context, int w, int h, int d, int mipmapCount, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttContextCompressBatch([NativeTypeName("const NvttContext *")] NvttContext* context, [NativeTypeName("const NvttBatchList *")] NvttBatchList* lst, [NativeTypeName("const NvttCompressionOptions *")] NvttCompressionOptions* compressionOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttContextEnableTiming(NvttContext* context, NvttBoolean enable, int detailLevel);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttTimingContext* nvttContextGetTimingContext(NvttContext* context);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttCreateSurface();
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttDestroySurface(NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttSurfaceClone([NativeTypeName("const NvttSurface *")] NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetSurfaceWrapMode(NvttSurface* surface, NvttWrapMode mode);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetSurfaceAlphaMode(NvttSurface* surface, NvttAlphaMode alphaMode);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSetSurfaceNormalMap(NvttSurface* surface, NvttBoolean isNormalMap);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceIsNull([NativeTypeName("const NvttSurface *")] NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttSurfaceWidth([NativeTypeName("const NvttSurface *")] NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttSurfaceHeight([NativeTypeName("const NvttSurface *")] NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttSurfaceDepth([NativeTypeName("const NvttSurface *")] NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttTextureType nvttSurfaceType([NativeTypeName("const NvttSurface *")] NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttWrapMode nvttSurfaceWrapMode([NativeTypeName("const NvttSurface *")] NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttAlphaMode nvttSurfaceAlphaMode([NativeTypeName("const NvttSurface *")] NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceIsNormalMap([NativeTypeName("const NvttSurface *")] NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttSurfaceCountMipmaps([NativeTypeName("const NvttSurface *")] NvttSurface* surface, int min_size);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float nvttSurfaceAlphaTestCoverage([NativeTypeName("const NvttSurface *")] NvttSurface* surface, float alphaRef, int alpha_channel);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float nvttSurfaceAverage([NativeTypeName("const NvttSurface *")] NvttSurface* surface, int channel, int alpha_channel, float gamma);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float* nvttSurfaceData(NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float* nvttSurfaceChannel(NvttSurface* surface, int i);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceHistogram([NativeTypeName("const NvttSurface *")] NvttSurface* surface, int channel, float rangeMin, float rangeMax, int binCount, int* binPtr, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceRange([NativeTypeName("const NvttSurface *")] NvttSurface* surface, int channel, float* rangeMin, float* rangeMax, int alpha_channel, float alpha_ref, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceLoad(NvttSurface* surface, [NativeTypeName("const char *")] sbyte* filename, NvttBoolean* hasAlpha, NvttBoolean expectSigned, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceLoadFromMemory(NvttSurface* surface, [NativeTypeName("const void *")] void* data, [NativeTypeName("unsigned long long")] ulong sizeInBytes, NvttBoolean* hasAlpha, NvttBoolean expectSigned, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceSave([NativeTypeName("const NvttSurface *")] NvttSurface* surface, [NativeTypeName("const char *")] sbyte* fileName, NvttBoolean hasAlpha, NvttBoolean hdr, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceSetImage(NvttSurface* surface, int w, int h, int d, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceSetImageData(NvttSurface* surface, NvttInputFormat format, int w, int h, int d, [NativeTypeName("const void *")] void* data, NvttBoolean unsignedToSigned, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceSetImageRGBA(NvttSurface* surface, NvttInputFormat format, int w, int h, int d, [NativeTypeName("const void *")] void* r, [NativeTypeName("const void *")] void* g, [NativeTypeName("const void *")] void* b, [NativeTypeName("const void *")] void* a, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceSetImage2D(NvttSurface* surface, NvttFormat format, int w, int h, [NativeTypeName("const void *")] void* data, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceSetImage3D(NvttSurface* surface, NvttFormat format, int w, int h, int d, [NativeTypeName("const void *")] void* data, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceResize(NvttSurface* surface, int w, int h, int d, NvttResizeFilter filter, float filterWidth, [NativeTypeName("const float *")] float* @params, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceResizeMax(NvttSurface* surface, int maxExtent, NvttRoundMode mode, NvttResizeFilter filter, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceResizeMaxParams(NvttSurface* surface, int maxExtent, NvttRoundMode mode, NvttResizeFilter filter, float filterWidth, [NativeTypeName("const float *")] float* @params, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceResizeMakeSquare(NvttSurface* surface, int maxExtent, NvttRoundMode mode, NvttResizeFilter filter, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceBuildNextMipmap(NvttSurface* surface, NvttMipmapFilter filter, float filterWidth, [NativeTypeName("const float *")] float* @params, int min_size, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceBuildNextMipmapDefaults(NvttSurface* surface, NvttMipmapFilter filter, int min_size, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceBuildNextMipmapSolidColor(NvttSurface* surface, [NativeTypeName("const float *const")] float* color_components, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceCanvasSize(NvttSurface* surface, int w, int h, int d, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceCanMakeNextMipmap(NvttSurface* surface, int min_size);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToLinear(NvttSurface* surface, float gamma, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToGamma(NvttSurface* surface, float gamma, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToLinearChannel(NvttSurface* surface, int channel, float gamma, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToGammaChannel(NvttSurface* surface, int channel, float gamma, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToSrgb(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToSrgbUnclamped(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToLinearFromSrgb(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToLinearFromSrgbUnclamped(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToXenonSrgb(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToLinearFromXenonSrgb(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceTransform(NvttSurface* surface, [NativeTypeName("const float[4]")] float* w0, [NativeTypeName("const float[4]")] float* w1, [NativeTypeName("const float[4]")] float* w2, [NativeTypeName("const float[4]")] float* w3, [NativeTypeName("const float[4]")] float* offset, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceSwizzle(NvttSurface* surface, int r, int g, int b, int a, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceScaleBias(NvttSurface* surface, int channel, float scale, float bias, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceClamp(NvttSurface* surface, int channel, float low, float high, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceBlend(NvttSurface* surface, float r, float g, float b, float a, float t, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfacePremultiplyAlpha(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceDemultiplyAlpha(NvttSurface* surface, float epsilon, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToGreyScale(NvttSurface* surface, float redScale, float greenScale, float blueScale, float alphaScale, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceSetBorder(NvttSurface* surface, float r, float g, float b, float a, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceFill(NvttSurface* surface, float r, float g, float b, float a, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceScaleAlphaToCoverage(NvttSurface* surface, float coverage, float alphaRef, int alpha_channel, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToRGBM(NvttSurface* surface, float range, float threshold, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceFromRGBM(NvttSurface* surface, float range, float threshold, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToLM(NvttSurface* surface, float range, float threshold, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToRGBE(NvttSurface* surface, int mantissaBits, int exponentBits, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceFromRGBE(NvttSurface* surface, int mantissaBits, int exponentBits, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToYCoCg(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceBlockScaleCoCg(NvttSurface* surface, int bits, float threshold, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceFromYCoCg(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToLUVW(NvttSurface* surface, float range, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceFromLUVW(NvttSurface* surface, float range, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceAbs(NvttSurface* surface, int channel, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceConvolve(NvttSurface* surface, int channel, int kernelSize, float* kernelData, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToLogScale(NvttSurface* surface, int channel, float @base, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceFromLogScale(NvttSurface* surface, int channel, float @base, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceSetAtlasBorder(NvttSurface* surface, int w, int h, float r, float g, float b, float a, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToneMap(NvttSurface* surface, NvttToneMapper tm, float* parameters, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceBinarize(NvttSurface* surface, int channel, float threshold, NvttBoolean dither, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceQuantize(NvttSurface* surface, int channel, int bits, NvttBoolean exactEndPoints, NvttBoolean dither, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToNormalMap(NvttSurface* surface, float sm, float medium, float big, float large, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceNormalizeNormalMap(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceTransformNormals(NvttSurface* surface, NvttNormalTransform xform, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceReconstructNormals(NvttSurface* surface, NvttNormalTransform xform, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToCleanNormalMap(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfacePackNormals(NvttSurface* surface, float scale, float bias, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceExpandNormals(NvttSurface* surface, float scale, float bias, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttSurfaceCreateToksvigMap([NativeTypeName("const NvttSurface *")] NvttSurface* surface, float power, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttSurfaceCreateCleanMap([NativeTypeName("const NvttSurface *")] NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceFlipX(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceFlipY(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceFlipZ(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttSurfaceCreateSubImage([NativeTypeName("const NvttSurface *")] NvttSurface* surface, int x0, int x1, int y0, int y1, int z0, int z1, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceCopyChannel(NvttSurface* surface, [NativeTypeName("const NvttSurface *")] NvttSurface* srcImage, int srcChannel, int dstChannel, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceAddChannel(NvttSurface* surface, [NativeTypeName("const NvttSurface *")] NvttSurface* srcImage, int srcChannel, int dstChannel, float scale, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceCopy(NvttSurface* surface, [NativeTypeName("const NvttSurface *")] NvttSurface* srcImage, int xsrc, int ysrc, int zsrc, int xsize, int ysize, int zsize, int xdst, int ydst, int zdst, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToGPU(NvttSurface* surface, NvttBoolean performCopy, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttSurfaceToCPU(NvttSurface* surface, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const float *")]
public static extern float* nvttSurfaceGPUData([NativeTypeName("const NvttSurface *")] NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float* nvttSurfaceGPUDataMutable(NvttSurface* surface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurfaceSet* nvttCreateSurfaceSet();
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttDestroySurfaceSet(NvttSurfaceSet* surfaceSet);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttResetSurfaceSet(NvttSurfaceSet* surfaceSet);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttTextureType nvttSurfaceSetGetTextureType(NvttSurfaceSet* surfaceSet);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttSurfaceSetGetFaceCount(NvttSurfaceSet* surfaceSet);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttSurfaceSetGetMipmapCount(NvttSurfaceSet* surfaceSet);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttSurfaceSetGetWidth(NvttSurfaceSet* surfaceSet);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttSurfaceSetGetHeight(NvttSurfaceSet* surfaceSet);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttSurfaceSetGetDepth(NvttSurfaceSet* surfaceSet);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttSurfaceSetGetSurface(NvttSurfaceSet* surfaceSet, int faceId, int mipId, NvttBoolean expectSigned);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceSetLoadDDS(NvttSurfaceSet* surfaceSet, [NativeTypeName("const char *")] sbyte* fileName, NvttBoolean forcenormal);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceSetLoadDDSFromMemory(NvttSurfaceSet* surfaceSet, [NativeTypeName("const void *")] void* data, [NativeTypeName("unsigned long long")] ulong sizeInBytes, NvttBoolean forcenormal);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSurfaceSetSaveImage(NvttSurfaceSet* surfaceSet, [NativeTypeName("const char *")] sbyte* fileName, int faceId, int mipId);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttCubeSurface* nvttCreateCubeSurface();
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttDestroyCubeSurface(NvttCubeSurface* cubeSurface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttCubeSurfaceIsNull([NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* cubeSurface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttCubeSurfaceEdgeLength([NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* cubeSurface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttCubeSurfaceCountMipmaps([NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* cubeSurface);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttCubeSurfaceLoad(NvttCubeSurface* cubeSurface, [NativeTypeName("const char *")] sbyte* fileName, int mipmap);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttCubeSurfaceLoadFromMemory(NvttCubeSurface* cubeSurface, [NativeTypeName("const void *")] void* data, [NativeTypeName("unsigned long long")] ulong sizeInBytes, int mipmap);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttCubeSurfaceSave(NvttCubeSurface* cubeSurface, [NativeTypeName("const char *")] sbyte* fileName);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttCubeSurfaceFace(NvttCubeSurface* cubeSurface, int face);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttCubeSurfaceFold(NvttCubeSurface* cubeSurface, [NativeTypeName("const NvttSurface *")] NvttSurface* img, NvttCubeLayout layout);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttCubeSurfaceUnfold([NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* cubeSurface, NvttCubeLayout layout);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float nvttCubeSurfaceAverage(NvttCubeSurface* cubeSurface, int channel);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttCubeSurfaceRange([NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* cubeSurface, int channel, float* minimum_ptr, float* maximum_ptr);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttCubeSurfaceClamp(NvttCubeSurface* cubeSurface, int channel, float low, float high);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttCubeSurface* nvttCubeSurfaceIrradianceFilter([NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* cubeSurface, int size, [NativeTypeName("NvttEdgeFixup")] EdgeFixup fixupMethod);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttCubeSurface* nvttCubeSurfaceCosinePowerFilter([NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* cubeSurface, int size, float cosinePower, [NativeTypeName("NvttEdgeFixup")] EdgeFixup fixupMethod);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttCubeSurface* nvttCubeSurfaceFastResample([NativeTypeName("const NvttCubeSurface *")] NvttCubeSurface* cubeSurface, int size, [NativeTypeName("NvttEdgeFixup")] EdgeFixup fixupMethod);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttCubeSurfaceToLinear(NvttCubeSurface* cubeSurface, float gamma);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttCubeSurfaceToGamma(NvttCubeSurface* cubeSurface, float gamma);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBatchList* nvttCreateBatchList();
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttDestroyBatchList(NvttBatchList* batchList);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttBatchListClear(NvttBatchList* batchList);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttBatchListAppend(NvttBatchList* batchList, [NativeTypeName("const NvttSurface *")] NvttSurface* pImg, int face, int mipmap, [NativeTypeName("const NvttOutputOptions *")] NvttOutputOptions* outputOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("unsigned int")]
public static extern uint nvttBatchListGetSize([NativeTypeName("const NvttBatchList *")] NvttBatchList* batchList);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttBatchListGetItem([NativeTypeName("const NvttBatchList *")] NvttBatchList* batchList, [NativeTypeName("unsigned int")] uint i, [NativeTypeName("const NvttSurface **")] NvttSurface** pImg, int* face, int* mipmap, [NativeTypeName("const NvttOutputOptions **")] NvttOutputOptions** outputOptions);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern sbyte* nvttErrorString(NvttError e);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("unsigned int")]
public static extern uint nvttVersion();
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttBoolean nvttSetMessageCallback([NativeTypeName("nvttMessageCallback")] delegate* unmanaged[Cdecl]<NvttSeverity, NvttError, sbyte*, void*, void> callback, [NativeTypeName("const void *")] void* userData);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float nvttRmsError([NativeTypeName("const NvttSurface *")] NvttSurface* reference, [NativeTypeName("const NvttSurface *")] NvttSurface* img, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float nvttRmsAlphaError([NativeTypeName("const NvttSurface *")] NvttSurface* reference, [NativeTypeName("const NvttSurface *")] NvttSurface* img, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float nvttRmsCIELabError([NativeTypeName("const NvttSurface *")] NvttSurface* reference, [NativeTypeName("const NvttSurface *")] NvttSurface* img, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float nvttAngularError([NativeTypeName("const NvttSurface *")] NvttSurface* reference, [NativeTypeName("const NvttSurface *")] NvttSurface* img, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttDiff([NativeTypeName("const NvttSurface *")] NvttSurface* reference, [NativeTypeName("const NvttSurface *")] NvttSurface* img, float scale, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern float nvttRmsToneMappedError([NativeTypeName("const NvttSurface *")] NvttSurface* reference, [NativeTypeName("const NvttSurface *")] NvttSurface* img, float exposure, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttHistogram([NativeTypeName("const NvttSurface *")] NvttSurface* img, int width, int height, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttSurface* nvttHistogramRange([NativeTypeName("const NvttSurface *")] NvttSurface* img, float minRange, float maxRange, int width, int height, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttGetTargetExtent(int* width, int* height, int* depth, int maxExtent, NvttRoundMode roundMode, NvttTextureType textureType, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttCountMipmaps(int w, int h, int d, NvttTimingContext* tc);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern NvttTimingContext* nvttCreateTimingContext(int detailLevel);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttDestroyTimingContext(NvttTimingContext* timingContext);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttTimingContextSetDetailLevel(NvttTimingContext* timingContext, int detailLevel);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int nvttTimingContextGetRecordCount(NvttTimingContext* timingContext);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttTimingContextGetRecord(NvttTimingContext* timingContext, int i, [NativeTypeName("char *")] sbyte* description, double* seconds);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
public static extern nuint nvttTimingContextGetRecordSafe(NvttTimingContext* timingContext, int i, [NativeTypeName("char *")] sbyte* outDescription, [NativeTypeName("size_t")] nuint outDescriptionSize, double* seconds);
[DllImport("nvtt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nvttTimingContextPrintRecords(NvttTimingContext* timingContext);
[NativeTypeName("#define NVTT_VERSION 30203")]
public const int NVTT_VERSION = 30203;
[NativeTypeName("#define NVTT_EncodeSettings_Version_1 1")]
public const int NVTT_EncodeSettings_Version_1 = 1;
}
}

View File

@@ -0,0 +1,10 @@
namespace Ghost.Nvtt
{
public enum EdgeFixup
{
NVTT_EdgeFixup_None,
NVTT_EdgeFixup_Stretch,
NVTT_EdgeFixup_Warp,
NVTT_EdgeFixup_Average,
}
}

View File

@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<IsAotCompatible>True</IsAotCompatible>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<IsAotCompatible>True</IsAotCompatible>
</PropertyGroup>
<ItemGroup>
<None Remove="runtime\win-x64\native\nvtt.dll" />
</ItemGroup>
<ItemGroup>
<Content Include="runtime\win-x64\native\nvtt.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,23 @@
using System;
using System.Diagnostics;
namespace Ghost.Nvtt
{
/// <summary>Defines the annotation found in a native declaration.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
[Conditional("DEBUG")]
internal sealed partial class NativeAnnotationAttribute : Attribute
{
private readonly string _annotation;
/// <summary>Initializes a new instance of the <see cref="NativeAnnotationAttribute" /> class.</summary>
/// <param name="annotation">The annotation that was used in the native declaration.</param>
public NativeAnnotationAttribute(string annotation)
{
_annotation = annotation;
}
/// <summary>Gets the annotation that was used in the native declaration.</summary>
public string Annotation => _annotation;
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Diagnostics;
namespace Ghost.Nvtt
{
/// <summary>Defines the type of a member as it was used in the native signature.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = true)]
[Conditional("DEBUG")]
internal sealed partial class NativeTypeNameAttribute : Attribute
{
private readonly string _name;
/// <summary>Initializes a new instance of the <see cref="NativeTypeNameAttribute" /> class.</summary>
/// <param name="name">The name of the type that was used in the native signature.</param>
public NativeTypeNameAttribute(string name)
{
_name = name;
}
/// <summary>Gets the name of the type that was used in the native signature.</summary>
public string Name => _name;
}
}

View File

@@ -0,0 +1,9 @@
namespace Ghost.Nvtt
{
public enum NvttAlphaMode
{
NVTT_AlphaMode_None,
NVTT_AlphaMode_Transparency,
NVTT_AlphaMode_Premultiplied,
}
}

View File

@@ -0,0 +1,6 @@
namespace Ghost.Nvtt
{
public partial struct NvttBatchList
{
}
}

View File

@@ -0,0 +1,8 @@
namespace Ghost.Nvtt
{
public enum NvttBoolean
{
NVTT_False,
NVTT_True,
}
}

View File

@@ -0,0 +1,6 @@
namespace Ghost.Nvtt
{
public partial struct NvttCPUInputBuffer
{
}
}

View File

@@ -0,0 +1,13 @@
namespace Ghost.Nvtt
{
public enum NvttChannelOrder
{
NVTT_ChannelOrder_Red = 0,
NVTT_ChannelOrder_Green = 1,
NVTT_ChannelOrder_Blue = 2,
NVTT_ChannelOrder_Alpha = 3,
NVTT_ChannelOrder_Zero = 4,
NVTT_ChannelOrder_One = 5,
NVTT_ChannelOrder_MaxEnum = 0x7FFFFFFF,
}
}

View File

@@ -0,0 +1,6 @@
namespace Ghost.Nvtt
{
public partial struct NvttCompressionOptions
{
}
}

View File

@@ -0,0 +1,8 @@
namespace Ghost.Nvtt
{
public enum NvttContainer
{
NVTT_Container_DDS,
NVTT_Container_DDS10,
}
}

View File

@@ -0,0 +1,6 @@
namespace Ghost.Nvtt
{
public partial struct NvttContext
{
}
}

View File

@@ -0,0 +1,11 @@
namespace Ghost.Nvtt
{
public enum NvttCubeLayout
{
NVTT_CubeLayout_VerticalCross,
NVTT_CubeLayout_HorizontalCross,
NVTT_CubeLayout_Column,
NVTT_CubeLayout_Row,
NVTT_CubeLayout_LatitudeLongitude,
}
}

View File

@@ -0,0 +1,6 @@
namespace Ghost.Nvtt
{
public partial struct NvttCubeSurface
{
}
}

View File

@@ -0,0 +1,10 @@
namespace Ghost.Nvtt
{
public enum NvttEncodeFlags
{
NVTT_EncodeFlags_None = 0,
NVTT_EncodeFlags_UseGPU = 1 << 0,
NVTT_EncodeFlags_OutputToGPUMem = 1 << 1,
NVTT_EncodeFlags_Opaque = 1 << 2,
}
}

View File

@@ -0,0 +1,19 @@
namespace Ghost.Nvtt
{
public unsafe partial struct NvttEncodeSettings
{
[NativeTypeName("uint32_t")]
public uint sType;
public NvttFormat format;
public NvttQuality quality;
public NvttPixelType rgb_pixel_type;
public NvttTimingContext* timing_context;
[NativeTypeName("uint32_t")]
public uint encode_flags;
}
}

View File

@@ -0,0 +1,19 @@
namespace Ghost.Nvtt
{
public enum NvttError
{
NVTT_Error_None,
NVTT_Error_Unknown = NVTT_Error_None,
NVTT_Error_InvalidInput,
NVTT_Error_UnsupportedFeature,
NVTT_Error_CudaError,
NVTT_Error_FileOpen,
NVTT_Error_FileWrite,
NVTT_Error_UnsupportedOutputFormat,
NVTT_Error_Messaging,
NVTT_Error_OutOfHostMemory,
NVTT_Error_OutOfDeviceMemory,
NVTT_Error_OutputWrite,
NVTT_Error_Count,
}
}

View File

@@ -0,0 +1,44 @@
namespace Ghost.Nvtt
{
public enum NvttFormat
{
NVTT_Format_RGB,
NVTT_Format_RGBA = NVTT_Format_RGB,
NVTT_Format_DXT1,
NVTT_Format_DXT1a,
NVTT_Format_DXT3,
NVTT_Format_DXT5,
NVTT_Format_DXT5n,
NVTT_Format_BC1 = NVTT_Format_DXT1,
NVTT_Format_BC1a = NVTT_Format_DXT1a,
NVTT_Format_BC2 = NVTT_Format_DXT3,
NVTT_Format_BC3 = NVTT_Format_DXT5,
NVTT_Format_BC3n = NVTT_Format_DXT5n,
NVTT_Format_BC4,
NVTT_Format_BC4S,
NVTT_Format_ATI2,
NVTT_Format_BC5,
NVTT_Format_BC5S,
NVTT_Format_DXT1n,
NVTT_Format_CTX1,
NVTT_Format_BC6U,
NVTT_Format_BC6S,
NVTT_Format_BC7,
NVTT_Format_BC3_RGBM,
NVTT_Format_ASTC_LDR_4x4,
NVTT_Format_ASTC_LDR_5x4,
NVTT_Format_ASTC_LDR_5x5,
NVTT_Format_ASTC_LDR_6x5,
NVTT_Format_ASTC_LDR_6x6,
NVTT_Format_ASTC_LDR_8x5,
NVTT_Format_ASTC_LDR_8x6,
NVTT_Format_ASTC_LDR_8x8,
NVTT_Format_ASTC_LDR_10x5,
NVTT_Format_ASTC_LDR_10x6,
NVTT_Format_ASTC_LDR_10x8,
NVTT_Format_ASTC_LDR_10x10,
NVTT_Format_ASTC_LDR_12x10,
NVTT_Format_ASTC_LDR_12x12,
NVTT_Format_Count,
}
}

View File

@@ -0,0 +1,6 @@
namespace Ghost.Nvtt
{
public partial struct NvttGPUInputBuffer
{
}
}

View File

@@ -0,0 +1,11 @@
namespace Ghost.Nvtt
{
public enum NvttInputFormat
{
NVTT_InputFormat_BGRA_8UB,
NVTT_InputFormat_BGRA_8SB,
NVTT_InputFormat_RGBA_16F,
NVTT_InputFormat_RGBA_32F,
NVTT_InputFormat_R_32F,
}
}

View File

@@ -0,0 +1,12 @@
namespace Ghost.Nvtt
{
public enum NvttMipmapFilter
{
NVTT_MipmapFilter_Box,
NVTT_MipmapFilter_Triangle,
NVTT_MipmapFilter_Kaiser,
NVTT_MipmapFilter_Mitchell,
NVTT_MipmapFilter_Min,
NVTT_MipmapFilter_Max,
}
}

View File

@@ -0,0 +1,10 @@
namespace Ghost.Nvtt
{
public enum NvttNormalTransform
{
NVTT_NormalTransform_Orthographic,
NVTT_NormalTransform_Stereographic,
NVTT_NormalTransform_Paraboloid,
NVTT_NormalTransform_Quartic,
}
}

View File

@@ -0,0 +1,6 @@
namespace Ghost.Nvtt
{
public partial struct NvttOutputOptions
{
}
}

View File

@@ -0,0 +1,13 @@
namespace Ghost.Nvtt
{
public enum NvttPixelType
{
NVTT_PixelType_UnsignedNorm = 0,
NVTT_PixelType_SignedNorm = 1,
NVTT_PixelType_UnsignedInt = 2,
NVTT_PixelType_SignedInt = 3,
NVTT_PixelType_Float = 4,
NVTT_PixelType_UnsignedFloat = 5,
NVTT_PixelType_SharedExp = 6,
}
}

View File

@@ -0,0 +1,10 @@
namespace Ghost.Nvtt
{
public enum NvttQuality
{
NVTT_Quality_Fastest,
NVTT_Quality_Normal,
NVTT_Quality_Production,
NVTT_Quality_Highest,
}
}

View File

@@ -0,0 +1,29 @@
using System.Runtime.CompilerServices;
namespace Ghost.Nvtt
{
public unsafe partial struct NvttRefImage
{
[NativeTypeName("const void *")]
public void* data;
public int width;
public int height;
public int depth;
public int num_channels;
[NativeTypeName("NvttChannelOrder[4]")]
public _channel_swizzle_e__FixedBuffer channel_swizzle;
public NvttBoolean channel_interleave;
[InlineArray(4)]
public partial struct _channel_swizzle_e__FixedBuffer
{
public NvttChannelOrder e0;
}
}
}

View File

@@ -0,0 +1,12 @@
namespace Ghost.Nvtt
{
public enum NvttResizeFilter
{
NVTT_ResizeFilter_Box,
NVTT_ResizeFilter_Triangle,
NVTT_ResizeFilter_Kaiser,
NVTT_ResizeFilter_Mitchell,
NVTT_ResizeFilter_Min,
NVTT_ResizeFilter_Max,
}
}

View File

@@ -0,0 +1,10 @@
namespace Ghost.Nvtt
{
public enum NvttRoundMode
{
NVTT_RoundMode_None,
NVTT_RoundMode_ToNextPowerOfTwo,
NVTT_RoundMode_ToNearestPowerOfTwo,
NVTT_RoundMode_ToPreviousPowerOfTwo,
}
}

View File

@@ -0,0 +1,10 @@
namespace Ghost.Nvtt
{
public enum NvttSeverity
{
NVTT_Severity_Info,
NVTT_Severity_Warning,
NVTT_Severity_Error,
NVTT_Severity_Count,
}
}

View File

@@ -0,0 +1,6 @@
namespace Ghost.Nvtt
{
public partial struct NvttSurface
{
}
}

View File

@@ -0,0 +1,6 @@
namespace Ghost.Nvtt
{
public partial struct NvttSurfaceSet
{
}
}

View File

@@ -0,0 +1,9 @@
namespace Ghost.Nvtt
{
public enum NvttTextureType
{
NVTT_TextureType_2D,
NVTT_TextureType_Cube,
NVTT_TextureType_3D,
}
}

View File

@@ -0,0 +1,6 @@
namespace Ghost.Nvtt
{
public partial struct NvttTimingContext
{
}
}

View File

@@ -0,0 +1,11 @@
namespace Ghost.Nvtt
{
public enum NvttToneMapper
{
NVTT_ToneMapper_Linear,
NVTT_ToneMapper_Reinhard,
NVTT_ToneMapper_Reindhart = NVTT_ToneMapper_Reinhard,
NVTT_ToneMapper_Halo,
NVTT_ToneMapper_Lightmap,
}
}

View File

@@ -0,0 +1,9 @@
namespace Ghost.Nvtt
{
public enum NvttValueType
{
NVTT_ValueType_UINT8,
NVTT_ValueType_SINT8,
NVTT_ValueType_FLOAT32,
}
}

View File

@@ -0,0 +1,9 @@
namespace Ghost.Nvtt
{
public enum NvttWrapMode
{
NVTT_WrapMode_Clamp,
NVTT_WrapMode_Repeat,
NVTT_WrapMode_Mirror,
}
}