mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
[GSP::GPU] Proper type assertions and visibility
This commit is contained in:
parent
73a18e3609
commit
0b4497302b
3 changed files with 22 additions and 20 deletions
|
@ -97,7 +97,7 @@ struct ColourBuffer {
|
||||||
const u32 startOffset = (inputAddress - location) / sizePerPixel(format);
|
const u32 startOffset = (inputAddress - location) / sizePerPixel(format);
|
||||||
const u32 x0 = (startOffset % (size.x() * 8)) / 8;
|
const u32 x0 = (startOffset % (size.x() * 8)) / 8;
|
||||||
const u32 y0 = (startOffset / (size.x() * 8)) * 8;
|
const u32 y0 = (startOffset / (size.x() * 8)) * 8;
|
||||||
return Math::Rect{x0, size.y() - y0, x0 + width, size.y() - height - y0};
|
return Math::Rect<u32>{x0, size.y() - y0, x0 + width, size.y() - height - y0};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool matches(ColourBuffer& other) {
|
bool matches(ColourBuffer& other) {
|
||||||
|
|
|
@ -18,24 +18,6 @@ enum class GPUInterrupt : u8 {
|
||||||
DMA = 6
|
DMA = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FramebufferInfo {
|
|
||||||
u32 activeFb;
|
|
||||||
u32 leftFramebufferVaddr;
|
|
||||||
u32 rightFramebufferVaddr;
|
|
||||||
u32 stride;
|
|
||||||
u32 format;
|
|
||||||
u32 displayFb;
|
|
||||||
u32 attribute;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FrameBufferUpdate {
|
|
||||||
u8 index;
|
|
||||||
u8 dirtyFlag;
|
|
||||||
u16 pad0;
|
|
||||||
std::array<FramebufferInfo, 2> framebufferInfo;
|
|
||||||
u32 pad1;
|
|
||||||
};
|
|
||||||
|
|
||||||
// More circular dependencies
|
// More circular dependencies
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
|
@ -58,6 +40,26 @@ class GPUService {
|
||||||
MAKE_LOG_FUNCTION(log, gspGPULogger)
|
MAKE_LOG_FUNCTION(log, gspGPULogger)
|
||||||
void processCommandBuffer();
|
void processCommandBuffer();
|
||||||
|
|
||||||
|
struct FramebufferInfo {
|
||||||
|
u32 activeFb;
|
||||||
|
u32 leftFramebufferVaddr;
|
||||||
|
u32 rightFramebufferVaddr;
|
||||||
|
u32 stride;
|
||||||
|
u32 format;
|
||||||
|
u32 displayFb;
|
||||||
|
u32 attribute;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(FramebufferInfo) == 28, "GSP::GPU::FramebufferInfo has the wrong size");
|
||||||
|
|
||||||
|
struct FramebufferUpdate {
|
||||||
|
u8 index;
|
||||||
|
u8 dirtyFlag;
|
||||||
|
u16 pad0;
|
||||||
|
std::array<FramebufferInfo, 2> framebufferInfo;
|
||||||
|
u32 pad1;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(FramebufferUpdate) == 64, "GSP::GPU::FramebufferUpdate has the wrong size");
|
||||||
|
|
||||||
// Service commands
|
// Service commands
|
||||||
void acquireRight(u32 messagePointer);
|
void acquireRight(u32 messagePointer);
|
||||||
void flushDataCache(u32 messagePointer);
|
void flushDataCache(u32 messagePointer);
|
||||||
|
|
|
@ -128,7 +128,7 @@ void GPUService::requestInterrupt(GPUInterrupt type) {
|
||||||
if (type == GPUInterrupt::VBlank0 || type == GPUInterrupt::VBlank1) {
|
if (type == GPUInterrupt::VBlank0 || type == GPUInterrupt::VBlank1) {
|
||||||
int screen = static_cast<u32>(type) - static_cast<u32>(GPUInterrupt::VBlank0); // 0 for top screen, 1 for bottom
|
int screen = static_cast<u32>(type) - static_cast<u32>(GPUInterrupt::VBlank0); // 0 for top screen, 1 for bottom
|
||||||
// TODO: Offset depends on GSP thread being triggered
|
// TODO: Offset depends on GSP thread being triggered
|
||||||
FrameBufferUpdate* update = reinterpret_cast<FrameBufferUpdate*>(&sharedMem[0x200 + screen * sizeof(FrameBufferUpdate)]);
|
FramebufferUpdate* update = reinterpret_cast<FramebufferUpdate*>(&sharedMem[0x200 + screen * sizeof(FramebufferUpdate)]);
|
||||||
|
|
||||||
if (update->dirtyFlag & 1) {
|
if (update->dirtyFlag & 1) {
|
||||||
setBufferSwapImpl(screen, update->framebufferInfo[update->index]);
|
setBufferSwapImpl(screen, update->framebufferInfo[update->index]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue