mPlatformAbstraction = new SlpPlatform::SlpPlatformAbstraction;
+ std::string path;
+ GetDataStoragePath( path );
+ mPlatformAbstraction->SetDataStoragePath( path );
+
ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
{
*/
void ProcessCoreEventsFromIdle();
+ /**
+ * Gets path for data/resource storage.
+ * @param[out] path Path for data/resource storage
+ */
+ void GetDataStoragePath(std::string& path);
+
private:
/**
--- /dev/null
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <adaptor-impl.h>
+
+// EXTERNAL INCLUDES
+#ifdef OVER_TIZEN_SDK_2_2
+#include <app.h>
+#endif
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+void Adaptor::GetDataStoragePath( std::string& path)
+{
+ path = "";
+#ifdef OVER_TIZEN_SDK_2_2
+ path = app_get_data_path();
+#endif
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
adaptor_tizen_internal_src_files = \
$(adaptor_tizen_dir)/accessibility-manager-impl-tizen.cpp \
+ $(adaptor_tizen_dir)/adaptor-impl-tizen.cpp \
$(adaptor_tizen_dir)/framework-tizen.cpp \
$(adaptor_tizen_dir)/vsync-monitor-tizen.cpp \
$(adaptor_tizen_dir)/tilt-sensor-impl-tizen.cpp \
--- /dev/null
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <adaptor-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+void Adaptor::GetDataStoragePath( std::string& path)
+{
+ path = DALI_SHADERBIN_DIR;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
adaptor_ubuntu_internal_src_files = \
$(adaptor_ubuntu_dir)/accessibility-manager-impl-ubuntu.cpp \
+ $(adaptor_ubuntu_dir)/adaptor-impl-ubuntu.cpp \
$(adaptor_ubuntu_dir)/framework-ubuntu.cpp \
$(adaptor_ubuntu_dir)/vsync-monitor-ubuntu.cpp \
$(adaptor_ubuntu_dir)/tilt-sensor-impl-ubuntu.cpp \
}
/**
+ * @copydoc PlatformAbstraction::LoadShaderBinFile()
+ */
+bool TestPlatformAbstraction::LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
+{
+ mTrace.PushCall("LoadShaderBinFile", "");
+ if( mLoadFileResult.loadResult )
+ {
+ buffer = mLoadFileResult.buffer;
+ }
+
+ return mLoadFileResult.loadResult;
+}
+
+/**
* @copydoc PlatformAbstraction::SaveFile()
*/
bool TestPlatformAbstraction::SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const
case LoadResourceFunc: return mTrace.FindMethod("LoadResource");
case SaveResourceFunc: return mTrace.FindMethod("SaveResource");
case LoadFileFunc: return mTrace.FindMethod("LoadFile");
+ case LoadShaderBinFileFunc: return mTrace.FindMethod("LoadShaderBinFile");
case SaveFileFunc: return mTrace.FindMethod("SaveFile");
case CancelLoadFunc: return mTrace.FindMethod("CancelLoad");
case GetResourcesFunc: return mTrace.FindMethod("GetResources");
virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
/**
+ * @copydoc PlatformAbstraction::LoadShaderBinFile()
+ */
+ virtual bool LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer
+) const;
+
+ /**
* @copydoc PlatformAbstraction::SaveFile()
*/
virtual bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const;
SaveResourceFunc,
SaveFileFunc,
LoadFileFunc,
+ LoadShaderBinFileFunc,
CancelLoadFunc,
GetResourcesFunc,
IsLoadingFunc,
daliDefaultFontCacheDir = ${dataReadOnlyDir}/glyphcache/
daliUserFontCacheDir = ${dataReadWriteDir}/glyphcache/
daliDefaultThemeDir = ${dataReadWriteDir}/theme/
-daliUserShaderCacheDir = ${dataReadWriteDir}/core/shaderbin/
+daliShaderbinCacheDir = ${dataReadOnlyDir}/core/shaderbin/
libdali_adaptor_la_CXXFLAGS = \
-DDALI_DATA_RW_DIR="\"${daliReadWriteDir}\"" \
-DDALI_DATA_RO_DIR="\"${daliReadOnlyDir}\"" \
-DDALI_DEFAULT_FONT_CACHE_DIR="\"${daliDefaultFontCacheDir}\"" \
-DDALI_USER_FONT_CACHE_DIR="\"${daliUserFontCacheDir}\"" \
+ -DDALI_SHADERBIN_DIR="\"${daliShaderbinCacheDir}\"" \
-DDALI_DEFAULT_THEME_DIR="\"${daliDefaultThemeDir}\"" \
-DFONT_PRELOADED_PATH="\"${fontPreloadedPath}\"" \
-DFONT_DOWNLOADED_PATH="\"${fontDownloadedPath}\"" \
tizenadaptordaliheader_HEADERS = $(adaptor_dali_header_file)
install-data-local:
- $(MKDIR_P) ${DESTDIR}/${daliUserFontCacheDir} ${DESTDIR}/${daliUserShaderCacheDir}
+ $(MKDIR_P) ${DESTDIR}/${daliUserFontCacheDir} ${DESTDIR}/${daliShaderbinCacheDir}
# Install resource log analyzer script
bin_SCRIPTS = ../../../adaptors/scripts/dalireslog.sh
[enable_debug=$enableval],
[enable_debug=no])
+AC_ARG_ENABLE(shaderbincache,
+ [AC_HELP_STRING([--enable-shaderbincache],
+ [enables shader binary cache])],
+ [enable_shaderbincache=$enableval],
+ [enable_shaderbincache=DISABLE])
+
if test "x$enable_debug" = "xyes"; then
DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -DDEBUG_ENABLED"
fi
DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS"
fi
+if test "x$enable_shaderbincache" = "xENABLE"; then
+ DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -DSHADERBIN_CACHE_ENABLED"
+fi
+
AC_ARG_ENABLE([assimp],
[AC_HELP_STRING([--enable-assimp],
[Enable assimp plugin, overriding platform defaults])],
%define dali_bullet_plugin 1
%define dali_assimp_plugin 1
+%if 0%{?over_tizen_2_2}
+%define shaderbincache_flag ENABLE
+%endif
+
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: boost-thread
%define dali_data_rw_dir /opt/usr/share/dali/
%define dali_data_ro_dir /usr/share/dali/
%define user_font_cache_dir %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir %{dali_data_ro_dir}/core/shaderbin/
%define font_preloaded_path /usr/share/fonts/
%define font_downloaded_path /opt/share/fonts/
%define font_application_path /usr/share/app_fonts/
CXXFLAGS+=" -D_ARCH_ARM_ -lgcc"
%endif
-%if 0%{?TIZEN_SDK_2_3}
-CXXFLAGS+=" -DTIZEN_SDK_2_3"
+%if 0%{?over_tizen_2_2}
+CFLAGS+=" -DOVER_TIZEN_SDK_2_2"
+CXXFLAGS+=" -DOVER_TIZEN_SDK_2_2"
%endif
libtoolize --force
FONT_APPLICATION_PATH="%{font_application_path}" ; export FONT_APPLICATION_PATH
FONT_CONFIGURATION_FILE="%{font_configuration_file}" ; export FONT_CONFIGURATION_FILE
-%configure --with-jpeg-turbo --enable-gles=20 --enable-profile=%{dali_profile} \
+%configure --with-jpeg-turbo --enable-gles=20 --enable-shaderbincache=%{shaderbincache_flag} --enable-profile=%{dali_profile} \
%if 0%{?dali_feedback_plugin}
--enable-feedback \
%endif
%pre
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%post
/sbin/ldconfig
chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
exit 0
%if 0%{?dali_feedback_plugin}
##############################
%preun
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%define dali_data_rw_dir /usr/share/dali/
%define dali_data_ro_dir /usr/share/dali/
%define user_font_cache_dir %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir %{dali_data_ro_dir}/core/shaderbin/
%define font_preloaded_path /usr/share/fonts/
%define font_downloaded_path /opt/share/fonts/
%define font_application_path /usr/share/app_fonts/
%pre
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%post
/sbin/ldconfig
chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
exit 0
%if 0%{?dali_feedback_plugin}
##############################
%preun
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%define dali_data_rw_dir /opt/usr/share/dali/
%define dali_data_ro_dir /usr/share/dali/
%define user_font_cache_dir %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir %{dali_data_ro_dir}/core/shaderbin/
%define font_preloaded_path /usr/share/fonts/
%define font_downloaded_path /opt/share/fonts/
%define font_application_path /usr/share/app_fonts/
%pre
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%post
/sbin/ldconfig
chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
exit 0
%if 0%{?dali_feedback_plugin}
##############################
%preun
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
%define over_tizen_2_2 0
+%define shaderbincache_flag DISABLE
+%endif
-%else if "%{profile}" == "tv"
+%if "%{profile}" == "tv"
%define dali_profile TV
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
%define over_tizen_2_2 1
+%define shaderbincache_flag ENABLE
+%endif
-%else if "%{profile}" == "wearable"
+%if "%{profile}" == "wearable"
%define dali_profile WEARABLE
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
%define over_tizen_2_2 0
+%define shaderbincache_flag DISABLE
+%endif
-%else
-## profile == common
+%if "%{profile}" == "common"
%define dali_profile COMMON
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
%define over_tizen_2_2 0
-
+%define shaderbincache_flag DISABLE
%endif
Requires(post): /sbin/ldconfig
%define dali_data_rw_dir /usr/share/dali/
%define dali_data_ro_dir /usr/share/dali/
%define user_font_cache_dir %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir %{dali_data_ro_dir}/core/shaderbin/
%define font_preloaded_path /usr/share/fonts/
%define font_downloaded_path /opt/share/fonts/
%define font_application_path /usr/share/app_fonts/
cd %{_builddir}/%{name}-%{version}/build/tizen && autoreconf --install
cd %{_builddir}/%{name}-%{version}/build/tizen && CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}" FONT_PRELOADED_PATH="%{font_preloaded_path}" FONT_DOWNLOADED_PATH="%{font_downloaded_path}" FONT_APPLICATION_PATH="%{font_application_path}" FONT_CONFIGURATION_FILE="%{font_configuration_file}"
-%configure --prefix=$PREFIX --with-jpeg-turbo --enable-gles=20 --enable-profile=%{dali_profile} \
+%configure --prefix=$PREFIX --with-jpeg-turbo --enable-gles=20 --enable-shaderbincache=%{shaderbincache_flag} --enable-profile=%{dali_profile} \
%if 0%{?dali_feedback_plugin}
--enable-feedback \
%endif
%pre
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%post
/sbin/ldconfig
chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
exit 0
%if 0%{?dali_feedback_plugin}
##############################
%preun
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
SlpPlatformAbstraction::SlpPlatformAbstraction()
: mResourceLoader(new ResourceLoader),
- mDefaultFontSize(FONT_SIZE_TABLE[1]),
- mDynamicsFactory(NULL)
+ mDynamicsFactory(NULL),
+ mDataStoragePath( "" ),
+ mDefaultFontSize(FONT_SIZE_TABLE[1])
{
int error = FT_Init_FreeType(&mFreeTypeHandle);
DALI_ASSERT_ALWAYS( error == 0 && "Freetype initialization failed" );
{
if (mResourceLoader)
{
- mResourceLoader->SaveResource(request);
+ if( request.GetType()->id == Integration::ResourceShader )
+ {
+#ifdef SHADERBIN_CACHE_ENABLED
+ std::string path = mDataStoragePath;
+ path += request.GetPath();
+
+ Integration::ResourceRequest newRequest( request.GetId(), *request.GetType(), path, request.GetResource() );
+ mResourceLoader->SaveResource(newRequest);
+#endif
+ }
+ else
+ {
+ mResourceLoader->SaveResource(request);
+ }
}
}
return glyphImage;
}
+bool SlpPlatformAbstraction::LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
+{
+ bool result = false;
+
+#ifdef SHADERBIN_CACHE_ENABLED
+ std::string path;
+
+ if( mResourceLoader )
+ {
+ path = DALI_SHADERBIN_DIR;
+ path += filename;
+ result = mResourceLoader->LoadFile( path, buffer );
+ }
+
+ if( mResourceLoader && result == false )
+ {
+ path = mDataStoragePath;
+ path += filename;
+ result = mResourceLoader->LoadFile( path, buffer );
+ }
+#endif
+
+ return result;
+}
+
+void SlpPlatformAbstraction::SetDataStoragePath( const std::string& path )
+{
+ mDataStoragePath = path;
+}
+
} // namespace SlpPlatform
} // namespace Dali
*/
virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const;
+ /**
+ * @copydoc PlatformAbstraction::LoadShaderBinFile()
+ */
+ virtual bool LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
+
+ /**
+ * Sets path for data/resource storage.
+ * @param[in] path data/resource storage path
+ */
+ void SetDataStoragePath( const std::string& path );
+
private:
ResourceLoader* mResourceLoader;
+ DynamicsFactory* mDynamicsFactory;
FT_Library mFreeTypeHandle; ///< Freetype library
std::string mDefaultFontFamily;
std::string mDefaultFontStyle;
- float mDefaultFontSize;
std::string mDefaultThemeFile;
- DynamicsFactory* mDynamicsFactory;
+ std::string mDataStoragePath;
+ float mDefaultFontSize;
};
} // namespace SlpPlatform