X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=ycbcr_input.cpp;h=d6cefe65bfb4120069bc16107a02cdf677b84408;hp=e424fca6c474108b986a5515a58aa97890ffab88;hb=7d67e608f6e4f6d0823e43ef0b16641a67c1cbfb;hpb=6a176580b95002657b381acfaf3892b345e28364 diff --git a/ycbcr_input.cpp b/ycbcr_input.cpp index e424fca..d6cefe6 100644 --- a/ycbcr_input.cpp +++ b/ycbcr_input.cpp @@ -28,7 +28,7 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format, type(type), width(width), height(height), - resource_pool(NULL) + resource_pool(nullptr) { pbos[0] = pbos[1] = pbos[2] = 0; texture_num[0] = texture_num[1] = texture_num[2] = 0; @@ -36,7 +36,7 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format, set_width(width); set_height(height); - pixel_data[0] = pixel_data[1] = pixel_data[2] = NULL; + pixel_data[0] = pixel_data[1] = pixel_data[2] = nullptr; owns_texture[0] = owns_texture[1] = owns_texture[2] = false; register_uniform_sampler2d("tex_y", &uniform_tex_y); @@ -87,7 +87,7 @@ void YCbCrInput::set_gl_state(GLuint glsl_program_num, const string& prefix, uns glActiveTexture(GL_TEXTURE0 + *sampler_num + channel); check_error(); - if (texture_num[channel] == 0 && (pbos[channel] != 0 || pixel_data[channel] != NULL)) { + if (texture_num[channel] == 0 && (pbos[channel] != 0 || pixel_data[channel] != nullptr)) { GLenum format, internal_format; if (channel == 0 && ycbcr_input_splitting == YCBCR_INPUT_INTERLEAVED) { if (type == GL_UNSIGNED_INT_2_10_10_10_REV) { @@ -147,6 +147,8 @@ void YCbCrInput::set_gl_state(GLuint glsl_program_num, const string& prefix, uns } else { glBindTexture(GL_TEXTURE_2D, texture_num[channel]); check_error(); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, needs_mipmaps ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR); + check_error(); } } @@ -184,6 +186,7 @@ string YCbCrInput::output_fragment_shader() } frag_shader += read_file("ycbcr_input.frag"); + frag_shader += "#undef CB_CR_SAME_TEXTURE\n#undef Y_CB_CR_SAME_TEXTURE\n"; return frag_shader; }