59 lines
1.3 KiB
C++
59 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>
|
|
|
|
#define SCREEN_WIDTH (gfx_current_native_viewport.width)
|
|
#define SCREEN_HEIGHT (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
|