Repository navigation
Stage 8d: C API validation layer, device functions, sample_binaural - #47
Merged
Merged
Conversation
- Validation layer (IPL_CONTEXTFLAGS_VALIDATION, callers of 4.5+): every ipl* function checks its arguments and results as upstream's api_validation_layer.cpp does and logs the same warnings to its context's log callback (method name, type, stringized expression, value formatted as MSVC's %f/%p). Checks that would crash upstream are skipped. - Embree, OpenCL, Radeon Rays and TrueAudio Next device functions: creation fails, retain gives null, a device list has no devices. - Upstream's src/itest cannot build against phonon.h (internal headers, GLFW, ImGui, PortAudio); upstream's sample_binaural, written against phonon.h alone, builds unchanged against the port's phonon.dll instead. - Goldens: capi_validation (8 sections of log messages, device statuses), capi_sample (input and upstream output). Messages match byte for byte; sample audio within 2.9e-7 x peak (FFT, R1), also for the port-built sample. - Plan: 8d row, name map, R34; DEVIATIONS: validation and device rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Stage 8d of the porting plan: the C API's validation layer and device functions, and an unchanged upstream program built against the port's
phononlibrary.crates/phonon-capi/src/validation.rs, wired into every module): withIPL_CONTEXTFLAGS_VALIDATION(callers of API 4.5+), eachipl*function checks its arguments and results asapi_validation_layer.cppdoes and logs the same warnings to the context's log callback: method name (__func__), type, the expression as the macro stringizes it, and the value as MSVC'sstd::to_string/%pprint it. Expression strings are built withconcat!, so validation allocates nothing unless it logs.devices.rs): Embree, OpenCL, Radeon Rays and TrueAudio Next functions fail, as in upstream built without those libraries; retain gives null, a device list has no devices.src/itest, but it includes internal C++ headers, links thecoreobject library and needs GLFW/ImGui/PortAudio, so it cannot build againstphonon.h. Upstream'score/src/samples/sample_binaural.cpp(onlyphonon.h) is built unchanged against both upstream (sample_binaural_upstream) and the port'sphonon.dll(sample_binaural_port, withGOLDEN_PORT_PHONON_DIR);tools/golden/run_sample.pyruns either.Verification
capi_validationgoldens: 8 sections of log messages from upstream with hand-picked invalid values (NaN kinds, infinities,%fedge cases, bad enums/flags/bools, null pointers, mismatched shapes, bad probe indices, post-call checks). Match byte for byte; the same calls without validation log nothing. Device statusesEXACT.capi_sample: the port-built sample's output and the same calls through the crate (on every CI platform) are within 2.9e-7 × peak of upstream's (FFT, R1). The port-built check is#[ignore](needs the reference build; steps intools/golden/README.md).cargo test --allpass locally on Windows.For reviewers
DEVIATIONS.md): per-context log callback instead of upstream's global log; validated device factories fail instead of returning empty devices; checks that would crash upstream are skipped; context-settings warnings go to the new context's callback; only validation warnings are logged.IPL_AIRABSORPTIONTYPE_CALLBACK).itest→sample_binauralsubstitution.🤖 Generated with Claude Code