Skip to content

Commit

Permalink
Use div_up for rounding up
Browse files Browse the repository at this point in the history
  • Loading branch information
szellmann committed Nov 26, 2024
1 parent 5f9a488 commit eb7e16c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scene/volume/spatial_field/BlockStructuredField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ void BlockStructuredField::buildGrid()
{
#ifdef WITH_CUDA
box3f worldBounds = {bounds().min,bounds().max};
int3 dims{(worldBounds.max-worldBounds.min)/float3(8.f)};
dims = max(int3(1),dims);
int3 dims{
div_up(int(worldBounds.max.x-worldBounds.min.x),8),
div_up(int(worldBounds.max.y-worldBounds.min.y),8),
div_up(int(worldBounds.max.z-worldBounds.min.z),8)
};
m_gridAccel.init(dims, worldBounds);

dco::GridAccel &vaccel = m_gridAccel.visionarayAccel();
Expand All @@ -199,8 +202,11 @@ void BlockStructuredField::buildGrid()
vaccel, m_blocks.devicePtr(), numBlocks, m_params.gridOrigin, m_params.gridSpacing);
#else
box3f worldBounds = {bounds().min,bounds().max};
int3 dims{(worldBounds.max-worldBounds.min)/float3(8.f)};
dims = max(int3(1),dims);
int3 dims{
div_up(int(worldBounds.max.x-worldBounds.min.x),8),
div_up(int(worldBounds.max.y-worldBounds.min.y),8),
div_up(int(worldBounds.max.z-worldBounds.min.z),8)
};
m_gridAccel.init(dims, worldBounds);

dco::GridAccel &vaccel = m_gridAccel.visionarayAccel();
Expand Down

0 comments on commit eb7e16c

Please sign in to comment.