Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ChannelAccessor has no valid channel pointer with VectorGrid #2000

Open
ZephirFXEC opened this issue Jan 25, 2025 · 0 comments
Open

[BUG] ChannelAccessor has no valid channel pointer with VectorGrid #2000

ZephirFXEC opened this issue Jan 25, 2025 · 0 comments
Labels

Comments

@ZephirFXEC
Copy link

ZephirFXEC commented Jan 25, 2025

Environment

Operating System: Win 10
Version: VDB 12.0

Describe the bug

I'm building an nanovdb::IndexGrid from an openvdb::FloatGrid. It encodes voxel values as blind data that can be accessed with a
nanovdb::ChannelAccessor<float, nanovdb::ValueOnIndex>, there everythings works as it should.

But when using an openvdb::VectorGrid and the accessor nanovdb::ChannelAccessor<nanovdb::Vec3f, nanovdb::ValueOnIndex> the channel ptr is empty.

To Reproduce

using SrcGridT  = openvdb::FloatGrid; // replace by opevdb::VectorGrid 
using DstBuildT = nanovdb::ValueOnIndex;
using BufferT   = nanovdb::cuda::DeviceBuffer;

nanovdb::GridHandle<BufferT> idxHandle = nanovdb::tools::createNanoGrid<SrcGridT, DstBuildT, BufferT>(*floatGrid /* *vectorGrid */, 1u, false , false, 0);
idxHandle.deviceUpload(stream, false);

const auto* gpuGrid = idxHandle.deviceGrid<DstBuildT>();
launch_kernels(gpuGrid, toSample, stream);

Then a cuda kernel is launched to access the grid on the GPU.

__global__ void gpu_kernel(const nanovdb::NanoGrid<nanovdb::ValueOnIndex>* gpuGrid, const float* data) {
	const nanovdb::ChannelAccessor<float /* nanovdb::Vec3f */, nanovdb::ValueOnIndex> acc(*gpuGrid);

	if (!acc) {
		printf("Error: ChannelAccessor has no valid channel pointer! (null)\n");
		return;
	}

	const uint32_t idx000 = acc.idx(0, 0, 0);
	printf("Idx at Coord 0,0,0 : %u\n", idx000);
}

Additional context

I tried different configurations such as adding 3u channel with the VectorGrid and trying to access each component individually but it didn't work.

@ZephirFXEC ZephirFXEC added the bug label Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant