Commit b25c8af9 authored by James Kress's avatar James Kress
Browse files

Merge remote-tracking branch 'upstream/master'

parents 26f9dc3c 2ed1bb72
...@@ -197,7 +197,7 @@ struct GetTypeInParentheses<void(T)> ...@@ -197,7 +197,7 @@ struct GetTypeInParentheses<void(T)>
/// This macro also defines a Superclass typedef as well as ValueType and /// This macro also defines a Superclass typedef as well as ValueType and
/// StorageTag. /// StorageTag.
/// ///
/// Note that this macor only works on ArrayHandle subclasses that are /// Note that this macro only works on ArrayHandle subclasses that are
/// templated. For ArrayHandle sublcasses that are not templates, use /// templated. For ArrayHandle sublcasses that are not templates, use
/// VTKM_ARRAY_HANDLE_SUBCLASS_NT. /// VTKM_ARRAY_HANDLE_SUBCLASS_NT.
/// ///
...@@ -220,8 +220,8 @@ struct GetTypeInParentheses<void(T)> ...@@ -220,8 +220,8 @@ struct GetTypeInParentheses<void(T)>
/// This macro also defines a Superclass typedef as well as ValueType and /// This macro also defines a Superclass typedef as well as ValueType and
/// StorageTag. /// StorageTag.
/// ///
/// Note that this macor only works on ArrayHandle subclasses that are not /// Note that this macro only works on ArrayHandle subclasses that are not
/// templated. For ArrayHandle sublcasses that are are templates, use /// templated. For ArrayHandle sublcasses that are templates, use
/// VTKM_ARRAY_HANDLE_SUBCLASS. /// VTKM_ARRAY_HANDLE_SUBCLASS.
/// ///
#define VTKM_ARRAY_HANDLE_SUBCLASS_NT(classname, superclass) \ #define VTKM_ARRAY_HANDLE_SUBCLASS_NT(classname, superclass) \
......
...@@ -153,12 +153,10 @@ ColorSpace ColorTable::GetColorSpace() const ...@@ -153,12 +153,10 @@ ColorSpace ColorTable::GetColorSpace() const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ColorTable::SetColorSpace(ColorSpace space) void ColorTable::SetColorSpace(ColorSpace space)
{ {
if (this->Impl->CSpace != space || this->Impl->HostSideCache == nullptr) if (this->Impl->CSpace != space || this->Impl->HostSideCache.get() == nullptr)
{ {
this->Impl->CSpace = space; this->Impl->CSpace = space;
//Remove any existing host and execution data //Remove any existing host and execution data
delete this->Impl->HostSideCache;
delete this->Impl->ExecHandle;
using HandleType = vtkm::cont::VirtualObjectHandle<vtkm::exec::ColorTableBase>; using HandleType = vtkm::cont::VirtualObjectHandle<vtkm::exec::ColorTableBase>;
switch (space) switch (space)
...@@ -166,36 +164,36 @@ void ColorTable::SetColorSpace(ColorSpace space) ...@@ -166,36 +164,36 @@ void ColorTable::SetColorSpace(ColorSpace space)
case vtkm::cont::ColorSpace::RGB: case vtkm::cont::ColorSpace::RGB:
{ {
auto* hostPortal = new vtkm::exec::ColorTableRGB(); auto* hostPortal = new vtkm::exec::ColorTableRGB();
this->Impl->ExecHandle = new HandleType(hostPortal, false); this->Impl->ExecHandle.reset(new HandleType(hostPortal, false));
this->Impl->HostSideCache = hostPortal; this->Impl->HostSideCache.reset(hostPortal);
break; break;
} }
case vtkm::cont::ColorSpace::HSV: case vtkm::cont::ColorSpace::HSV:
{ {
auto* hostPortal = new vtkm::exec::ColorTableHSV(); auto* hostPortal = new vtkm::exec::ColorTableHSV();
this->Impl->ExecHandle = new HandleType(hostPortal, false); this->Impl->ExecHandle.reset(new HandleType(hostPortal, false));
this->Impl->HostSideCache = hostPortal; this->Impl->HostSideCache.reset(hostPortal);
break; break;
} }
case vtkm::cont::ColorSpace::HSV_WRAP: case vtkm::cont::ColorSpace::HSV_WRAP:
{ {
auto* hostPortal = new vtkm::exec::ColorTableHSVWrap(); auto* hostPortal = new vtkm::exec::ColorTableHSVWrap();
this->Impl->ExecHandle = new HandleType(hostPortal, false); this->Impl->ExecHandle.reset(new HandleType(hostPortal, false));
this->Impl->HostSideCache = hostPortal; this->Impl->HostSideCache.reset(hostPortal);
break; break;
} }
case vtkm::cont::ColorSpace::LAB: case vtkm::cont::ColorSpace::LAB:
{ {
auto* hostPortal = new vtkm::exec::ColorTableLab(); auto* hostPortal = new vtkm::exec::ColorTableLab();
this->Impl->ExecHandle = new HandleType(hostPortal, false); this->Impl->ExecHandle.reset(new HandleType(hostPortal, false));
this->Impl->HostSideCache = hostPortal; this->Impl->HostSideCache.reset(hostPortal);
break; break;
} }
case vtkm::cont::ColorSpace::DIVERGING: case vtkm::cont::ColorSpace::DIVERGING:
{ {
auto* hostPortal = new vtkm::exec::ColorTableDiverging(); auto* hostPortal = new vtkm::exec::ColorTableDiverging();
this->Impl->ExecHandle = new HandleType(hostPortal, false); this->Impl->ExecHandle.reset(new HandleType(hostPortal, false));
this->Impl->HostSideCache = hostPortal; this->Impl->HostSideCache.reset(hostPortal);
break; break;
} }
default: default:
...@@ -864,14 +862,14 @@ vtkm::cont::VirtualObjectHandle<vtkm::exec::ColorTableBase>* ColorTable::GetHand ...@@ -864,14 +862,14 @@ vtkm::cont::VirtualObjectHandle<vtkm::exec::ColorTableBase>* ColorTable::GetHand
if (this->Impl->ColorArraysChanged || this->Impl->OpacityArraysChanged) if (this->Impl->ColorArraysChanged || this->Impl->OpacityArraysChanged)
{ {
vtkm::cont::TryExecute( vtkm::cont::TryExecute(
detail::transfer_color_table_to_device{}, this->Impl->HostSideCache, this->Impl.get()); detail::transfer_color_table_to_device{}, this->Impl->HostSideCache.get(), this->Impl.get());
this->Impl->HostSideCache->Modified(); this->Impl->HostSideCache->Modified();
} }
this->Impl->ColorArraysChanged = false; this->Impl->ColorArraysChanged = false;
this->Impl->OpacityArraysChanged = false; this->Impl->OpacityArraysChanged = false;
return this->Impl->ExecHandle; return this->Impl->ExecHandle.get();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -48,9 +48,9 @@ struct ColorTableInternals ...@@ -48,9 +48,9 @@ struct ColorTableInternals
// AboveRangeColor // AboveRangeColor
//Note the pointers inside the host side portal are not valid, as they //Note the pointers inside the host side portal are not valid, as they
//are execution //are execution
vtkm::exec::ColorTableBase* HostSideCache = nullptr; std::unique_ptr<vtkm::exec::ColorTableBase> HostSideCache;
//Execution side version of the ColorTableBase. //Execution side version of the ColorTableBase.
vtkm::cont::VirtualObjectHandle<vtkm::exec::ColorTableBase>* ExecHandle = nullptr; std::unique_ptr<vtkm::cont::VirtualObjectHandle<vtkm::exec::ColorTableBase>> ExecHandle;
std::vector<double> ColorNodePos; std::vector<double> ColorNodePos;
std::vector<vtkm::Vec<float, 3>> ColorRGB; std::vector<vtkm::Vec<float, 3>> ColorRGB;
......
...@@ -66,13 +66,13 @@ struct compute_info ...@@ -66,13 +66,13 @@ struct compute_info
//if we both the same SM level check performance //if we both the same SM level check performance
if ((this->Major >= 3 && other.Major >= 3) || (this->Major == other.Major)) if ((this->Major >= 3 && other.Major >= 3) || (this->Major == other.Major))
{ {
return betterPerfomance(other); return betterPerformance(other);
} }
//prefer the greater SM otherwise //prefer the greater SM otherwise
return this->Major > other.Major; return this->Major > other.Major;
} }
bool betterPerfomance(const compute_info other) const bool betterPerformance(const compute_info other) const
{ {
if (this->Performance == other.Performance) if (this->Performance == other.Performance)
{ {
......
...@@ -69,6 +69,15 @@ public: ...@@ -69,6 +69,15 @@ public:
vtkm::cont::ColorTable tableRGBA(range, rgba1, rgba2, diverging); vtkm::cont::ColorTable tableRGBA(range, rgba1, rgba2, diverging);
VTKM_TEST_ASSERT(tableRGBA.GetColorSpace() == diverging, "color space not saved"); VTKM_TEST_ASSERT(tableRGBA.GetColorSpace() == diverging, "color space not saved");
VTKM_TEST_ASSERT(tableRGBA.GetRange() == range, "color range not saved"); VTKM_TEST_ASSERT(tableRGBA.GetRange() == range, "color range not saved");
//verify we can store a vector of tables
std::vector<vtkm::cont::ColorTable> tables;
tables.push_back(table);
tables.push_back(tableRGB);
tables.push_back(tableRGBA);
tables.push_back(tableRGBA);
tables.push_back(tableRGB);
tables.push_back(table);
} }
static void TestLoadPresets() static void TestLoadPresets()
......
...@@ -95,7 +95,7 @@ static inline VTKM_EXEC bool CellInside(const vtkm::Vec<T, 3>& pcoords, vtkm::Ce ...@@ -95,7 +95,7 @@ static inline VTKM_EXEC bool CellInside(const vtkm::Vec<T, 3>& pcoords, vtkm::Ce
pcoords[2] >= T(0) && pcoords[2] <= T(1); pcoords[2] >= T(0) && pcoords[2] <= T(1);
} }
/// Checks if the paramteric coordinates `pcoords` are on the inside for the /// Checks if the parametric coordinates `pcoords` are on the inside for the
/// specified cell type. /// specified cell type.
/// ///
template <typename T> template <typename T>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment