AcademySoftwareFoundation / AcademySoftwareFoundation/openvdb

[BUG] PNANOVDB_GRID_TYPE_CAP should be 28 (is 32)

Open
#2,107 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
3.4k
Forks
777
Avg merge
3d 9h
Merged PRs (30d)
34

Description

Environment

Operating System: Windows 11
Version / Commit SHA: v12.1.1 (e3a9b1c1d9c9247c2d0fd85f688cc66bda16e890)
Other: DirectXShaderCompiler 1.8.2403.2 (11e1318)

Describe the bug

When PNanoVDB.h is included in the HLSL shader and the PNANOVDB_HLSL define is set as the only define the DXC compiler reports a bunch of errors related to the fact that PNANOVDB_GRID_TYPE_CAP is set to 32, while it seems it should be 28. Manually editing the file and changing the value to 28 fixes the issue.

data/shader/common/PNanoVDB.h:1153:106: error: too few elements in vector initialization (expected 32 elements, have 28)
PNANOVDB_STATIC_CONST pnanovdb_uint32_t pnanovdb_grid_type_value_strides_bits[PNANOVDB_GRID_TYPE_CAP]  = {  0, 32, 64, 16, 32, 64,  96, 192,  0, 16, 32,  1, 32,  4,  8, 16,  0, 128, 256,  0,  0,  0,  0, 16, 24, 48,  8,  0 };
                                                                                                         ^
data/shader/common/PNanoVDB.h:1155:106: error: too few elements in vector initialization (expected 32 elements, have 28)
PNANOVDB_STATIC_CONST pnanovdb_uint32_t pnanovdb_grid_type_table_strides_bits[PNANOVDB_GRID_TYPE_CAP]  = { 64, 64, 64, 64, 64, 64, 128, 192, 64, 64, 64, 64, 64, 64, 64, 64, 64, 128, 256, 64, 64, 64, 64, 64, 64, 64, 64, 64 };
                                                                                                         ^
data/shader/common/PNanoVDB.h:1157:106: error: too few elements in vector initialization (expected 32 elements, have 28)
PNANOVDB_STATIC_CONST pnanovdb_uint32_t pnanovdb_grid_type_minmax_strides_bits[PNANOVDB_GRID_TYPE_CAP] = {  0, 32, 64, 16, 32, 64,  96, 192,  8, 16, 32,  8, 32, 32, 32, 32, 32, 128, 256, 64, 64, 64, 64, 64, 24, 48,  8,  0 };
                                                                                                         ^
data/shader/common/PNanoVDB.h:1159:106: error: too few elements in vector initialization (expected 32 elements, have 28)
PNANOVDB_STATIC_CONST pnanovdb_uint32_t pnanovdb_grid_type_minmax_aligns_bits[PNANOVDB_GRID_TYPE_CAP]  = {  0, 32, 64, 16, 32, 64,  32,  64,  8, 16, 32,  8, 32, 32, 32, 32, 32,  32,  64, 64, 64, 64, 64, 64,  8, 16,  8,  0 };
                                                                                                         ^
data/shader/common/PNanoVDB.h:1161:106: error: too few elements in vector initialization (expected 32 elements, have 28)
PNANOVDB_STATIC_CONST pnanovdb_uint32_t pnanovdb_grid_type_stat_strides_bits[PNANOVDB_GRID_TYPE_CAP]   = {  0, 32, 64, 32, 32, 64,  32,  64,  8, 32, 32,  8, 32, 32, 32, 32, 32,  32,  64, 64, 64, 64, 64, 64, 32, 32, 32,  0 };
                                                                                                         ^
data/shader/common/PNanoVDB.h:1163:106: error: too few elements in vector initialization (expected 32 elements, have 28)
PNANOVDB_STATIC_CONST pnanovdb_uint32_t pnanovdb_grid_type_leaf_type[PNANOVDB_GRID_TYPE_CAP]           = {  0,  0,  0,  0,  0,  0,  0,    0,  1,  0,  0,  1,  0,  2,  2,  2,  2,   0,   0,  3,  3,  4,  4,  5,  0,  0,  0,  0 };
To Reproduce

Steps to reproduce the behavior:

  1. Build any HLSL shader with DXC compiler that defines PNANOVDB_HLSL and includes the PNanoVDB.h header
  2. See error
Expected behavior

No error.

Additional context

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in data/shader/common/PNanoVDB.h around lines 1153-1163 and compare PNANOVDB_GRID_TYPE_CAP with the initializer lengths. Reproduce by compiling an HLSL shader with DXC, PNANOVDB_HLSL, and this header; done when the reported initialization errors are gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.