How kiruyamomochi/texture2ddecoder works
Texture2DDecoder exposes a .NET API for turning Unity texture data into decoded pixel images. The main workflow is caller → managed wrapper → native interop → exported native dispatch → format-specific decoder; Crunch data has separate standard and Unity-specific unpackers. The README documents broad platform package availability, but those packaging/build details are not runtime components. Relationships within the native decoder are supported by the exported calls in dllmain.cpp; some managed-to-native detail is inferred from the indexed interop files and DLL name.
Main entry points: dllmain.cpp Native Exports · TextureDecoder.cs Texture API · TextureDecoder.PInvoke.cs P/Invoke Bindings · T2DDll.cs Native DLL Name
Components 18
Managed API
- Texture API
Texture2DDecoderWrapper/TextureDecoder.cs - P/Invoke Bindings
Texture2DDecoderWrapper/TextureDecoder.PInvoke.cs - Native DLL Name
Texture2DDecoderWrapper/T2DDll.cs
Native Interface
- Native Exports
Texture2DDecoderNative/dllmain.cpp
Texture Formats
- BCn Decoders
Texture2DDecoderNative/bcn.cpp - ETC Decoders
Texture2DDecoderNative/etc.cpp - ATC Decoders
Texture2DDecoderNative/atc.cpp - ASTC Decoder
Texture2DDecoderNative/astc.cpp - PVRTC Decoder
Texture2DDecoderNative/pvrtc.cpp
Crunch Unpacking
- Crunch Exports
Texture2DDecoderNative/crunch.cpp - Crunch Transcoder
Texture2DDecoderNative/crunch/crn_decomp.h - Unity Crunch Exports
Texture2DDecoderNative/unitycrunch.cpp - Unity Crunch Transcoder
Texture2DDecoderNative/unitycrunch/crn_decomp.h
Decode Helpers
- Pixel Color Helpers
Texture2DDecoderNative/color.h - Endianness Helpers
Texture2DDecoderNative/endianness.h - Half-Float Helpers
Texture2DDecoderNative/fp16/fp16.h
Other components
- Application
- Decoded Pixel Image
Connections 14
- Application → Texture API: calls
README.md - Texture API → P/Invoke Bindings: uses bindings
Texture2DDecoderWrapper/TextureDecoder.PInvoke.cs - P/Invoke Bindings → Native DLL Name: names library
Texture2DDecoderWrapper/TextureDecoder.PInvoke.cs - Native DLL Name → Native Exports: loads
- Native Exports → BCn Decoders: dispatches
Texture2DDecoderNative/dllmain.cpp - Native Exports → ETC Decoders: dispatches
Texture2DDecoderNative/dllmain.cpp - Native Exports → ATC Decoders: dispatches
Texture2DDecoderNative/dllmain.cpp - Native Exports → ASTC Decoder: dispatches
Texture2DDecoderNative/dllmain.cpp - Native Exports → PVRTC Decoder: dispatches
- Native Exports → Crunch Exports: dispatches
- Native Exports → Unity Crunch Exports: dispatches
- Crunch Exports → Crunch Transcoder: unpacks with
Texture2DDecoderNative/crunch.cpp - Unity Crunch Exports → Unity Crunch Transcoder: unpacks with
Texture2DDecoderNative/unitycrunch.cpp - Texture API → Decoded Pixel Image: returns pixels
Texture2DDecoderWrapper/TextureDecoder.cs