diff --git a/lib/graphicsdev/GL.cpp b/lib/graphicsdev/GL.cpp index 032d31a..7d15b67 100644 --- a/lib/graphicsdev/GL.cpp +++ b/lib/graphicsdev/GL.cpp @@ -421,11 +421,25 @@ class GLShaderPipeline : public IShaderPipeline GLShaderPipeline() = default; public: operator bool() const {return m_prog != 0;} - ~GLShaderPipeline() { glDeleteProgram(m_prog); } + ~GLShaderPipeline() { if (m_prog) glDeleteProgram(m_prog); } GLShaderPipeline& operator=(const GLShaderPipeline&) = delete; GLShaderPipeline(const GLShaderPipeline&) = delete; - GLShaderPipeline& operator=(GLShaderPipeline&& other) = default; - GLShaderPipeline(GLShaderPipeline&& other) = default; + GLShaderPipeline& operator=(GLShaderPipeline&& other) + { + m_vert = std::move(other.m_vert); + m_frag = std::move(other.m_frag); + m_prog = other.m_prog; + other.m_prog = 0; + m_sfactor = other.m_sfactor; + m_dfactor = other.m_dfactor; + m_drawPrim = other.m_drawPrim; + m_depthTest = other.m_depthTest; + m_depthWrite = other.m_depthWrite; + m_backfaceCulling = other.m_backfaceCulling; + m_uniLocs = std::move(other.m_uniLocs); + return *this; + } + GLShaderPipeline(GLShaderPipeline&& other) { *this = std::move(other); } GLuint bind() const { diff --git a/lib/graphicsdev/Metal.mm b/lib/graphicsdev/Metal.mm index b241805..d9714f0 100644 --- a/lib/graphicsdev/Metal.mm +++ b/lib/graphicsdev/Metal.mm @@ -25,8 +25,8 @@ class MetalDataFactoryImpl; struct MetalShareableShader : IShareableShader { id m_shader; - MetalShareableShader(MetalDataFactoryImpl& fac, uint64_t key, id s) - : IShareableShader(fac, key), m_shader(s) {} + MetalShareableShader(MetalDataFactoryImpl& fac, uint64_t srcKey, id s) + : IShareableShader(fac, srcKey, 0), m_shader(s) {} }; class MetalDataFactoryImpl : public MetalDataFactory @@ -58,7 +58,7 @@ public: GraphicsDataToken commitTransaction(const std::function&); GraphicsBufferPoolToken newBufferPool(); - void _unregisterShareableShader(uint64_t key) { m_sharedShaders.erase(key); } + void _unregisterShareableShader(uint64_t srcKey, uint64_t binKey) { m_sharedShaders.erase(srcKey); } }; ThreadLocalPtr MetalDataFactoryImpl::m_deferredData;