Skip to content

Commit

Permalink
Merge pull request #521 from Kitware/tighter_shader_rebuilds
Browse files Browse the repository at this point in the history
fix(Rendering): tighten up the shader rebuild code
  • Loading branch information
martinken authored Jan 23, 2018
2 parents 79abfc5 + d362585 commit 62699bd
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 62699bd

Please sign in to comment.