Repository navigation
Closed
Labels
enhancementNew feature or requestportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimable
Description
Unit
libobs/graphics/effect-parser.c.h: the effect parser's passes and techniques, moved to a new hidden file and then ported to rust/obs-graphics:
ep_parse_pass_command_call()andep_parse_pass_command(): onevertex_shader|vertex_program|pixel_shader|pixel_program = [compile] <call>;command, its tokens copied into the pass'svertex_programorfragment_programwith a zeroed end token;ep_parse_pass():pass [name] { <commands> };ep_parse_technique():technique name { <passes> }, pushed intoep->techniques.
ep_parse() calls ep_parse_technique() after the technique keyword. It becomes a hidden (not EXPORT) function declared in a new internal graphics/effect-parser-passes.h, in a new libobs/graphics/effect-parser-passes.c.h; the pass and command helpers stay static inside it.
Phase and position
Phase 6 style (#444): a behaviour-neutral extraction, then the port. Crate obs-graphics, after the effect parser's struct and sampler-state blocks (#3550). Tracking: #4.
Dependencies and existing tests
- No open PR touches
graphics/effect-parser.*; the blocks move and port (libobs: Move the effect parser blocks to own file #3561, obs-graphics: Port the effect parser blocks #3595) have merged. - No C test pins what
ep_parse()builds from technique blocks: the effect tests load whole effects through a device.ep_parse()is hidden in libobs, so a newtest_effect_parser_passes(cmocka) compiles the original effect parser C into itself, astest_effect_parser_blocksdoes, and callsep_init(),ep_parse()andep_free()on fixed effect texts behind a first line of{}, whose error keepsep_parse()from callingep_compile()(which needs a device). It pinsep->techniques(names, pass names, the token strings ofvertex_programandfragment_program, end token included), the error and warning list, and the allocation count afterep_free(): named and unnamed passes, both spellings, thecompilewarning, a missing;before}, an unknown command, a non-passentry, a technique without{, and text cut short at each step. No display, no graphics context. - PR 1: the characterization and the move, C only. PR 2: the Rust port of the moved file.
Notes
- The functions fill the parser's
struct ep_techniqueandstruct ep_pass(bmalloc'd names and token darrays freed byep_free()) and walkep->cfp's tokens in place, so the port works on the C parser's token cursor and keeps everycf_adderror()where it is. - One expected intentional difference in the port:
ep_parse_technique()returns without freeing the technique's name when the text ends right after the name, or when a technique without{has no;after it (a leak per malformed technique, seen only in the allocation count). The characterization pins the count it sees; the port frees it, and its parity test lists the difference. - Threads: effects are parsed on the graphics thread; nothing here keeps state.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimable
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Nov 4, 2026
Claiming: #3598.
test_effect_parser_passes(cmocka) that compiles the original effect parser C into itself, astest_effect_parser_blocksdoes, and pinsep->techniques(names, pass names, thevertex_programandfragment_programtokens, end token included), every error and warning with its row and column, and the allocations still held afterep_free(), on fixed texts behind a first line of{}soep_compile()never runs.ep_parse_pass_command_call(),ep_parse_pass_command(),ep_parse_pass()andep_parse_technique()as written intolibobs/graphics/effect-parser-passes.c.h, withep_parse_technique()declared in an internalgraphics/effect-parser-passes.hand its own live unity group, as libobs: Move the effect parser blocks to own file #3561 did for the blocks. Export sets identical on the C, hybrid and C reference builds.leaked 0and a C fix in the same PR, so the port has no intentional difference.obs-graphics, with its Tier 1 and Tier 3 tests.First PR (steps 1-3) as a draft today.
test: Characterize the effect parser passes
libobs: Move the effect parser passes to own file
test: Expect the effect technique name to free
libobs: Free effect technique names on all paths
obs-graphics: Test the effect parser passes
obs-graphics: Port the effect parser passes
obs-graphics: Compare the effect parser passes
docs: Record the effect parser passes port
rdoupe commentedon Nov 4, 2026
Closed by the Rust port PR (#3609, merged through the merge queue as f8bc87e). It follows the characterization test and the move into
libobs/graphics/effect-parser-passes.c.h(#3599), which also fixed the technique-name leak on the two early returns in the C. The effect parser's passes and techniques (ep_parse_technique,ep_parse_pass,ep_parse_pass_commandand the call's loop) now run inrust/obs-graphics, with Tier 1, Tier 2 layouts and Tier 3 parity tests, and no intentional differences from the C.Left of this unit: nothing. The rest of the effect parser's
ep_parse()pieces continue in the follow-up issues for the parameter value assignments (#3610) and the annotations and parameter declaration (#3611).libobs: Move the effect parser passes to own file (obs-rust#3599)
obs-graphics: Port the effect parser passes (obs-rust#3609)