From a768b08eb3714cc37796517e702882c75c615b7b Mon Sep 17 00:00:00 2001 From: Franco Octavianus Date: Tue, 10 Sep 2019 09:45:01 +1000 Subject: [PATCH] Synchronously lookup shader from cache --- framework/Source/OpenGLContext_Shared.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/Source/OpenGLContext_Shared.swift b/framework/Source/OpenGLContext_Shared.swift index 81aee9c3..1cfec840 100755 --- a/framework/Source/OpenGLContext_Shared.swift +++ b/framework/Source/OpenGLContext_Shared.swift @@ -22,7 +22,7 @@ public let sharedImageProcessingContext = OpenGLContext() extension OpenGLContext { public func programForVertexShader(_ vertexShader:String, fragmentShader:String) throws -> ShaderProgram { let lookupKeyForShaderProgram = "V: \(vertexShader) - F: \(fragmentShader)" - if let shaderFromCache = shaderCache[lookupKeyForShaderProgram] { + if let shaderFromCache = sharedImageProcessingContext.runOperationSynchronously({ shaderCache[lookupKeyForShaderProgram] }) { return shaderFromCache } else { return try sharedImageProcessingContext.runOperationSynchronously{