mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
fix: properly pass info about 3D image
Related-To: NEO-14538 It's valid for 3D image to copy 2D region. Current checks for mip map do not consider that. This change correctly checks for mip mapped 3D image. Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
7e7e0a000f
commit
95e0244f70
@@ -73,10 +73,10 @@ cl_int CommandQueue::enqueueStagingImageTransfer(cl_command_type commandType, Im
|
||||
auto bytesPerPixel = image->getSurfaceFormatInfo().surfaceFormat.imageElementSizeInBytes;
|
||||
auto dstRowPitch = inputRowPitch ? inputRowPitch : globalRegion[0] * bytesPerPixel;
|
||||
auto dstSlicePitch = inputSlicePitch ? inputSlicePitch : globalRegion[1] * dstRowPitch;
|
||||
auto isMipMap = isMipMapped(image->getImageDesc());
|
||||
auto isMipMap3D = isMipMapped(image->getImageDesc()) && image->getImageDesc().image_type == CL_MEM_OBJECT_IMAGE3D;
|
||||
|
||||
auto stagingBufferManager = this->context->getStagingBufferManager();
|
||||
auto ret = stagingBufferManager->performImageTransfer(ptr, globalOrigin, globalRegion, dstRowPitch, dstSlicePitch, bytesPerPixel, isMipMap, chunkWrite, &csr, isRead);
|
||||
auto ret = stagingBufferManager->performImageTransfer(ptr, globalOrigin, globalRegion, dstRowPitch, dstSlicePitch, bytesPerPixel, isMipMap3D, chunkWrite, &csr, isRead);
|
||||
|
||||
if (isRead && context->isProvidingPerformanceHints()) {
|
||||
auto hostPtrSize = calculateHostPtrSizeForImage(globalRegion, inputRowPitch, inputSlicePitch, image);
|
||||
|
||||
@@ -984,4 +984,21 @@ HWTEST_F(WriteImageStagingBufferTest, whenEnqueueStagingWriteImageCalledFor3DIma
|
||||
EXPECT_EQ(2ul, mockCommandQueueHw.enqueueWriteImageCounter);
|
||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
EXPECT_EQ(0u, csr.createAllocationForHostSurfaceCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(WriteImageStagingBufferTest, whenEnqueueStagingWriteImageCalledForMipMapped3DImageThenReturnSuccess) {
|
||||
MockCommandQueueHw<FamilyType> mockCommandQueueHw(context, device.get(), &props);
|
||||
cl_image_desc imageDesc = {};
|
||||
imageDesc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
imageDesc.image_width = 4;
|
||||
imageDesc.image_height = 4;
|
||||
imageDesc.image_depth = 64;
|
||||
|
||||
imageDesc.num_mip_levels = 2;
|
||||
size_t origin[4] = {0, 0, 0, 10};
|
||||
size_t region[3] = {2, 2, 4};
|
||||
auto image = std::unique_ptr<Image>(ImageHelper<Image3dDefaults>::create(context, &imageDesc));
|
||||
|
||||
auto res = mockCommandQueueHw.enqueueStagingImageTransfer(CL_COMMAND_WRITE_IMAGE, image.get(), false, origin, region, 4u, MemoryConstants::megaByte, ptr, nullptr);
|
||||
EXPECT_EQ(res, CL_SUCCESS);
|
||||
}
|
||||
Reference in New Issue
Block a user