Repository navigation
Add linear PBR output and shared tone-mapping operators - #4351
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
It changes a public stdlib function's output and adds a renderer output path affecting GLSL/SPIR-V/Vulkan shaders whose rendering correctness cannot be exercised in this automated environment, so it warrants human sign-off.
1 open issue
What changed in this PR
This PR extracts the tone-mapping/sRGB helpers that were duplicated across the OpenGL and Vulkan tutorials into a new shared daslib/color_mapping module, adds an optional scene-linear output path to the glTF PBR renderer, and corrects the sRGB linear-segment threshold in linear_to_SRGB. It fits into the stdlib/shader-tutorial surface: the same operators now feed GLSL, SPIR-V and Vulkan consumers, with matching documentation, license attribution, and CPU/shader/readback regression tests.
Changes:
- New
daslib/color_mappingmodule withtone_reinhard/tone_aces_fit/tone_pbr_neutralandcolor_srgb_encode/decode(+ per-channel forms); tutorials and gltf shaders now call the shared operators instead of local copies. - Fixes
linear_to_SRGBto use the correct0.0031308linear-segment threshold (was0.00031308), with a dedicated transfer regression test. - Adds
GltfPbrRenderer.linearOutput(scene-linear radiance + fog decode) plus license/notice wiring (THIRD_PARTY_NOTICES, CMake install, bundle smoke test) and docs/architecture/tests.
| File | Description |
|---|---|
| daslib/color_mapping.das | New shared module: tone operators + sRGB transfer functions |
| daslib/math_boost.das | Corrects linear_to_SRGB linear-segment threshold |
| daslib/color_mapping.LICENSE | Apache-2.0 + ACES attribution for the new operators |
| daslib/ARCHITECTURE_SHADER.md | New #color-output-boundaries section cited by the operators |
| modules/dasGLTF/gltf/gltf_pbr.das | Adds u_linear_output uniform, linear output + fog decode, linearOutput field |
| modules/dasGLTF/tests/test_render_targets.das | GL readback regression for linear/legacy/fog/tint |
| modules/dasGLTF/README.md | Documents linear output + shared operators |
| tutorials/opengl/{03_sdf,11_hdr,12_gltf} | Replace local tonemap/aces_fit with shared operators |
| modules/dasVulkan/tutorials/{03_sdf,11_hdr}/*_shaders.das | Same operator migration for Vulkan |
| tests/math/test_color_mapping.das, test_srgb_transfer.das | CPU reference-value and transfer coverage |
| tests/glsl/test_color_mapping.das, tests/spirv/{_color_mapping_shader,test_color_mapping,test_census}.das | GLSL/SPIR-V shader compilation + census coverage |
| tests/aot/CMakeLists.txt | Registers the new SPIR-V shader module for AOT |
| doc/* , skills/daslang/references/everything.md, THIRD_PARTY_NOTICES.md, CMakeLists.txt, ci/smoke_test_bundle.sh, tests/README.md | Docs digest, toctree, license install, and bundle/test bookkeeping |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
It spans a public-API behavior change (linear_to_SRGB), the glTF renderer, and GPU shader/SPIR-V/GLSL paths whose device-rendering and golden-fixture claims cannot be verified here, so it warrants human review.
3 open issues
Review effort: Balanced
81a705d to
b9a9d76
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
It changes a shared, widely-used color function's output and spans stdlib, renderer HDR behavior, cross-API shader emission, and license/install wiring, which warrants human sign-off despite the code appearing correct.
1 open issue
3 resolved since last review
Review effort: Balanced
b9a9d76 to
3424887
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
It changes a shared public color function's behavior, adds a new public stdlib module and a glTF renderer output mode, and spans shader codegen across GLSL/SPIR-V/Vulkan whose device-rendering path the PR itself states was not executed, warranting human final sign-off.
No open issues 🎉
1 resolved since last review
Review effort: Balanced

Behavior change:
linear_to_SRGBnow uses the correct linear-segment threshold for dark values. The glTF renderer keeps its existing output by default.Why. HDR composition needs radiance before display encoding. Tone operators were duplicated across tutorials.
What changes.
Observable behavior.
0.001now returns0.01292.Where to look.
color_mapping.das,gltf_pbr.das, and the CPU/shader/readback regressions.Validation, claims, ledger
Validation
test_aotbuild and sweep passed. The one full preflight stopped on added line lengths; after wrapping, targeted lint and every skipped runtime/utility lane passed. Post-review focused tests also pass; the Windows x86 precision adjustment is described below.COLOR_MAPPING.LICENSE, fails when it is removed, and passes when restored; installed bytes match the source.pow. A native 32-bit probe reproduced the three CI precision failures; tests now use measured allowances of 2.5e-5 for their round-trip inputs and 1e-4 for their HDR decode vector on that platform only. Other targets retain their original bounds. The Windows 32-bit CI lane passes with the correction. All 14 negative controls still fail with the wider limits; no assertions were removed.daslib/color_mapping.das; checked against those declarations and generateddoc/source/stdlib/generated/color_mapping.rstusingbin/daslang -documentation doc/reflections/das2rst.das.color-output-boundariesarchitecture section was checked against both cited operators (tone_reinhard,tone_aces_fit) and the named OpenGL/Vulkan tutorial consumers.Claims - stated, not tested
Not done
aces_tonemapremains unchanged because its negative-input policy differs.