1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-06 01:28:57 +00:00

Eliminated a further potential cause of texture/geometry mismatch: the texture retain succeeded but then there wasn't room for geometry.

This commit is contained in:
Thomas Harte 2017-07-09 19:11:38 -04:00
parent 646622b99e
commit 8ccec37a4b
3 changed files with 11 additions and 0 deletions

View File

@ -143,6 +143,9 @@ void CRT::advance_cycles(unsigned int number_of_cycles, bool hsync_requested, bo
bool did_retain_source_data = openGL_output_builder_.texture_builder.retain_latest();
if(did_retain_source_data) {
next_run = openGL_output_builder_.array_builder.get_input_storage(SourceVertexSize);
if(!next_run) {
openGL_output_builder_.texture_builder.discard_latest();
}
}
}

View File

@ -128,6 +128,11 @@ bool TextureBuilder::retain_latest() {
return true;
}
void TextureBuilder::discard_latest() {
if(was_full_) return;
number_of_write_areas_--;
}
bool TextureBuilder::is_full() {
return is_full_;
}

View File

@ -79,6 +79,9 @@ class TextureBuilder {
/// @returns @c true if a retain succeeded; @c false otherwise.
bool retain_latest();
// Undoes the most recent retain_latest. Undefined behaviour if a submission has occurred in the interim.
void discard_latest();
/// @returns @c true if all future calls to @c allocate_write_area will fail on account of the input texture
/// being full; @c false if calls may succeed.
bool is_full();