44 lines
1.5 KiB
C++
44 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "ShaderTypes.h"
|
|
|
|
#include <atomic>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
class RuntimeStore;
|
|
|
|
struct RuntimeSnapshotVersions
|
|
{
|
|
uint64_t renderStateVersion = 0;
|
|
uint64_t parameterStateVersion = 0;
|
|
};
|
|
|
|
class RenderSnapshotBuilder
|
|
{
|
|
public:
|
|
explicit RenderSnapshotBuilder(RuntimeStore& runtimeStore);
|
|
|
|
bool BuildLayerPassFragmentShaderSources(const std::string& layerId, std::vector<ShaderPassBuildSource>& passSources, std::string& error) const;
|
|
unsigned GetMaxTemporalHistoryFrames() const;
|
|
RuntimeSnapshotVersions GetVersions() const;
|
|
void AdvanceFrame();
|
|
void BuildLayerRenderStates(unsigned outputWidth, unsigned outputHeight, std::vector<RuntimeRenderState>& states) const;
|
|
bool TryBuildLayerRenderStates(unsigned outputWidth, unsigned outputHeight, std::vector<RuntimeRenderState>& states) const;
|
|
bool TryRefreshLayerParameters(std::vector<RuntimeRenderState>& states) const;
|
|
void RefreshDynamicRenderStateFields(std::vector<RuntimeRenderState>& states) const;
|
|
void MarkRenderStateDirty();
|
|
void MarkParameterStateDirty();
|
|
|
|
private:
|
|
void BuildLayerRenderStatesLocked(unsigned outputWidth, unsigned outputHeight, std::vector<RuntimeRenderState>& states) const;
|
|
void RefreshLayerParametersLocked(std::vector<RuntimeRenderState>& states) const;
|
|
void RefreshDynamicRenderStateFieldsLocked(std::vector<RuntimeRenderState>& states) const;
|
|
|
|
RuntimeStore& mRuntimeStore;
|
|
std::atomic<uint64_t> mFrameCounter{ 0 };
|
|
std::atomic<uint64_t> mRenderStateVersion{ 0 };
|
|
std::atomic<uint64_t> mParameterStateVersion{ 0 };
|
|
};
|