| 230 | } |
| 231 | |
| 232 | clfftStatus clfftGetPlanLength( const clfftPlanHandle plHandle, const clfftDim dim, size_t* clLengths ) |
| 233 | { |
| 234 | FFTRepo& fftRepo = FFTRepo::getInstance( ); |
| 235 | FFTPlan* fftPlan = NULL; |
| 236 | lockRAII* planLock = NULL; |
| 237 | |
| 238 | OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); |
| 239 | scopedLock sLock( *planLock, _T( "clfftGetPlanLength" ) ); |
| 240 | |
| 241 | if( clLengths == NULL ) |
| 242 | return CLFFT_INVALID_HOST_PTR; |
| 243 | |
| 244 | if( fftPlan->length.empty( ) ) |
| 245 | return CLFFT_INVALID_ARG_INDEX; |
| 246 | |
| 247 | switch( dim ) |
| 248 | { |
| 249 | case CLFFT_1D: |
| 250 | { |
| 251 | clLengths[ DimX ] = fftPlan->length[ DimX ]; |
| 252 | } |
| 253 | break; |
| 254 | case CLFFT_2D: |
| 255 | { |
| 256 | if( fftPlan->length.size( ) < 2 ) |
| 257 | return CLFFT_INVALID_ARG_INDEX; |
| 258 | |
| 259 | clLengths[ DimX ] = fftPlan->length[ DimX ]; |
| 260 | clLengths[ DimY ] = fftPlan->length[ DimY ]; |
| 261 | } |
| 262 | break; |
| 263 | case CLFFT_3D: |
| 264 | { |
| 265 | if( fftPlan->length.size( ) < 3 ) |
| 266 | return CLFFT_INVALID_ARG_INDEX; |
| 267 | |
| 268 | clLengths[ DimX ] = fftPlan->length[ DimX ]; |
| 269 | clLengths[ DimY ] = fftPlan->length[ DimY ]; |
| 270 | clLengths[ DimZ ] = fftPlan->length[ DimZ ]; |
| 271 | } |
| 272 | break; |
| 273 | default: |
| 274 | return CLFFT_NOTIMPLEMENTED; |
| 275 | break; |
| 276 | } |
| 277 | return CLFFT_SUCCESS; |
| 278 | } |
| 279 | |
| 280 | clfftStatus clfftSetPlanLength( clfftPlanHandle plHandle, const clfftDim dim, const size_t* clLengths ) |
| 281 | { |