forked from Ports/perfect_dark
--log: logs messages to pd.log --boot-stage N: sets initial stage number to N (MP stages will crash or hang if booted like this) --no-sound: disable sound --rom-file S: set ROM filename
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
#ifndef GFX_PC_H
|
|
#define GFX_PC_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <unordered_map>
|
|
#include <list>
|
|
#include <cstddef>
|
|
|
|
#include <PR/gbi.h>
|
|
|
|
#include "system.h"
|
|
|
|
#define SCREEN_WIDTH ((int32_t)gfx_current_native_viewport.width)
|
|
#define SCREEN_HEIGHT ((int32_t)gfx_current_native_viewport.height)
|
|
|
|
extern uintptr_t gfxFramebuffer;
|
|
|
|
struct GfxRenderingAPI;
|
|
struct GfxWindowManagerAPI;
|
|
|
|
struct TextureCacheKey {
|
|
const uint8_t* texture_addr;
|
|
const uint8_t* palette_addrs[2];
|
|
uint8_t fmt, siz;
|
|
uint8_t palette_index;
|
|
|
|
bool operator==(const TextureCacheKey&) const noexcept = default;
|
|
|
|
struct Hasher {
|
|
size_t operator()(const TextureCacheKey& key) const noexcept {
|
|
uintptr_t addr = (uintptr_t)key.texture_addr;
|
|
return (size_t)(addr ^ (addr >> 5));
|
|
}
|
|
};
|
|
};
|
|
|
|
typedef std::unordered_map<TextureCacheKey, struct TextureCacheValue, TextureCacheKey::Hasher> TextureCacheMap;
|
|
typedef std::pair<const TextureCacheKey, struct TextureCacheValue> TextureCacheNode;
|
|
|
|
struct TextureCacheValue {
|
|
uint32_t texture_id;
|
|
uint8_t cms, cmt;
|
|
bool linear_filter;
|
|
|
|
std::list<struct TextureCacheMapIter>::iterator lru_location;
|
|
};
|
|
|
|
struct TextureCacheMapIter {
|
|
TextureCacheMap::iterator it;
|
|
};
|
|
|
|
extern "C" {
|
|
|
|
#include "gfx_api.h"
|
|
|
|
}
|
|
|
|
#endif
|