Repository navigation
Open
Labels
readyMeets the definition of Ready; claimable
Description
Unit
Port shader_parse and its sp_parse_* helpers in libobs/graphics/shader-parser.c.h to the existing obs-graphics crate. Not in scope: shader_sampler_convert (#1716) and the name lookups get_shader_param_type, get_sample_filter, get_address_mode (#839).
Phase and position
Phase 6 (#444): "the effect/shader parser" is a claimable unit there. The effect parser lifecycle is done (#1644, #1650). The shader parser is the smaller of the two parsers and has no claim.
Dependencies and existing tests
shader_parse(EXPORT) runscf_parser_parse, which calls the cf preprocessor. cf-parser and cf-tokenizer are ported; the cf preprocessor is rust: Port util/cf-lexer.c (cf preprocessor) to obs-util #1499 (claimed). The Rust swap waits for rust: Port util/cf-lexer.c (cf preprocessor) to obs-util #1499. The C characterization does not.- The result is the public
struct shader_parserinshader-parser.h: DARRAYs ofshader_var,shader_struct,shader_samplerandshader_func, plus thecf_parserand its tokens. The header's static inline init, free and lookup functions use these fields directly. - Direct users of the fields: libobs-opengl (
gl-shaderparser.c.hwalks the tokens betweenshader_func.startand.endto write GLSL), libobs-d3d11 (d3d11-shaderprocessor.cpp.hpp) and libobs-metal (OBSShader.swift). The port must fill the same C layouts, with memory from bmalloc so thatshader_parser_freecan release it, and withstart/endpointing intocfp's token array. - Existing tests:
test_shader_param_namesandtest_shader_sampler_convertcover the parts that are already split off. No test coversshader_parse.
Plan and notes
- C-only characterization PR: a cmocka test against the real exported
shader_parse, run against the C reference and the hybrid. It covers uniform and const parameters, arrays and assignments (int, float, float array), structs, samplers, functions with parameters, mappings and return types, the lookup functions, thestart/endtokens of each function body, and the error text and position for malformed input. A corpus check parses shader text taken from the shipped.effectfiles and compares a digest of each result. - Rust RED, then GREEN, in
obs-graphicsafter rust: Port util/cf-lexer.c (cf preprocessor) to obs-util #1499 merges, with layout assertions for the public structs and differential parity against the C oracle on the characterization inputs. A fuzz target followsdocs/rust-port/fuzzing.md. - Swap: move the file to the ported list (
LIBOBS_PORTED_SOURCES).
No intended behavior changes and no protocol surface. Any difference from the C code goes to its own issue first.
Metadata
Metadata
Assignees
Labels
readyMeets the definition of Ready; claimable
Type
Projects
- StatusShow more project fieldsBlocked
Activity
vpacher commentedon Oct 22, 2026
Claiming: graphics/shader-parser.c (
shader_parseand thesp_parse_*helpers), characterization first.shader_parse, against the C reference and the hybrid. Parameters, structs, samplers, functions, lookups, the function body tokens (start/end) that the OpenGL backend walks, error text and position, plus a corpus digest over shader text taken from the shipped.effectfiles.obs-graphicsafter rust: Port util/cf-lexer.c (cf preprocessor) to obs-util #1499 (cf preprocessor) merges: layout assertions for the public structs, differential parity against the C oracle, fuzz target.Decisions:
start/endintocfp's tokens) and does not changeshader-parser.h. Reason: libobs-opengl, libobs-d3d11 and libobs-metal read the fields directly.zackees commentedon Oct 24, 2026
@vpacher, are you still on this? The claim from 2026-10-22 has lapsed, and I found no PR here (or a characterization PR for
shader_parse). If you've stopped, I'll take it from the characterization step in your plan. If there's a branch, link it and I'll build on it. I'll take it over tomorrow (2026-10-25) if there's no reply.vpacher commentedon Oct 24, 2026
Claiming: graphics/shader-parser.c (
shader_parseand thesp_parse_*helpers).@zackees yes, I am still on this. The characterization step waits on non-public work that is coordinated with a maintainer, and the Rust step waits on #1499. There is no public branch yet. I will mark the claim blocked in the next comment.
vpacher commentedon Oct 24, 2026
Blocked: waiting on #1499 and on non-public work that is coordinated with a maintainer.
vpacher commentedon Oct 25, 2026
Blocked: waiting on #1499 and on non-public work that is coordinated with a maintainer.
nathan-v commentedon Nov 7, 2026
Claiming: #1785, the characterization of
shader_parse.shader_parse. It pins functions (params, mappings, and the token range the GL backend walks fromstart), the header lookups, and error text and position. Sampler-state and struct blocks stay withtest_shader_parser_blocks. Number defaults stay withtest_shader_number_defaults. No change toshader-parser.h.The characterization PR should be up today.
github-actions commentedon Nov 7, 2026
Claim bot: @nathan-v, this can't be claimed yet: it is blocked by 1 open issue(s) (see "Blocked by" on the issue); claim it once they close.
vpacher commentedon Nov 8, 2026
This is blocked by #1499, which is mine and waits on non-public work that is coordinated with a maintainer. I'll claim #1785 once #1499 is closed. @nathan-v, please hold the characterization PR until then, so it builds on the port in #1499.