diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-06-05 10:43:34 +0200 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-06-13 12:21:50 -0700 |
commit | 18b50f51b4fa14b9f2fe6f865dc47490b22e74c6 (patch) | |
tree | 24c28db13a496da6625c6a395bc6cf0d6b5b63ca /src/mbgl/shaders/shaders.cpp | |
parent | 1708b297a7c4eb6287e36837fd1cfe1220c5d97b (diff) | |
download | qtlocation-mapboxgl-18b50f51b4fa14b9f2fe6f865dc47490b22e74c6.tar.gz |
[core] cleanup ProgramParameters
Diffstat (limited to 'src/mbgl/shaders/shaders.cpp')
-rw-r--r-- | src/mbgl/shaders/shaders.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/mbgl/shaders/shaders.cpp b/src/mbgl/shaders/shaders.cpp index 03d796edba..93e273f985 100644 --- a/src/mbgl/shaders/shaders.cpp +++ b/src/mbgl/shaders/shaders.cpp @@ -9,30 +9,12 @@ namespace mbgl { namespace shaders { -static std::string pixelRatioDefine(const ProgramParameters& parameters) { - std::ostringstream pixelRatioSS; - pixelRatioSS.imbue(std::locale("C")); - pixelRatioSS.setf(std::ios_base::showpoint); - pixelRatioSS << parameters.pixelRatio; - return std::string("#define DEVICE_PIXEL_RATIO ") + pixelRatioSS.str() + "\n"; -} - std::string fragmentSource(const ProgramParameters& parameters, const char* fragmentSource) { - std::string source = pixelRatioDefine(parameters) + fragmentPrelude + fragmentSource; - if (parameters.overdraw) { - assert(source.find("#ifdef OVERDRAW_INSPECTOR") != std::string::npos); - source.replace(source.find_first_of('\n'), 1, "\n#define OVERDRAW_INSPECTOR\n"); - } - return source; + return parameters.defines + fragmentPrelude + fragmentSource; } std::string vertexSource(const ProgramParameters& parameters, const char* vertexSource) { - return pixelRatioDefine(parameters) + vertexPrelude + vertexSource; -} - -std::string programCachePath(const ProgramParameters& parameters, const char* name) { - return parameters.cacheDir + "/com.mapbox.gl.shader." + name + - (parameters.overdraw ? ".overdraw.pbf" : ".pbf"); + return parameters.defines + vertexPrelude + vertexSource; } std::string programIdentifier(const std::string& vertexSource, const std::string& fragmentSource) { |