Skip to content

Commit 382f8cb

Browse files
committed
offsetDifference comments
1 parent 72fd9f2 commit 382f8cb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

include/nbl/asset/filters/CMatchedSizeInOutImageFilterCommon.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class NBL_API CMatchedSizeInOutImageFilterCommon : public CBasicImageFilterCommo
161161
const core::SRange<const IImage::SBufferCopy> outRegions;
162162
const IImage::SBufferCopy* oit; //!< oit is a current output handled region by commonExecute lambda. Notice that the lambda may execute executePerRegion a few times with different oits data since regions may overlap in a certain mipmap in an image!
163163
core::vectorSIMDu32 offsetDifference;
164-
core::vectorSIMDu32 outBlockByteStrides;
164+
core::vectorSIMDu32 outByteStrides;
165165
};
166166
template<typename PerOutputFunctor>
167167
static inline bool commonExecute(state_type* state, PerOutputFunctor& perOutput)
@@ -191,8 +191,8 @@ class NBL_API CMatchedSizeInOutImageFilterCommon : public CBasicImageFilterCommo
191191
outRegions.begin(), {}, {}
192192
};
193193

194-
const asset::TexelBlockInfo srcImageTexelBlockInfo(inParams.format);
195-
const asset::TexelBlockInfo dstImageTexelBlockInfo(outParams.format);
194+
const asset::TexelBlockInfo srcImageTexelBlockInfo(commonExecuteData.inFormat);
195+
const asset::TexelBlockInfo dstImageTexelBlockInfo(commonExecuteData.outFormat);
196196

197197
// iterate over output regions, then input cause read cache miss is faster
198198
for (; commonExecuteData.oit!=commonExecuteData.outRegions.end(); commonExecuteData.oit++)
@@ -203,10 +203,11 @@ class NBL_API CMatchedSizeInOutImageFilterCommon : public CBasicImageFilterCommo
203203
// setup convert state
204204
const auto& outRegionOffset = commonExecuteData.oit->imageOffset;
205205
const auto& inOffset = (core::vectorSIMDu32(outRegionOffset.x, outRegionOffset.y, outRegionOffset.z, commonExecuteData.oit->imageSubresource.baseArrayLayer) + state->inOffsetBaseLayer);
206-
206+
const auto& inOffsetInBlocks = srcImageTexelBlockInfo.convertTexelsToBlocks(inOffset);
207207
// offsetDifference types are uint but I know my two's complement wraparound well enough to make this work
208-
commonExecuteData.offsetDifference = dstImageTexelBlockInfo.convertTexelsToBlocks(state->outOffsetBaseLayer) - srcImageTexelBlockInfo.convertTexelsToBlocks(inOffset);
209-
commonExecuteData.outBlockByteStrides = commonExecuteData.oit->getByteStrides(TexelBlockInfo(commonExecuteData.outFormat));
208+
// TODO: this needs to be in block dimensions for copy filter but probably needs to be in texel dimensions for convert filter
209+
commonExecuteData.offsetDifference = dstImageTexelBlockInfo.convertTexelsToBlocks(state->outOffsetBaseLayer) - inOffsetInBlocks;
210+
commonExecuteData.outByteStrides = commonExecuteData.oit->getByteStrides(dstImageTexelBlockInfo);
210211
if (!perOutput(commonExecuteData,clip))
211212
return false;
212213
}

0 commit comments

Comments
 (0)