-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
switch to wgpu4k native #308
switch to wgpu4k native #308
Conversation
Replaced outdated WebGPU binding imports and memory handling with updated equivalents from the newer ffi and io.ygdrasil.wgpu packages. This improves compatibility, clarity, and ensures the code adheres to updated APIs. Additionally, refactored buffer handling for better performance and maintainability.
Replaced deprecated WebGPU bindings with the latest `ffi` and `io.ygdrasil.wgpu` imports, ensuring compliance with modern APIs. Refactored memory allocation logic to utilize `memoryScope` for improved efficiency, reducing boilerplate and ensuring cleaner code. Simplified resource creation logic for pipelines, textures, buffers, and bind groups to enhance maintainability and error handling.
Extracted and improved mapping logic for device and surface configurations into dedicated utility functions. Simplified code around device requests, texture capabilities, and memory allocation, ensuring better modularity and maintainability. Updated related enums and helper methods to support refined mapping and data handling.
This commit replaces the wgpu-ffm and wgpu-natives modules with the ygdrasil wgpu library for native interop. Corresponding imports, dependencies, and initialization were updated or removed. This change simplifies the build configuration and consolidates the usage of native bindings.
This commit eliminates unnecessary debug println statements across various descriptor mapper functions, improving code cleanliness and reducing noise. The removed debug logs included outputting objects like render pass descriptors, color attachments, and other mapping-related entities.
Replaces direct calls to `wgpuBufferRelease` with the `destroy` method for better consistency. Additionally, removes redundant `destroy` call in `Mesh.release` to streamline resource cleanup.
The `writeFloats` calls in `put` methods now utilize the buffer's current position, ensuring accurate data placement. This resolves potential issues with incorrect positioning during data writes and improves consistency in buffer operations.
Updated `writeShorts` and `writeInts` calls to include the missing destination offset parameter (`0uL`). This ensures proper data writing behavior and prevents potential runtime issues.
Replaces `MemoryAllocator` usage with a new `allocateBuffer` function, simplifying memory management. Fixes incorrect byte offset calculations in buffer read/write operations by properly accounting for element size. These changes improve code clarity and correctness.
The `destroy` method calls were unnecessary as `release` already handles resource cleanup. This simplifies the code and ensures consistency in resource management.
Replaced direct segment handling with the updated `handler` approach to enhance consistency and maintainability. Adjusted logic in `wgpuQueueWriteTexture`, `dataBuffer`, and `getMappedRange` to comply with the new handler structure. This simplifies buffer operations and aligns with recent API changes.
1d48282
to
1b729e8
Compare
I'm not getting any crashes, which is good, but for some reason none of the 3D examples are rendering anything on the JVM (SimpleGltf, PBR, ModelInstancing, MipMaps). All of the 2D examples seem to render fine. I spent a little time debugging but couldn't find the cause yet but can spend some more later this evening. |
I only tried the sample with the preconfigured XML task in the examples folder. I will check. |
This change organizes the run configurations by moving example-related configurations into a more appropriate "Examples" folder. It improves clarity and consistency within the project structure.
Replaced `MemoryBuffer` with `MemorySegment` for more efficient and modern memory management. Simplified buffer operations by leveraging direct `MemorySegment` methods, and removed redundant allocation utilities. This change improves code clarity and aligns with the latest memory management practices in Java.
@LeHaine The issue was coming from the Buffer. I have rolled back this part in the last commit. |
Removed redundant `destroy()` method, consolidating functionality within `release()`. This simplifies the code and eliminates unnecessary indirection. No functionality has been altered.
@ygdrasil-io My mistake. I thought I had those all saved in the run configuration. Not sure how I missed those not being there for so long. I did pull and went through everything and it all seems to be working nicely now for me! |
Nice work and thank you! |
The Triangle and Rotating Cube examples are working on Mac and Windows. However, other examples are still crashing when loading files. This is a mistake on my part, and I will address it as soon as possible.