Comments (2)
What do you think about this?
typedef void (*PxTexDecompressCallback)(uint8_t const* data, uint32_t size, void* context);
void pxTexDecompress(PxTexture const* tex, PxTexDecompressCallback cb, void* context);
This would automatically allocate the data
buffer and free it after the callback exits. You'd use it like this:
void copyTexture(uint8_t const* data, uint32_t size, void* context) {
uint8_t** output = context;
*output = malloc(size);
memcpy(*output, data, size);
}
int main() {
uint8_t* data;
pxTexDecompress(tex, copyTexture, &data);
// Now `data` contains the decompressed image data.
free(data);
}
from phoenix-shared-interface.
Thanks for your idea. But I would like to avoid callbacks as it adds a new architecture pattern you only use for Vm right now (where it definitely makes sense).
On C# interface I already build small wrapper functions which take care of loading, transforming, and deleting C-data. No need for callbacks.
How about using it the classical way? Something like:
PXC_API uint8_t const* pxTexGetMipmapUncompressed(PxTexture const* tex, uint32_t* length, uint32_t level, uint32_t* width, uint32_t* height) {
...
}
Normal flow for C# sharp is right now:
- Get TextureMetadata - exists
- Decide whether to call pxTexGetMipmap() or pxTexGetMipmapUncompressed() based on TextureFormat - second half is new
- Then call pxTexMipmapUncompressedDestroy() if uncompressed data was received before. - new
from phoenix-shared-interface.
Related Issues (9)
- Win64 dll compilation won't work on fresh installation of Windows 11
- .dylib for MacOS seems to have a deprecated build target HOT 1
- clang-lint for PRs isn't checking header files
- Model for object element not loadable (mesh is empty) HOT 6
- Tests are failing HOT 1
- gitflow - built Win64.DLL can't be loaded HOT 5
- pxVmStackPopInstance() from VM returns nullptr (0x0) HOT 3
- VM: Resetting pxVmSetGlobalSelf() after a pxVmCallFunction() call throws memory exceptin HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phoenix-shared-interface.