Skip to content

Commit

Permalink
GPU: Page align VRAM storage on Apple Silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Nov 10, 2024
1 parent 2bf0838 commit 5b60078
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ LOG_CHANNEL(GPU);
std::unique_ptr<GPU> g_gpu;

// aligning VRAM to 4K is fine, since the ARM64 instructions compute 4K page aligned addresses
// TOOD: REMOVE ME
alignas(4096) u16 g_vram[VRAM_SIZE / sizeof(u16)];
// or it would be, except we want to import the memory for readbacks on metal..
#ifdef DYNAMIC_HOST_PAGE_SIZE
#define VRAM_STORAGE_ALIGNMENT MIN_HOST_PAGE_SIZE
#else
#define VRAM_STORAGE_ALIGNMENT HOST_PAGE_SIZE
#endif
alignas(VRAM_STORAGE_ALIGNMENT) u16 g_vram[VRAM_SIZE / sizeof(u16)];
u16 g_gpu_clut[GPU_CLUT_SIZE];

const GPU::GP0CommandHandlerTable GPU::s_GP0_command_handler_table = GPU::GenerateGP0CommandHandlerTable();
Expand Down

0 comments on commit 5b60078

Please sign in to comment.