1 #ifndef _TWEAKED_INPUTS_H
2 #define _TWEAKED_INPUTS_H 1
4 // Some tweaked variations of Movit inputs.
6 #include <movit/flat_input.h>
7 #include <movit/ycbcr_input.h>
14 class NonBouncingYCbCrInput : public movit::YCbCrInput {
16 NonBouncingYCbCrInput(const movit::ImageFormat &image_format,
17 const movit::YCbCrFormat &ycbcr_format,
18 unsigned width, unsigned height,
19 movit::YCbCrInputSplitting ycbcr_input_splitting = movit::YCBCR_INPUT_PLANAR)
20 : movit::YCbCrInput(image_format, ycbcr_format, width, height, ycbcr_input_splitting) {}
22 bool override_disable_bounce() const override { return true; }
25 // We use FlatInput with RGBA inputs a few places where we can't tell when
26 // uploading the texture whether it needs to be converted from sRGB to linear
27 // or not. (FlatInput deals with this if you give it pixels, but we give it
28 // already uploaded textures.)
30 // Since we require GL_EXT_texture_sRGB_decode (very common, as far as I can tell),
31 // we can just always upload with the sRGB flag turned on (upload your texture with
32 // GL_SRGB8_ALPHA8), and then sRGBSwitchingFlatInput will turn it off if not requested.
34 class sRGBSwitchingFlatInput : public movit::FlatInput {
36 sRGBSwitchingFlatInput(movit::ImageFormat format, movit::MovitPixelFormat pixel_format, GLenum type, unsigned width, unsigned height)
37 : movit::FlatInput(format, pixel_format, type, width, height) {}
39 ~sRGBSwitchingFlatInput();
40 void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
41 void clear_gl_state() override;
43 bool set_int(const std::string &key, int value) override
45 if (key == "output_linear_gamma") {
46 output_linear_gamma = value;
48 if (key == "needs_mipmaps") {
49 needs_mipmaps = value;
51 return movit::FlatInput::set_int(key, value);
55 bool output_linear_gamma = false;
56 bool needs_mipmaps = false;
57 GLuint sampler_obj = 0;
61 #endif // !defined(_TWEAKED_INPUTS_H)