Skip to content

feat: add code for drawing full scenes#209

Draft
beckermr wants to merge 14 commits intomainfrom
fix-bounds-scene-rend
Draft

feat: add code for drawing full scenes#209
beckermr wants to merge 14 commits intomainfrom
fix-bounds-scene-rend

Conversation

@beckermr
Copy link
Collaborator

@beckermr beckermr commented Mar 11, 2026

This PR addresses some of the full-scene rendering issues raised in #190.

  • bounds comparisons can be vmapped
  • can render objects in stamps and then apply to full image via vmapping
  • can render sum of objects into the full image

There were a few issues, many of which were unrelated:

  • some bugs in the repr functions have been fixed
  • the bounds objects' pytrees change shape when traced
  • images need to tell JAX to trace their attached bounds objects (these were marked as static data)
  • We cannot render objects with the center keyword set to a JAX value since it uses the bounds to basically put the object at the right location in the stamp. So instead, I coded up rendering with an offset and applying the bounds shifts after.
  • For JIT-ed code, we need dynamic slice operators to assemble the final image.
  • The final bit is that for JAX you need fixed size arrays. So when you assemble the stamps, you actually need to pad the image you are adding into by the stamp size and then remove the padding. This avoids having to add a dynamically sized array into the final image.

One change that we could explore to make all of this more automatic would be to represent image bounds as a location + width, instead of (xmin, xmax, ymin, ymax). This would be more compatible with JAX since we could force the width to be a python int and then automatically use dynamic slice operators to add images together within the bounds.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 11, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 36 untouched benchmarks


Comparing fix-bounds-scene-rend (ab4c052) with main (d2f2d94)

Open in CodSpeed

@beckermr beckermr changed the title fix: ensure bounds comparisons can be vmapped feat: add code for drawing full scenes Mar 13, 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.

1 participant