Commit db39e7f5 by Corentin Wallez

Rename path_utils to system_utils

For inclusion of Sleep BUG=angleproject:892 Change-Id: I1a9491102e9943d945eef0ba372a6779c30cd311 Reviewed-on: https://chromium-review.googlesource.com/273131Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 3d5cb774
...@@ -14,9 +14,10 @@ ...@@ -14,9 +14,10 @@
// http://www.opengles-book.com // http://www.opengles-book.com
#include "SampleApplication.h" #include "SampleApplication.h"
#include "shader_utils.h" #include "shader_utils.h"
#include "system_utils.h"
#include "tga_utils.h" #include "tga_utils.h"
#include "path_utils.h"
class MultiTextureSample : public SampleApplication class MultiTextureSample : public SampleApplication
{ {
...@@ -83,8 +84,8 @@ class MultiTextureSample : public SampleApplication ...@@ -83,8 +84,8 @@ class MultiTextureSample : public SampleApplication
mLightMapLoc = glGetUniformLocation(mProgram, "s_lightMap"); mLightMapLoc = glGetUniformLocation(mProgram, "s_lightMap");
// Load the textures // Load the textures
mBaseMapTexID = loadTexture(GetExecutableDirectory() + "/basemap.tga"); mBaseMapTexID = loadTexture(angle::GetExecutableDirectory() + "/basemap.tga");
mLightMapTexID = loadTexture(GetExecutableDirectory() + "/lightmap.tga"); mLightMapTexID = loadTexture(angle::GetExecutableDirectory() + "/lightmap.tga");
if (mBaseMapTexID == 0 || mLightMapTexID == 0) if (mBaseMapTexID == 0 || mLightMapTexID == 0)
{ {
return false; return false;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "SampleApplication.h" #include "SampleApplication.h"
#include "shader_utils.h" #include "shader_utils.h"
#include "path_utils.h" #include "system_utils.h"
#include "texture_utils.h" #include "texture_utils.h"
#include <cstring> #include <cstring>
...@@ -49,15 +49,15 @@ class MultipleDrawBuffersSample : public SampleApplication ...@@ -49,15 +49,15 @@ class MultipleDrawBuffersSample : public SampleApplication
return false; return false;
} }
mMRTProgram = CompileProgramFromFiles(GetExecutableDirectory() + "/multiple_draw_buffers_vs.glsl", mMRTProgram = CompileProgramFromFiles(angle::GetExecutableDirectory() + "/multiple_draw_buffers_vs.glsl",
GetExecutableDirectory() + "/multiple_draw_buffers_fs.glsl"); angle::GetExecutableDirectory() + "/multiple_draw_buffers_fs.glsl");
if (!mMRTProgram) if (!mMRTProgram)
{ {
return false; return false;
} }
mCopyProgram = CompileProgramFromFiles(GetExecutableDirectory() + "/multiple_draw_buffers_vs.glsl", mCopyProgram = CompileProgramFromFiles(angle::GetExecutableDirectory() + "/multiple_draw_buffers_vs.glsl",
GetExecutableDirectory() + "/multiple_draw_buffers_copy_fs.glsl"); angle::GetExecutableDirectory() + "/multiple_draw_buffers_copy_fs.glsl");
if (!mCopyProgram) if (!mCopyProgram)
{ {
return false; return false;
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#include "Vector.h" #include "Vector.h"
#include "shader_utils.h" #include "shader_utils.h"
#include "random_utils.h" #include "random_utils.h"
#include "system_utils.h"
#include "tga_utils.h" #include "tga_utils.h"
#include "path_utils.h"
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include <math.h> #include <math.h>
...@@ -114,7 +114,7 @@ class ParticleSystemSample : public SampleApplication ...@@ -114,7 +114,7 @@ class ParticleSystemSample : public SampleApplication
mParticleTime = 1.0f; mParticleTime = 1.0f;
TGAImage img; TGAImage img;
if (!LoadTGAImageFromFile(GetExecutableDirectory() + "/smoke.tga", &img)) if (!LoadTGAImageFromFile(angle::GetExecutableDirectory() + "/smoke.tga", &img))
{ {
return false; return false;
} }
......
...@@ -4,14 +4,17 @@ ...@@ -4,14 +4,17 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// Linux_path_utils.cpp: Implementation of OS-specific path functions for Linux // Linux_system_utils.cpp: Implementation of OS-specific functions for Linux
#include "path_utils.h" #include "system_utils.h"
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <array> #include <array>
namespace angle
{
std::string GetExecutablePath() std::string GetExecutablePath()
{ {
// We cannot use lstat to get the size of /proc/self/exe as it always returns 0 // We cannot use lstat to get the size of /proc/self/exe as it always returns 0
...@@ -34,3 +37,5 @@ std::string GetExecutableDirectory() ...@@ -34,3 +37,5 @@ std::string GetExecutableDirectory()
size_t lastPathSepLoc = executablePath.find_last_of("/"); size_t lastPathSepLoc = executablePath.find_last_of("/");
return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : ""; return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
} }
} // namespace angle
...@@ -4,12 +4,19 @@ ...@@ -4,12 +4,19 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// system_utils.h: declaration of OS-specific utility functions
#ifndef SAMPLE_UTIL_PATH_UTILS_H #ifndef SAMPLE_UTIL_PATH_UTILS_H
#define SAMPLE_UTIL_PATH_UTILS_H #define SAMPLE_UTIL_PATH_UTILS_H
#include <string> #include <string>
namespace angle
{
std::string GetExecutablePath(); std::string GetExecutablePath();
std::string GetExecutableDirectory(); std::string GetExecutableDirectory();
} // namespace angle
#endif // SAMPLE_UTIL_PATH_UTILS_H #endif // SAMPLE_UTIL_PATH_UTILS_H
...@@ -10,21 +10,21 @@ ...@@ -10,21 +10,21 @@
'com_utils.h', 'com_utils.h',
'keyboard.h', 'keyboard.h',
'mouse.h', 'mouse.h',
'path_utils.h',
'random_utils.cpp', 'random_utils.cpp',
'random_utils.h', 'random_utils.h',
'shader_utils.cpp', 'shader_utils.cpp',
'shader_utils.h', 'shader_utils.h',
'system_utils.h',
'Event.h',
'EGLWindow.cpp', 'EGLWindow.cpp',
'EGLWindow.h', 'EGLWindow.h',
'Event.h',
'OSWindow.cpp', 'OSWindow.cpp',
'OSWindow.h', 'OSWindow.h',
'Timer.h', 'Timer.h',
], ],
'util_win32_sources': 'util_win32_sources':
[ [
'win32/Win32_path_utils.cpp', 'win32/Win32_system_utils.cpp',
'win32/Win32Timer.cpp', 'win32/Win32Timer.cpp',
'win32/Win32Timer.h', 'win32/Win32Timer.h',
'win32/Win32Window.cpp', 'win32/Win32Window.cpp',
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
], ],
'util_linux_sources': 'util_linux_sources':
[ [
'linux/Linux_path_utils.cpp', 'linux/Linux_system_utils.cpp',
'linux/LinuxTimer.cpp', 'linux/LinuxTimer.cpp',
'linux/LinuxTimer.h', 'linux/LinuxTimer.h',
'x11/X11Window.cpp', 'x11/X11Window.cpp',
......
...@@ -4,11 +4,15 @@ ...@@ -4,11 +4,15 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// Win32_path_utils.cpp: Implementation of OS-specific path functions for Windows // Win32_system_utils.cpp: Implementation of OS-specific functions for Windows
#include "system_utils.h"
#include "path_utils.h"
#include <array>
#include <windows.h> #include <windows.h>
#include <array>
namespace angle
{
std::string GetExecutablePath() std::string GetExecutablePath()
{ {
...@@ -23,3 +27,5 @@ std::string GetExecutableDirectory() ...@@ -23,3 +27,5 @@ std::string GetExecutableDirectory()
size_t lastPathSepLoc = executablePath.find_last_of("\\/"); size_t lastPathSepLoc = executablePath.find_last_of("\\/");
return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : ""; return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
} }
} // namespace angle
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment