[feature] fix android compile error

This commit is contained in:
coulsonwang 2019-03-13 10:10:15 +08:00
parent d4375db34f
commit 5d5eaf4be1
2 changed files with 6 additions and 0 deletions

View File

@ -3,7 +3,9 @@
#include "renderer/backend/Program.h" #include "renderer/backend/Program.h"
#include "renderer/backend/Texture.h" #include "renderer/backend/Texture.h"
#include "renderer/backend/Types.h" #include "renderer/backend/Types.h"
#ifdef CC_USE_METAL
#include "glsl_optimizer.h" #include "glsl_optimizer.h"
#endif
CC_BACKEND_BEGIN 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<char>& uniformData) void ProgramState::convertUniformData(const backend::UniformInfo& uniformInfo, const void* srcData, uint32_t srcSize, std::vector<char>& uniformData)
{ {
auto basicType = static_cast<glslopt_basic_type>(uniformInfo.type); auto basicType = static_cast<glslopt_basic_type>(uniformInfo.type);
@ -309,6 +312,7 @@ void ProgramState::convertUniformData(const backend::UniformInfo& uniformInfo, c
uniformData.assign(convertedData, convertedData + uniformInfo.bufferSize); uniformData.assign(convertedData, convertedData + uniformInfo.bufferSize);
CC_SAFE_DELETE_ARRAY(convertedData); CC_SAFE_DELETE_ARRAY(convertedData);
} }
#endif
void ProgramState::setVertexUniform(int location, const void* data, uint32_t size) void ProgramState::setVertexUniform(int location, const void* data, uint32_t size)
{ {

View File

@ -84,8 +84,10 @@ protected:
void setTexture(int location, uint32_t slot, backend::Texture* texture, std::unordered_map<int, TextureInfo>& textureInfo); void setTexture(int location, uint32_t slot, backend::Texture* texture, std::unordered_map<int, TextureInfo>& textureInfo);
void setTextureArray(int location, const std::vector<uint32_t>& slots, const std::vector<backend::Texture*> textures, std::unordered_map<int, TextureInfo>& textureInfo); void setTextureArray(int location, const std::vector<uint32_t>& slots, const std::vector<backend::Texture*> textures, std::unordered_map<int, TextureInfo>& textureInfo);
#ifdef CC_USE_METAL
//float3 etc in Metal has both sizeof and alignment same as float4, convert it before fill into uniform buffer //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<char>& uniformData); void convertUniformData(const backend::UniformInfo& uniformInfo, const void* srcData, uint32_t srcSize, std::vector<char>& uniformData);
#endif
backend::Program* _program = nullptr; backend::Program* _program = nullptr;
std::vector<UniformBuffer> _vertexUniformInfos; std::vector<UniformBuffer> _vertexUniformInfos;