Tile uploads share a persistent mapped staging buffer and are recorded into the canvas command buffer before its render pass, instead of one buffer, allocation and fenced submit per tile. Tiles outside the view are not uploaded, and when more than the per-frame budget changed the rest follow in the next frames while the canvas keeps redrawing. RenderBuffer can open its command buffer before the render pass.
44 lines
No EOL
862 B
C++
44 lines
No EOL
862 B
C++
|
|
#pragma once
|
|
|
|
#include "Rect.hpp"
|
|
#include "Color.hpp"
|
|
|
|
namespace tp {
|
|
class RenderBuffer {
|
|
public:
|
|
class Context;
|
|
|
|
explicit RenderBuffer(const Vec2F& size = { 10, 10 });
|
|
RenderBuffer(const Vec2F& size, tp::uint1 samples);
|
|
~RenderBuffer();
|
|
|
|
void beginDraw();
|
|
void beginCommands();
|
|
void beginPass();
|
|
void setViewport(const RectF& viewport);
|
|
void clear();
|
|
void endDraw();
|
|
void measureGpuTime(const char* name);
|
|
|
|
[[nodiscard]] uint4 texId() const;
|
|
[[nodiscard]] uint4 buffId() const;
|
|
|
|
void resize(const Vec2F& size);
|
|
|
|
[[nodiscard]] const Vec2F& getSize() const;
|
|
|
|
[[nodiscard]] Context* context() const { return mCtx; }
|
|
|
|
[[nodiscard]] void* activeCommandBuffer() const;
|
|
[[nodiscard]] void* renderTarget() const;
|
|
|
|
public:
|
|
RGBA mClearCol = 0.f;
|
|
|
|
private:
|
|
Context* mCtx = nullptr;
|
|
Vec2F mSize;
|
|
ualni mSamples = 0;
|
|
};
|
|
}; |