Skip to content
Permalink
Browse files

[opencl] Memory optimization

  • Loading branch information
elpaso committed Aug 8, 2018
1 parent d5dd50c commit 5129dcf03c2aafc9be49f48fb81ae94a16d71335
Showing with 9 additions and 13 deletions.
  1. +2 −11 resources/opencl_programs/hillshade.cl
  2. +3 −1 src/app/qgsoptions.cpp
  3. +2 −0 src/core/qgsopenclutils.cpp
  4. +2 −1 src/core/qgsopenclutils.h
@@ -35,17 +35,8 @@ __kernel void processNineCellWindow( __global float *scanLine1,
}
else
{
// 180.0 / M_PI = 57.29577951308232
float aspect = atan2( derX, derY ) * 57.29577951308232;
if ( aspect < 0 )
aspect = 90.0f - aspect;
else if (aspect > 90.0f)
// 360 + 90 = 450
aspect = 450.0f - aspect;
else
aspect = 90.0 - aspect;
// aspect = aspect / 360 * 255; // for display
aspect = radians( aspect );
float aspect = atan2( derX, - derY );
// aspect = aspect * M_PI * 255; // for display

float slope = sqrt( derX * derX + derY * derY );
slope = atan( slope );
@@ -1095,13 +1095,15 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
"Image support: <b>%5</b><br>"
"Max image2d width: <b>%6</b><br>"
"Max image2d height: <b>%7</b><br>"
"Max mem alloc size: <b>%8</b><br>"
).arg( QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::Name ),
QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::Vendor ),
QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::Profile ),
QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::Version ),
QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::ImageSupport ),
QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::Image2dMaxWidth ),
QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::Image2dMaxHeight )
QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::Image2dMaxHeight ),
QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::MaxMemAllocSize )
)
);
}
@@ -130,6 +130,8 @@ QString QgsOpenClUtils::deviceInfo( const Info infoType )
return sDevice.getInfo<CL_DEVICE_IMAGE_SUPPORT>() ? QStringLiteral( "True" ) : QStringLiteral( "False" );
case Info::Image2dMaxHeight:
return QString::number( sDevice.getInfo<CL_DEVICE_IMAGE2D_MAX_HEIGHT>() );
case Info::MaxMemAllocSize:
return QString::number( sDevice.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>() );
case Info::Image2dMaxWidth:
return QString::number( sDevice.getInfo<CL_DEVICE_IMAGE2D_MAX_WIDTH>() );
case Info::Name:
@@ -58,7 +58,8 @@ class CORE_EXPORT QgsOpenClUtils
Profile = CL_DEVICE_PROFILE,
ImageSupport = CL_DEVICE_IMAGE_SUPPORT,
Image2dMaxWidth = CL_DEVICE_IMAGE2D_MAX_WIDTH,
Image2dMaxHeight = CL_DEVICE_IMAGE2D_MAX_HEIGHT
Image2dMaxHeight = CL_DEVICE_IMAGE2D_MAX_HEIGHT,
MaxMemAllocSize = CL_DEVICE_MAX_MEM_ALLOC_SIZE
};

static bool enabled();

0 comments on commit 5129dcf

Please sign in to comment.
You can’t perform that action at this time.