diff --git a/core/2d/CCDrawNode.cpp b/core/2d/CCDrawNode.cpp index 243ec25311..d62ea3e8a7 100644 --- a/core/2d/CCDrawNode.cpp +++ b/core/2d/CCDrawNode.cpp @@ -170,10 +170,17 @@ void DrawNode::updateShaderInternal(CustomCommand& cmd, auto program = backend::Program::getBuiltinProgram(programType); pipelinePS = new backend::ProgramState(program); + setVertexLayout(cmd); cmd.setPrimitiveType(primitiveType); cmd.setDrawType(drawType); } +void DrawNode::setVertexLayout(CustomCommand& cmd) +{ + auto* programState = cmd.getPipelineDescriptor().programState; + programState->validateSharedVertexLayout(VertexLayoutHelper::setupDrawNode); +} + void DrawNode::freeShaderInternal(CustomCommand& cmd) { auto& pipelinePS = cmd.getPipelineDescriptor().programState; diff --git a/core/2d/CCDrawNode.h b/core/2d/CCDrawNode.h index 1826cc206c..89efdc581d 100644 --- a/core/2d/CCDrawNode.h +++ b/core/2d/CCDrawNode.h @@ -378,6 +378,8 @@ protected: CustomCommand::PrimitiveType primitiveType); void freeShaderInternal(CustomCommand& cmd); + void setVertexLayout(CustomCommand& cmd); + void updateBlendState(CustomCommand& cmd); void updateUniforms(const Mat4& transform, CustomCommand& cmd);