/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
}
-ShaderFactory::ShaderFactory()
-{
-}
+ShaderFactory::ShaderFactory() = default;
ShaderFactory::~ShaderFactory()
{
// Let all the cached objects destroy themselves:
- for( int i = 0, cacheSize = mShaderBinaryCache.Size(); i < cacheSize; ++i )
+ for( std::size_t i = 0, cacheSize = mShaderBinaryCache.Size(); i < cacheSize; ++i )
{
if( mShaderBinaryCache[i] )
{
ShaderDataPtr shaderData;
/// Check a cache of previously loaded shaders:
- for( int i = 0, cacheSize = mShaderBinaryCache.Size(); i < cacheSize; ++i )
+ for( std::size_t i = 0, cacheSize = mShaderBinaryCache.Size(); i < cacheSize; ++i )
{
if( mShaderBinaryCache[i]->GetHashValue() == shaderHash )
{
}
// If memory cache failed check the file system for a binary or return a source-only ShaderData:
- if( shaderData.Get() == NULL )
+ if( shaderData.Get() == nullptr )
{
// Allocate the structure that returns the loaded shader:
shaderData = new ShaderData( vertexSource, fragmentSource, hints );
ThreadLocalStorage& tls = ThreadLocalStorage::Get();
Integration::PlatformAbstraction& platformAbstraction = tls.GetPlatformAbstraction();
- const bool saved = platformAbstraction.SaveShaderBinaryFile( binaryShaderFilename, &shaderData->GetBuffer()[0], shaderData->GetBufferSize() );
+ const bool saved = platformAbstraction.SaveShaderBinaryFile( binaryShaderFilename, &shaderData->GetBuffer()[0], static_cast<unsigned int>( shaderData->GetBufferSize() ) ); // don't expect buffer larger than unsigned int
// Save the binary into to memory cache:
MemoryCacheInsert( *shaderData );