Correctly check max 1D image buffer size

VDI reports the limits in pixels, but user provides the size in bytes.

Make sure both values are in pixels before doing comparisons.

Change-Id: I082c7175c9fa4383e0b0ee38ff8c047c26ff20b4
This commit is contained in:
Vladislav Sytchenko
2020-04-08 13:01:15 -04:00
zatwierdzone przez Vladislav Sytchenko
rodzic 73751496e1
commit 28da0b89ea
2 zmienionych plików z 6 dodań i 1 usunięć
+5
Wyświetl plik
@@ -895,4 +895,9 @@ HIP_RESOURCE_VIEW_DESC getResourceViewDesc(const hipResourceViewDesc& resViewDes
return desc;
}
inline
size_t getElementSize(const hipChannelFormatDesc &desc) {
return (desc.x / 4) * getNumChannels(desc);
}
};
+1 -1
Wyświetl plik
@@ -100,7 +100,7 @@ hipError_t ihipCreateTextureObject(hipTextureObject_t* pTexObject,
if ((pResDesc->resType == hipResourceTypeLinear) &&
((pResDesc->res.linear.devPtr == nullptr) ||
(!amd::isMultipleOf(pResDesc->res.linear.devPtr, info.imageBaseAddressAlignment_)) ||
(pResDesc->res.linear.sizeInBytes >= info.imageMaxBufferSize_))) {
((pResDesc->res.linear.sizeInBytes / hip::getElementSize(pResDesc->res.linear.desc)) >= info.imageMaxBufferSize_))) {
return hipErrorInvalidValue;
}