#include <glfft.hpp>
|
| FFT (unsigned Nx, unsigned Ny, Type type, Direction direction, Target input_target, Target output_target, std::shared_ptr< ProgramCache > cache, const FFTOptions &options, const FFTWisdom &wisdom=FFTWisdom()) |
| Creates a full FFT. More...
|
|
| FFT (unsigned Nx, unsigned Ny, unsigned radix, unsigned p, Mode mode, Target input_target, Target output_target, std::shared_ptr< ProgramCache > cache, const FFTOptions &options) |
| Creates a single stage FFT. Used mostly internally for benchmarking partial FFTs. More...
|
|
void | process (GLuint output, GLuint input, GLuint input_aux=0) |
| Process the FFT. More...
|
|
double | bench (GLuint output, GLuint input, unsigned warmup_iterations, unsigned iterations, unsigned dispatches_per_iteration, double max_time=std::numeric_limits< double >::max()) |
| Run process() multiple times, timing the results. More...
|
|
double | get_cost () const |
| Returns cost for a process() call. Only used for debugging. More...
|
|
unsigned | get_num_passes () const |
| Returns number of passes (glDispatchCompute) in a process() call. More...
|
|
unsigned | get_dimension_x () const |
| Returns Nx. More...
|
|
unsigned | get_dimension_y () const |
| Returns Ny. More...
|
|
void | set_texture_offset_scale (float offset_x, float offset_y, float scale_x, float scale_y) |
| Sets offset and scale parameters for normalized texel coordinates when sampling textures. More...
|
|
void | set_input_buffer_range (GLintptr offset, GLsizei size) |
| Set binding range for input. More...
|
|
void | set_input_aux_buffer_range (GLintptr offset, GLsizei size) |
| Set binding range for input_aux. More...
|
|
void | set_output_buffer_range (GLintptr offset, GLsizei size) |
| Set binding range for output. More...
|
|
void | set_samplers (GLuint sampler0, GLuint sampler1=0) |
| Set samplers for input textures. More...
|
|
Definition at line 36 of file glfft.hpp.
Creates a full FFT.
All buffer allocation done by GLFFT will be done in constructor. Will throw if invalid parameters are passed.
- Parameters
-
Nx | Number of samples in horizontal dimension. |
Ny | Number of samples in vertical dimension. |
type | The transform type. |
direction | Forward, inverse or inverse with convolution. For real-to-complex and complex-to-real transforms, the transform type must match. |
input_target | GL object type of input target. For real-to-complex with texture as input, ImageReal is used. |
output_target | GL object type of output target. For complex-to-real with texture as output, ImageReal is used. |
cache | A program cache for caching the GLFFT programs created. |
options | FFT options such as performance related parameters and types. |
wisdom | GLFFT wisdom which can override performance related options (options.performance is used as a fallback). |
Definition at line 498 of file glfft.cpp.
Creates a single stage FFT. Used mostly internally for benchmarking partial FFTs.
All buffer allocation done by GLFFT will be done in constructor. Will throw if invalid parameters are passed.
- Parameters
-
Nx | Number of samples in horizontal dimension. |
Ny | Number of samples in vertical dimension. |
radix | The FFT radix to use. |
p | Which P-factor to use. Essentially, p == 1 will trigger "first pass" paths, p > 1 will trigger generic paths. |
mode | The transform mode. |
input_target | GL object type of input target. For real-to-complex with texture as input, ImageReal is used. |
output_target | GL object type of output target. For complex-to-real with texture as output, ImageReal is used. |
cache | A program cache for caching the GLFFT programs created. |
options | FFT options such as performance related parameters and types. |
Definition at line 376 of file glfft.cpp.
double FFT::bench |
( |
GLuint |
output, |
|
|
GLuint |
input, |
|
|
unsigned |
warmup_iterations, |
|
|
unsigned |
iterations, |
|
|
unsigned |
dispatches_per_iteration, |
|
|
double |
max_time = std::numeric_limits<double>::max() |
|
) |
| |
Run process() multiple times, timing the results.
Mostly used internally by GLFFT wisdom, glfft_cli's bench, and so on.
- Parameters
-
output | Output buffer or image. NOTE: For images, the texture must be using immutable storage, i.e. glTexStorage2D! |
input | Input buffer or texture. |
warmup_iterations | Number of iterations to run to "warm" up GL, ensures we don't hit recompilations or similar when benching. |
iterations | Number of iterations to run the benchmark. Each iteration will ensure timing with a glFinish() followed by timing. |
dispatches_per_iteration | Number of calls to process() we should do per iteration. |
max_time | The max time the benchmark should run. Will be checked after each iteration is complete. |
- Returns
- Average GPU time per process() call.
Definition at line 997 of file glfft.cpp.
GLuint FFT::compile_compute_shader |
( |
const char * |
src | ) |
|
|
private |
double GLFFT::FFT::get_cost |
( |
| ) |
const |
|
inline |
unsigned GLFFT::FFT::get_dimension_x |
( |
| ) |
const |
|
inline |
unsigned GLFFT::FFT::get_dimension_y |
( |
| ) |
const |
|
inline |
unsigned GLFFT::FFT::get_num_passes |
( |
| ) |
const |
|
inline |
Returns number of passes (glDispatchCompute) in a process() call.
Definition at line 113 of file glfft.hpp.
string FFT::load_shader_string |
( |
const char * |
path | ) |
|
|
staticprivate |
Process the FFT.
The type of object passed here must match what FFT was initialized with.
- Parameters
-
output | Output buffer or image. NOTE: For images, the texture must be using immutable storage, i.e. glTexStorage2D! |
input | Input buffer or texture. |
input_aux | If using convolution transform type, the content of input and input_aux will be multiplied together. |
Definition at line 1028 of file glfft.cpp.
void GLFFT::FFT::set_input_aux_buffer_range |
( |
GLintptr |
offset, |
|
|
GLsizei |
size |
|
) |
| |
|
inline |
Set binding range for input_aux.
If input_aux is an SSBO, set a custom binding range to be passed to glBindBufferRange. By default, the entire buffer is bound.
Definition at line 148 of file glfft.hpp.
void GLFFT::FFT::set_input_buffer_range |
( |
GLintptr |
offset, |
|
|
GLsizei |
size |
|
) |
| |
|
inline |
Set binding range for input.
If input is an SSBO, set a custom binding range to be passed to glBindBufferRange. By default, the entire buffer is bound.
Definition at line 138 of file glfft.hpp.
void GLFFT::FFT::set_output_buffer_range |
( |
GLintptr |
offset, |
|
|
GLsizei |
size |
|
) |
| |
|
inline |
Set binding range for output.
If output buffer is an SSBO, set a custom binding range to be passed to glBindBufferRange. By default, the entire buffer is bound.
Definition at line 158 of file glfft.hpp.
Set samplers for input textures.
Set sampler objects to be used for input and input_aux if textures are used as input. By default, sampler object 0 will be used (inheriting sampler parameters from the texture object itself).
Definition at line 168 of file glfft.hpp.
Sets offset and scale parameters for normalized texel coordinates when sampling textures.
By default, these values are 0.5 / size (samples in the center of texel (0, 0)). Scale is 1.0 / size, so it steps one texel for each coordinate in the FFT transform. Setting this to something custom is useful to get downsampling with GL_LINEAR -> FFT transform without having to downsample the texture first, then FFT.
Definition at line 126 of file glfft.hpp.
void FFT::store_shader_string |
( |
const char * |
path, |
|
|
const std::string & |
source |
|
) |
| |
|
staticprivate |
double GLFFT::FFT::cost = 0.0 |
|
private |
struct { ... } GLFFT::FFT::input |
struct { ... } GLFFT::FFT::input_aux |
GLintptr GLFFT::FFT::offset = 0 |
float GLFFT::FFT::offset_x = 0.0f |
float GLFFT::FFT::offset_y = 0.0f |
struct { ... } GLFFT::FFT::output |
std::vector<Pass> GLFFT::FFT::passes |
|
private |
GLuint GLFFT::FFT::samplers[2] = { 0, 0 } |
float GLFFT::FFT::scale_x = 1.0f |
float GLFFT::FFT::scale_y = 1.0f |
GLsizei GLFFT::FFT::size = 0 |
unsigned GLFFT::FFT::size_x |
|
private |
unsigned GLFFT::FFT::size_y |
|
private |
struct { ... } GLFFT::FFT::ssbo |
Buffer GLFFT::FFT::temp_buffer |
|
private |
Buffer GLFFT::FFT::temp_buffer_image |
|
private |
struct { ... } GLFFT::FFT::texture |
The documentation for this class was generated from the following files:
- /mnt/d/working/gitlab/opengles-sdk-android/samples/advanced_samples/FFTOceanWater/jni/GLFFT/glfft.hpp
- /mnt/d/working/gitlab/opengles-sdk-android/samples/advanced_samples/FFTOceanWater/jni/GLFFT/glfft.cpp