Skip to content

Commit

Permalink
fix(Rendering): tighten up the shader rebuild code
Browse files Browse the repository at this point in the history
for the imagemapper and volumemapper so that they do
not rebuild as often.
  • Loading branch information
martinken committed Jan 23, 2018
1 parent 79abfc5 commit d362585
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Sources/Rendering/OpenGL/ImageMapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,16 @@ function vtkOpenGLImageMapper(publicAPI, model) {
// property modified (representation interpolation and lighting)
// input modified
// light complexity changed

const tNumComp = model.openGLTexture.getComponents();

if (
model.lastHaveSeenDepthRequest !== model.haveSeenDepthRequest ||
cellBO.getProgram() === 0 ||
cellBO.getShaderSourceTime().getMTime() < publicAPI.getMTime() ||
cellBO.getShaderSourceTime().getMTime() < actor.getMTime() ||
cellBO.getShaderSourceTime().getMTime() < model.currentInput.getMTime()
model.lastTextureComponents !== tNumComp
) {
model.lastHaveSeenDepthRequest = model.haveSeenDepthRequest;
model.lastTextureComponents = tNumComp;
return true;
}

Expand Down Expand Up @@ -650,6 +652,7 @@ const DEFAULT_VALUES = {
colorTexture: null,
lastHaveSeenDepthRequest: false,
haveSeenDepthRequest: false,
lastTextureComponents: 0,
};

// ----------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion Sources/Rendering/OpenGL/VolumeMapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
if (
cellBO.getProgram() === 0 ||
needRebuild ||
model.lastZBufferTexture !== model.zBufferTexture ||
model.lastHaveSeenDepthRequest !== model.haveSeenDepthRequest ||
!!model.lastZBufferTexture !== !!model.zBufferTexture ||
cellBO.getShaderSourceTime().getMTime() < publicAPI.getMTime() ||
cellBO.getShaderSourceTime().getMTime() < actor.getMTime() ||
cellBO.getShaderSourceTime().getMTime() < model.currentInput.getMTime()
Expand Down

0 comments on commit d362585

Please sign in to comment.