| 278 | } |
| 279 | |
| 280 | clfftStatus clfftSetPlanLength( clfftPlanHandle plHandle, const clfftDim dim, const size_t* clLengths ) |
| 281 | { |
| 282 | FFTRepo& fftRepo = FFTRepo::getInstance( ); |
| 283 | FFTPlan* fftPlan = NULL; |
| 284 | lockRAII* planLock = NULL; |
| 285 | |
| 286 | OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); |
| 287 | scopedLock sLock( *planLock, _T( "clfftSetPlanLength" ) ); |
| 288 | |
| 289 | if( clLengths == NULL ) |
| 290 | return CLFFT_INVALID_HOST_PTR; |
| 291 | |
| 292 | // Simplest to clear any previous contents, because it's valid for user to shrink dimension |
| 293 | fftPlan->length.clear( ); |
| 294 | switch( dim ) |
| 295 | { |
| 296 | case CLFFT_1D: |
| 297 | { |
| 298 | // Minimum length size is 1 |
| 299 | if( clLengths[ DimX ] == 0 ) |
| 300 | return CLFFT_INVALID_ARG_VALUE; |
| 301 | |
| 302 | if( !IsASupportedLength( clLengths[ DimX ] ) ) |
| 303 | return CLFFT_NOTIMPLEMENTED; |
| 304 | |
| 305 | fftPlan->length.push_back( clLengths[ DimX ] ); |
| 306 | } |
| 307 | break; |
| 308 | case CLFFT_2D: |
| 309 | { |
| 310 | // Minimum length size is 1 |
| 311 | if( clLengths[ DimX ] == 0 || clLengths[ DimY ] == 0 ) |
| 312 | return CLFFT_INVALID_ARG_VALUE; |
| 313 | |
| 314 | if(!fftPlan->transflag) |
| 315 | { |
| 316 | if( !IsASupportedLength( clLengths[ DimX ] ) || !IsASupportedLength( clLengths[ DimY ] ) ) |
| 317 | { |
| 318 | return CLFFT_NOTIMPLEMENTED; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | fftPlan->length.push_back( clLengths[ DimX ] ); |
| 323 | fftPlan->length.push_back( clLengths[ DimY ] ); |
| 324 | } |
| 325 | break; |
| 326 | case CLFFT_3D: |
| 327 | { |
| 328 | // Minimum length size is 1 |
| 329 | if( clLengths[ DimX ] == 0 || clLengths[ DimY ] == 0 || clLengths[ DimZ ] == 0) |
| 330 | return CLFFT_INVALID_ARG_VALUE; |
| 331 | |
| 332 | if( !IsASupportedLength( clLengths[ DimX ] ) || !IsASupportedLength( clLengths[ DimY ] ) || |
| 333 | !IsASupportedLength( clLengths[ DimZ ] ) ) |
| 334 | { |
| 335 | return CLFFT_NOTIMPLEMENTED; |
| 336 | } |
| 337 | |