DMA BIOS Font (not HW tested)
This commit is contained in:
parent
8124daeaa1
commit
fe62aa4e16
|
@ -20,7 +20,7 @@ namespace FontWriter {
|
|||
JabyEngine::GlobalFontPrimitivePool::setup(font_buffer);
|
||||
|
||||
new_font_writer.setup(LibraryFontTIM, JabyEngine::DefaultFont::Info);
|
||||
bios_font_writer.setup(LibraryFontTIM, JabyEngine::DefaultFont::Info);//(JabyEngine::BIOSFont::TIM, JabyEngine::BIOSFont::Info);
|
||||
bios_font_writer.setup(JabyEngine::BIOSFont::TIM, JabyEngine::BIOSFont::Info);
|
||||
timer.reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace JabyEngine {
|
|||
GPU::internal::DMA::Receive::prepare();
|
||||
load_special_chars(start_pos, Specials);
|
||||
load_alpha_num(start_pos, AlphaNumeric);
|
||||
font_buffer.flush();
|
||||
font_buffer.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include "../../../internal-include/GPU/gpu_internal.hpp"
|
||||
#include <PSX/GPU/gpu_auto_load_font.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
|
@ -30,60 +31,50 @@ namespace JabyEngine {
|
|||
};
|
||||
|
||||
// Letters are actually only 16x15 but should be treated 16x16
|
||||
// FIXME: This is to big for Linked Lists. Maybe we do not buffer this at all? Or just double buffer it?
|
||||
struct Letter /*: public GPU::internal::LinkedElementCreator<Letter>*/ {
|
||||
CPU2VRAM cmd;
|
||||
Line lines[BIOS_Font::Size.height - 1];
|
||||
Line empty_line;
|
||||
struct Letter {
|
||||
PositionU16 position;
|
||||
Line lines[BIOS_Font::Size.height - 1];
|
||||
Line empty_line;
|
||||
|
||||
void setup(const SizeU16& size) {
|
||||
this->cmd.cmd = GPU_IO::Command::CPU2VRAM_Blitting();
|
||||
this->cmd.size = GPU_IO::Command::WidthHeight(size);
|
||||
void setup() {
|
||||
this->empty_line.load(0);
|
||||
}
|
||||
|
||||
void load_to(const PositionU16& pos, const uint16_t* bit_map) {
|
||||
this->cmd.pos = GPU_IO::Command::TopLeftPosition(pos);
|
||||
this->position = pos;
|
||||
for(auto& cur_line : this->lines) {
|
||||
cur_line.load(__builtin_bswap16(*bit_map++));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// v ::Linked v double buffer do not change size without adjusting
|
||||
Letter letter_buffer[2*4];
|
||||
// v double buffer do not change size without adjusting
|
||||
Letter letter_buffer[2];
|
||||
uint8_t free_idx;
|
||||
|
||||
void setup() {
|
||||
for(auto& letter : this->letter_buffer) {
|
||||
letter.setup(SizeU16::create(16/4, 16));
|
||||
//letter.set_link_identitiy();
|
||||
letter.setup();
|
||||
}
|
||||
this->free_idx = 0;
|
||||
GPU::internal::DMA::Receive::prepare();
|
||||
}
|
||||
|
||||
void shutdown() {
|
||||
GPU::internal::DMA::wait();
|
||||
GPU::internal::DMA::end();
|
||||
}
|
||||
|
||||
void load_to(const PositionU16& pos, const uint16_t* bit_map) {
|
||||
auto& cur_letter = this->letter_buffer[this->free_idx++];
|
||||
|
||||
auto& cur_letter = this->letter_buffer[this->free_idx];
|
||||
this->free_idx ^= 1;
|
||||
|
||||
cur_letter.load_to(pos, bit_map);
|
||||
if((this->free_idx&0x3) == 0) {
|
||||
//cur_letter.terminate();
|
||||
//GPU::render(this->letter_buffer[this->free_idx - 4]);
|
||||
this->free_idx &= ~0x7;
|
||||
}
|
||||
|
||||
else {
|
||||
//cur_letter.concat(this->letter_buffer[this->free_idx]);
|
||||
}
|
||||
}
|
||||
|
||||
void flush() {
|
||||
if((this->free_idx&0x3) != 0) {
|
||||
//this->letter_buffer[this->free_idx - 1].terminate();
|
||||
|
||||
const auto idx = this->free_idx > 3 ? 4 : 0;
|
||||
//GPU::render(this->letter_buffer[idx]);
|
||||
}
|
||||
GPU::internal::DMA::wait();
|
||||
GPU::internal::DMA::Receive::set_src(reinterpret_cast<uintptr_t>(cur_letter.lines));
|
||||
// v 4 Pixel per byte
|
||||
GPU::internal::DMA::Receive::set_dst(cur_letter.position, SizeU16::create(16/4, 16));
|
||||
GPU::internal::DMA::Receive::start(sizeof(Line) >> 2);
|
||||
}
|
||||
|
||||
static PositionU16 vram_offset(uint16_t tile_id) {
|
||||
|
|
|
@ -112,11 +112,11 @@ namespace JabyEngine {
|
|||
static constexpr auto DebugY = 0;
|
||||
static constexpr auto DebugScale = 1.0;
|
||||
|
||||
__debug_boot_color_at(::JabyEngine::GPU::Color24::White(), DebugX, DebugY, DebugScale);
|
||||
Periphery::setup();
|
||||
__debug_boot_color_at(::JabyEngine::GPU::Color24::Grey(), DebugX, DebugY, DebugScale);
|
||||
enable_DMA();
|
||||
|
||||
__debug_boot_color_at(::JabyEngine::GPU::Color24::White(), DebugX, DebugY, DebugScale);
|
||||
enable_DMA();
|
||||
Periphery::setup();
|
||||
|
||||
__debug_boot_color_at(::JabyEngine::GPU::Color24::Red(), DebugX, DebugY, DebugScale);
|
||||
SPU::stop_voices();
|
||||
|
|
Loading…
Reference in New Issue