Skip to content

fix: use layout(color) for proper color space handling#3

Merged
Manabu-GT merged 1 commit intomainfrom
fix/colorspace
Feb 13, 2026
Merged

fix: use layout(color) for proper color space handling#3
Manabu-GT merged 1 commit intomainfrom
fix/colorspace

Conversation

@Manabu-GT
Copy link
Copy Markdown
Owner

@Manabu-GT Manabu-GT commented Feb 13, 2026

Summary

  • Use layout(color) uniform half4 in AGSL shaders instead of plain uniform float4 for all color uniforms
  • Switch from setFloatUniform(name, r, g, b, a) to setColorUniform(name, color.toArgb()) in UniformBinder
  • Ensures Android automatically converts colors from sRGB to the canvas working color space (e.g. Display P3) on wide-gamut devices

Test plan

  • Build and install sample app on device
  • Verify Rain, Snow, Clouds, and LightningFlash effects render correctly
  • Visually confirm no color regression on sRGB and wide-gamut displays

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced color rendering accuracy and performance in weather visual effects (clouds, lightning, rain, and snow).
    • Optimized shader color uniform declarations and binding mechanisms for improved efficiency in color data handling and rendering.

…dling

Color uniforms were passed as raw floats via setFloatUniform, bypassing
Android's color management. On wide-gamut (Display P3) devices, this
could cause colors to appear slightly off. Now uses layout(color)
qualifier in AGSL shaders with setColorUniform for automatic sRGB to
canvas working color space conversion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

Color uniform handling is refactored across the codebase. The Kotlin-side UniformBinder now converts colors to ARGB integers via toArgb() and passes them directly to setColorUniform(). Simultaneously, shader declarations are updated from float4 to half4 with layout(color) qualifiers for color uniforms across multiple weather components.

Changes

Cohort / File(s) Summary
Color Binding Refactor
aether/src/main/kotlin/com/ms/square/aether/core/internal/UniformBinder.kt
Simplified color binding by replacing manual RGBA component extraction with toArgb() conversion, passing ARGB integers directly to setColorUniform(). Added import for toArgb().
Shader Color Uniform Updates
aether/src/main/kotlin/com/ms/square/aether/weather/Clouds.kt, aether/src/main/kotlin/com/ms/square/aether/weather/LightningFlash.kt, aether/src/main/kotlin/com/ms/square/aether/weather/Rain.kt, aether/src/main/kotlin/com/ms/square/aether/weather/Snow.kt
Updated shader color uniform declarations from uniform float4 to layout(color) uniform half4 for cloudColor, flashColor, rainColor, haloColor, tintColor, and snowColor uniforms.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10-15 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: updating color handling in AGSL shaders to use layout(color) for proper color space handling, which is the primary objective across all modified files.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/colorspace

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Manabu-GT Manabu-GT merged commit ee94a9f into main Feb 13, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant