Commit cd3ffe5b authored by David E. DeMarle's avatar David E. DeMarle Committed by Kitware Robot

Merge topic 'clean-backports-for-8.1.1' into release

597cc33a fix ios build issues
c4751b8f Increment version to VTK 8.1.1
8fa3de4e comparison was being done for the wrong case
3588d82c Remove vtkProbeOpebGLSupport executable from Mobile
61694e1f Check that context exists before trying to pop context.
3538ec08 Use public instead of protected member functions
373b2a55 fixed case where the array name differed from
98a23692 fix issues with the array calc and string arrays
...
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !4284
parents 9ab1a120 597cc33a
......@@ -48,6 +48,10 @@ if (NOT EXISTS ${CMAKE_INSTALL_PREFIX})
"Install path ${CMAKE_INSTALL_PREFIX} does not exist.")
endif()
# make sure we have a CTestCustom.cmake file
configure_file("${VTK_CMAKE_DIR}/CTestCustom.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake" @ONLY)
# Compile a minimal VTK for its compile tools
macro(compile_vtk_tools)
ExternalProject_Add(
......
......@@ -146,6 +146,12 @@ if(VTK_CAN_DO_ONSCREEN)
endif()
endif()
# windows opengl delayed loading option
if(WIN32)
option(VTK_USE_OPENGL_DELAYED_LOAD "Use delayed loading for the opengl dll" FALSE)
mark_as_advanced(VTK_USE_OPENGL_DELAYED_LOAD)
endif()
# Function to link a VTK target to the necessary OpenGL libraries.
function(vtk_opengl_link target)
if(VTK_OPENGL_HAS_OSMESA)
......@@ -157,4 +163,8 @@ function(vtk_opengl_link target)
if(VTK_CAN_DO_ONSCREEN)
vtk_module_link_libraries(${target} LINK_PRIVATE ${OPENGL_LIBRARIES})
endif()
if (VTK_USE_OPENGL_DELAYED_LOAD)
vtk_module_link_libraries(${target} LINK_PRIVATE delayimp.lib)
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "/DELAYLOAD:opengl32.dll")
endif()
endfunction()
# VTK version number components.
set(VTK_MAJOR_VERSION 8)
set(VTK_MINOR_VERSION 1)
set(VTK_BUILD_VERSION 0)
set(VTK_BUILD_VERSION 1)
......@@ -11,9 +11,9 @@ file(REMOVE_RECURSE ${BUILD_DIR})
file(REMOVE_RECURSE ${INSTALL_DIR})
# Define default architectures to compile for
set(IOS_SIMULATOR_ARCHITECTURES "i386;x86_64"
set(IOS_SIMULATOR_ARCHITECTURES "x86_64"
CACHE STRING "iOS Simulator Architectures")
set(IOS_DEVICE_ARCHITECTURES "arm64;armv7"
set(IOS_DEVICE_ARCHITECTURES "arm64"
CACHE STRING "iOS Device Architectures")
list(REMOVE_DUPLICATES IOS_SIMULATOR_ARCHITECTURES)
list(REMOVE_DUPLICATES IOS_DEVICE_ARCHITECTURES)
......
......@@ -2448,6 +2448,22 @@ void vtkFunctionParser::UpdateNeededVariables()
}
}
//-----------------------------------------------------------------------------
int vtkFunctionParser::GetScalarVariableIndex(const char* inVariableName)
{
char* variableName = this->RemoveSpacesFrom(inVariableName);
for (int i = 0; i < static_cast<int>(this->ScalarVariableNames.size()); ++i)
{
if (this->ScalarVariableNames[i] == variableName)
{
delete [] variableName;
return i;
}
}
delete [] variableName;
return -1;
}
//-----------------------------------------------------------------------------
bool vtkFunctionParser::GetScalarVariableNeeded(int i)
{
......@@ -2465,9 +2481,9 @@ bool vtkFunctionParser::GetScalarVariableNeeded(const char* inVariableName)
std::vector<std::string>::const_iterator iter = std::find(
this->ScalarVariableNames.begin(), this->ScalarVariableNames.end(),
std::string(variableName));
delete [] variableName;
if (iter != this->ScalarVariableNames.end())
{
delete [] variableName;
return this->GetScalarVariableNeeded(
static_cast<int>(iter - this->ScalarVariableNames.begin()));
}
......@@ -2475,10 +2491,27 @@ bool vtkFunctionParser::GetScalarVariableNeeded(const char* inVariableName)
{
vtkErrorMacro("GetScalarVariableNeeded: scalar variable name " << variableName
<< " does not exist");
delete [] variableName;
return false;
}
}
//-----------------------------------------------------------------------------
int vtkFunctionParser::GetVectorVariableIndex(const char* inVariableName)
{
char* variableName = this->RemoveSpacesFrom(inVariableName);
for (int i = 0; i < static_cast<int>(this->VectorVariableNames.size()); ++i)
{
if (this->VectorVariableNames[i] == variableName)
{
delete [] variableName;
return i;
}
}
delete [] variableName;
return -1;
}
//-----------------------------------------------------------------------------
bool vtkFunctionParser::GetVectorVariableNeeded(int i)
{
......
......@@ -234,12 +234,22 @@ public:
int GetNumberOfScalarVariables()
{ return static_cast<int>(this->ScalarVariableNames.size()); }
/**
* Get scalar variable index or -1 if not found
*/
int GetScalarVariableIndex(const char *name);
/**
* Get the number of vector variables.
*/
int GetNumberOfVectorVariables()
{ return static_cast<int>(this->VectorVariableNames.size()); }
/**
* Get scalar variable index or -1 if not found
*/
int GetVectorVariableIndex(const char *name);
/**
* Get the ith scalar variable name.
*/
......
......@@ -427,18 +427,34 @@ int vtkArrayCalculator::RequestData(
// Save array pointers to avoid looking them up for each tuple.
std::vector<vtkDataArray*> scalarArrays(this->NumberOfScalarArrays);
std::vector<vtkDataArray*> vectorArrays(this->NumberOfVectorArrays);
std::vector<int> scalarArrayIndicies(this->NumberOfScalarArrays);
std::vector<int> vectorArrayIndicies(this->NumberOfVectorArrays);
for (int cc=0; cc < this->NumberOfScalarArrays; cc++)
{
if (this->FunctionParser->GetScalarVariableNeeded(cc))
int idx = this->FunctionParser->GetScalarVariableIndex(
this->ScalarVariableNames[cc]);
if (idx >= 0)
{
scalarArrays[cc] = inFD->GetArray(this->ScalarArrayNames[cc]);
if (this->FunctionParser->GetScalarVariableNeeded(idx))
{
scalarArrays[cc] = inFD->GetArray(this->ScalarArrayNames[cc]);
scalarArrayIndicies[cc] = idx;
}
}
}
for (int cc=0; cc < this->NumberOfVectorArrays; cc++)
{
if (this->FunctionParser->GetVectorVariableNeeded(cc))
int idx = this->FunctionParser->GetVectorVariableIndex(
this->VectorVariableNames[cc]);
if (idx >= 0)
{
vectorArrays[cc] = inFD->GetArray(this->VectorArrayNames[cc]);
if (this->FunctionParser->GetVectorVariableNeeded(idx))
{
vectorArrays[cc] = inFD->GetArray(this->VectorArrayNames[cc]);
vectorArrayIndicies[cc] = idx;
}
}
}
......@@ -449,16 +465,16 @@ int vtkArrayCalculator::RequestData(
if ((currentArray = scalarArrays[j]))
{
this->FunctionParser->
SetScalarVariableValue(
j, currentArray->GetComponent(i, this->SelectedScalarComponents[j]));
SetScalarVariableValue(scalarArrayIndicies[j],
currentArray->GetComponent(i, this->SelectedScalarComponents[j]));
}
}
for (j = 0; j < this->NumberOfVectorArrays; j++)
{
if ((currentArray = vectorArrays[j]))
{
this->FunctionParser->SetVectorVariableValue(
j, currentArray->GetComponent(i, this->SelectedVectorComponents[j][0]),
this->FunctionParser->SetVectorVariableValue(vectorArrayIndicies[j],
currentArray->GetComponent(i, this->SelectedVectorComponents[j][0]),
currentArray->GetComponent(
i, this->SelectedVectorComponents[j][1]),
currentArray->GetComponent(i, this->SelectedVectorComponents[j][2]));
......
......@@ -351,20 +351,27 @@ int vtkStructuredGridGeometryFilter::RequestData(
for (j=0; j < (diff[1]+1); j++)
{
pos = startIdx + j*offset[0] + k*offset[1];
// avoid accessing cells past the end of the grid
vtkIdType cellK = (k == dims[2] - 1) ? k - 1 : k;
vtkIdType cellJ = (j == dims[1] - 1) ? j - 1 : j;
cellPos = startCellIdx + (cellK*(dims[1] - 1) + cellJ)*(dims[0] - 1);
for (i=0; i < (diff[0]+1); i++)
{
if ( input->IsPointVisible(pos+i) )
{
vtkIdType cellI = (i == dims[0] - 1) ? i - 1 : i;
input->GetPoint(pos+i, x);
ptIds[0] = newPts->InsertNextPoint(x);
outPD->CopyData(pd,pos+i,ptIds[0]);
cellId = newVerts->InsertNextCell(1,ptIds);
outCD->CopyData(cd,pos+i,cellId);
outCD->CopyData(cd,cellPos + cellI, cellId);
}
}
}
}
break; /* end this case */
break; /* end this case */
} // switch
......
......@@ -437,7 +437,9 @@ void vtkPDFContextDevice2D::DrawPointSprites(vtkImageData *spriteIn,
coloredBuf.reserve(numPoints * 3);
// Using int since we're iterating to j < 0 (and vtkIdType is unsigned).
// It's very unlikely that numPoints will be larger than INT_MAX, but
// we'll check anyway:
// we'll check anyway. This throws a warning (taut-compare) when
// vtkIdType is a 32-bit integer, so we disable it in that case.
#ifdef VTK_USE_64BIT_IDS
if (numPoints > static_cast<vtkIdType>(VTK_INT_MAX))
{
vtkErrorMacro("FIXME: Image data too large for indexing with int.");
......@@ -445,6 +447,7 @@ void vtkPDFContextDevice2D::DrawPointSprites(vtkImageData *spriteIn,
rgb->UnRegister(this);
return;
}
#endif // VTK_USE_64BIT_IDS
for (int j = static_cast<int>(numPoints) - 1; j >= 0; --j)
{
unsigned char *pointColor = bufIn + 3 * j;
......
......@@ -280,22 +280,35 @@ int vtkJPEGReaderUpdate2(vtkJPEGReader *self, OT *outPtr,
// prepare to read the bulk data
jpeg_start_decompress(&cinfo);
int rowbytes = cinfo.output_components * cinfo.output_width;
unsigned char *tempImage = new unsigned char [rowbytes*cinfo.output_height];
JSAMPROW *row_pointers = new JSAMPROW [cinfo.output_height];
for (unsigned int ui = 0; ui < cinfo.output_height; ++ui)
unsigned int maxChunk = cinfo.output_height;
if (maxChunk > 4096)
{
maxChunk = 4096;
}
vtkIdType rowbytes = cinfo.output_components * cinfo.output_width;
unsigned char *tempImage = new unsigned char [rowbytes*maxChunk];
JSAMPROW *row_pointers = new JSAMPROW [maxChunk];
for (unsigned int ui = 0; ui < maxChunk; ++ui)
{
row_pointers[ui] = tempImage + rowbytes*ui;
}
// read the bulk data
unsigned int remainingRows;
long outSize = cinfo.output_components*(outExt[1] - outExt[0] + 1);
while (cinfo.output_scanline < cinfo.output_height)
{
remainingRows = cinfo.output_height - cinfo.output_scanline;
jpeg_read_scanlines(&cinfo, &row_pointers[cinfo.output_scanline],
remainingRows);
JDIMENSION linesRead = jpeg_read_scanlines(&cinfo, row_pointers, maxChunk);
// copy the data into the outPtr
OT *outPtr2 = outPtr + (cinfo.output_height - cinfo.output_scanline)*outInc[1];
for (unsigned int i = 0; i < linesRead; ++i)
{
memcpy(outPtr2,
row_pointers[linesRead - i - 1]
+ outExt[0]*cinfo.output_components,
outSize);
outPtr2 += outInc[1];
}
}
// finish the decompression step
......@@ -304,17 +317,6 @@ int vtkJPEGReaderUpdate2(vtkJPEGReader *self, OT *outPtr,
// destroy the decompression object
jpeg_destroy_decompress(&cinfo);
// copy the data into the outPtr
OT *outPtr2 = outPtr;
long outSize = cinfo.output_components*(outExt[1] - outExt[0] + 1);
for (int i = outExt[2]; i <= outExt[3]; ++i)
{
memcpy(outPtr2,
row_pointers[cinfo.output_height - i - 1]
+ outExt[0]*cinfo.output_components,
outSize);
outPtr2 += outInc[1];
}
delete [] tempImage;
delete [] row_pointers;
......
......@@ -40,7 +40,8 @@ void vtkUnstructuredGridWriter::WriteData()
ostream *fp;
vtkUnstructuredGrid *input= vtkUnstructuredGrid::SafeDownCast(
this->GetInput());
int *types, ncells, cellId;
int *types;
vtkIdType ncells, cellId;
vtkDebugMacro(<<"Writing vtk unstructured grid data...");
......@@ -159,7 +160,7 @@ int vtkUnstructuredGridWriter::WriteCellsAndFaces(
// Create a copy of the cell data with the face streams expanded.
// Do this before writing anything so that we know the size.
// Use ints to represent vtkIdTypes, since that's what the superclass does.
std::vector<int> cells;
std::vector<vtkIdType> cells;
cells.reserve(grid->GetNumberOfCells() * grid->GetMaxCellSize());
vtkSmartPointer<vtkCellIterator> it =
......@@ -195,14 +196,14 @@ int vtkUnstructuredGridWriter::WriteCellsAndFaces(
if ( this->FileType == VTK_ASCII )
{ // Write each cell out to a separate line, must traverse:
std::vector<int>::const_iterator cellStart = cells.begin();
std::vector<int>::const_iterator cellEnd;
std::vector<vtkIdType>::const_iterator cellStart = cells.begin();
std::vector<vtkIdType>::const_iterator cellEnd;
vtkIdType nCells = grid->GetNumberOfCells();
while (nCells-- > 0)
{
cellEnd = cellStart + (*cellStart + 1);
while (cellStart != cellEnd)
*fp << static_cast<int>(*cellStart++) << " ";
*fp << static_cast<vtkIdType>(*cellStart++) << " ";
*fp << "\n";
}
}
......
......@@ -138,6 +138,14 @@ void vtkDataSetMapper::Render(vtkRenderer *ren, vtkActor *act)
this->PolyDataMapper->SetInterpolateScalarsBeforeMapping(
this->GetInterpolateScalarsBeforeMapping());
double f, u;
this->GetRelativeCoincidentTopologyPolygonOffsetParameters(f,u);
this->PolyDataMapper->SetRelativeCoincidentTopologyPolygonOffsetParameters(f,u);
this->GetRelativeCoincidentTopologyLineOffsetParameters(f,u);
this->PolyDataMapper->SetRelativeCoincidentTopologyLineOffsetParameters(f,u);
this->GetRelativeCoincidentTopologyPointOffsetParameter(u);
this->PolyDataMapper->SetRelativeCoincidentTopologyPointOffsetParameter(u);
this->PolyDataMapper->SetScalarMode(this->GetScalarMode());
if ( this->ScalarMode == VTK_SCALAR_MODE_USE_POINT_FIELD_DATA ||
this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA )
......
......@@ -366,6 +366,11 @@ if (APPLE_IOS)
vtk_module_link_libraries(${vtk-module} LINK_PUBLIC "-framework UIKit")
endif()
if (NOT ANDROID AND NOT APPLE_IOS)
VTK_ADD_EXECUTABLE(vtkProbeOpenGLVersion vtkProbeOpenGLVersion.cxx)
target_link_libraries(vtkProbeOpenGLVersion ${vtk-module})
endif()
if (WIN32 AND ( NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR) )
VTK_ADD_EXECUTABLE(vtkTestOpenGLVersion vtkTestOpenGLVersion.cxx)
set_target_properties(vtkTestOpenGLVersion
......
......@@ -440,7 +440,7 @@ unsigned char *vtkOpenGLTexture::ResampleToPowerOfTwo(int &xs,
int bpp)
{
unsigned char *tptr, *p, *p1, *p2, *p3, *p4;
int jOffset, iIdx, jIdx;
vtkIdType jOffset, iIdx, jIdx;
double pcoords[3], rm, sm, w0, w1, w2, w3;
int yInIncr = xs;
int xInIncr = 1;
......
......@@ -248,16 +248,16 @@ void vtkAppendVBOWorker<destType>::operator() (DataArray *array)
}
destType *VBOit =
reinterpret_cast<destType *>(&this->VBO->PackedVBO[this->Offset]);
reinterpret_cast<destType *>(&this->VBO->GetPackedVBO()[this->Offset]);
// Accessor for the data array
vtkDataArrayAccessor<DataArray> data(array);
// compute extra padding required
int bytesNeeded =
this->VBO->DataTypeSize*this->VBO->NumberOfComponents;
this->VBO->GetDataTypeSize() * this->VBO->GetNumberOfComponents();
int extraComponents =
((4 - (bytesNeeded % 4)) % 4)/this->VBO->DataTypeSize;
((4 - (bytesNeeded % 4)) % 4) / this->VBO->GetDataTypeSize();
// If not shift & scale
if(!this->VBO->GetCoordShiftAndScaleEnabled())
......
/*=========================================================================
Program: Visualization Toolkit
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkAutoInit.h"
VTK_MODULE_INIT(vtkRenderingOpenGL2);
#include "vtkNew.h"
#include "vtkRenderer.h"
#include "vtkOpenGLRenderWindow.h"
#include "vtkOutputWindow.h"
#include <sstream>
int main(int , char* /* argv */[])
{
int result = 0;
vtkNew<vtkRenderer> renderer;
vtkNew<vtkRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer);
std::ostringstream toString;
toString << "Class: " << renderWindow->GetClassName();
if (!renderWindow->SupportsOpenGL())
{
toString << " failed to find a working OpenGL\n\n";
toString << vtkOpenGLRenderWindow::SafeDownCast(renderWindow)->GetOpenGLSupportMessage();
result = 1;
}
else
{
toString << " succeeded in finding a working OpenGL\n\n";
}
renderWindow->Render();
toString << renderWindow->ReportCapabilities();
vtkOutputWindow::GetInstance()->PromptUserOn();
vtkOutputWindow::GetInstance()->DisplayText(toString.str().c_str());
return result;
}
/*=========================================================================
Program: Visualization Toolkit
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* This header file is designed to be included into your program
* to support delayed loading of opengl and if needed use of Mesa
* in cases where the users computer does not support OpenGL 3.2
* natively.
*
* To use this class you must
*
* 1) Build VTK with the advanced cmake option VTK_USE_OPENGL_DELAYED_LOAD
* turned on.
*
* 2) Include this file in your application and call HandleOpenGL32Issues
* before you do any rendering or anything that would cause opengl
* to be used. Ideally do this right at the beginning of your program.
*
* 3) Make sure you include vtkTestOpenGLVersion.exe with your application
* and pass the fullpath to it as the first argument to HandleOpenGL32Issues
*
* 4) Make sure you include the Mesa libraries with your application. Typically
* this means opengl32.dll swrAVX.dll swrAVX2.dll and graw.dll. Pass the path
* to these libraries as the second argument to HandleOpenGL32Issues
*/
#include <windows.h>
// returns an int, zero indicates a problem though right now
// all paths return 1.
int HandleOpenGL32Issues(
const char *pathToTestOpenGLExecutable,
const char *mesaLibPath
)
{
// run the test executable and collect the result
int result = system(pathToTestOpenGLExecutable);
// if the default works then just return
if (result == 0)
{
return 1;
}
// otherwise set the dll path so that mesa willbe loaded
SetDllDirectory(mesaLibPath);
return 1;
}
// VTK-HeaderTest-Exclude: vtkTestOpenGLVersion.h
......@@ -1151,7 +1151,7 @@ void vtkXOpenGLRenderWindow::PopContext()
GLXContext current = glXGetCurrentContext();
GLXContext target = static_cast<GLXContext>(this->ContextStack.top());
this->ContextStack.pop();
if (target != current)
if (target && target != current)
{
glXMakeCurrent(this->DisplayStack.top(),
this->DrawableStack.top(),
......
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