1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-29 00:29:34 +00:00

Resolves improper state if an end-of-frame clear is triggered by the first new line.

This commit is contained in:
Thomas Harte 2019-02-17 21:49:53 -05:00
parent 7939897622
commit 7bd721f334

View File

@ -512,15 +512,17 @@ void ScanTarget::draw(bool synchronous, int output_width, int output_height) {
// Prepare to output lines.
glBindVertexArray(line_vertex_array_);
// Bind the accumulation framebuffer, unless there's going to be QAM work.
if(!qam_separation_shader_) {
// Bind the accumulation framebuffer, unless there's going to be QAM work first.
if(!qam_separation_shader_ || line_metadata_buffer_[read_pointers.line].is_first_in_frame) {
accumulation_texture_->bind_framebuffer();
output_shader_->bind();
// Enable blending and stenciling, and ensure spans increment the stencil buffer.
// Enable blending and stenciling.
glEnable(GL_BLEND);
glEnable(GL_STENCIL_TEST);
}
// Set the proper stencil function regardless.
glStencilFunc(GL_EQUAL, 0, GLuint(~0));
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);