Skip to content

Commit

Permalink
Runtime: Streamline deferred UI event names for RML 6
Browse files Browse the repository at this point in the history
The library no longer supports immediate rendering, so there's no point in keeping the old event names around. Since the contract was broken anyway, might as well rename the events to match the new behavior and get it over with.
  • Loading branch information
rdw-software committed Jun 2, 2024
1 parent b810bb9 commit df366b4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Runtime/Bindings/FFI/RmlUi_Renderer_WebGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ Rml::CompiledGeometryHandle RenderInterface_WebGPU::CompileGeometry(Rml::Span<co

RML_DEBUG_TRACE("Compiled geometry %p (%d vertices + %d indices; %d bytes per vertex)", geometry, num_vertices, num_indices, sizeof(Rml::Vertex));

geometry_compile_event_t payload {
.type = GEOMETRY_COMPILE_EVENT,
GEOMETRY_COMPILATION_EVENT_t payload {
.type = GEOMETRY_COMPILATION_EVENT,

Check notice on line 134 in Runtime/Bindings/FFI/RmlUi_Renderer_WebGPU.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Excess Number of Function Arguments

RenderInterface_WebGPU::CompileGeometry is no longer above the threshold for number of arguments
.compiled_geometry = *geometry,
};
deferred_event_t event { .geometry_compilation_details = payload };
Expand All @@ -146,7 +146,7 @@ void RenderInterface_WebGPU::RenderGeometry(Rml::CompiledGeometryHandle rmlGeome
RML_DEBUG_TRACE("Rendering compiled geometry %p with translation (%.2f, %.2f)", geometry, rmlTranslationVector.x, rmlTranslationVector.y);

compilation_render_event_t payload {
.type = COMPILATION_RENDER_EVENT,
.type = GEOMETRY_RENDER_EVENT,
.compiled_geometry = *geometry,
.translate_u = rmlTranslationVector.x,
.translate_v = rmlTranslationVector.y,
Expand All @@ -161,7 +161,7 @@ void RenderInterface_WebGPU::ReleaseGeometry(Rml::CompiledGeometryHandle rmlGeom
RML_DEBUG_TRACE("Releasing compiled geometry %p", geometry);

compilation_release_event_t payload {
.type = COMPILATION_RELEASE_EVENT,
.type = GEOMETRY_RELEASE_EVENT,
.compiled_geometry = *geometry,
};
deferred_event_t event { .compilation_release_details = payload };
Expand Down
11 changes: 5 additions & 6 deletions Runtime/Bindings/FFI/interop/interop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ typedef enum {
KEYBOARD_EVENT,
CHARACTER_INPUT_EVENT,
// RML UI events
GEOMETRY_COMPILATION_EVENT,
GEOMETRY_RENDER_EVENT,
GEOMETRY_COMPILE_EVENT,
COMPILATION_RENDER_EVENT,
COMPILATION_RELEASE_EVENT,
GEOMETRY_RELEASE_EVENT,
SCISSORTEST_STATUS_EVENT,
SCISSORTEST_REGION_EVENT,
TEXTURE_LOAD_EVENT,
Expand Down Expand Up @@ -154,10 +153,10 @@ typedef struct geometry_render_event_t {
float translate_v;
} geometry_render_event_t;
typedef struct geometry_compile_event_t {
typedef struct GEOMETRY_COMPILATION_EVENT_t {
int type;
rml_geometry_info_t compiled_geometry;
} geometry_compile_event_t;
} GEOMETRY_COMPILATION_EVENT_t;
typedef struct compilation_render_event_t {
int type;
Expand Down Expand Up @@ -240,7 +239,7 @@ typedef union deferred_event_t {
character_input_event_t character_input_details;
// RML
geometry_render_event_t geometry_render_details;
geometry_compile_event_t geometry_compilation_details;
GEOMETRY_COMPILATION_EVENT_t geometry_compilation_details;
compilation_render_event_t compilation_render_details;
compilation_release_event_t compilation_release_details;
scissortest_status_event_t scissortest_status_details;
Expand Down
11 changes: 5 additions & 6 deletions Runtime/Bindings/FFI/interop/interop_exports.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ typedef enum {
KEYBOARD_EVENT,
CHARACTER_INPUT_EVENT,
// RML UI events
GEOMETRY_COMPILATION_EVENT,
GEOMETRY_RENDER_EVENT,
GEOMETRY_COMPILE_EVENT,
COMPILATION_RENDER_EVENT,
COMPILATION_RELEASE_EVENT,
GEOMETRY_RELEASE_EVENT,
SCISSORTEST_STATUS_EVENT,
SCISSORTEST_REGION_EVENT,
TEXTURE_LOAD_EVENT,
Expand Down Expand Up @@ -145,10 +144,10 @@ typedef struct geometry_render_event_t {
float translate_v;
} geometry_render_event_t;

typedef struct geometry_compile_event_t {
typedef struct GEOMETRY_COMPILATION_EVENT_t {
int type;
rml_geometry_info_t compiled_geometry;
} geometry_compile_event_t;
} GEOMETRY_COMPILATION_EVENT_t;

typedef struct compilation_render_event_t {
int type;
Expand Down Expand Up @@ -231,7 +230,7 @@ typedef union deferred_event_t {
character_input_event_t character_input_details;
// RML
geometry_render_event_t geometry_render_details;
geometry_compile_event_t geometry_compilation_details;
GEOMETRY_COMPILATION_EVENT_t geometry_compilation_details;
compilation_render_event_t compilation_render_details;
compilation_release_event_t compilation_release_details;
scissortest_status_event_t scissortest_status_details;
Expand Down

0 comments on commit df366b4

Please sign in to comment.