Skip to content

Remove Cell::shared1 and Cell::shared2, use tempValue1/tempValue2 instead#561

Merged
chrxh merged 2 commits intofeatures/CreatureCheckfrom
copilot/remove-cell-shared1-and-shared2
Mar 19, 2026
Merged

Remove Cell::shared1 and Cell::shared2, use tempValue1/tempValue2 instead#561
chrxh merged 2 commits intofeatures/CreatureCheckfrom
copilot/remove-cell-shared1-and-shared2

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

Consolidate shared1/shared2 fields into the existing TempValue union fields. These serve the same role (per-object scratch storage across kernel phases) and never overlap temporally — physics uses them for force accumulation, then cell state transitions reuse the same memory via the as_uint32_float view.

  • Remove float2 shared1 and float2 shared2 from Object struct in Entities.cuh
  • Replace all usages in ObjectProcessor.cuh: shared1tempValue1.as_float2, shared2tempValue2.as_float2
  • Drop redundant shared1 = {0,0} init (already covered by tempValue1.as_uint64 = 0)
// Before
object->shared1 += F_pressure * strength * density;
atomicAdd(&otherObject->shared1.x, force.x);
object->shared2 = object->shared1;  // forces

// After
object->tempValue1.as_float2 += F_pressure * strength * density;
atomicAdd(&otherObject->tempValue1.as_float2.x, force.x);
object->tempValue2.as_float2 = object->tempValue1.as_float2;

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…tempValue2.as_float2 instead

Co-authored-by: chrxh <73127001+chrxh@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove Cell::shared1 and Cell::shared2 for tempValue1 and tempValue2 Remove Cell::shared1 and Cell::shared2, use tempValue1/tempValue2 instead Mar 19, 2026
Copilot AI requested a review from chrxh March 19, 2026 20:54
@chrxh chrxh marked this pull request as ready for review March 19, 2026 21:30
@chrxh chrxh merged commit de1c3da into features/CreatureCheck Mar 19, 2026
@chrxh chrxh deleted the copilot/remove-cell-shared1-and-shared2 branch March 19, 2026 21:30
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