/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Load the auxiliary image
mAuxiliaryTextureSet = textureManager.LoadTexture(mAuxiliaryUrl, Dali::ImageDimensions(), FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, maskingDataPtr, synchronousLoading, mAuxiliaryTextureId, atlasRect, atlasRectSize, atlasing, loadingStatus, this, nullptr, imageAtlasManagerPtr, true, TextureManager::ReloadPolicy::CACHED, preMultiplyOnLoad);
- if(mAuxiliaryTextureSet)
- {
- Sampler sampler = Sampler::New();
- sampler.SetWrapMode(WrapMode::DEFAULT, WrapMode::DEFAULT);
- mAuxiliaryTextureSet.SetSampler(0u, sampler);
- }
-
// If synchronousLoading is true, we can check the auxiliaryResource's status now.
if(synchronousLoading)
{
shader = mFactoryCache.GetShader(shaderType);
if(DALI_UNLIKELY(!shader))
{
- shader = Shader::New(SHADER_NPATCH_VISUAL_3X3_SHADER_VERT, fragmentShader);
- // Only cache vanilla 9 patch shaders
- mFactoryCache.SaveShader(shaderType, shader);
+ shader = mFactoryCache.GenerateAndSaveShader(shaderType, SHADER_NPATCH_VISUAL_3X3_SHADER_VERT, fragmentShader);
}
}
else if(xStretchCount > 0 || yStretchCount > 0)
{
+ std::stringstream shaderName;
+ shaderName << "N_PATCH_" << xStretchCount << "x" << yStretchCount;
+
std::stringstream vertexShader;
vertexShader << "#define FACTOR_SIZE_X " << xStretchCount + 2 << "\n"
<< "#define FACTOR_SIZE_Y " << yStretchCount + 2 << "\n"
<< SHADER_NPATCH_VISUAL_SHADER_VERT;
- shader = Shader::New(vertexShader.str(), fragmentShader);
+ shader = Shader::New(vertexShader.str(), fragmentShader, Dali::Shader::Hint::NONE, shaderName.str());
}
}
else
}
else if(xStretchCount > 0 || yStretchCount > 0)
{
+ std::stringstream shaderName;
+ shaderName << "N_PATCH_" << xStretchCount << "x" << yStretchCount;
+
std::stringstream vertexShader;
vertexShader << "#define FACTOR_SIZE_X " << xStretchCount + 2 << "\n"
<< "#define FACTOR_SIZE_Y " << yStretchCount + 2 << "\n"
<< SHADER_NPATCH_VISUAL_SHADER_VERT;
- shader = Shader::New(vertexShader.str(), fragmentShader, hints);
+ shader = Shader::New(vertexShader.str(), fragmentShader, hints, shaderName.str());
}
}
}
if(loadSuccess)
{
- mAuxiliaryTextureSet = textureInformation.textureSet;
- if(mAuxiliaryTextureSet)
- {
- Sampler sampler = Sampler::New();
- sampler.SetWrapMode(WrapMode::DEFAULT, WrapMode::DEFAULT);
- mAuxiliaryTextureSet.SetSampler(0u, sampler);
- }
-
+ mAuxiliaryTextureSet = textureInformation.textureSet;
mAuxiliaryResourceStatus = Toolkit::Visual::ResourceStatus::READY;
}
else