From 865c1e22ac92dac65e5b09e52ca87d509c6c8efb Mon Sep 17 00:00:00 2001 From: halx99 Date: Tue, 27 Oct 2020 17:08:26 +0800 Subject: [PATCH] Sync https://github.com/EsotericSoftware/spine-runtimes/pull/1801 --- extensions/spine/v4/SkeletonBatch.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/extensions/spine/v4/SkeletonBatch.cpp b/extensions/spine/v4/SkeletonBatch.cpp index 62e39c1921..0ce3a63c92 100644 --- a/extensions/spine/v4/SkeletonBatch.cpp +++ b/extensions/spine/v4/SkeletonBatch.cpp @@ -163,20 +163,18 @@ cocos2d::TrianglesCommand* SkeletonBatch::addCommand(cocos2d::Renderer* renderer CCASSERT(programState, "programState should not be null"); auto& pipelinePS = command->getPipelineDescriptor().programState; - if (pipelinePS != programState) + if (pipelinePS == nullptr || pipelinePS->getProgram() != programState->getProgram()) { CC_SAFE_RELEASE(pipelinePS); - pipelinePS = programState; - CC_SAFE_RETAIN(pipelinePS); - + pipelinePS = programState->clone(); updateProgramStateLayout(pipelinePS); } pipelinePS->setUniform(_locMVP, projectionMat.m, sizeof(projectionMat.m)); pipelinePS->setTexture(_locTexture, 0, texture->getBackendTexture()); - command->init(globalOrder, texture, blendType, triangles, mv, flags); - renderer->addCommand(command); + command->init(globalOrder, texture, blendType, triangles, mv, flags); + renderer->addCommand(command); return command; }