bool enable_audio = true; // Kaeru only. If false, then transcode_audio is also false.
int x264_bit_depth = 8; // Not user-settable.
bool use_zerocopy = false; // Not user-settable.
- bool can_disable_srgb_decoder = false; // Not user-settable.
bool fullscreen = false;
std::map<unsigned, unsigned> card_to_mjpeg_stream_export; // If a card is not in the map, it is not exported.
};
case PixelFormat_8BitBGRA:
glBindTexture(GL_TEXTURE_2D, userdata->tex_rgba[field]);
check_error();
- if (global_flags.can_disable_srgb_decoder) { // See the comments in tweaked_inputs.h.
- glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
- } else {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
- }
+ // NOTE: sRGB may be disabled by sRGBSwitchingFlatInput.
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
check_error();
break;
default:
CHECK(init_movit(MOVIT_SHADER_DIR, MOVIT_DEBUG_OFF));
check_error();
- // This nearly always should be true.
- global_flags.can_disable_srgb_decoder =
- epoxy_has_gl_extension("GL_EXT_texture_sRGB_decode") &&
- epoxy_has_gl_extension("GL_ARB_sampler_objects");
+ if (!epoxy_has_gl_extension("GL_EXT_texture_sRGB_decode") ||
+ !epoxy_has_gl_extension("GL_ARB_sampler_objects")) {
+ fprintf(stderr, "Nageru requires GL_EXT_texture_sRGB_decode and GL_ARB_sampler_objects to run.\n");
+ exit(1);
+ }
// Since we allow non-bouncing 4:2:2 YCbCrInputs, effective subpixel precision
// will be halved when sampling them, and we need to compensate here.
check_error();
set_clamp_to_edge();
if (field == 0) {
- if (global_flags.can_disable_srgb_decoder) { // See the comments in tweaked_inputs.h.
- glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
- } else {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
- }
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
check_error();
}
break;
for (unsigned i = 0; i < num_inputs; ++i) {
// We upload our textures ourselves, and Movit swaps
// R and B in the shader if we specify BGRA, so lie and say RGBA.
- if (global_flags.can_disable_srgb_decoder) {
- rgba_inputs.push_back(new sRGBSwitchingFlatInput(inout_format, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, GL_UNSIGNED_BYTE, global_flags.width, global_flags.height));
- } else {
- rgba_inputs.push_back(new NonsRGBCapableFlatInput(inout_format, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, GL_UNSIGNED_BYTE, global_flags.width, global_flags.height));
- }
+ rgba_inputs.push_back(new sRGBSwitchingFlatInput(inout_format, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, GL_UNSIGNED_BYTE, global_flags.width, global_flags.height));
chain->add_input(rgba_inputs.back());
}
// Some tweaked variations of Movit inputs.
+#include <movit/flat_input.h>
#include <movit/ycbcr_input.h>
namespace movit {
// or not. (FlatInput deals with this if you give it pixels, but we give it
// already uploaded textures.)
//
-// If we have GL_EXT_texture_sRGB_decode (very common, as far as I can tell),
-// we can just always upload with the sRGB flag turned on, and then turn it off
-// if not requested; that's sRGBSwitchingFlatInput. If not, we just need to
-// turn off the functionality altogether, which is NonsRGBCapableFlatInput.
-//
-// If you're using NonsRGBCapableFlatInput, upload with GL_RGBA8.
-// If using sRGBSwitchingFlatInput, upload with GL_SRGB8_ALPHA8.
-
-class NonsRGBCapableFlatInput : public movit::FlatInput {
-public:
- NonsRGBCapableFlatInput(movit::ImageFormat format, movit::MovitPixelFormat pixel_format, GLenum type, unsigned width, unsigned height)
- : movit::FlatInput(format, pixel_format, type, width, height) {}
-
- bool can_output_linear_gamma() const override { return false; }
-};
+// Since we require GL_EXT_texture_sRGB_decode (very common, as far as I can tell),
+// we can just always upload with the sRGB flag turned on (upload your texture with
+// GL_SRGB8_ALPHA8), and then sRGBSwitchingFlatInput will turn it off if not requested.
class sRGBSwitchingFlatInput : public movit::FlatInput {
public:
GLuint texture_unit;
};
-
#endif // !defined(_TWEAKED_INPUTS_H)