@@ -43,8 +43,10 @@ ProgramGL::ProgramGL(const std::string& vertexShader, const std::string& fragmen
43
43
std::string fsPreDefine (" precision mediump float;\n precision mediump int;\n " );
44
44
vsPreDefine.append (vertexShader);
45
45
fsPreDefine.append (fragmentShader);
46
- _fragmentShaderModule = static_cast <ShaderModuleGL*>(ShaderCache::newFragmentShaderModule (fsPreDefine));
47
- _vertexShaderModule = static_cast <ShaderModuleGL*>(ShaderCache::newVertexShaderModule (vsPreDefine));
46
+ _vertexShader = std::move (vsPreDefine);
47
+ _fragmentShader = std::move (fsPreDefine);
48
+ _vertexShaderModule = static_cast <ShaderModuleGL*>(ShaderCache::newVertexShaderModule (_vertexShader));
49
+ _fragmentShaderModule = static_cast <ShaderModuleGL*>(ShaderCache::newFragmentShaderModule (_fragmentShader));
48
50
#else
49
51
_vertexShaderModule = static_cast <ShaderModuleGL*>(ShaderCache::newVertexShaderModule (_vertexShader));
50
52
_fragmentShaderModule = static_cast <ShaderModuleGL*>(ShaderCache::newFragmentShaderModule (_fragmentShader));
@@ -325,20 +327,16 @@ UniformLocation ProgramGL::getUniformLocation(backend::Uniform name) const
325
327
UniformLocation ProgramGL::getUniformLocation (const std::string& uniform) const
326
328
{
327
329
UniformLocation uniformLocation;
328
- #if CC_ENABLE_CACHE_TEXTURE_DATA
329
- if (_originalUniformLocations.find (uniform) != _originalUniformLocations.end ())
330
- {
331
- uniformLocation.location [0 ] = _originalUniformLocations.at (uniform);
332
- uniformLocation.location [1 ] = _activeUniformInfos.at (uniform).bufferOffset ;
333
- }
334
- #else
335
330
if (_activeUniformInfos.find (uniform) != _activeUniformInfos.end ())
336
331
{
337
332
const auto & uniformInfo = _activeUniformInfos.at (uniform);
333
+ #if CC_ENABLE_CACHE_TEXTURE_DATA
334
+ uniformLocation.location [0 ] = _mapToOriginalLocation.at (uniformInfo.location );
335
+ #else
338
336
uniformLocation.location [0 ] = uniformInfo.location ;
337
+ #endif
339
338
uniformLocation.location [1 ] = uniformInfo.bufferOffset ;
340
339
}
341
- #endif
342
340
return uniformLocation;
343
341
}
344
342
0 commit comments