Skip to content

fix(heterovec): fix type mismatch in with_index generated comparison#12

Merged
SimonDanisch merged 1 commit intoJuliaGeometry:sd/multitype-vecfrom
jkrumbiegel:jk/fix-with-index-type-mismatch
Mar 1, 2026
Merged

fix(heterovec): fix type mismatch in with_index generated comparison#12
SimonDanisch merged 1 commit intoJuliaGeometry:sd/multitype-vecfrom
jkrumbiegel:jk/fix-with-index-type-mismatch

Conversation

@jkrumbiegel
Copy link
Copy Markdown

Summary

  • SetKey.type_idx was changed from UInt8 to UInt32 for LLVM/SPIR-V compatibility, but the @generated with_index function still compared against UInt8 literals
  • Since Julia's === checks both value and type, UInt32(1) === UInt8(1) is always false, causing all branches to fall through to the default (first material)
  • This made every object render with the same material regardless of its actual assigned material

How these changes were tested

  • Rendered a scene with multiple spheres using different MatteMaterial colors (red, green, purple) — all previously appeared gray, now render with correct colors
  • Rendered a materials gallery with 6 different materials (matte, diffuse, conductor) — all show distinct appearances

Created with the help of Claude Code

SetKey.type_idx was changed from UInt8 to UInt32 for LLVM/SPIR-V
compatibility, but the @generated with_index function still compared
against UInt8 literals. Since Julia's === checks both value and type,
UInt32(1) === UInt8(1) is always false, causing all branches to fall
through to the default (first material). This made every object render
with the same material.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@SimonDanisch SimonDanisch merged commit a2c23ee into JuliaGeometry:sd/multitype-vec Mar 1, 2026
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.

2 participants