mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-28 00:03:14 +08:00
Refactor redescribe() method
Change-Id: I52aaec0e48fa44a79823b3ff44c07b1d5ce1e4c0 Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
e43e06192f
commit
a33495a3de
@@ -892,20 +892,14 @@ Image *Image::redescribe() {
|
||||
7 // {CL_RGBA, CL_UNSIGNED_INT32} 16 byte
|
||||
};
|
||||
|
||||
const uint32_t bytesPerPixel = this->surfaceFormatInfo.NumChannels * surfaceFormatInfo.PerChannelSizeInBytes;
|
||||
const uint32_t exponent = Math::log2(bytesPerPixel);
|
||||
DEBUG_BREAK_IF(exponent >= 5u);
|
||||
const uint32_t surfaceFormatIdx = redescribeTableBytes[exponent % 5];
|
||||
const ArrayRef<const SurfaceFormatInfo> readWriteSurfaceFormats = SurfaceFormats::readWrite();
|
||||
const SurfaceFormatInfo *surfaceFormat = &readWriteSurfaceFormats[surfaceFormatIdx];
|
||||
|
||||
auto imageFormatNew = this->imageFormat;
|
||||
auto imageDescNew = this->imageDesc;
|
||||
const SurfaceFormatInfo *surfaceFormat = nullptr;
|
||||
auto bytesPerPixel = this->surfaceFormatInfo.NumChannels * surfaceFormatInfo.PerChannelSizeInBytes;
|
||||
uint32_t exponent = 0;
|
||||
|
||||
exponent = Math::log2(bytesPerPixel);
|
||||
DEBUG_BREAK_IF(exponent >= 32);
|
||||
|
||||
uint32_t surfaceFormatIdx = redescribeTableBytes[exponent % 5];
|
||||
ArrayRef<const SurfaceFormatInfo> readWriteSurfaceFormats = SurfaceFormats::readWrite();
|
||||
|
||||
surfaceFormat = &readWriteSurfaceFormats[surfaceFormatIdx];
|
||||
|
||||
imageFormatNew.image_channel_order = surfaceFormat->OCLImageFormat.image_channel_order;
|
||||
imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type;
|
||||
|
||||
@@ -918,7 +912,7 @@ Image *Image::redescribe() {
|
||||
this->getSize(),
|
||||
this->getCpuAddress(),
|
||||
imageFormatNew,
|
||||
imageDescNew,
|
||||
this->imageDesc,
|
||||
this->isMemObjZeroCopy(),
|
||||
this->getGraphicsAllocation(),
|
||||
true,
|
||||
|
||||
Reference in New Issue
Block a user