diff --git a/cocos/renderer/backend/ProgramState.cpp b/cocos/renderer/backend/ProgramState.cpp index 3025a73562..5ca55bc4ec 100644 --- a/cocos/renderer/backend/ProgramState.cpp +++ b/cocos/renderer/backend/ProgramState.cpp @@ -3,7 +3,9 @@ #include "renderer/backend/Program.h" #include "renderer/backend/Texture.h" #include "renderer/backend/Types.h" +#ifdef CC_USE_METAL #include "glsl_optimizer.h" +#endif CC_BACKEND_BEGIN @@ -245,6 +247,7 @@ void ProgramState::setUniform(const backend::UniformLocation& uniformLocation, c } } +#ifdef CC_USE_METAL void ProgramState::convertUniformData(const backend::UniformInfo& uniformInfo, const void* srcData, uint32_t srcSize, std::vector& uniformData) { auto basicType = static_cast(uniformInfo.type); @@ -309,6 +312,7 @@ void ProgramState::convertUniformData(const backend::UniformInfo& uniformInfo, c uniformData.assign(convertedData, convertedData + uniformInfo.bufferSize); CC_SAFE_DELETE_ARRAY(convertedData); } +#endif void ProgramState::setVertexUniform(int location, const void* data, uint32_t size) { diff --git a/cocos/renderer/backend/ProgramState.h b/cocos/renderer/backend/ProgramState.h index 738dfc0e6c..fda01ee8dc 100644 --- a/cocos/renderer/backend/ProgramState.h +++ b/cocos/renderer/backend/ProgramState.h @@ -84,8 +84,10 @@ protected: void setTexture(int location, uint32_t slot, backend::Texture* texture, std::unordered_map& textureInfo); void setTextureArray(int location, const std::vector& slots, const std::vector textures, std::unordered_map& textureInfo); +#ifdef CC_USE_METAL //float3 etc in Metal has both sizeof and alignment same as float4, convert it before fill into uniform buffer void convertUniformData(const backend::UniformInfo& uniformInfo, const void* srcData, uint32_t srcSize, std::vector& uniformData); +#endif backend::Program* _program = nullptr; std::vector _vertexUniformInfos;