1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 01:31:42 +00:00

Attempts to add clearing of the destination framebuffer too.

This commit is contained in:
Thomas Harte 2018-11-24 23:31:56 -05:00
parent dd4af4f0df
commit cd1e796093

View File

@ -70,8 +70,6 @@ template <typename T> void ScanTarget::allocate_buffer(const T &array, GLuint &b
ScanTarget::ScanTarget() :
unprocessed_line_texture_(LineBufferWidth, LineBufferHeight, UnprocessedLineBufferTextureUnit, GL_LINEAR, false),
// svideo_texture_(LineBufferWidth, LineBufferHeight, SVideoLineBufferTextureUnit, GL_LINEAR, false),
// rgb_texture_(LineBufferWidth, LineBufferHeight, RGBLineBufferTextureUnit, GL_LINEAR, false),
full_display_rectangle_(-1.0f, -1.0f, 2.0f, 2.0f) {
// Ensure proper initialisation of the two atomic pointer sets.
@ -483,11 +481,26 @@ void ScanTarget::draw(bool synchronous, int output_width, int output_height) {
if(first_line_to_clear < final_line_to_clear) {
glScissor(0, first_line_to_clear, unprocessed_line_texture_.get_width(), final_line_to_clear - first_line_to_clear);
glClear(GL_COLOR_BUFFER_BIT);
if(pipeline_stages_.size()) {
pipeline_stages_.back().target.bind_framebuffer();
glClear(GL_COLOR_BUFFER_BIT);
unprocessed_line_texture_.bind_framebuffer();
}
} else {
glScissor(0, 0, unprocessed_line_texture_.get_width(), final_line_to_clear);
glClear(GL_COLOR_BUFFER_BIT);
glScissor(0, first_line_to_clear, unprocessed_line_texture_.get_width(), unprocessed_line_texture_.get_height() - first_line_to_clear);
glClear(GL_COLOR_BUFFER_BIT);
if(pipeline_stages_.size()) {
pipeline_stages_.back().target.bind_framebuffer();
glScissor(0, 0, unprocessed_line_texture_.get_width(), final_line_to_clear);
glClear(GL_COLOR_BUFFER_BIT);
glScissor(0, first_line_to_clear, unprocessed_line_texture_.get_width(), unprocessed_line_texture_.get_height() - first_line_to_clear);
glClear(GL_COLOR_BUFFER_BIT);
unprocessed_line_texture_.bind_framebuffer();
}
}
glDisable(GL_SCISSOR_TEST);