Skip to content

Commit

Permalink
BugFix: FLAMEGPU_SEATBELTS macro was changed back to SEATBELTS in a f…
Browse files Browse the repository at this point in the history
…w places.

Probably a bad merge.
  • Loading branch information
Robadob committed Mar 20, 2023
1 parent 54ca13d commit d519027
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions include/flamegpu/runtime/environment/DeviceEnvironment.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ __device__ __forceinline__ ReadOnlyDeviceMacroProperty<T, I, J, K, W> ReadOnlyDe
template<typename T, unsigned int I, unsigned int J, unsigned int K, unsigned int W, unsigned int N>
__device__ __forceinline__ DeviceMacroProperty<T, I, J, K, W> DeviceEnvironment::getMacroProperty(const char(&name)[N]) const {
char* d_ptr = detail::curve::DeviceCurve::getEnvironmentMacroProperty<T, I, J, K, W>(name);
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
if (!d_ptr) {
return DeviceMacroProperty<T, I, J, K, W>(nullptr, nullptr);
}
Expand All @@ -134,7 +134,7 @@ __device__ __forceinline__ DeviceMacroProperty<T, I, J, K, W> DeviceEnvironment:
template<unsigned int M>
__device__ __forceinline__ DeviceEnvironmentDirectedGraph ReadOnlyDeviceEnvironment::getDirectedGraph(const char(&name)[M]) const {
const detail::curve::Curve::VariableHash graph_hash = detail::curve::Curve::variableHash(name);
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
// Seatbelts check that the graph exists, by looking for mandatory vertex _id property
// Rather than it failing at property lookup time
if (detail::curve::DeviceCurve::getVariableIndex((graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_vertex")) + detail::curve::Curve::variableHash("_id"))
Expand All @@ -149,7 +149,7 @@ __device__ __forceinline__ DeviceEnvironmentDirectedGraph ReadOnlyDeviceEnvironm
template<unsigned int M>
__device__ __forceinline__ DeviceEnvironmentDirectedGraph ReadOnlyDeviceEnvironment::getDirectedGraph(const char(&name)[M]) const {
const detail::curve::Curve::VariableHash graph_hash = detail::curve::Curve::variableHash(name);
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
// Seatbelts check that the graph exists, by requesting it's hash
if (detail::curve::DeviceCurve::getGraphHash(name) == detail::curve::DeviceCurve::UNKNOWN_GRAPH) {
DTHROW("Environment directed graph with name '%s' was not found\n", name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ __device__ DeviceEnvironmentDirectedGraph::OutEdgeFilter::OutEdgeFilter(const de
: bucket_begin(0)
, bucket_end(0)
, graph_hash(_graph_hash) {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
// Vertex "_id" always exists
const unsigned int VERTEX_COUNT = detail::curve::DeviceCurve::getVariableCount("_id", graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_vertex"));
if (vertexID >= VERTEX_COUNT) {
Expand All @@ -432,7 +432,7 @@ __device__ DeviceEnvironmentDirectedGraph::OutEdgeFilter::OutEdgeFilter(const de
}
#endif
unsigned int* pbm = detail::curve::DeviceCurve::getEnvironmentDirectedGraphPBM(graph_hash);
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
if (!pbm) return;
#endif
bucket_begin = pbm[vertexID];
Expand All @@ -443,7 +443,7 @@ __device__ DeviceEnvironmentDirectedGraph::InEdgeFilter::InEdgeFilter(const deta
, bucket_end(0)
, graph_ipbm_edges(nullptr)
, graph_hash(_graph_hash) {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
// Vertex "_id" always exists
const unsigned int VERTEX_COUNT = detail::curve::DeviceCurve::getVariableCount("_id", graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_vertex"));
if (vertexID >= VERTEX_COUNT) {
Expand All @@ -452,7 +452,7 @@ __device__ DeviceEnvironmentDirectedGraph::InEdgeFilter::InEdgeFilter(const deta
}
#endif
unsigned int* ipbm = detail::curve::DeviceCurve::getEnvironmentDirectedGraphIPBM(graph_hash);
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
if (!ipbm) return;
#endif
bucket_begin = ipbm[vertexID];
Expand All @@ -463,7 +463,7 @@ __device__ DeviceEnvironmentDirectedGraph::InEdgeFilter::InEdgeFilter(const deta

template<typename T, unsigned int N>
__device__ T DeviceEnvironmentDirectedGraph::OutEdgeFilter::Edge::getProperty(const char(&property_name)[N]) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
if (edge_index >= _parent.bucket_end) {
DTHROW("Edge index exceeds bin length, unable to get property '%s'.\n", property_name);
return {};
Expand All @@ -475,7 +475,7 @@ __device__ T DeviceEnvironmentDirectedGraph::OutEdgeFilter::Edge::getProperty(co
}
template<typename T, flamegpu::size_type N, unsigned int M> __device__
T DeviceEnvironmentDirectedGraph::OutEdgeFilter::Edge::getProperty(const char(&property_name)[M], const unsigned int& element_index) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
if (edge_index >= _parent.bucket_end) {
DTHROW("Edge index exceeds bin length, unable to get property '%s'.\n", property_name);
return {};
Expand All @@ -487,7 +487,7 @@ T DeviceEnvironmentDirectedGraph::OutEdgeFilter::Edge::getProperty(const char(&p
}
template<typename T, unsigned int N>
__device__ T DeviceEnvironmentDirectedGraph::InEdgeFilter::Edge::getProperty(const char(&property_name)[N]) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
const unsigned int EDGE_COUNT = detail::curve::DeviceCurve::getVariableCount("_source_dest", _parent.graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_edge"));
if (edge_index >= EDGE_COUNT) {
DTHROW("Edge index exceeds edge count, unable to get property '%s'.\n", property_name);
Expand All @@ -500,7 +500,7 @@ __device__ T DeviceEnvironmentDirectedGraph::InEdgeFilter::Edge::getProperty(con
}
template<typename T, flamegpu::size_type N, unsigned int M> __device__
T DeviceEnvironmentDirectedGraph::InEdgeFilter::Edge::getProperty(const char(&property_name)[M], const unsigned int& element_index) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
const unsigned int EDGE_COUNT = detail::curve::DeviceCurve::getVariableCount("_source_dest", _parent.graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_edge"));
if (edge_index >= EDGE_COUNT) {
DTHROW("Edge index exceeds edge count, unable to get property '%s'.\n", property_name);
Expand All @@ -518,7 +518,7 @@ __device__ __forceinline__ id_t DeviceEnvironmentDirectedGraph::InEdgeFilter::Ed
return getProperty<id_t, 2>("_source_dest", 1);
}
__device__ __forceinline__ id_t DeviceEnvironmentDirectedGraph::getVertexID(const unsigned int vertex_index) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
const unsigned int VERTEX_COUNT = detail::curve::DeviceCurve::getVariableCount("_id", graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_vertex"));
if (vertex_index >= VERTEX_COUNT) {
DTHROW("Vertex index (%u) exceeds vertex count (%u), unable to get vertex ID.\n", vertex_index, VERTEX_COUNT);
Expand All @@ -529,7 +529,7 @@ __device__ __forceinline__ id_t DeviceEnvironmentDirectedGraph::getVertexID(cons
}
template<typename T, unsigned int M>
__device__ __forceinline__ T DeviceEnvironmentDirectedGraph::getVertexProperty(const char(&property_name)[M], const unsigned int vertex_index) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
const unsigned int VERTEX_COUNT = detail::curve::DeviceCurve::getVariableCount(property_name, graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_vertex"));
if (vertex_index >= VERTEX_COUNT) {
DTHROW("Vertex index (%u) exceeds vertex count (%u), unable to get property '%s'.\n", vertex_index, VERTEX_COUNT, property_name);
Expand All @@ -540,7 +540,7 @@ __device__ __forceinline__ T DeviceEnvironmentDirectedGraph::getVertexProperty(c
}
template<typename T, flamegpu::size_type N, unsigned int M>
__device__ __forceinline__ T DeviceEnvironmentDirectedGraph::getVertexProperty(const char(&property_name)[M], const unsigned int vertex_index, const unsigned int element_index) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
const unsigned int VERTEX_COUNT = detail::curve::DeviceCurve::getVariableCount(property_name, graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_vertex"));
if (vertex_index >= VERTEX_COUNT) {
DTHROW("Vertex index (%u) exceeds vertex count (%u), unable to get property '%s'.\n", vertex_index, VERTEX_COUNT, property_name);
Expand All @@ -551,7 +551,7 @@ __device__ __forceinline__ T DeviceEnvironmentDirectedGraph::getVertexProperty(c
}

__device__ __forceinline__ id_t DeviceEnvironmentDirectedGraph::getEdgeSource(const unsigned int edge_index) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
const unsigned int EDGE_COUNT = detail::curve::DeviceCurve::getVariableCount("_source_dest", graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_edge"));
if (edge_index >= EDGE_COUNT) {
DTHROW("Edge index (%u) exceeds edge count (%u), unable to get edge source vertex.\n", edge_index, EDGE_COUNT);
Expand All @@ -561,7 +561,7 @@ __device__ __forceinline__ id_t DeviceEnvironmentDirectedGraph::getEdgeSource(co
return getEdgeProperty<id_t, 2>("_source_dest", edge_index, 1);
}
__device__ __forceinline__ id_t DeviceEnvironmentDirectedGraph::getEdgeDestination(const unsigned int edge_index) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
const unsigned int EDGE_COUNT = detail::curve::DeviceCurve::getVariableCount("_source_dest", graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_edge"));
if (edge_index >= EDGE_COUNT) {
DTHROW("Edge index (%u) exceeds edge count (%u), unable to get edge destination vertex.\n", edge_index, EDGE_COUNT);
Expand All @@ -572,7 +572,7 @@ __device__ __forceinline__ id_t DeviceEnvironmentDirectedGraph::getEdgeDestinati
}
template<typename T, unsigned int M>
__device__ __forceinline__ T DeviceEnvironmentDirectedGraph::getEdgeProperty(const char(&property_name)[M], const unsigned int edge_index) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
const unsigned int EDGE_COUNT = detail::curve::DeviceCurve::getVariableCount("_source_dest", graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_edge"));
if (edge_index >= EDGE_COUNT) {
DTHROW("Edge index (%u) exceeds edge count (%u), unable to get property '%s'.\n", edge_index, EDGE_COUNT, property_name);
Expand All @@ -583,7 +583,7 @@ __device__ __forceinline__ T DeviceEnvironmentDirectedGraph::getEdgeProperty(con
}
template<typename T, flamegpu::size_type N, unsigned int M>
__device__ __forceinline__ T DeviceEnvironmentDirectedGraph::getEdgeProperty(const char(&property_name)[M], const unsigned int edge_index, const unsigned int element_index) const {
#if !defined(SEATBELTS) || SEATBELTS
#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS
const unsigned int EDGE_COUNT = detail::curve::DeviceCurve::getVariableCount("_source_dest", graph_hash ^ detail::curve::Curve::variableHash("_environment_directed_graph_edge"));
if (edge_index >= EDGE_COUNT) {
DTHROW("Edge index (%u) exceeds edge count (%u), unable to get property '%s'.\n", edge_index, EDGE_COUNT, property_name);
Expand Down
22 changes: 11 additions & 11 deletions src/flamegpu/runtime/detail/curve/curve_rtc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ void CurveRTCHost::initHeaderGetters() {
getDirectedGraphPBMImpl << " }\n";
} else { ++ct; }
}
getDirectedGraphPBMImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getDirectedGraphPBMImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getDirectedGraphPBMImpl << " DTHROW(\"Directed graph PBM was not found during getEnvironmentDirectedGraphPBM().\\n\");\n";
getDirectedGraphPBMImpl << "#endif\n";
getDirectedGraphPBMImpl << " return {};\n";
Expand All @@ -960,7 +960,7 @@ void CurveRTCHost::initHeaderGetters() {
getDirectedGraphIPBMImpl << " }\n";
} else { ++ct; }
}
getDirectedGraphIPBMImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getDirectedGraphIPBMImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getDirectedGraphIPBMImpl << " DTHROW(\"Directed graph IPBM was not found during getEnvironmentDirectedGraphIPBM().\\n\");\n";
getDirectedGraphIPBMImpl << "#endif\n";
getDirectedGraphIPBMImpl << " return {};\n";
Expand All @@ -978,7 +978,7 @@ void CurveRTCHost::initHeaderGetters() {
getDirectedGraphIPBMEdgesImpl << " }\n";
} else { ++ct; }
}
getDirectedGraphIPBMEdgesImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getDirectedGraphIPBMEdgesImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getDirectedGraphIPBMEdgesImpl << " DTHROW(\"Directed graph IPBM edge list was not found during getEnvironmentDirectedGraphIPBMEdges().\\n\");\n";
getDirectedGraphIPBMEdgesImpl << "#endif\n";
getDirectedGraphIPBMEdgesImpl << " return {};\n";
Expand All @@ -992,7 +992,7 @@ void CurveRTCHost::initHeaderGetters() {
RTCVariableProperties props = element.second;
if (props.read) {
getGraphVertexPropertyImpl << " if (strings_equal(name, \"" << element.first.second << "\") && graphHash == " << Curve::variableRuntimeHash(element.first.first) << ") {\n";
getGraphVertexPropertyImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getGraphVertexPropertyImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getGraphVertexPropertyImpl << " if(sizeof(type_decode<T>::type_t) != " << element.second.type_size << ") {\n";
getGraphVertexPropertyImpl << " DTHROW(\"Directed graph vertex property '%s' type mismatch during getProperty().\\n\", name);\n";
getGraphVertexPropertyImpl << " return {};\n";
Expand All @@ -1005,7 +1005,7 @@ void CurveRTCHost::initHeaderGetters() {
getGraphVertexPropertyImpl << " }\n";
} else { ++ct; }
}
getGraphVertexPropertyImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getGraphVertexPropertyImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getGraphVertexPropertyImpl << " DTHROW(\"Directed graph vertex property '%s' was not found during getProperty().\\n\", name);\n";
getGraphVertexPropertyImpl << "#endif\n";
getGraphVertexPropertyImpl << " return {};\n";
Expand All @@ -1019,7 +1019,7 @@ void CurveRTCHost::initHeaderGetters() {
RTCVariableProperties props = element.second;
if (props.read) {
getGraphEdgePropertyImpl << " if (strings_equal(name, \"" << element.first.second << "\") && graphHash == " << Curve::variableRuntimeHash(element.first.first) << ") {\n";
getGraphEdgePropertyImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getGraphEdgePropertyImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getGraphEdgePropertyImpl << " if(sizeof(type_decode<T>::type_t) != " << element.second.type_size << ") {\n";
getGraphEdgePropertyImpl << " DTHROW(\"Directed graph edge property '%s' type mismatch during getProperty().\\n\", name);\n";
getGraphEdgePropertyImpl << " return {};\n";
Expand All @@ -1032,7 +1032,7 @@ void CurveRTCHost::initHeaderGetters() {
getGraphEdgePropertyImpl << " }\n";
} else { ++ct; }
}
getGraphEdgePropertyImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getGraphEdgePropertyImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getGraphEdgePropertyImpl << " DTHROW(\"Directed graph edge property '%s' was not found during getProperty().\\n\", name);\n";
getGraphEdgePropertyImpl << "#endif\n";
getGraphEdgePropertyImpl << " return {};\n";
Expand Down Expand Up @@ -1164,7 +1164,7 @@ void CurveRTCHost::initHeaderGetters() {
RTCVariableProperties props = element.second;
if (props.read && props.elements > 1) {
getGraphVertexArrayPropertyImpl << " if (strings_equal(name, \"" << element.first.second << "\") && graphHash == " << Curve::variableRuntimeHash(element.first.first) << ") {\n";
getGraphVertexArrayPropertyImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getGraphVertexArrayPropertyImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getGraphVertexArrayPropertyImpl << " const unsigned int t_index = type_decode<T>::len_t * array_index + type_decode<T>::len_t;\n";
getGraphVertexArrayPropertyImpl << " if(sizeof(type_decode<T>::type_t) != " << element.second.type_size << ") {\n";
getGraphVertexArrayPropertyImpl << " DTHROW(\"Directed graph vertex array property '%s' type mismatch during getProperty().\\n\", name);\n";
Expand All @@ -1181,7 +1181,7 @@ void CurveRTCHost::initHeaderGetters() {
getGraphVertexArrayPropertyImpl << " };\n";
} else { ++ct; }
}
getGraphVertexArrayPropertyImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getGraphVertexArrayPropertyImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getGraphVertexArrayPropertyImpl << " DTHROW(\"Directed graph vertex array property '%s' was not found during getProperty().\\n\", name);\n";
getGraphVertexArrayPropertyImpl << "#endif\n";
getGraphVertexArrayPropertyImpl << " return {};\n";
Expand All @@ -1197,7 +1197,7 @@ void CurveRTCHost::initHeaderGetters() {
RTCVariableProperties props = element.second;
if (props.read && props.elements > 1) {
getGraphEdgeArrayPropertyImpl << " if (strings_equal(name, \"" << element.first.second << "\") && graphHash == " << Curve::variableRuntimeHash(element.first.first) << ") {\n";
getGraphEdgeArrayPropertyImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getGraphEdgeArrayPropertyImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getGraphEdgeArrayPropertyImpl << " const unsigned int t_index = type_decode<T>::len_t * array_index + type_decode<T>::len_t;\n";
getGraphEdgeArrayPropertyImpl << " if(sizeof(type_decode<T>::type_t) != " << element.second.type_size << ") {\n";
getGraphEdgeArrayPropertyImpl << " DTHROW(\"Directed graph edge array property '%s' type mismatch during getProperty().\\n\", name);\n";
Expand All @@ -1214,7 +1214,7 @@ void CurveRTCHost::initHeaderGetters() {
getGraphEdgeArrayPropertyImpl << " };\n";
} else { ++ct; }
}
getGraphEdgeArrayPropertyImpl << "#if !defined(SEATBELTS) || SEATBELTS\n";
getGraphEdgeArrayPropertyImpl << "#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS\n";
getGraphEdgeArrayPropertyImpl << " DTHROW(\"Directed graph edge array property '%s' was not found during getProperty().\\n\", name);\n";
getGraphEdgeArrayPropertyImpl << "#endif\n";
getGraphEdgeArrayPropertyImpl << " return {};\n";
Expand Down

0 comments on commit d519027

Please sign in to comment.