Repository navigation
Description
Unit
libobs/graphics/effect-parser.c.h: the effect parser's compile step, moved to a new hidden file and then ported to rust/obs-graphics:
ep_compile(): onceep_parse()finds no errors, fills thegs_effectfrom the parser: sizeseffect->paramsandeffect->techniques, then compiles each param and technique;ep_compile_param(),ep_compile_param_annotations()andep_compile_annotations(): eachgs_effect_param(and annotation) gets a copy of its name, its section, its effect, its type (obs_effect_param_type()) and the parser's default value (moved,da_move);ViewProjandWorldare kept aseffect->view_proj/effect->world;ep_compile_technique()andep_compile_pass(): each technique's and pass's name and section, with a "missing vertex/pixel shader" error logged for a pass whose shader fails;ep_compile_pass_shader(): builds the shader text withep_makeshaderstring()(the ported writer), creates the vertex or pixel shader, adds the device's compile errors to the parser's error list, thenep_compile_pass_shaderparams()pairs each used param with the effect's and the shader's param of that name.
The debug printers (debug_get_default_value(), debug_param(), debug_param_annotation(), debug_print_string(), only built with _DEBUG and _DEBUG_SHADERS) stay with ep_parse(), which prints with debug_print_string() too. ep_parse() calls ep_compile(), so its declaration goes into a new internal graphics/effect-parser-compile.h (a private adapter, not a new public API) and ep_compile() loses its static; under the same #if, debug_param() and debug_print_string() are declared there and lose theirs.
Phase and position
Phase 6 style (#444): a behaviour-neutral extraction, then the port. Crate obs-graphics, after the effect parser's shader writer (#3765, ported in #3769). Tracking: #4.
Dependencies and existing tests
- The blocks, passes, lifecycle, parameters and shader writer of the effect parser are ported (rust: Port the effect parser's struct and sampler-state blocks #3550, rust: Port the effect parser's passes and techniques #3598, rust: Port graphics/effect-parser lifecycle to obs-graphics #1644, obs-graphics: Port the effect parser params #3621, obs-graphics: Port the effect parser writer #3769).
- No C test pins what the compile step puts in the effect.
test_effect_parser_shader_call(libobs: Free and reset after unknown shader calls #3626) renamesgs_vertexshader_create()andgs_pixelshader_create()to recorders that return NULL, which is how a test can reachep_compile()with no graphics device. A newtest_effect_parser_compile(cmocka) compiles the original effect parser C into itself the same way, with the shader-create calls andgs_shader_get_param_by_name()renamed to stand-ins that hand back fake shaders and params from a table, and pins, throughep_parse()on fixed texts: eachgs_effect_param(name, section, type, default value, annotations,view_proj/world), each technique and pass (name, section, which shaders were created, theeparam/sparampairs), the shader-create calls (text and location), the result, the error list and the "missing vertex shader" / "missing pixel shader" lines when a shader fails or lacks a param. - PR 1: the characterization and the move, C only. PR 2: the Rust port of the moved file.
Notes
- A failed pass keeps whatever shader and params it got (
effect_free()frees them later); the port must leave the same state and free nothing itself. ViewProjandWorldare found with a case-sensitivestrcmp.- Expected intentional difference for the port: the compile step's own debug lines are gone in
_DEBUG_SHADERSbuilds (a developer-only define that no CI build sets). Nothing else changes. - Threads: effects are compiled on the graphics thread, inside
gs_effect_create().
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Nov 7, 2026
Claiming: #3792.
test_effect_parser_compile(cmocka): the original effect parser C compiled into the test, the shader-create calls andgs_shader_get_param_by_name()renamed to stand-ins with a table of fake shaders and params, pinning whatep_parse()puts in thegs_effectfor fixed texts (params, annotations, defaults,view_proj/world, techniques, passes, shader params), the shader-create calls, the result, the errors and the logged lines. No graphics device, so it runs everywhere.graphics/effect-parser-compile.hdeclaresep_compile()(no longerstatic; hidden, not EXPORT), plusdebug_param()anddebug_print_string()under_DEBUG_SHADERS; the debug printers stay ineffect-parser.c.hwithep_parse().ep_compile*functions intographics/effect-parser-compile.c.h, in its own live unity group, checked with a move harness (master's and the moved C over the same inputs, GCC and Clang, -O0/-O2, ASan/UBSan, planted mutants) and identical export sets on the C, hybrid and C reference builds.obs-graphics'seffect_parsermodule (Tier 1, the hiddenep_compile()shim, Tier 3 against the C with mutation, the include into a ported group), in its own PR.Draft PR for 1 to 3 expected today.
test: Skip the param link when nothing compiled
libobs: Move the effect parser compile step to file (obs-rust#3807)
rdoupe commentedon Nov 7, 2026
Continuing with step 4, the Rust port of the moved compile step (steps 1 to 3 landed in #3807):
shadertest module againsttodo!()stubs, portingtest_effect_parser_compile's cases one to one, with the shader backend (create, param lookups, errors, log) behind a trait.obs_graphics::effect_parser::compile, calling the ported param types and writer directly.ep_compile()shim, writinggs_effect, its params, techniques, passes and pass shader params in place as the C does, throughgs_vertexshader_create(),gs_pixelshader_create(),gs_shader_get_param_by_name(),gs_effect_get_param_by_name(),cf_adderror()andblog(); layout tests against the C.effect-parser-compile.c.hover a recording stub backend, and a proptest comparing the effect, the backend calls, the errors and the result, with a mutation check._DEBUG_SHADERSbuilds.Draft PR expected today, once the RED commit exists.
obs-graphics: Test the effect parser compile step
obs-graphics: Port the effect parser compile step
obs-graphics: Swap in the effect parser compile step
obs-graphics: Compare the effect parser compile step
docs: Record the effect parser compile step port
obs-graphics: Keep the compile step's C order
rdoupe commentedon Nov 8, 2026
Progress: the Rust port of the compile step is in #3843. It includes Tier 1, the hidden
ep_compile()shim swapped into the hybrid libobs,test_effect_parser_compile_rustrunning the unchanged C test against it, and Tier 3 parity with mutation. Local gate and PR CI were green, and it went to the merge queue, but the latest queue run failed its checks. Next: find out whether that failure is the PR's or a flake, fix it if it's ours, and re-queue.obs-graphics: Test the effect parser compile step
obs-graphics: Port the effect parser compile step
obs-graphics: Swap in the effect parser compile step
obs-graphics: Compare the effect parser compile step
docs: Record the effect parser compile step port
obs-graphics: Keep the compile step's C order
obs-graphics: Port the effect parser compile step (obs-rust#3843)
rdoupe commentedon Nov 8, 2026
Closed by the Rust port of the effect parser's compile step (PR #3843, merged through the merge queue). The compile step was first moved to its own file with a characterization test (PR #3807). The port covers
ep_compile()and its helpers inobs_graphics::effect_parser::compile, the hiddenep_compile()shim in the hybrid libobs, the unchanged C testtest_effect_parser_compile_rustagainst it, and Tier 3 parity with mutation.Left: nothing for this unit. The compile step's own debug lines are gone in
_DEBUG_SHADERSbuilds (the expected, developer-only difference). The rest of the effect parser has no follow-up issue from this unit.