| // Generated by src/wasm/idl/generate.py from bindings.py. Do not edit. | |
| // | |
| // The runtime import object for script modules executing on the | |
| // browser engine. Scalars forward straight into the host call | |
| // table; str/buf/pod params stage through the host heap because | |
| // the host cannot dereference module memory. `addr` ops throw | |
| // until their per-op audit lands. | |
| // | |
| // host contract: | |
| // calls per-op host entry points (native-pointer convention) | |
| // heapU8() Uint8Array over the host heap (refresh per call) | |
| // stackAlloc(size) -> host heap ptr valid until stackReset() | |
| // stackReset() | |
| // moduleMemory: late-bound accessor for the script module memory, | |
| // set after instantiation. | |
| export function createRiveModuleImports(host, moduleMemory) { | |
| const calls = host.calls; | |
| const stackReset = host.stackReset; | |
| const stageIn = (ptr, len) => { | |
| const dst = host.stackAlloc(len); | |
| host.heapU8().set( | |
| new Uint8Array(moduleMemory().buffer, ptr, len), | |
| dst | |
| ); | |
| return dst; | |
| }; | |
| const copyOut = (src, ptr, len) => { | |
| new Uint8Array(moduleMemory().buffer, ptr, len).set( | |
| host.heapU8().subarray(src, src + len) | |
| ); | |
| }; | |
| const unsupported = (name) => () => { | |
| throw new Error('web lane does not carry ' + name + ' yet'); | |
| }; | |
| return { | |
| rive_rt_v1: { | |
| log: (level, message, length) => { | |
| stackReset(); | |
| const message_p = stageIn(message, length); | |
| calls.rive_rt_log(level, message_p, length); | |
| }, | |
| mark_needs_update: calls.rive_rt_mark_needs_update, | |
| budget_exceeded: calls.rive_rt_budget_exceeded, | |
| error: (message, length) => { | |
| stackReset(); | |
| const message_p = stageIn(message, length); | |
| calls.rive_rt_error(message_p, length); | |
| }, | |
| debug_enter: calls.rive_rt_debug_enter, | |
| debug_line: calls.rive_rt_debug_line, | |
| debug_leave: calls.rive_rt_debug_leave, | |
| utc_offset: calls.rive_rt_utc_offset, | |
| is_dst: calls.rive_rt_is_dst, | |
| zone_name: (epochSeconds, buffer, capacity) => { | |
| stackReset(); | |
| const buffer_p = stageIn(buffer, capacity); | |
| const ret = calls.rive_rt_zone_name(epochSeconds, buffer_p, capacity); | |
| copyOut(buffer_p, buffer, capacity); | |
| return ret; | |
| }, | |
| }, | |
| rive_data_v1: { | |
| view_model: calls.rive_data_view_model, | |
| root_view_model: calls.rive_data_root_view_model, | |
| global_view_model: (object, name, nameLength) => { | |
| stackReset(); | |
| const name_p = stageIn(name, nameLength); | |
| const ret = calls.rive_data_global_view_model(object, name_p, nameLength); | |
| return ret; | |
| }, | |
| global_view_model_names: (object, buffer, capacity) => { | |
| stackReset(); | |
| const buffer_p = stageIn(buffer, capacity); | |
| const ret = calls.rive_data_global_view_model_names(object, buffer_p, capacity); | |
| copyOut(buffer_p, buffer, capacity); | |
| return ret; | |
| }, | |
| context: calls.rive_data_context, | |
| context_parent: calls.rive_data_context_parent, | |
| context_view_model: calls.rive_data_context_view_model, | |
| context_release: calls.rive_data_context_release, | |
| has_view_model: (name, nameLength) => { | |
| stackReset(); | |
| const name_p = stageIn(name, nameLength); | |
| const ret = calls.rive_data_has_view_model(name_p, nameLength); | |
| return ret; | |
| }, | |
| new_view_model: (name, nameLength, templateName, templateLength) => { | |
| stackReset(); | |
| const name_p = stageIn(name, nameLength); | |
| const templateName_p = stageIn(templateName, templateLength); | |
| const ret = calls.rive_data_new_view_model(name_p, nameLength, templateName_p, templateLength); | |
| return ret; | |
| }, | |
| vmi_release: calls.rive_data_vmi_release, | |
| vmi_number: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_number(vmi, name_p, length); | |
| return ret; | |
| }, | |
| vmi_boolean: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_boolean(vmi, name_p, length); | |
| return ret; | |
| }, | |
| vmi_string: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_string(vmi, name_p, length); | |
| return ret; | |
| }, | |
| vmi_trigger: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_trigger(vmi, name_p, length); | |
| return ret; | |
| }, | |
| vmi_color: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_color(vmi, name_p, length); | |
| return ret; | |
| }, | |
| vmi_view_model: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_view_model(vmi, name_p, length); | |
| return ret; | |
| }, | |
| vmi_property: (vmi, name, length, kindOut, kindCount) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const kindOut_p = stageIn(kindOut, kindCount * 4); | |
| const ret = calls.rive_data_vmi_property(vmi, name_p, length, kindOut_p, kindCount); | |
| copyOut(kindOut_p, kindOut, kindCount * 4); | |
| return ret; | |
| }, | |
| vmi_instance: (vmi, name, nameLength) => { | |
| stackReset(); | |
| const name_p = stageIn(name, nameLength); | |
| const ret = calls.rive_data_vmi_instance(vmi, name_p, nameLength); | |
| return ret; | |
| }, | |
| vmi_symbol_index: calls.rive_data_vmi_symbol_index, | |
| vmi_equal: calls.rive_data_vmi_equal, | |
| view_model_get: calls.rive_data_view_model_get, | |
| vmi_list: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_list(vmi, name_p, length); | |
| return ret; | |
| }, | |
| vmi_enum: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_enum(vmi, name_p, length); | |
| return ret; | |
| }, | |
| vmi_image: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_image(vmi, name_p, length); | |
| return ret; | |
| }, | |
| vmi_font: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_font(vmi, name_p, length); | |
| return ret; | |
| }, | |
| vmi_blob: (vmi, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_data_vmi_blob(vmi, name_p, length); | |
| return ret; | |
| }, | |
| image_get: calls.rive_data_image_get, | |
| image_set: calls.rive_data_image_set, | |
| font_get: calls.rive_data_font_get, | |
| font_set: calls.rive_data_font_set, | |
| font_release: calls.rive_data_font_release, | |
| blob_present: calls.rive_data_blob_present, | |
| blob_get: (property, buffer, capacity) => { | |
| stackReset(); | |
| const buffer_p = stageIn(buffer, capacity); | |
| const ret = calls.rive_data_blob_get(property, buffer_p, capacity); | |
| copyOut(buffer_p, buffer, capacity); | |
| return ret; | |
| }, | |
| blob_name: (property, buffer, capacity) => { | |
| stackReset(); | |
| const buffer_p = stageIn(buffer, capacity); | |
| const ret = calls.rive_data_blob_name(property, buffer_p, capacity); | |
| copyOut(buffer_p, buffer, capacity); | |
| return ret; | |
| }, | |
| blob_set: (property, bytes, byteCount) => { | |
| stackReset(); | |
| const bytes_p = stageIn(bytes, byteCount); | |
| calls.rive_data_blob_set(property, bytes_p, byteCount); | |
| }, | |
| blob_clear: calls.rive_data_blob_clear, | |
| enum_get: (property, buffer, capacity) => { | |
| stackReset(); | |
| const buffer_p = stageIn(buffer, capacity); | |
| const ret = calls.rive_data_enum_get(property, buffer_p, capacity); | |
| copyOut(buffer_p, buffer, capacity); | |
| return ret; | |
| }, | |
| enum_set: (property, value, length) => { | |
| stackReset(); | |
| const value_p = stageIn(value, length); | |
| calls.rive_data_enum_set(property, value_p, length); | |
| }, | |
| enum_values: (property, buffer, capacity) => { | |
| stackReset(); | |
| const buffer_p = stageIn(buffer, capacity); | |
| const ret = calls.rive_data_enum_values(property, buffer_p, capacity); | |
| copyOut(buffer_p, buffer, capacity); | |
| return ret; | |
| }, | |
| prop_release: calls.rive_data_prop_release, | |
| trigger_fire: calls.rive_data_trigger_fire, | |
| list_length: calls.rive_data_list_length, | |
| list_push: calls.rive_data_list_push, | |
| list_pop: calls.rive_data_list_pop, | |
| list_shift: calls.rive_data_list_shift, | |
| list_clear: calls.rive_data_list_clear, | |
| list_swap: calls.rive_data_list_swap, | |
| list_insert: calls.rive_data_list_insert, | |
| list_remove: calls.rive_data_list_remove, | |
| list_remove_at: calls.rive_data_list_remove_at, | |
| list_remove_all_of: calls.rive_data_list_remove_all_of, | |
| list_get: calls.rive_data_list_get, | |
| view_model_set: calls.rive_data_view_model_set, | |
| color_get: calls.rive_data_color_get, | |
| color_set: calls.rive_data_color_set, | |
| number_get: calls.rive_data_number_get, | |
| number_set: calls.rive_data_number_set, | |
| boolean_get: calls.rive_data_boolean_get, | |
| boolean_set: calls.rive_data_boolean_set, | |
| string_get: (property, buffer, capacity) => { | |
| stackReset(); | |
| const buffer_p = stageIn(buffer, capacity); | |
| const ret = calls.rive_data_string_get(property, buffer_p, capacity); | |
| copyOut(buffer_p, buffer, capacity); | |
| return ret; | |
| }, | |
| string_changed: calls.rive_data_string_changed, | |
| string_set: (property, value, length) => { | |
| stackReset(); | |
| const value_p = stageIn(value, length); | |
| calls.rive_data_string_set(property, value_p, length); | |
| }, | |
| watch: calls.rive_data_watch, | |
| unwatch: calls.rive_data_unwatch, | |
| convert_result: (kind, number, booleanValue, color, value, length) => { | |
| stackReset(); | |
| const value_p = stageIn(value, length); | |
| calls.rive_data_convert_result(kind, number, booleanValue, color, value_p, length); | |
| }, | |
| }, | |
| rive_artboard_v1: { | |
| release: calls.rive_artboard_release, | |
| advance: calls.rive_artboard_advance, | |
| draw: calls.rive_artboard_draw, | |
| instance: calls.rive_artboard_instance, | |
| data: calls.rive_artboard_data, | |
| width: calls.rive_artboard_width, | |
| height: calls.rive_artboard_height, | |
| set_width: calls.rive_artboard_set_width, | |
| set_height: calls.rive_artboard_set_height, | |
| frame_origin: calls.rive_artboard_frame_origin, | |
| set_frame_origin: calls.rive_artboard_set_frame_origin, | |
| bounds: (artboard, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| calls.rive_artboard_bounds(artboard, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| }, | |
| pointer_event: calls.rive_artboard_pointer_event, | |
| gamepad_event: (artboard, payload, byteCount) => { | |
| stackReset(); | |
| const payload_p = stageIn(payload, byteCount); | |
| const ret = calls.rive_artboard_gamepad_event(artboard, payload_p, byteCount); | |
| return ret; | |
| }, | |
| animation: (artboard, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_artboard_animation(artboard, name_p, length); | |
| return ret; | |
| }, | |
| animation_release: calls.rive_artboard_animation_release, | |
| animation_duration: calls.rive_artboard_animation_duration, | |
| animation_advance: calls.rive_artboard_animation_advance, | |
| animation_set_time: calls.rive_artboard_animation_set_time, | |
| add_to_path: calls.rive_artboard_add_to_path, | |
| node: (artboard, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_artboard_node(artboard, name_p, length); | |
| return ret; | |
| }, | |
| node_release: calls.rive_artboard_node_release, | |
| node_transform: (node, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| calls.rive_artboard_node_transform(node, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| }, | |
| node_set: calls.rive_artboard_node_set, | |
| node_world_transform: (node, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| calls.rive_artboard_node_world_transform(node, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| }, | |
| node_set_world_transform: (node, values, floatCount) => { | |
| stackReset(); | |
| const values_p = stageIn(values, floatCount * 4); | |
| calls.rive_artboard_node_set_world_transform(node, values_p, floatCount); | |
| }, | |
| node_decompose: (node, values, floatCount) => { | |
| stackReset(); | |
| const values_p = stageIn(values, floatCount * 4); | |
| calls.rive_artboard_node_decompose(node, values_p, floatCount); | |
| }, | |
| node_path_verbs: (node, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount); | |
| const ret = calls.rive_artboard_node_path_verbs(node, out_p, outCount); | |
| copyOut(out_p, out, outCount); | |
| return ret; | |
| }, | |
| node_path_points: (node, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_artboard_node_path_points(node, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| node_paint: (node, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_artboard_node_paint(node, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| node_children: (node, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_artboard_node_children(node, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| node_parent: calls.rive_artboard_node_parent, | |
| property_key: (artboard, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_artboard_property_key(artboard, name_p, length); | |
| return ret; | |
| }, | |
| draw_visit: calls.rive_artboard_draw_visit, | |
| draw_modulated: calls.rive_artboard_draw_modulated, | |
| drawable_draw: calls.rive_artboard_drawable_draw, | |
| drawable_value: (drawable, key, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_artboard_drawable_value(drawable, key, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| drawable_string: (drawable, key, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount); | |
| const ret = calls.rive_artboard_drawable_string(drawable, key, out_p, outCount); | |
| copyOut(out_p, out, outCount); | |
| return ret; | |
| }, | |
| drawable_properties: (drawable, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount); | |
| const ret = calls.rive_artboard_drawable_properties(drawable, out_p, outCount); | |
| copyOut(out_p, out, outCount); | |
| return ret; | |
| }, | |
| }, | |
| rive_audio_v1: { | |
| source: (object, name, nameLength) => { | |
| stackReset(); | |
| const name_p = stageIn(name, nameLength); | |
| const ret = calls.rive_audio_source(object, name_p, nameLength); | |
| return ret; | |
| }, | |
| source_release: calls.rive_audio_source_release, | |
| source_duration: calls.rive_audio_source_duration, | |
| source_sample_rate: calls.rive_audio_source_sample_rate, | |
| source_channels: calls.rive_audio_source_channels, | |
| play: calls.rive_audio_play, | |
| play_at_time: calls.rive_audio_play_at_time, | |
| play_in_time: calls.rive_audio_play_in_time, | |
| play_at_frame: calls.rive_audio_play_at_frame, | |
| play_in_frame: calls.rive_audio_play_in_frame, | |
| time: calls.rive_audio_time, | |
| time_frame: calls.rive_audio_time_frame, | |
| sample_rate: calls.rive_audio_sample_rate, | |
| sound_release: calls.rive_audio_sound_release, | |
| sound_play: calls.rive_audio_sound_play, | |
| sound_pause: calls.rive_audio_sound_pause, | |
| sound_resume: calls.rive_audio_sound_resume, | |
| sound_stop: calls.rive_audio_sound_stop, | |
| sound_seek: calls.rive_audio_sound_seek, | |
| sound_seek_frame: calls.rive_audio_sound_seek_frame, | |
| sound_completed: calls.rive_audio_sound_completed, | |
| sound_time: calls.rive_audio_sound_time, | |
| sound_time_frame: calls.rive_audio_sound_time_frame, | |
| sound_volume: calls.rive_audio_sound_volume, | |
| sound_set_volume: calls.rive_audio_sound_set_volume, | |
| }, | |
| rive_path_v1: { | |
| new: calls.rive_path_new, | |
| update: (path, verbs, verbCount, points, floatCount, fillRule) => { | |
| stackReset(); | |
| const verbs_p = stageIn(verbs, verbCount); | |
| const points_p = stageIn(points, floatCount * 4); | |
| calls.rive_path_update(path, verbs_p, verbCount, points_p, floatCount, fillRule); | |
| }, | |
| release: calls.rive_path_release, | |
| add: calls.rive_path_add, | |
| verbs: (path, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount); | |
| const ret = calls.rive_path_verbs(path, out_p, outCount); | |
| copyOut(out_p, out, outCount); | |
| return ret; | |
| }, | |
| points: (path, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_path_points(path, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| effect_result: (verbs, verbCount, points, floatCount) => { | |
| stackReset(); | |
| const verbs_p = stageIn(verbs, verbCount); | |
| const points_p = stageIn(points, floatCount * 4); | |
| calls.rive_path_effect_result(verbs_p, verbCount, points_p, floatCount); | |
| }, | |
| }, | |
| rive_measure_v1: { | |
| path_new: (verbs, verbCount, points, floatCount) => { | |
| stackReset(); | |
| const verbs_p = stageIn(verbs, verbCount); | |
| const points_p = stageIn(points, floatCount * 4); | |
| const ret = calls.rive_measure_path_new(verbs_p, verbCount, points_p, floatCount); | |
| return ret; | |
| }, | |
| contours_new: (verbs, verbCount, points, floatCount) => { | |
| stackReset(); | |
| const verbs_p = stageIn(verbs, verbCount); | |
| const points_p = stageIn(points, floatCount * 4); | |
| const ret = calls.rive_measure_contours_new(verbs_p, verbCount, points_p, floatCount); | |
| return ret; | |
| }, | |
| contour_next: calls.rive_measure_contour_next, | |
| length: calls.rive_measure_length, | |
| is_closed: calls.rive_measure_is_closed, | |
| pos_tan: (measure, distance, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| calls.rive_measure_pos_tan(measure, distance, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| }, | |
| warp: (measure, x, y, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| calls.rive_measure_warp(measure, x, y, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| }, | |
| extract: calls.rive_measure_extract, | |
| extract_read: (measure, verbs, verbCount, points, floatCount) => { | |
| stackReset(); | |
| const verbs_p = stageIn(verbs, verbCount); | |
| const points_p = stageIn(points, floatCount * 4); | |
| const ret = calls.rive_measure_extract_read(measure, verbs_p, verbCount, points_p, floatCount); | |
| copyOut(verbs_p, verbs, verbCount); | |
| copyOut(points_p, points, floatCount * 4); | |
| return ret; | |
| }, | |
| release: calls.rive_measure_release, | |
| }, | |
| rive_paint_v1: { | |
| new: calls.rive_paint_new, | |
| release: calls.rive_paint_release, | |
| style: calls.rive_paint_style, | |
| color: calls.rive_paint_color, | |
| thickness: calls.rive_paint_thickness, | |
| join: calls.rive_paint_join, | |
| cap: calls.rive_paint_cap, | |
| blend_mode: calls.rive_paint_blend_mode, | |
| feather: calls.rive_paint_feather, | |
| shader: calls.rive_paint_shader, | |
| }, | |
| rive_canvas_v1: { | |
| new: calls.rive_canvas_new, | |
| release: calls.rive_canvas_release, | |
| width: calls.rive_canvas_width, | |
| height: calls.rive_canvas_height, | |
| resize: calls.rive_canvas_resize, | |
| image: calls.rive_canvas_image, | |
| begin_frame: calls.rive_canvas_begin_frame, | |
| end_frame: calls.rive_canvas_end_frame, | |
| }, | |
| rive_gpu_v1: { | |
| features: (out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_gpu_features(out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| canvas_new: calls.rive_gpu_canvas_new, | |
| canvas_release: calls.rive_gpu_canvas_release, | |
| canvas_color_view: (canvas, props, propCount) => { | |
| stackReset(); | |
| const props_p = stageIn(props, propCount * 4); | |
| const ret = calls.rive_gpu_canvas_color_view(canvas, props_p, propCount); | |
| copyOut(props_p, props, propCount * 4); | |
| return ret; | |
| }, | |
| canvas_image: calls.rive_gpu_canvas_image, | |
| canvas_resize: (canvas, width, height, props, propCount) => { | |
| stackReset(); | |
| const props_p = stageIn(props, propCount * 4); | |
| const ret = calls.rive_gpu_canvas_resize(canvas, width, height, props_p, propCount); | |
| copyOut(props_p, props, propCount * 4); | |
| return ret; | |
| }, | |
| target_view: (current, props, propCount) => { | |
| stackReset(); | |
| const props_p = stageIn(props, propCount * 4); | |
| const ret = calls.rive_gpu_target_view(current, props_p, propCount); | |
| copyOut(props_p, props, propCount * 4); | |
| return ret; | |
| }, | |
| pass_begin: (desc, descByteCount, colors, colorByteCount) => { | |
| stackReset(); | |
| const desc_p = stageIn(desc, descByteCount); | |
| const colors_p = stageIn(colors, colorByteCount); | |
| const ret = calls.rive_gpu_pass_begin(desc_p, descByteCount, colors_p, colorByteCount); | |
| return ret; | |
| }, | |
| pass_set_pipeline: calls.rive_gpu_pass_set_pipeline, | |
| pass_set_vertex_buffer: calls.rive_gpu_pass_set_vertex_buffer, | |
| pass_set_index_buffer: calls.rive_gpu_pass_set_index_buffer, | |
| pass_set_bind_group: (pass, groupIndex, bindGroup, dynamicOffsets, dynamicOffsetByteCount) => { | |
| stackReset(); | |
| const dynamicOffsets_p = stageIn(dynamicOffsets, dynamicOffsetByteCount); | |
| calls.rive_gpu_pass_set_bind_group(pass, groupIndex, bindGroup, dynamicOffsets_p, dynamicOffsetByteCount); | |
| }, | |
| pass_set_viewport: calls.rive_gpu_pass_set_viewport, | |
| pass_set_scissor: calls.rive_gpu_pass_set_scissor, | |
| pass_set_stencil_reference: calls.rive_gpu_pass_set_stencil_reference, | |
| pass_set_blend_color: calls.rive_gpu_pass_set_blend_color, | |
| pass_draw: calls.rive_gpu_pass_draw, | |
| pass_draw_indexed: calls.rive_gpu_pass_draw_indexed, | |
| pass_finish: calls.rive_gpu_pass_finish, | |
| pass_release: calls.rive_gpu_pass_release, | |
| image_view: calls.rive_gpu_image_view, | |
| buffer_new: (usage, sizeInBytes, immutable, data, dataCount) => { | |
| stackReset(); | |
| const data_p = stageIn(data, dataCount); | |
| const ret = calls.rive_gpu_buffer_new(usage, sizeInBytes, immutable, data_p, dataCount); | |
| return ret; | |
| }, | |
| buffer_update: (buffer, dstOffset, data, dataCount) => { | |
| stackReset(); | |
| const data_p = stageIn(data, dataCount); | |
| calls.rive_gpu_buffer_update(buffer, dstOffset, data_p, dataCount); | |
| }, | |
| buffer_release: calls.rive_gpu_buffer_release, | |
| texture_new: (desc, descByteCount) => { | |
| stackReset(); | |
| const desc_p = stageIn(desc, descByteCount); | |
| const ret = calls.rive_gpu_texture_new(desc_p, descByteCount); | |
| return ret; | |
| }, | |
| texture_upload: (texture, region, regionByteCount, data, dataCount) => { | |
| stackReset(); | |
| const region_p = stageIn(region, regionByteCount); | |
| const data_p = stageIn(data, dataCount); | |
| calls.rive_gpu_texture_upload(texture, region_p, regionByteCount, data_p, dataCount); | |
| }, | |
| texture_release: calls.rive_gpu_texture_release, | |
| sampler_new: (desc, descByteCount) => { | |
| stackReset(); | |
| const desc_p = stageIn(desc, descByteCount); | |
| const ret = calls.rive_gpu_sampler_new(desc_p, descByteCount); | |
| return ret; | |
| }, | |
| sampler_release: calls.rive_gpu_sampler_release, | |
| texture_view_new: (texture, desc, descByteCount) => { | |
| stackReset(); | |
| const desc_p = stageIn(desc, descByteCount); | |
| const ret = calls.rive_gpu_texture_view_new(texture, desc_p, descByteCount); | |
| return ret; | |
| }, | |
| texture_view_release: calls.rive_gpu_texture_view_release, | |
| shader_target: calls.rive_gpu_shader_target, | |
| shader_asset_bytes: (object, name, nameLength, out, outCount) => { | |
| stackReset(); | |
| const name_p = stageIn(name, nameLength); | |
| const out_p = stageIn(out, outCount); | |
| const ret = calls.rive_gpu_shader_asset_bytes(object, name_p, nameLength, out_p, outCount); | |
| copyOut(out_p, out, outCount); | |
| return ret; | |
| }, | |
| shader_asset_id: (object, name, nameLength) => { | |
| stackReset(); | |
| const name_p = stageIn(name, nameLength); | |
| const ret = calls.rive_gpu_shader_asset_id(object, name_p, nameLength); | |
| return ret; | |
| }, | |
| shader_module_new: (desc, descByteCount, blob, blobCount) => { | |
| stackReset(); | |
| const desc_p = stageIn(desc, descByteCount); | |
| const blob_p = stageIn(blob, blobCount); | |
| const ret = calls.rive_gpu_shader_module_new(desc_p, descByteCount, blob_p, blobCount); | |
| return ret; | |
| }, | |
| shader_module_release: calls.rive_gpu_shader_module_release, | |
| bind_group_layout_new: (groupIndex, entries, entryByteCount) => { | |
| stackReset(); | |
| const entries_p = stageIn(entries, entryByteCount); | |
| const ret = calls.rive_gpu_bind_group_layout_new(groupIndex, entries_p, entryByteCount); | |
| return ret; | |
| }, | |
| bind_group_layout_release: calls.rive_gpu_bind_group_layout_release, | |
| bind_group_layout_from_shader: (shaderModule, groupIndex, dynamicUBOs, dynamicUBOCount) => { | |
| stackReset(); | |
| const dynamicUBOs_p = stageIn(dynamicUBOs, dynamicUBOCount * 4); | |
| const ret = calls.rive_gpu_bind_group_layout_from_shader(shaderModule, groupIndex, dynamicUBOs_p, dynamicUBOCount); | |
| return ret; | |
| }, | |
| bind_group_layout_from_shaders: (vertexModule, fragmentModule, groupIndex, dynamicUBOs, dynamicUBOCount) => { | |
| stackReset(); | |
| const dynamicUBOs_p = stageIn(dynamicUBOs, dynamicUBOCount * 4); | |
| const ret = calls.rive_gpu_bind_group_layout_from_shaders(vertexModule, fragmentModule, groupIndex, dynamicUBOs_p, dynamicUBOCount); | |
| return ret; | |
| }, | |
| bind_group_new: (layout, ubos, uboByteCount, textures, textureByteCount, samplers, samplerByteCount) => { | |
| stackReset(); | |
| const ubos_p = stageIn(ubos, uboByteCount); | |
| const textures_p = stageIn(textures, textureByteCount); | |
| const samplers_p = stageIn(samplers, samplerByteCount); | |
| const ret = calls.rive_gpu_bind_group_new(layout, ubos_p, uboByteCount, textures_p, textureByteCount, samplers_p, samplerByteCount); | |
| return ret; | |
| }, | |
| bind_group_release: calls.rive_gpu_bind_group_release, | |
| pipeline_new: (desc, descByteCount, blob, blobCount) => { | |
| stackReset(); | |
| const desc_p = stageIn(desc, descByteCount); | |
| const blob_p = stageIn(blob, blobCount); | |
| const ret = calls.rive_gpu_pipeline_new(desc_p, descByteCount, blob_p, blobCount); | |
| return ret; | |
| }, | |
| pipeline_release: calls.rive_gpu_pipeline_release, | |
| }, | |
| rive_mat4_v1: { | |
| multiply: (out, outBytes, a, aBytes, b, bBytes) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outBytes); | |
| const a_p = stageIn(a, aBytes); | |
| const b_p = stageIn(b, bBytes); | |
| calls.rive_mat4_multiply(out_p, outBytes, a_p, aBytes, b_p, bBytes); | |
| copyOut(out_p, out, outBytes); | |
| }, | |
| invert: (out, outBytes, src, srcBytes) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outBytes); | |
| const src_p = stageIn(src, srcBytes); | |
| const ret = calls.rive_mat4_invert(out_p, outBytes, src_p, srcBytes); | |
| copyOut(out_p, out, outBytes); | |
| return ret; | |
| }, | |
| }, | |
| rive_buffer_v1: { | |
| new: calls.rive_buffer_new, | |
| update: (buffer, bytes, byteCount) => { | |
| stackReset(); | |
| const bytes_p = stageIn(bytes, byteCount); | |
| calls.rive_buffer_update(buffer, bytes_p, byteCount); | |
| }, | |
| release: calls.rive_buffer_release, | |
| }, | |
| rive_mesh_instances_v1: { | |
| new: calls.rive_mesh_instances_new, | |
| resize: calls.rive_mesh_instances_resize, | |
| update: (instances, first, bytes, byteCount) => { | |
| stackReset(); | |
| const bytes_p = stageIn(bytes, byteCount); | |
| calls.rive_mesh_instances_update(instances, first, bytes_p, byteCount); | |
| }, | |
| release: calls.rive_mesh_instances_release, | |
| }, | |
| rive_blob_v1: { | |
| asset_bytes: (object, name, nameLength, out, outCount) => { | |
| stackReset(); | |
| const name_p = stageIn(name, nameLength); | |
| const out_p = stageIn(out, outCount); | |
| const ret = calls.rive_blob_asset_bytes(object, name_p, nameLength, out_p, outCount); | |
| copyOut(out_p, out, outCount); | |
| return ret; | |
| }, | |
| }, | |
| rive_image_v1: { | |
| from_asset: (object, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_image_from_asset(object, name_p, length); | |
| return ret; | |
| }, | |
| width: calls.rive_image_width, | |
| height: calls.rive_image_height, | |
| release: calls.rive_image_release, | |
| decode: (bytes, byteCount, token) => { | |
| stackReset(); | |
| const bytes_p = stageIn(bytes, byteCount); | |
| const ret = calls.rive_image_decode(bytes_p, byteCount, token); | |
| return ret; | |
| }, | |
| decode_cancel: calls.rive_image_decode_cancel, | |
| }, | |
| rive_font_v1: { | |
| from_asset: (object, name, length) => { | |
| stackReset(); | |
| const name_p = stageIn(name, length); | |
| const ret = calls.rive_font_from_asset(object, name_p, length); | |
| return ret; | |
| }, | |
| decode: (bytes, byteCount) => { | |
| stackReset(); | |
| const bytes_p = stageIn(bytes, byteCount); | |
| const ret = calls.rive_font_decode(bytes_p, byteCount); | |
| return ret; | |
| }, | |
| release: calls.rive_font_release, | |
| metrics: (font, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| calls.rive_font_metrics(font, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| }, | |
| weight: calls.rive_font_weight, | |
| is_italic: calls.rive_font_is_italic, | |
| axis_count: calls.rive_font_axis_count, | |
| axis: (font, index, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| calls.rive_font_axis(font, index, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| }, | |
| axis_value: calls.rive_font_axis_value, | |
| features: (font, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_font_features(font, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| has_glyph: calls.rive_font_has_glyph, | |
| with_options: (font, coords, coordCount, features, featureCount) => { | |
| stackReset(); | |
| const coords_p = stageIn(coords, coordCount * 4); | |
| const features_p = stageIn(features, featureCount * 4); | |
| const ret = calls.rive_font_with_options(font, coords_p, coordCount, features_p, featureCount); | |
| return ret; | |
| }, | |
| glyph_verbs: (font, glyph, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount); | |
| const ret = calls.rive_font_glyph_verbs(font, glyph, out_p, outCount); | |
| copyOut(out_p, out, outCount); | |
| return ret; | |
| }, | |
| glyph_points: (font, glyph, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_font_glyph_points(font, glyph, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| }, | |
| rive_text_v1: { | |
| new: calls.rive_text_new, | |
| release: calls.rive_text_release, | |
| append: (text, chars, length, font, paint, size, lineHeight, letterSpacing, foreground) => { | |
| stackReset(); | |
| const chars_p = stageIn(chars, length); | |
| calls.rive_text_append(text, chars_p, length, font, paint, size, lineHeight, letterSpacing, foreground); | |
| }, | |
| clear: calls.rive_text_clear, | |
| layout: (text, desc, descByteCount) => { | |
| stackReset(); | |
| const desc_p = stageIn(desc, descByteCount); | |
| calls.rive_text_layout(text, desc_p, descByteCount); | |
| }, | |
| draw: calls.rive_text_draw, | |
| bounds: (text, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| calls.rive_text_bounds(text, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| }, | |
| length: calls.rive_text_length, | |
| lines: (text, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_text_lines(text, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| runs: (text, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_text_runs(text, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| glyphs: (text, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_text_glyphs(text, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| hit_test: calls.rive_text_hit_test, | |
| caret: (text, index, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_text_caret(text, index, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| selection_rects: (text, from, to, out, outCount) => { | |
| stackReset(); | |
| const out_p = stageIn(out, outCount * 4); | |
| const ret = calls.rive_text_selection_rects(text, from, to, out_p, outCount); | |
| copyOut(out_p, out, outCount * 4); | |
| return ret; | |
| }, | |
| }, | |
| rive_shader_v1: { | |
| linear: unsupported('rive_shader_linear'), | |
| radial: unsupported('rive_shader_radial'), | |
| release: calls.rive_shader_release, | |
| }, | |
| rive_test_v1: { | |
| blob: (name, nameLength, out, outCount) => { | |
| stackReset(); | |
| const name_p = stageIn(name, nameLength); | |
| const out_p = stageIn(out, outCount); | |
| const ret = calls.rive_test_blob(name_p, nameLength, out_p, outCount); | |
| copyOut(out_p, out, outCount); | |
| return ret; | |
| }, | |
| }, | |
| rive_transition_v1: { | |
| child_draw: calls.rive_transition_child_draw, | |
| child_width: calls.rive_transition_child_width, | |
| child_height: calls.rive_transition_child_height, | |
| }, | |
| rive_renderer_v1: { | |
| save: calls.rive_renderer_save, | |
| restore: calls.rive_renderer_restore, | |
| transform: calls.rive_renderer_transform, | |
| draw_path: calls.rive_renderer_draw_path, | |
| clip_path: calls.rive_renderer_clip_path, | |
| modulate_opacity: calls.rive_renderer_modulate_opacity, | |
| modulate_color: calls.rive_renderer_modulate_color, | |
| draw_image: calls.rive_renderer_draw_image, | |
| draw_image_mesh: calls.rive_renderer_draw_image_mesh, | |
| draw_image_mesh_instanced: calls.rive_renderer_draw_image_mesh_instanced, | |
| }, | |
| }; | |
| } |