Skip to content

Commit 16f37af

Browse files
committed
fix(image): regression in direct texture uploads
1 parent 490b5cd commit 16f37af

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

include/tev/Image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class Image {
205205
return result;
206206
}
207207

208-
bool isInterleaved(std::span<const std::string> channelNames, size_t desiredBytesPerSample, size_t desiredStride) const;
208+
bool isInterleaved(std::span<const std::string> channelNames, size_t desiredStride) const;
209209

210210
nanogui::Texture* texture(std::span<const std::string> channelNames, EInterpolationMode minFilter, EInterpolationMode magFilter) &;
211211

src/Image.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ string Image::shortName() const {
689689
return result;
690690
}
691691

692-
bool Image::isInterleaved(span<const string> channelNames, size_t desiredBytesPerSample, size_t desiredStride) const {
692+
bool Image::isInterleaved(span<const string> channelNames, size_t desiredStride) const {
693693
if (desiredStride == 0) {
694694
throw runtime_error{"Desired stride must be greater than 0."};
695695
}
@@ -711,7 +711,7 @@ bool Image::isInterleaved(span<const string> channelNames, size_t desiredBytesPe
711711
interleavedData = chan->dataBuf();
712712
}
713713

714-
if (interleavedData != chan->dataBuf() || chan->stride() != desiredStride || chan->offset() != i * desiredBytesPerSample) {
714+
if (interleavedData != chan->dataBuf() || chan->stride() != desiredStride || chan->offset() != i) {
715715
return false;
716716
}
717717
}
@@ -880,8 +880,7 @@ Texture* Image::texture(span<const string> channelNames, EInterpolationMode minF
880880
)};
881881
}
882882

883-
const size_t bytesPerSample = bitsPerSample / 8;
884-
const bool directUpload = isInterleaved(channelNames, bytesPerSample, numTextureChannels * bytesPerSample);
883+
const bool directUpload = isInterleaved(channelNames, numTextureChannels);
885884

886885
tlog::debug() << fmt::format(
887886
"Uploading texture: direct={} bps={} filter={}-{} img={}:{}",

0 commit comments

Comments
 (0)