Add LowLevelDemo: ThorVG rasterising into an Evergine texture - #3
Merged
Conversation
Drives the binding the way an application would, which is the half the headless Test cannot reach: per-frame animation, the array-marshalling corners of the API, and a CPU buffer shared with the GPU at the window's refresh rate. The roles are the inverse of MuJoCo.NET's demo. There Evergine drew geometry and the native library supplied transforms; here ThorVG supplies finished pixels -- it is a CPU rasteriser -- and Evergine's job is the upload-and-present bridge: UpdateTextureData each frame into a Default-usage texture and a fullscreen SV_VertexID triangle, the same pattern as the engine's video player and ComputeTextureTest. The scene exercises, per frame at 120 fps on this machine: - tvg_gradient_set_color_stops with a Tvg_Color_Stop[] (struct array) - tvg_paint_set_transform with Tvg_Matrix by pointer (9-float struct) - tvg_shape_append_path with parallel byte[] command / Tvg_Point[] arrays - tvg_shape_set_stroke_dash with a float[] pattern - tvg_picture_load_data from memory (the byte* payload path) - tvg_animation_set_frame driven by wall clock against tvg_animation_get_total_frame / get_duration out-params ABGR8888 maps byte-for-byte to Evergine's R8G8B8A8_UNorm on little-endian, and ThorVG writes row 0 at the top, so there is no swizzle and no flip anywhere. The generator gained one fix the demo forced: TVG_PATH_COMMAND_* lives in an anonymous enum behind `typedef uint8_t Tvg_Path_Command`, which the generator used to drop entirely. Anonymous enum members are standalone constants and now land in Constants.cs, per the C2CSharpBinding spec. Caught before first publish, so no released surface changes. Assets/animation.lot is test/resources/test5.lot from thorvg v1.1.0, MIT.
Contributor
API gate: additiveEvery symbol that existed still exists, unchanged. Nothing that compiled before stops compiling.
Enum and constant values are part of the measured surface: a renumbering keeps compiling and sends the wrong number to the driver, so it counts as a removal. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Validation-by-usage before the first publish, mirroring MuJoCo.NET's demo — with the roles inverted: ThorVG is a CPU rasteriser, so it supplies finished pixels and Evergine's low-level API does the upload-and-present bridge (per-frame
UpdateTextureData+ fullscreen SV_VertexID triangle, the engine's video-player pattern).The animated scene exercises the API corners the headless Test cannot:
Tvg_Color_Stop[]gradients,Tvg_Matrixtransforms, parallel command/point path arrays,float[]dash patterns, Lottie loaded from memory through thebyte*payload path, and the animation API driven by wall clock. Runs at 120 fps.One generator fix fell out of writing it:
TVG_PATH_COMMAND_*lives in an anonymous enum behindtypedef uint8_t Tvg_Path_Command, which the generator dropped entirely. Anonymous enum members now land inConstants.cs, per the C2CSharpBinding spec. Caught before first publish.Verified live: window sustains 120 fps, and PrintWindow captures show the scene animating between frames with correct colors — confirming the ABGR8888 → R8G8B8A8_UNorm byte mapping needs no swizzle.