diff --git a/Generate-Bindings.ps1 b/Generate-Bindings.ps1 index 6499d87..03da10d 100644 --- a/Generate-Bindings.ps1 +++ b/Generate-Bindings.ps1 @@ -13,7 +13,7 @@ param ( [string]$buildVerbosity = "normal", [string]$buildConfiguration = "Release", - [string]$tinyUSDGenCsprojPath = "MeshOptimizerGen\MeshOptimizerGen\MeshOptimizerGen.csproj" + [string]$csprojPath = "MeshOptimizerGen\MeshOptimizerGen\MeshOptimizerGen.csproj" ) # Utility functions @@ -29,7 +29,7 @@ LogDebug "#######################################" # Compile generator LogDebug "START generator build process" -dotnet publish -v:$buildVerbosity -p:Configuration=$buildConfiguration $tinyUSDGenCsprojPath +dotnet publish -v:$buildVerbosity -p:Configuration=$buildConfiguration $csprojPath if($?) { LogDebug "END generator build process" diff --git a/MeshOptimizerGen/Evergine.Bindings.MeshOptimizer/Generated/Funtions.cs b/MeshOptimizerGen/Evergine.Bindings.MeshOptimizer/Generated/Funtions.cs index ee2b139..baac867 100644 --- a/MeshOptimizerGen/Evergine.Bindings.MeshOptimizer/Generated/Funtions.cs +++ b/MeshOptimizerGen/Evergine.Bindings.MeshOptimizer/Generated/Funtions.cs @@ -14,7 +14,7 @@ public static unsafe partial class MeshOptNative /// indices can be NULL if the input is unindexed /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_generateVertexRemap(uint* destination, uint* indices, uint index_count, void* vertices, uint vertex_count, uint vertex_size); + public static extern UIntPtr meshopt_generateVertexRemap(uint* destination, uint* indices, UIntPtr index_count, void* vertices, UIntPtr vertex_count, UIntPtr vertex_size); /// /// Generates a vertex remap table from multiple vertex streams and an optional index buffer and returns number of unique vertices @@ -29,7 +29,7 @@ public static unsafe partial class MeshOptNative /// = 16 /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_generateVertexRemapMulti(uint* destination, uint* indices, uint index_count, uint vertex_count, meshopt_Stream* streams, uint stream_count); + public static extern UIntPtr meshopt_generateVertexRemapMulti(uint* destination, uint* indices, UIntPtr index_count, UIntPtr vertex_count, meshopt_Stream* streams, UIntPtr stream_count); /// /// Generates vertex buffer from the source vertex buffer and remap table generated by meshopt_generateVertexRemap @@ -37,7 +37,7 @@ public static unsafe partial class MeshOptNative /// vertex_count should be the initial vertex count and not the value returned by meshopt_generateVertexRemap /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_remapVertexBuffer(void* destination, void* vertices, uint vertex_count, uint vertex_size, uint* remap); + public static extern void meshopt_remapVertexBuffer(void* destination, void* vertices, UIntPtr vertex_count, UIntPtr vertex_size, uint* remap); /// /// Generate index buffer from the source index buffer and remap table generated by meshopt_generateVertexRemap @@ -45,7 +45,7 @@ public static unsafe partial class MeshOptNative /// indices can be NULL if the input is unindexed /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_remapIndexBuffer(uint* destination, uint* indices, uint index_count, uint* remap); + public static extern void meshopt_remapIndexBuffer(uint* destination, uint* indices, UIntPtr index_count, uint* remap); /// /// Generate index buffer that can be used for more efficient rendering when only a subset of the vertex attributes is necessary @@ -55,7 +55,7 @@ public static unsafe partial class MeshOptNative /// destination must contain enough space for the resulting index buffer (index_count elements) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_generateShadowIndexBuffer(uint* destination, uint* indices, uint index_count, void* vertices, uint vertex_count, uint vertex_size, uint vertex_stride); + public static extern void meshopt_generateShadowIndexBuffer(uint* destination, uint* indices, UIntPtr index_count, void* vertices, UIntPtr vertex_count, UIntPtr vertex_size, UIntPtr vertex_stride); /// /// Generate index buffer that can be used for more efficient rendering when only a subset of the vertex attributes is necessary @@ -68,7 +68,7 @@ public static unsafe partial class MeshOptNative /// = 16 /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_generateShadowIndexBufferMulti(uint* destination, uint* indices, uint index_count, uint vertex_count, meshopt_Stream* streams, uint stream_count); + public static extern void meshopt_generateShadowIndexBufferMulti(uint* destination, uint* indices, UIntPtr index_count, UIntPtr vertex_count, meshopt_Stream* streams, UIntPtr stream_count); /// /// Generate index buffer that can be used as a geometry shader input with triangle adjacency topology @@ -81,7 +81,7 @@ public static unsafe partial class MeshOptNative /// vertex_positions should have float3 position in the first 12 bytes of each vertex /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_generateAdjacencyIndexBuffer(uint* destination, uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride); + public static extern void meshopt_generateAdjacencyIndexBuffer(uint* destination, uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride); /// /// Generate index buffer that can be used for PN-AEN tessellation with crack-free displacement @@ -97,7 +97,7 @@ public static unsafe partial class MeshOptNative /// vertex_positions should have float3 position in the first 12 bytes of each vertex /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_generateTessellationIndexBuffer(uint* destination, uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride); + public static extern void meshopt_generateTessellationIndexBuffer(uint* destination, uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride); /// /// Experimental: Generate index buffer that can be used for visibility buffer rendering and returns the size of the reorder table @@ -110,7 +110,7 @@ public static unsafe partial class MeshOptNative /// reorder must contain enough space for the worst case reorder table (vertex_count + index_count/3 elements) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_generateProvokingIndexBuffer(uint* destination, uint* reorder, uint* indices, uint index_count, uint vertex_count); + public static extern UIntPtr meshopt_generateProvokingIndexBuffer(uint* destination, uint* reorder, uint* indices, UIntPtr index_count, UIntPtr vertex_count); /// /// Vertex transform cache optimizer @@ -119,7 +119,7 @@ public static unsafe partial class MeshOptNative /// destination must contain enough space for the resulting index buffer (index_count elements) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_optimizeVertexCache(uint* destination, uint* indices, uint index_count, uint vertex_count); + public static extern void meshopt_optimizeVertexCache(uint* destination, uint* indices, UIntPtr index_count, UIntPtr vertex_count); /// /// Vertex transform cache optimizer for strip-like caches @@ -128,7 +128,7 @@ public static unsafe partial class MeshOptNative /// destination must contain enough space for the resulting index buffer (index_count elements) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_optimizeVertexCacheStrip(uint* destination, uint* indices, uint index_count, uint vertex_count); + public static extern void meshopt_optimizeVertexCacheStrip(uint* destination, uint* indices, UIntPtr index_count, UIntPtr vertex_count); /// /// Vertex transform cache optimizer for FIFO caches @@ -139,7 +139,7 @@ public static unsafe partial class MeshOptNative /// cache_size should be less than the actual GPU cache size to avoid cache thrashing /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_optimizeVertexCacheFifo(uint* destination, uint* indices, uint index_count, uint vertex_count, uint cache_size); + public static extern void meshopt_optimizeVertexCacheFifo(uint* destination, uint* indices, UIntPtr index_count, UIntPtr vertex_count, uint cache_size); /// /// Overdraw optimizer @@ -151,7 +151,7 @@ public static unsafe partial class MeshOptNative /// threshold indicates how much the overdraw optimizer can degrade vertex cache efficiency (1.05 = up to 5%) to reduce overdraw more efficiently /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_optimizeOverdraw(uint* destination, uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride, float threshold); + public static extern void meshopt_optimizeOverdraw(uint* destination, uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride, float threshold); /// /// Vertex fetch cache optimizer @@ -162,7 +162,7 @@ public static unsafe partial class MeshOptNative /// indices is used both as an input and as an output index buffer /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_optimizeVertexFetch(void* destination, uint* indices, uint index_count, void* vertices, uint vertex_count, uint vertex_size); + public static extern UIntPtr meshopt_optimizeVertexFetch(void* destination, uint* indices, UIntPtr index_count, void* vertices, UIntPtr vertex_count, UIntPtr vertex_size); /// /// Vertex fetch cache optimizer @@ -172,7 +172,7 @@ public static unsafe partial class MeshOptNative /// destination must contain enough space for the resulting remap table (vertex_count elements) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_optimizeVertexFetchRemap(uint* destination, uint* indices, uint index_count, uint vertex_count); + public static extern UIntPtr meshopt_optimizeVertexFetchRemap(uint* destination, uint* indices, UIntPtr index_count, UIntPtr vertex_count); /// /// Index buffer encoder @@ -187,10 +187,10 @@ public static unsafe partial class MeshOptNative /// buffer must contain enough space for the encoded index buffer (use meshopt_encodeIndexBufferBound to compute worst case size) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_encodeIndexBuffer(byte* buffer, uint buffer_size, uint* indices, uint index_count); + public static extern UIntPtr meshopt_encodeIndexBuffer(byte* buffer, UIntPtr buffer_size, uint* indices, UIntPtr index_count); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_encodeIndexBufferBound(uint index_count, uint vertex_count); + public static extern UIntPtr meshopt_encodeIndexBufferBound(UIntPtr index_count, UIntPtr vertex_count); /// /// Set index encoder format version @@ -207,7 +207,7 @@ public static unsafe partial class MeshOptNative /// destination must contain enough space for the resulting index buffer (index_count elements) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern int meshopt_decodeIndexBuffer(void* destination, uint index_count, uint index_size, byte* buffer, uint buffer_size); + public static extern int meshopt_decodeIndexBuffer(void* destination, UIntPtr index_count, UIntPtr index_size, byte* buffer, UIntPtr buffer_size); /// /// Get encoded index format version @@ -215,7 +215,7 @@ public static unsafe partial class MeshOptNative /// Note that a non-negative value doesn't guarantee that the buffer will be decoded correctly if the input is malformed. /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern int meshopt_decodeIndexVersion(byte* buffer, uint buffer_size); + public static extern int meshopt_decodeIndexVersion(byte* buffer, UIntPtr buffer_size); /// /// Index sequence encoder @@ -225,10 +225,10 @@ public static unsafe partial class MeshOptNative /// buffer must contain enough space for the encoded index sequence (use meshopt_encodeIndexSequenceBound to compute worst case size) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_encodeIndexSequence(byte* buffer, uint buffer_size, uint* indices, uint index_count); + public static extern UIntPtr meshopt_encodeIndexSequence(byte* buffer, UIntPtr buffer_size, uint* indices, UIntPtr index_count); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_encodeIndexSequenceBound(uint index_count, uint vertex_count); + public static extern UIntPtr meshopt_encodeIndexSequenceBound(UIntPtr index_count, UIntPtr vertex_count); /// /// Index sequence decoder @@ -238,7 +238,7 @@ public static unsafe partial class MeshOptNative /// destination must contain enough space for the resulting index sequence (index_count elements) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern int meshopt_decodeIndexSequence(void* destination, uint index_count, uint index_size, byte* buffer, uint buffer_size); + public static extern int meshopt_decodeIndexSequence(void* destination, UIntPtr index_count, UIntPtr index_size, byte* buffer, UIntPtr buffer_size); /// /// Vertex buffer encoder @@ -250,10 +250,10 @@ public static unsafe partial class MeshOptNative /// buffer must contain enough space for the encoded vertex buffer (use meshopt_encodeVertexBufferBound to compute worst case size) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_encodeVertexBuffer(byte* buffer, uint buffer_size, void* vertices, uint vertex_count, uint vertex_size); + public static extern UIntPtr meshopt_encodeVertexBuffer(byte* buffer, UIntPtr buffer_size, void* vertices, UIntPtr vertex_count, UIntPtr vertex_size); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_encodeVertexBufferBound(uint vertex_count, uint vertex_size); + public static extern UIntPtr meshopt_encodeVertexBufferBound(UIntPtr vertex_count, UIntPtr vertex_size); /// /// Experimental: Vertex buffer encoder @@ -263,7 +263,7 @@ public static unsafe partial class MeshOptNative /// level should be in the range [0, 3] with 0 being the fastest and 3 being the slowest and producing the best compression ratio. /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_encodeVertexBufferLevel(byte* buffer, uint buffer_size, void* vertices, uint vertex_count, uint vertex_size, int level); + public static extern UIntPtr meshopt_encodeVertexBufferLevel(byte* buffer, UIntPtr buffer_size, void* vertices, UIntPtr vertex_count, UIntPtr vertex_size, int level); /// /// Set vertex encoder format version @@ -280,7 +280,7 @@ public static unsafe partial class MeshOptNative /// destination must contain enough space for the resulting vertex buffer (vertex_count * vertex_size bytes) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern int meshopt_decodeVertexBuffer(void* destination, uint vertex_count, uint vertex_size, byte* buffer, uint buffer_size); + public static extern int meshopt_decodeVertexBuffer(void* destination, UIntPtr vertex_count, UIntPtr vertex_size, byte* buffer, UIntPtr buffer_size); /// /// Get encoded vertex format version @@ -288,7 +288,7 @@ public static unsafe partial class MeshOptNative /// Note that a non-negative value doesn't guarantee that the buffer will be decoded correctly if the input is malformed. /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern int meshopt_decodeVertexVersion(byte* buffer, uint buffer_size); + public static extern int meshopt_decodeVertexVersion(byte* buffer, UIntPtr buffer_size); /// /// Vertex buffer filters @@ -307,22 +307,22 @@ public static unsafe partial class MeshOptNative /// Each 32-bit component is decoded in isolation; stride must be divisible by 4. /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_decodeFilterOct(void* buffer, uint count, uint stride); + public static extern void meshopt_decodeFilterOct(void* buffer, UIntPtr count, UIntPtr stride); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_decodeFilterQuat(void* buffer, uint count, uint stride); + public static extern void meshopt_decodeFilterQuat(void* buffer, UIntPtr count, UIntPtr stride); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_decodeFilterExp(void* buffer, uint count, uint stride); + public static extern void meshopt_decodeFilterExp(void* buffer, UIntPtr count, UIntPtr stride); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_encodeFilterOct(void* destination, uint count, uint stride, int bits, float* data); + public static extern void meshopt_encodeFilterOct(void* destination, UIntPtr count, UIntPtr stride, int bits, float* data); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_encodeFilterQuat(void* destination, uint count, uint stride, int bits, float* data); + public static extern void meshopt_encodeFilterQuat(void* destination, UIntPtr count, UIntPtr stride, int bits, float* data); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_encodeFilterExp(void* destination, uint count, uint stride, int bits, float* data, meshopt_EncodeExpMode mode); + public static extern void meshopt_encodeFilterExp(void* destination, UIntPtr count, UIntPtr stride, int bits, float* data, meshopt_EncodeExpMode mode); /// /// Mesh simplifier @@ -339,7 +339,7 @@ public static unsafe partial class MeshOptNative /// result_error can be NULL; when it's not NULL, it will contain the resulting (relative) error after simplification /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_simplify(uint* destination, uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride, uint target_index_count, float target_error, uint options, float* result_error); + public static extern UIntPtr meshopt_simplify(uint* destination, uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride, UIntPtr target_index_count, float target_error, uint options, float* result_error); /// /// Mesh simplifier with attribute metric @@ -353,7 +353,7 @@ public static unsafe partial class MeshOptNative /// vertex_lock can be NULL; when it's not NULL, it should have a value for each vertex; 1 denotes vertices that can't be moved /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_simplifyWithAttributes(uint* destination, uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride, float* vertex_attributes, uint vertex_attributes_stride, float* attribute_weights, uint attribute_count, byte* vertex_lock, uint target_index_count, float target_error, uint options, float* result_error); + public static extern UIntPtr meshopt_simplifyWithAttributes(uint* destination, uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride, float* vertex_attributes, UIntPtr vertex_attributes_stride, float* attribute_weights, UIntPtr attribute_count, byte* vertex_lock, UIntPtr target_index_count, float target_error, uint options, float* result_error); /// /// Experimental: Mesh simplifier (sloppy) @@ -368,7 +368,7 @@ public static unsafe partial class MeshOptNative /// result_error can be NULL; when it's not NULL, it will contain the resulting (relative) error after simplification /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_simplifySloppy(uint* destination, uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride, uint target_index_count, float target_error, float* result_error); + public static extern UIntPtr meshopt_simplifySloppy(uint* destination, uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride, UIntPtr target_index_count, float target_error, float* result_error); /// /// Point cloud simplifier @@ -382,7 +382,7 @@ public static unsafe partial class MeshOptNative /// color_weight determines relative priority of color wrt position; 1.0 is a safe default /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_simplifyPoints(uint* destination, float* vertex_positions, uint vertex_count, uint vertex_positions_stride, float* vertex_colors, uint vertex_colors_stride, float color_weight, uint target_vertex_count); + public static extern UIntPtr meshopt_simplifyPoints(uint* destination, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride, float* vertex_colors, UIntPtr vertex_colors_stride, float color_weight, UIntPtr target_vertex_count); /// /// Returns the error scaling factor used by the simplifier to convert between absolute and relative extents @@ -390,7 +390,7 @@ public static unsafe partial class MeshOptNative /// Relative error returned by meshopt_simplify via result_error must be *multiplied* by the scaling factor to get absolute error. /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern float meshopt_simplifyScale(float* vertex_positions, uint vertex_count, uint vertex_positions_stride); + public static extern float meshopt_simplifyScale(float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride); /// /// Mesh stripifier @@ -402,10 +402,10 @@ public static unsafe partial class MeshOptNative /// restart_index should be 0xffff or 0xffffffff depending on index size, or 0 to use degenerate triangles /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_stripify(uint* destination, uint* indices, uint index_count, uint vertex_count, uint restart_index); + public static extern UIntPtr meshopt_stripify(uint* destination, uint* indices, UIntPtr index_count, UIntPtr vertex_count, uint restart_index); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_stripifyBound(uint index_count); + public static extern UIntPtr meshopt_stripifyBound(UIntPtr index_count); /// /// Mesh unstripifier @@ -414,10 +414,10 @@ public static unsafe partial class MeshOptNative /// destination must contain enough space for the target index buffer, worst case can be computed with meshopt_unstripifyBound /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_unstripify(uint* destination, uint* indices, uint index_count, uint restart_index); + public static extern UIntPtr meshopt_unstripify(uint* destination, uint* indices, UIntPtr index_count, uint restart_index); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_unstripifyBound(uint index_count); + public static extern UIntPtr meshopt_unstripifyBound(UIntPtr index_count); /// /// Vertex transform cache analyzer @@ -425,7 +425,7 @@ public static unsafe partial class MeshOptNative /// Results may not match actual GPU performance /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern meshopt_VertexCacheStatistics meshopt_analyzeVertexCache(uint* indices, uint index_count, uint vertex_count, uint cache_size, uint warp_size, uint primgroup_size); + public static extern meshopt_VertexCacheStatistics meshopt_analyzeVertexCache(uint* indices, UIntPtr index_count, UIntPtr vertex_count, uint cache_size, uint warp_size, uint primgroup_size); /// /// Overdraw analyzer @@ -434,7 +434,7 @@ public static unsafe partial class MeshOptNative /// vertex_positions should have float3 position in the first 12 bytes of each vertex /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern meshopt_OverdrawStatistics meshopt_analyzeOverdraw(uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride); + public static extern meshopt_OverdrawStatistics meshopt_analyzeOverdraw(uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride); /// /// Vertex fetch cache analyzer @@ -442,7 +442,7 @@ public static unsafe partial class MeshOptNative /// Results may not match actual GPU performance /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern meshopt_VertexFetchStatistics meshopt_analyzeVertexFetch(uint* indices, uint index_count, uint vertex_count, uint vertex_size); + public static extern meshopt_VertexFetchStatistics meshopt_analyzeVertexFetch(uint* indices, UIntPtr index_count, UIntPtr vertex_count, UIntPtr vertex_size); /// /// Meshlet builder @@ -463,13 +463,13 @@ public static unsafe partial class MeshOptNative /// cone_weight should be set to 0 when cone culling is not used, and a value between 0 and 1 otherwise to balance between cluster size and cone culling efficiency /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_buildMeshlets(meshopt_Meshlet* meshlets, uint* meshlet_vertices, byte* meshlet_triangles, uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride, uint max_vertices, uint max_triangles, float cone_weight); + public static extern UIntPtr meshopt_buildMeshlets(meshopt_Meshlet* meshlets, uint* meshlet_vertices, byte* meshlet_triangles, uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride, UIntPtr max_vertices, UIntPtr max_triangles, float cone_weight); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_buildMeshletsScan(meshopt_Meshlet* meshlets, uint* meshlet_vertices, byte* meshlet_triangles, uint* indices, uint index_count, uint vertex_count, uint max_vertices, uint max_triangles); + public static extern UIntPtr meshopt_buildMeshletsScan(meshopt_Meshlet* meshlets, uint* meshlet_vertices, byte* meshlet_triangles, uint* indices, UIntPtr index_count, UIntPtr vertex_count, UIntPtr max_vertices, UIntPtr max_triangles); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_buildMeshletsBound(uint index_count, uint max_vertices, uint max_triangles); + public static extern UIntPtr meshopt_buildMeshletsBound(UIntPtr index_count, UIntPtr max_vertices, UIntPtr max_triangles); /// /// Experimental: Meshlet builder with flexible cluster sizes @@ -491,7 +491,7 @@ public static unsafe partial class MeshOptNative /// split_factor should be set to a non-negative value; when greater than 0, clusters that have large bounds may be split unless they are under the min_triangles threshold /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_buildMeshletsFlex(meshopt_Meshlet* meshlets, uint* meshlet_vertices, byte* meshlet_triangles, uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride, uint max_vertices, uint min_triangles, uint max_triangles, float cone_weight, float split_factor); + public static extern UIntPtr meshopt_buildMeshletsFlex(meshopt_Meshlet* meshlets, uint* meshlet_vertices, byte* meshlet_triangles, uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride, UIntPtr max_vertices, UIntPtr min_triangles, UIntPtr max_triangles, float cone_weight, float split_factor); /// /// Meshlet optimizer @@ -505,7 +505,7 @@ public static unsafe partial class MeshOptNative /// = 512) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_optimizeMeshlet(uint* meshlet_vertices, byte* meshlet_triangles, uint triangle_count, uint vertex_count); + public static extern void meshopt_optimizeMeshlet(uint* meshlet_vertices, byte* meshlet_triangles, UIntPtr triangle_count, UIntPtr vertex_count); /// /// Cluster bounds generator @@ -530,10 +530,10 @@ public static unsafe partial class MeshOptNative /// = 512) /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern meshopt_Bounds meshopt_computeClusterBounds(uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride); + public static extern meshopt_Bounds meshopt_computeClusterBounds(uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride); [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern meshopt_Bounds meshopt_computeMeshletBounds(uint* meshlet_vertices, byte* meshlet_triangles, uint triangle_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride); + public static extern meshopt_Bounds meshopt_computeMeshletBounds(uint* meshlet_vertices, byte* meshlet_triangles, UIntPtr triangle_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride); /// /// Experimental: Sphere bounds generator @@ -542,7 +542,7 @@ public static unsafe partial class MeshOptNative /// radii can be NULL; when it's not NULL, it should have a non-negative float radius in the first 4 bytes of each element /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern meshopt_Bounds meshopt_computeSphereBounds(float* positions, uint count, uint positions_stride, float* radii, uint radii_stride); + public static extern meshopt_Bounds meshopt_computeSphereBounds(float* positions, UIntPtr count, UIntPtr positions_stride, float* radii, UIntPtr radii_stride); /// /// Experimental: Cluster partitioner @@ -554,7 +554,7 @@ public static unsafe partial class MeshOptNative /// target_partition_size is a target size for each partition, in clusters; the resulting partitions may be smaller or larger /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern uint meshopt_partitionClusters(uint* destination, uint* cluster_indices, uint total_index_count, uint* cluster_index_counts, uint cluster_count, uint vertex_count, uint target_partition_size); + public static extern UIntPtr meshopt_partitionClusters(uint* destination, uint* cluster_indices, UIntPtr total_index_count, uint* cluster_index_counts, UIntPtr cluster_count, UIntPtr vertex_count, UIntPtr target_partition_size); /// /// Spatial sorter @@ -564,7 +564,7 @@ public static unsafe partial class MeshOptNative /// vertex_positions should have float3 position in the first 12 bytes of each vertex /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_spatialSortRemap(uint* destination, float* vertex_positions, uint vertex_count, uint vertex_positions_stride); + public static extern void meshopt_spatialSortRemap(uint* destination, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride); /// /// Experimental: Spatial sorter @@ -573,7 +573,7 @@ public static unsafe partial class MeshOptNative /// vertex_positions should have float3 position in the first 12 bytes of each vertex /// [DllImport("meshoptimizer", CallingConvention = CallingConvention.Cdecl)] - public static extern void meshopt_spatialSortTriangles(uint* destination, uint* indices, uint index_count, float* vertex_positions, uint vertex_count, uint vertex_positions_stride); + public static extern void meshopt_spatialSortTriangles(uint* destination, uint* indices, UIntPtr index_count, float* vertex_positions, UIntPtr vertex_count, UIntPtr vertex_positions_stride); /// /// Quantize a float into half-precision (as defined by IEEE-754 fp16) floating point value diff --git a/MeshOptimizerGen/Evergine.Bindings.MeshOptimizer/Generated/Structs.cs b/MeshOptimizerGen/Evergine.Bindings.MeshOptimizer/Generated/Structs.cs index 918e1af..fe7ea10 100644 --- a/MeshOptimizerGen/Evergine.Bindings.MeshOptimizer/Generated/Structs.cs +++ b/MeshOptimizerGen/Evergine.Bindings.MeshOptimizer/Generated/Structs.cs @@ -11,8 +11,8 @@ namespace Evergine.Bindings.MeshOptimizer public unsafe struct meshopt_Stream { public void* data; - public uint size; - public uint stride; + public UIntPtr size; + public UIntPtr stride; } [StructLayout(LayoutKind.Sequential)] diff --git a/MeshOptimizerGen/HelloMeshlets/Program.cs b/MeshOptimizerGen/HelloMeshlets/Program.cs index 3346d93..dddd05e 100644 --- a/MeshOptimizerGen/HelloMeshlets/Program.cs +++ b/MeshOptimizerGen/HelloMeshlets/Program.cs @@ -41,17 +41,17 @@ public unsafe static void Main(string[] args) uint kMaxVertices = 64; uint kMaxTriangles = 124; float kConeWeight = 0.0f; - uint meshNumIndices = (uint)mesh.Indices.Count; - uint meshNumVertices = (uint)attrib.Vertices.Count; + UIntPtr meshNumIndices = (UIntPtr)mesh.Indices.Count; + UIntPtr meshNumVertices = (UIntPtr)attrib.Vertices.Count; uint[] indices = new uint[meshNumIndices]; - for (int i = 0; i < meshNumIndices; i++) + for (int i = 0; i < (int)meshNumIndices; i++) { indices[i] = (uint)mesh.Indices[i].VertexIndex; } // Create Meshlet array - uint maxMeshlets = MeshOptNative.meshopt_buildMeshletsBound(meshNumIndices, kMaxVertices, kMaxTriangles); + UIntPtr maxMeshlets = MeshOptNative.meshopt_buildMeshletsBound(meshNumIndices, kMaxVertices, kMaxTriangles); meshopt_Meshlet[] meshlets = new meshopt_Meshlet[maxMeshlets]; uint[] meshletVertices = new uint[maxMeshlets * kMaxVertices]; @@ -64,7 +64,7 @@ public unsafe static void Main(string[] args) uint* pIndices = (uint*)Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(indices)); float* pVertsAsFloats = (float*)Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(positions)); - uint meshletCount = MeshOptNative.meshopt_buildMeshlets( + UIntPtr meshletCount = MeshOptNative.meshopt_buildMeshlets( pMeshlets, pMeshletVertices, pMeshletTriangles, diff --git a/MeshOptimizerGen/MeshOptimizerGen/Helpers.cs b/MeshOptimizerGen/MeshOptimizerGen/Helpers.cs index 5f06366..5d06a48 100644 --- a/MeshOptimizerGen/MeshOptimizerGen/Helpers.cs +++ b/MeshOptimizerGen/MeshOptimizerGen/Helpers.cs @@ -12,7 +12,7 @@ public static class Helpers { private static readonly Dictionary csNameMappings = new Dictionary() { - { "bool", "bool" }, + { "bool", "byte" }, { "uint8_t", "byte" }, { "uint16_t", "ushort" }, { "uint32_t", "uint" }, @@ -23,9 +23,9 @@ public static class Helpers { "int64_t", "long" }, { "int64_t*", "long*" }, { "char", "byte" }, - { "size_t", "uint" }, - { "intptr_t", "nint" }, - { "uintptr_t", "nuint" }, + { "size_t", "UIntPtr" }, + { "intptr_t", "IntPtr" }, + { "uintptr_t", "UIntPtr" }, }; public static string ConvertToCSharpType(CppType type, bool isPointer = false)