OpenVDB 13.0.0

Loading...
Searching...
No Matches
VolumeKernelFunctions.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: Apache-2.0
3
4/// @file codegen/VolumeKernelFunctions.h
5///
6/// @authors Nick Avramoussis
7///
8/// @brief The definitions of the public functions built by the
9/// VolumeComputeGenerator.
10///
11
12#ifndef OPENVDB_AX_VOLUME_KERNEL_FUNCTIONS_HAS_BEEN_INCLUDED
13#define OPENVDB_AX_VOLUME_KERNEL_FUNCTIONS_HAS_BEEN_INCLUDED
14
15#include "Types.h"
16#include <openvdb/version.h>
17
18#include <array>
19#include <string>
20
21 namespace openvdb {
22 OPENVDB_USE_VERSION_NAMESPACE
23 namespace OPENVDB_VERSION_NAME {
24
25 namespace ax {
26 namespace codegen {
27
28/// @brief The primary volume kernel. This function holds the generated body
29/// of AX programs.
30/// @details argument structure is as follows:
31/// 1) - A void pointer to the ax::CustomData
32/// 2) - A pointer to an array of three ints representing the
33/// current voxel coord being accessed
34/// 3) - A void pointer to the current value buffer
35/// 4) - A bool representing the current values active state
36/// 5) - The index of the current tile in the parent tile's table
37/// 6) - A void pointer to a vector of void pointers, representing
38/// an array of grid accessors
39/// 7) - A void pointer to a vector of void pointers, representing
40/// an array of grid transforms
41/// 8) - The index of currently executing volume in the list of write
42/// accessible volumes.
43 struct VolumeKernelValue
44{
45 // The signature of the generated function
46 using Signature =
47 void(const void* const,
48 const int32_t (*)[3],
49 void*, // value
50 bool, // active
51 int64_t, // index
52 void**, // r accessors
53 const void* const*,
54 int64_t);
55
56 using FunctionTraitsT = codegen::FunctionTraits<Signature>;
57 static const size_t N_ARGS = FunctionTraitsT::N_ARGS;
58
59 static const std::array<std::string, N_ARGS>& argumentKeys();
60 static const char* getDefaultName();
61};
62
63/// @brief The second volume kernel, responsible for providing the core
64/// layer of SIMD optimisations by invoking this kernel across a range of
65/// values.
66/// @details argument structure is as follows:
67/// 1) - A void pointer to the ax::CustomData
68/// 2) - A pointer to an array of three ints representing the
69/// current voxel coord being accessed
70/// 3) - A void pointer to the current value buffer
71/// 4) - A uint64_t pointer to the active word buffer
72/// 5) - The active state execution mode
73/// 6) - A void pointer to a vector of void pointers, representing
74/// an array of grid accessors
75/// 7) - A void pointer to a vector of void pointers, representing
76/// an array of grid transforms
77/// 8) - The index of currently executing volume in the list of write
78/// accessible volumes.
79 struct VolumeKernelBuffer
80{
81 // The signature of the generated function
82 using Signature =
83 void(const void* const,
84 const int32_t (*)[3],
85 void*, // value buffer
86 uint64_t*, // active buffer
87 int64_t, // buffer size
88 uint64_t, // mode (0 = off, 1 = active, 2 = both)
89 void**, // read accessors
90 const void* const*, // transforms
91 int64_t); // write index
92
93 using FunctionTraitsT = codegen::FunctionTraits<Signature>;
94 static const size_t N_ARGS = FunctionTraitsT::N_ARGS;
95
96 static const std::array<std::string, N_ARGS>& argumentKeys();
97 static const char* getDefaultName();
98};
99
100/// @brief The third volume kernel, providing an agnostic way to modify
101/// a single tile value without passing through the buffer states. Note
102/// that this kernel is mainly utility and one of the value kernels should
103/// almost always be preferred.
104/// @details argument structure is as follows:
105/// 1) - A void pointer to the ax::CustomData
106/// 2) - A pointer to an array of three ints representing the
107/// current voxel coord being accessed
108/// 3) - A void pointer to a vector of void pointers, representing
109/// an array of grid accessors
110/// 4) - A void pointer to a vector of void pointers, representing
111/// an array of grid transforms
112/// 5) - The index of currently executing volume in the list of write
113/// accessible volumes.
114/// 5) - A unique write accessor to the target volume.
115 struct VolumeKernelNode
116{
117 // The signature of the generated function
118 using Signature =
119 void(const void* const,
120 const int32_t (*)[3], // index space coord
121 void**, // read accessors
122 const void* const*, // transforms
123 int64_t, // write index
124 void*); // write accessor
125
126 using FunctionTraitsT = codegen::FunctionTraits<Signature>;
127 static const size_t N_ARGS = FunctionTraitsT::N_ARGS;
128
129 static const std::array<std::string, N_ARGS>& argumentKeys();
130 static const char* getDefaultName();
131};
132
133} // namespace codegen
134} // namespace ax
135} // namespace OPENVDB_VERSION_NAME
136} // namespace openvdb
137
138#endif // OPENVDB_AX_VOLUME_KERNEL_FUNCTIONS_HAS_BEEN_INCLUDED
139
Types.h
Consolidated llvm types for most supported types.
openvdb
Definition Exceptions.h:13
openvdb::v13_0::ax::codegen::FunctionTraits
Templated function traits which provides compile-time index access to the types of the function signa...
Definition Types.h:311
openvdb::v13_0::ax::codegen::VolumeKernelBuffer
The second volume kernel, responsible for providing the core layer of SIMD optimisations by invoking ...
Definition VolumeKernelFunctions.h:80
openvdb::v13_0::ax::codegen::VolumeKernelBuffer::FunctionTraitsT
codegen::FunctionTraits< Signature > FunctionTraitsT
Definition VolumeKernelFunctions.h:93
openvdb::v13_0::ax::codegen::VolumeKernelBuffer::argumentKeys
static const std::array< std::string, N_ARGS > & argumentKeys()
openvdb::v13_0::ax::codegen::VolumeKernelBuffer::N_ARGS
static const size_t N_ARGS
Definition VolumeKernelFunctions.h:94
openvdb::v13_0::ax::codegen::VolumeKernelBuffer::getDefaultName
static const char * getDefaultName()
openvdb::v13_0::ax::codegen::VolumeKernelBuffer::Signature
void(const void *const, const int32_t(*)[3], void *, uint64_t *, int64_t, uint64_t, void **, const void *const *, int64_t) Signature
Definition VolumeKernelFunctions.h:82
openvdb::v13_0::ax::codegen::VolumeKernelNode
The third volume kernel, providing an agnostic way to modify a single tile value without passing thro...
Definition VolumeKernelFunctions.h:116
openvdb::v13_0::ax::codegen::VolumeKernelNode::FunctionTraitsT
codegen::FunctionTraits< Signature > FunctionTraitsT
Definition VolumeKernelFunctions.h:126
openvdb::v13_0::ax::codegen::VolumeKernelNode::argumentKeys
static const std::array< std::string, N_ARGS > & argumentKeys()
openvdb::v13_0::ax::codegen::VolumeKernelNode::N_ARGS
static const size_t N_ARGS
Definition VolumeKernelFunctions.h:127
openvdb::v13_0::ax::codegen::VolumeKernelNode::Signature
void(const void *const, const int32_t(*)[3], void **, const void *const *, int64_t, void *) Signature
Definition VolumeKernelFunctions.h:118
openvdb::v13_0::ax::codegen::VolumeKernelNode::getDefaultName
static const char * getDefaultName()
openvdb::v13_0::ax::codegen::VolumeKernelValue
The primary volume kernel. This function holds the generated body of AX programs.
Definition VolumeKernelFunctions.h:44
openvdb::v13_0::ax::codegen::VolumeKernelValue::FunctionTraitsT
codegen::FunctionTraits< Signature > FunctionTraitsT
Definition VolumeKernelFunctions.h:56
openvdb::v13_0::ax::codegen::VolumeKernelValue::argumentKeys
static const std::array< std::string, N_ARGS > & argumentKeys()
openvdb::v13_0::ax::codegen::VolumeKernelValue::Signature
void(const void *const, const int32_t(*)[3], void *, bool, int64_t, void **, const void *const *, int64_t) Signature
Definition VolumeKernelFunctions.h:46
openvdb::v13_0::ax::codegen::VolumeKernelValue::N_ARGS
static const size_t N_ARGS
Definition VolumeKernelFunctions.h:57
openvdb::v13_0::ax::codegen::VolumeKernelValue::getDefaultName
static const char * getDefaultName()
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218