Skip to content

Commit 2a8a7b6

Browse files
committed
Fix SampleExtComputationInput() for non-varying computation inputs.
If the computation input was not time-sampled, the return value would be 0 causing callers to ignore the time sample of 0.0. This could then cause HdExtComputationUtils::SampleComputedPrimvarValues() to fail while executing the computation due to the non-varying inputs having no values. This was the same issue that 33dbdb1 fixed for SamplePrimvar()
1 parent 99749e2 commit 2a8a7b6

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,21 +2736,34 @@ HdSceneIndexAdapterSceneDelegate::SampleExtComputationInput(
27362736
valueDs->GetContributingSampleTimesForInterval(
27372737
std::numeric_limits<float>::lowest(),
27382738
std::numeric_limits<float>::max(), &times);
2739+
2740+
// XXX fallback to include a single sample
2741+
if (times.empty()) {
2742+
times.push_back(0.0f);
2743+
}
27392744
} else {
2740-
valueDs->GetContributingSampleTimesForInterval(
2745+
const bool isVarying =
2746+
valueDs->GetContributingSampleTimesForInterval(
27412747
startTime, endTime, &times);
2748+
if (isVarying) {
2749+
if (times.empty()) {
2750+
TF_CODING_ERROR("No contributing sample times returned for "
2751+
"%s %s even though "
2752+
"GetContributingSampleTimesForInterval "
2753+
"indicated otherwise.",
2754+
computationId.GetText(), input.GetText());
2755+
times.push_back(0.0f);
2756+
}
2757+
} else {
2758+
times = { 0.0f };
2759+
}
27422760
}
27432761

2744-
size_t authoredSamples = times.size();
2762+
const size_t authoredSamples = times.size();
27452763
if (authoredSamples > maxSampleCount) {
27462764
times.resize(maxSampleCount);
27472765
}
27482766

2749-
// XXX fallback to include a single sample
2750-
if (times.empty()) {
2751-
times.push_back(0.0f);
2752-
}
2753-
27542767
for (size_t i = 0; i < times.size(); ++i) {
27552768
sampleTimes[i] = times[i];
27562769
sampleValues[i] = valueDs->GetValue(times[i]);

0 commit comments

Comments
 (0)