Patching VTK

Revision as of 07:49, 26 February 2012 by BradWhitlock (talk | contribs) (Committing the changes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In October 2011, VisIt was updated to use a modified version of VTK 5.8 that had support for mangled Mesa. That version of VTK had some other fixes as well to get specular highlights, text shadows, etc. working. This page shows the steps you need to follow in order to make additional changes to VTK.

Getting the VTK sources

We track all of our changes to VTK in a git repository based on VTK's own git repository. This enables us to more easily keep up to date and also provides us an easier mechanism to eventually submit the patches back to VTK's gerrit source code submission system.

  • If you plan to change VTK, you must make changes in git
  • Adding patches to build_visit is unacceptable

Gitorious access

You'll need a gitorious account in order to make changes to the VTK repo.

  • Register at gitorious
  • Set up SSH keys
  • Request access to the git repository

Checking out sources

In order to check out the VTK sources, follow these steps:

  • Developers at LLNL will need to access the git repository from LC since the git protocol is blocked on the desktop network.
git clone git@gitorious.org:visit-vtk/visit-vtk.git

The above command will check out VTK into a directory called visit-vtk.

Building VTK

You can use the build_visit script to build the VTK sources. build_visit does an out of source build of VTK so you don't pollute your git directory with object files and the like. A few extra steps are need to trick build_visit into not downloading the latest VTK from the svn repository.

touch foo
tar zcf visit-vtk-5.8.tar.gz foo
ln -s visit-vtk visit-vtk-5.8
cp /path/to/build_visit .
./build_visit --console --no-thirdparty --no-visit --thirdparty-path ~/Development/thirdparty_shared/ \
   --mesa --python --vtk --makeflags -j12

Committing the changes

Now that you have made your changes to VTK and made sure that they work, you can push them back to VisIt's VTK git repository. Since build_visit was used to build the VTK sources, be sure to note that it applied a change to IO/CMakeList.txt and we don't want to commit that change.

Back it out:

git checkout -- IO/CMakeLists.txt

The rest of the checkin can be accomplished by a series of git commands. You must first add the files that you've changed to the checkout.

git add filename

Then you'll commit the changes to the local working copy. Finally, you will push the changes to the remote git repository. This is accomplished by the following git commands issued from the visit-vtk directory:

git commit
git push

Errors

Sometimes I get this error message when I want to commit. I end up having to check out VTK over again because the following the steps does not work and my git kung fu is weak.

brad@coruscant:~/Development/VTK_rendering/visit-vtk$ git commit
Please initialize your local Git hooks.
Paste the following commands into a shell:

 cd "/home/brad/Development/VTK_rendering/visit-vtk/.git/hooks"
 git init
 git pull .. remotes/origin/hooks
 cd ../..

Creating a new VTK tarball

To ensure that other developers can easily obtain the VTK sources that VisIt ought to use, we keep a source tarball in the trunk/third_party directory. Here is how to create a new tarball:

tar --exclude='.git*' -cvzf  visit-vtk-5.8.tar.gz visit-vtk-5.8/

Once you have created the tarball, make sure you do a check-in, updating the tarball in the VisIt svn trunk/third_party directory.