Support all primitives

This commit is contained in:
2023-06-05 22:44:45 +02:00
parent d99b7445be
commit fd9e352355
7 changed files with 92 additions and 46 deletions

View File

@@ -6,24 +6,11 @@
namespace JabyEngine {
namespace GPU_IO {
enum struct SemiTransparency {
B_Half_add_F_Half = 0,
B_add_F = 1,
B_sub_F = 2,
B_add_F_Quarter = 3,
};
enum struct DisplayAreaColorDepth {
$15bit = 0,
$24bit = 1,
};
enum struct TexturePageColor {
$4bit = 0,
$8bit = 1,
$15bit = 2,
};
enum struct HorizontalResolution {
$256 = 0,
$320 = 1,
@@ -114,9 +101,20 @@ namespace JabyEngine {
return {(0b101u << 29)};
}
/*static constexpr GP0_t DrawMode(const GPU::PositionU16& page_pos, SemiTransparency transparency, TexturePageColor tex_color, bool dither) {
static constexpr GP0_t TexPage(const GPU::PositionU16& page_pos, GPU::SemiTransparency transparency, GPU::TexturePageColor tex_color, bool dither, bool draw_on_display_area) {
constexpr auto TexXRange = BitRange::from_to(0, 3);
constexpr auto TexYRange = BitRange::from_to(4, 4);
constexpr auto TransparencyRange = BitRange::from_to(5, 6);
constexpr auto TextureColorRange = BitRange::from_to(7, 8);
constexpr auto DitherBit = BitRange::from_to(9, 9);
constexpr auto DrawOnDisplayAreaBit = BitRange::from_to(10, 10);
}*/
return {Helper::construct_cmd(0xE1,
TexXRange.as_value(page_pos.x >> 6) | TexYRange.as_value(page_pos.y >> 7) |
TransparencyRange.as_value(static_cast<uint32_t>(transparency)) | TextureColorRange.as_value(static_cast<uint32_t>(tex_color)) |
DitherBit.as_value(static_cast<uint32_t>(dither)) | DrawOnDisplayAreaBit.as_value(static_cast<uint32_t>(draw_on_display_area))
)};
}
static constexpr GP0_t DrawAreaTopLeft(const GPU::PositionU16& position) {
return Helper::DrawAreaTemplate(0xE3, position.x, position.y);
@@ -126,7 +124,7 @@ namespace JabyEngine {
return Helper::DrawAreaTemplate(0xE4, position.x, position.y);
}
static GP0_t SetDrawOffset(const GPU::PositionI16& offset) {
static constexpr GP0_t SetDrawOffset(const GPU::PositionI16& offset) {
constexpr auto X = BitRange::from_to(0, 10);
constexpr auto Y = BitRange::from_to(11, 21);