1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-28 07:29:45 +00:00

Adds through route for setting a texture bookender, and exploits it from the Electron.

This commit is contained in:
Thomas Harte 2017-10-23 18:35:37 -04:00
parent 513903890e
commit 218b976dbc
2 changed files with 13 additions and 0 deletions

View File

@ -32,6 +32,13 @@ namespace {
static const int real_time_clock_interrupt_2 = 56704; static const int real_time_clock_interrupt_2 = 56704;
static const int display_end_interrupt_1 = (first_graphics_line + display_end_interrupt_line)*cycles_per_line; static const int display_end_interrupt_1 = (first_graphics_line + display_end_interrupt_line)*cycles_per_line;
static const int display_end_interrupt_2 = (first_graphics_line + field_divider_line + display_end_interrupt_line)*cycles_per_line; static const int display_end_interrupt_2 = (first_graphics_line + field_divider_line + display_end_interrupt_line)*cycles_per_line;
struct FourBPPBookender: public Outputs::CRT::TextureBuilder::Bookender {
void add_bookends(uint8_t *const left_value, uint8_t *const right_value, uint8_t *left_bookend, uint8_t *right_bookend) {
*left_bookend = static_cast<uint8_t>(((*left_value) & 0x0f) | (((*left_value) & 0x0f) << 4));
*right_bookend = static_cast<uint8_t>(((*right_value) & 0xf0) | (((*right_value) & 0xf0) >> 4));
}
};
} }
#pragma mark - Lifecycle #pragma mark - Lifecycle
@ -49,6 +56,8 @@ VideoOutput::VideoOutput(uint8_t *memory) : ram_(memory) {
"texValue >>= 4 - (int(icoordinate.x * 8) & 4);" "texValue >>= 4 - (int(icoordinate.x * 8) & 4);"
"return vec3( uvec3(texValue) & uvec3(4u, 2u, 1u));" "return vec3( uvec3(texValue) & uvec3(4u, 2u, 1u));"
"}"); "}");
std::unique_ptr<Outputs::CRT::TextureBuilder::Bookender> bookender(new FourBPPBookender);
crt_->set_bookender(std::move(bookender));
// TODO: as implied below, I've introduced a clock's latency into the graphics pipeline somehow. Investigate. // TODO: as implied below, I've introduced a clock's latency into the graphics pipeline somehow. Investigate.
crt_->set_visible_area(crt_->get_rect_for_area(first_graphics_line - 3, 256, (first_graphics_cycle+1) * crt_cycles_multiplier, 80 * crt_cycles_multiplier, 4.0f / 3.0f)); crt_->set_visible_area(crt_->get_rect_for_area(first_graphics_line - 3, 256, (first_graphics_cycle+1) * crt_cycles_multiplier, 80 * crt_cycles_multiplier, 4.0f / 3.0f));
} }

View File

@ -312,6 +312,10 @@ class CRT {
}); });
} }
inline void set_bookender(std::unique_ptr<TextureBuilder::Bookender> bookender) {
openGL_output_builder_.texture_builder.set_bookender(std::move(bookender));
}
inline void set_output_device(OutputDevice output_device) { inline void set_output_device(OutputDevice output_device) {
enqueue_openGL_function([output_device, this] { enqueue_openGL_function([output_device, this] {
openGL_output_builder_.set_output_device(output_device); openGL_output_builder_.set_output_device(output_device);