X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Frenderers%2Frender-renderer.cpp;h=2a9357419ca7f533f98e180f5227258ba7ae7a15;hb=5ec86b45081ff6dd2f3b2555f465b10c9d64a697;hp=8d666b7e0bb6b070b04ed33e6d8c6d7774090194;hpb=230e3766ab05d2eef7eb58542eb5ecb7bb647813;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/renderers/render-renderer.cpp b/dali/internal/render/renderers/render-renderer.cpp index 8d666b7..2a93574 100644 --- a/dali/internal/render/renderers/render-renderer.cpp +++ b/dali/internal/render/renderers/render-renderer.cpp @@ -367,34 +367,39 @@ bool Renderer::BindTextures( SceneGraph::TextureCache& textureCache, Program& pr if( result ) { - GLint uniformLocation; - - bool result = program.GetSamplerUniformLocation( i, uniformLocation ); - if( result && Program::UNIFORM_UNKNOWN != uniformLocation ) + Render::Texture& textureMapping = textures[i]; + // Set sampler uniform location for the texture + int32_t uniqueIndex = textureMapping.GetUniformUniqueIndex(); + if( Render::Texture::NOT_INITIALIZED == uniqueIndex ) + { + uniqueIndex = mUniformNameCache->GetSamplerUniformUniqueIndex( textureMapping.GetUniformName() ); + textureMapping.SetUniformUniqueIndex( uniqueIndex ); + } + GLint uniformLocation = program.GetSamplerUniformLocation( uniqueIndex, textureMapping.GetUniformName() ); + if( Program::UNIFORM_UNKNOWN != uniformLocation ) { program.SetUniform1i( uniformLocation, textureUnit ); + } - unsigned int samplerBitfield(0); - Render::Texture& textureMapping = textures[i]; - const Render::Sampler* sampler( textureMapping.GetSampler() ); - if( sampler ) - { - samplerBitfield = ImageSampler::PackBitfield( - static_cast< FilterMode::Type >(sampler->GetMinifyFilterMode()), - static_cast< FilterMode::Type >(sampler->GetMagnifyFilterMode()), - static_cast< WrapMode::Type >(sampler->GetUWrapMode()), - static_cast< WrapMode::Type >(sampler->GetVWrapMode()) - ); - } - else - { - samplerBitfield = ImageSampler::DEFAULT_BITFIELD; - } - - texture->ApplySampler( (TextureUnit)textureUnit, samplerBitfield ); - - ++textureUnit; + unsigned int samplerBitfield(0); + const Render::Sampler* sampler( textureMapping.GetSampler() ); + if( sampler ) + { + samplerBitfield = ImageSampler::PackBitfield( + static_cast< FilterMode::Type >(sampler->GetMinifyFilterMode()), + static_cast< FilterMode::Type >(sampler->GetMagnifyFilterMode()), + static_cast< WrapMode::Type >(sampler->GetUWrapMode()), + static_cast< WrapMode::Type >(sampler->GetVWrapMode()) + ); } + else + { + samplerBitfield = ImageSampler::DEFAULT_BITFIELD; + } + + texture->ApplySampler( (TextureUnit)textureUnit, samplerBitfield ); + + ++textureUnit; } } }