Make Linked elements BSS conform
This commit is contained in:
parent
63aa467962
commit
75ab477fff
|
@ -22,6 +22,7 @@ namespace FontWriter {
|
|||
reset_links();
|
||||
for(auto& char_array : TextBuffer) {
|
||||
for(auto& single_char : char_array) {
|
||||
single_char.set_link_identitiy();
|
||||
single_char->set_identitiy();
|
||||
single_char->clut = GPU::PageClut(Assets::FontTIM.get_clut_x(), Assets::FontTIM.get_clut_y());
|
||||
}
|
||||
|
|
|
@ -10,18 +10,26 @@ namespace JabyEngine {
|
|||
|
||||
static constexpr uint32_t TerminationValue = 0x00FFFFFF;
|
||||
|
||||
uint32_t value = TerminationValue;
|
||||
static constexpr uint32_t default_link_value(size_t size) {
|
||||
return SizeRange.as_value(size >> 2) | TerminationValue;
|
||||
}
|
||||
|
||||
uint32_t link_value;
|
||||
|
||||
constexpr Link() = default;
|
||||
constexpr Link(size_t size) : value(SizeRange.as_value(size >> 2) | TerminationValue) {
|
||||
constexpr Link(size_t size) : link_value(default_link_value(size)) {
|
||||
}
|
||||
|
||||
constexpr void set_link_identitiy(size_t size) {
|
||||
this->link_value = default_link_value(size);
|
||||
}
|
||||
|
||||
void set_adr(const void* adr) {
|
||||
this->value = bit::value::set_normalized(this->value, AdrRange.with(reinterpret_cast<uint32_t>(adr)));
|
||||
this->link_value = bit::value::set_normalized(this->link_value, AdrRange.with(reinterpret_cast<uint32_t>(adr)));
|
||||
}
|
||||
|
||||
void* get_adr() const {
|
||||
return reinterpret_cast<void*>(bit::value::get_normalized(this->value, AdrRange));
|
||||
return reinterpret_cast<void*>(bit::value::get_normalized(this->link_value, AdrRange));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -45,7 +53,7 @@ namespace JabyEngine {
|
|||
}
|
||||
|
||||
constexpr void terminate() {
|
||||
this->value |= TerminationValue;
|
||||
this->link_value |= TerminationValue;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -59,6 +67,10 @@ namespace JabyEngine {
|
|||
constexpr LinkedElement(const T& element) : Link(sizeof(T)), element(element) {
|
||||
}
|
||||
|
||||
constexpr void set_link_identitiy() {
|
||||
Link::set_link_identitiy(sizeof(T));
|
||||
}
|
||||
|
||||
constexpr const T* operator->() const {
|
||||
return &this->element;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace JabyEngine {
|
|||
|
||||
template<typename T>
|
||||
static void render(const LinkedElement<T>& linked_primitives) {
|
||||
internal::render_dma(&linked_primitives.value);
|
||||
internal::render_dma(&linked_primitives.link_value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
Loading…
Reference in New Issue