#include <string.h>
#include <assert.h>
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <fftw3.h>
#include "effect_util.h"
fft_height(height),
convolve_width(width),
convolve_height(height),
- pixel_data(NULL)
+ pixel_data(nullptr)
{
register_int("fft_width", &fft_width);
register_int("fft_height", &fft_height);
+ register_uniform_sampler2d("tex", &uniform_tex);
}
FFTInput::~FFTInput()
check_error();
if (texture_num == 0) {
- assert(pixel_data != NULL);
+ assert(pixel_data != nullptr);
// Do the FFT. Our FFTs should typically be small enough and
// the data changed often enough that FFTW_ESTIMATE should be
// Convert to fp16.
fp16_int_t *kernel = new fp16_int_t[fft_width * fft_height * 2];
for (int i = 0; i < fft_width * fft_height; ++i) {
- kernel[i * 2 + 0] = fp64_to_fp16(out[i][0]);
- kernel[i * 2 + 1] = fp64_to_fp16(out[i][1]);
+ kernel[i * 2 + 0] = fp32_to_fp16(out[i][0]);
+ kernel[i * 2 + 1] = fp32_to_fp16(out[i][1]);
}
// (Re-)upload the texture.
}
// Bind it to a sampler.
- set_uniform_int(glsl_program_num, prefix, "tex", *sampler_num);
+ uniform_tex = *sampler_num;
++*sampler_num;
}
string FFTInput::output_fragment_shader()
{
- return read_file("flat_input.frag");
+ return string("#define FIXUP_SWAP_RB 0\n#define FIXUP_RED_TO_GRAYSCALE 0\n") +
+ read_file("flat_input.frag");
}
void FFTInput::invalidate_pixel_data()