mirror of
https://github.com/open-goal/jak-project
synced 2026-07-04 21:35:47 -04:00
b2052016e2
* time of day * goal code seems to work * stars at wrong spot * stars and sun work * debugging clouds * fix texture correction * sky works * cleanup, add profiler * clean up * final clean up * offline tests * missing include
37 lines
1.4 KiB
C++
37 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "game/graphics/opengl_renderer/BucketRenderer.h"
|
|
#include "game/graphics/texture/TexturePool.h"
|
|
|
|
/*!
|
|
* The TextureUploadHandler receives textures uploads in the DMA chain and updates the TexturePool.
|
|
* It will attempt to cache textures when possible as converting and uploading them to the GPU is
|
|
* pretty expensive.
|
|
*
|
|
* Note that the PC Port sends a somewhat simplified texture upload message and this can't handle
|
|
* any arbitrary PS2 texture transfer. We rely on the texture metadata in GOAL to simplify this.
|
|
*/
|
|
class TextureUploadHandler : public BucketRenderer {
|
|
public:
|
|
TextureUploadHandler(const std::string& name, BucketId my_id);
|
|
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
|
void draw_debug_window() override;
|
|
void serialize(Serializer& ser) override;
|
|
|
|
private:
|
|
void evict_all();
|
|
bool try_to_populate_from_cache(u64 page,
|
|
const bool with_seg[3],
|
|
SharedRenderState* render_state);
|
|
void populate_cache(const std::vector<std::shared_ptr<TextureRecord>>& textures,
|
|
SharedRenderState* render_state);
|
|
std::unordered_map<std::string, std::vector<std::shared_ptr<TextureRecord>>> m_tex_cache;
|
|
|
|
struct {
|
|
u32 textures_provided = 0;
|
|
u32 textures_converted = 0;
|
|
u32 textures_evicted = 0;
|
|
|
|
} m_stats;
|
|
};
|