Layer stacking

This commit is contained in:
2026-05-02 18:18:49 +10:00
parent fb1bf01fef
commit 80399c5a15
18 changed files with 3761 additions and 799 deletions

View File

@@ -79,11 +79,16 @@ public:
bool Stop();
bool ReloadShader();
std::string GetRuntimeStateJson() const;
bool SelectShader(const std::string& shaderId, std::string& error);
bool UpdateParameterJson(const std::string& shaderId, const std::string& parameterId, const std::string& valueJson, std::string& error);
bool ResetShaderParameters(const std::string& shaderId, std::string& error);
bool SetBypassEnabled(bool bypassEnabled, std::string& error);
bool SetMixAmount(double mixAmount, std::string& error);
bool AddLayer(const std::string& shaderId, std::string& error);
bool RemoveLayer(const std::string& layerId, std::string& error);
bool MoveLayer(const std::string& layerId, int direction, std::string& error);
bool MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error);
bool SetLayerBypass(const std::string& layerId, bool bypassed, std::string& error);
bool SetLayerShader(const std::string& layerId, const std::string& shaderId, std::string& error);
bool UpdateLayerParameterJson(const std::string& layerId, const std::string& parameterId, const std::string& valueJson, std::string& error);
bool ResetLayerParameters(const std::string& layerId, std::string& error);
bool SaveStackPreset(const std::string& presetName, std::string& error);
bool LoadStackPreset(const std::string& presetName, std::string& error);
void resizeGL(WORD width, WORD height);
void paintGL();
@@ -118,9 +123,11 @@ private:
bool mFastTransferExtensionAvailable;
GLuint mCaptureTexture;
GLuint mDecodedTexture;
GLuint mLayerTempTexture;
GLuint mFBOTexture;
GLuint mUnpinnedTextureBuffer;
GLuint mDecodeFrameBuf;
GLuint mLayerTempFrameBuf;
GLuint mIdFrameBuf;
GLuint mIdColorBuf;
GLuint mIdDepthBuf;
@@ -129,21 +136,31 @@ private:
GLuint mDecodeProgram;
GLuint mDecodeVertexShader;
GLuint mDecodeFragmentShader;
GLuint mProgram;
GLuint mVertexShader;
GLuint mFragmentShader;
GLsizeiptr mGlobalParamsUBOSize;
int mViewWidth;
int mViewHeight;
std::unique_ptr<RuntimeHost> mRuntimeHost;
std::unique_ptr<ControlServer> mControlServer;
struct LayerProgram
{
std::string layerId;
std::string shaderId;
GLuint program = 0;
GLuint vertexShader = 0;
GLuint fragmentShader = 0;
};
std::vector<LayerProgram> mLayerPrograms;
bool InitOpenGLState();
bool compileFragmentShader(int errorMessageSize, char* errorMessage);
bool compileLayerPrograms(int errorMessageSize, char* errorMessage);
bool compileSingleLayerProgram(const RuntimeRenderState& state, LayerProgram& layerProgram, int errorMessageSize, char* errorMessage);
bool compileDecodeShader(int errorMessageSize, char* errorMessage);
void destroyShaderProgram();
void destroyLayerPrograms();
void destroySingleLayerProgram(LayerProgram& layerProgram);
void destroyDecodeShaderProgram();
void renderDecodePass();
void renderShaderProgram(GLuint sourceTexture, GLuint destinationFrameBuffer, const LayerProgram& layerProgram, const RuntimeRenderState& state);
void renderEffect();
bool PollRuntimeChanges();
void broadcastRuntimeState();