Skip to content

Commit

Permalink
[opencl] Memory optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Aug 8, 2018
1 parent d5dd50c commit 5129dcf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
13 changes: 2 additions & 11 deletions resources/opencl_programs/hillshade.cl
Expand Up @@ -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 );
Expand Down
4 changes: 3 additions & 1 deletion src/app/qgsoptions.cpp
Expand Up @@ -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 )
)
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsopenclutils.cpp
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsopenclutils.h
Expand Up @@ -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();
Expand Down

0 comments on commit 5129dcf

Please sign in to comment.