mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 21:27:04 +08:00
Fix mipmaps return values
Change-Id: I6e7cdc69edc80010a0c6f5f337e6b530278a6606
This commit is contained in:
committed by
sys_ocldev
parent
23a7ec5ef9
commit
93c1a7b51b
@@ -1236,29 +1236,33 @@ size_t Image::calculateOffsetForMapping(const MemObjOffsetArray &origin) const {
|
||||
return offset;
|
||||
}
|
||||
|
||||
bool Image::validateRegionAndOrigin(const size_t *origin, const size_t *region, const cl_image_desc &imgDesc) {
|
||||
cl_int Image::validateRegionAndOrigin(const size_t *origin, const size_t *region, const cl_image_desc &imgDesc) {
|
||||
if (region[0] == 0 || region[1] == 0 || region[2] == 0) {
|
||||
return false;
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
bool notMippMapped = (false == isMipMapped(imgDesc));
|
||||
|
||||
if ((imgDesc.image_type == CL_MEM_OBJECT_IMAGE1D || imgDesc.image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) &&
|
||||
(((origin[1] > 0) && notMippMapped) || origin[2] > 0 || region[1] > 1 || region[2] > 1)) {
|
||||
return false;
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if ((imgDesc.image_type == CL_MEM_OBJECT_IMAGE2D || imgDesc.image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY) &&
|
||||
(((origin[2] > 0) && notMippMapped) || region[2] > 1)) {
|
||||
return false;
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (notMippMapped) {
|
||||
return true;
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t mipLevel = findMipLevel(imgDesc.image_type, origin);
|
||||
return mipLevel < imgDesc.num_mip_levels;
|
||||
if (mipLevel < imgDesc.num_mip_levels) {
|
||||
return CL_SUCCESS;
|
||||
} else {
|
||||
return CL_INVALID_MIP_LEVEL;
|
||||
}
|
||||
}
|
||||
|
||||
bool Image::hasSameDescriptor(const cl_image_desc &imageDesc) const {
|
||||
|
||||
@@ -175,7 +175,7 @@ class Image : public MemObj {
|
||||
void setMipCount(uint32_t mipCountNew) { this->mipCount = mipCountNew; }
|
||||
|
||||
static const SurfaceFormatInfo *getSurfaceFormatFromTable(cl_mem_flags flags, const cl_image_format *imageFormat);
|
||||
static bool validateRegionAndOrigin(const size_t *origin, const size_t *region, const cl_image_desc &imgDesc);
|
||||
static cl_int validateRegionAndOrigin(const size_t *origin, const size_t *region, const cl_image_desc &imgDesc);
|
||||
|
||||
cl_int writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch);
|
||||
void setMcsSurfaceInfo(McsSurfaceInfo &info) { mcsSurfaceInfo = info; }
|
||||
|
||||
Reference in New Issue
Block a user