Crash fix when using multiple renderers (do not use static currentPipe) (#428)

Co-authored-by: djdron <djdron@gmail.com>
This commit is contained in:
djdron
2020-12-08 18:36:39 +02:00
committed by GitHub
parent fd1d235a05
commit b8fc74ad3f
2 changed files with 6 additions and 9 deletions

View File

@ -17,8 +17,6 @@
#include <chrono>
#include <ctime>
Pipeline* Renderer::currentPipe;
using namespace std::chrono;
class Preset;
@ -533,7 +531,11 @@ void Renderer::Interpolation(const Pipeline& pipeline, const PipelineContext& pi
else
{
mesh.Reset();
omptl::transform(mesh.p.begin(), mesh.p.end(), mesh.identity.begin(), mesh.p.begin(), &Renderer::PerPixel);
Pipeline *cp = currentPipe;
omptl::transform(mesh.p.begin(), mesh.p.end(), mesh.identity.begin(), mesh.p.begin(),
[cp](PixelPoint p, PerPixelContext &context) {
return cp->PerPixel(p, context);
});
for (int j = 0; j < mesh.height - 1; j++)
{

View File

@ -190,7 +190,7 @@ private:
PerPixelMesh mesh;
BeatDetect *beatDetect;
TextureManager *textureManager;
static Pipeline* currentPipe;
Pipeline* currentPipe;
TimeKeeper *timeKeeperFPS;
TimeKeeper *timeKeeperToast;
@ -252,11 +252,6 @@ private:
void CompositeShaderOutput(const Pipeline &pipeline, const PipelineContext &pipelineContext);
void CompositeOutput(const Pipeline &pipeline, const PipelineContext &pipelineContext);
inline static PixelPoint PerPixel(PixelPoint p, PerPixelContext &context)
{
return currentPipe->PerPixel(p,context);
}
void rescale_per_pixel_matrices();
void draw_toast();