OpenGLDevice: Lazily compile shaders

This commit is contained in:
Stenzek
2023-08-30 22:20:39 +10:00
parent 5421900bb2
commit a11c9faba9
3 changed files with 85 additions and 33 deletions

View File

@@ -18,14 +18,22 @@ public:
void SetDebugName(const std::string_view& name) override;
ALWAYS_INLINE GLuint GetGLId() const { return m_id; }
bool Compile();
ALWAYS_INLINE GLuint GetGLId() const { return m_id.value(); }
ALWAYS_INLINE const GPUShaderCache::CacheIndexKey& GetKey() const { return m_key; }
private:
OpenGLShader(GPUShaderStage stage, GLuint id, const GPUShaderCache::CacheIndexKey& key);
OpenGLShader(GPUShaderStage stage, const GPUShaderCache::CacheIndexKey& key, std::string source);
GLuint m_id;
GPUShaderCache::CacheIndexKey m_key;
std::string m_source;
std::optional<GLuint> m_id;
bool m_compile_tried = false;
#ifdef _DEBUG
std::string m_debug_name;
#endif
};
class OpenGLPipeline final : public GPUPipeline