Commit c1ed233a authored by David E. DeMarle's avatar David E. DeMarle
Browse files

fix a segfault with environmental light

the texture for the light is built in a temporary buffer, so we
can not give it to ospray via zero copy/sharing as the temp buffer
has to be deleted.
parent ee2b8570
......@@ -17,6 +17,7 @@ namespace RTW
virtual RTWData NewData(size_t numItems, RTWDataType) = 0;
virtual RTWData NewCopyData1D(size_t numItems, RTWDataType, const void *source) = 0;
virtual RTWData NewCopyData2D(const void *source, RTWDataType, size_t numItems1, size_t numItems2) = 0;
virtual RTWData NewSharedData1D(const void *source, RTWDataType, uint32_t numItems) = 0;
virtual RTWData NewSharedData2D(const void *source, RTWDataType, uint32_t numItems1, uint32_t numItems2) = 0;
virtual RTWData NewSharedData3D(const void *source, RTWDataType, uint32_t numItems1, uint32_t numItems2,
......
......@@ -121,6 +121,17 @@ namespace RTW
ospRelease(shared);
return reinterpret_cast<RTWData>(data);
}
RTWData NewCopyData2D(const void *source, RTWDataType dataType, size_t numElements, size_t numElements2) override
{
OSPData data = ospNewData2D(static_cast<OSPDataType>(dataType), numElements, numElements2);
ospCommit(data);
OSPData shared = ospNewSharedData2D(source, static_cast<OSPDataType>(dataType), numElements, numElements2);
ospCommit(shared);
ospCopyData2D(shared, data, 0, 0);
ospCommit(data);
ospRelease(shared);
return reinterpret_cast<RTWData>(data);
}
RTWData NewData(size_t numElements, RTWDataType dataType) override
{
......
......@@ -138,6 +138,7 @@ std::set<RTWBackendType> rtwGetAvailableBackends();
#define ospNewData backend->NewData
#define ospNewCopyData1D backend->NewCopyData1D
#define ospNewCopyData2D backend->NewCopyData2D
#define ospNewSharedData1D backend->NewSharedData1D
#define ospNewSharedData2D backend->NewSharedData2D
#define ospNewSharedData3D backend->NewSharedData3D
......
......@@ -57,7 +57,7 @@ OSPTexture vtkOSPRayMaterialHelpers::NewTexture2D(RTW::Backend* backend, const o
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
auto data_handle = ospNewSharedData2D(data, dataType, size.x, size.y);
auto data_handle = ospNewCopyData2D(data, dataType, size.x, size.y);
#pragma GCC diagnostic pop
ospCommit(data_handle);
......
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