This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd4bd95
commit 977b55d
Showing
7 changed files
with
46 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <mbgl/programs/program_parameters.hpp> | ||
|
||
#include <iomanip> | ||
#include <sstream> | ||
|
||
namespace mbgl { | ||
|
||
ProgramParameters::ProgramParameters(const float pixelRatio, | ||
const bool overdraw, | ||
std::string cacheDir_) | ||
: defines([&] { | ||
std::ostringstream ss; | ||
ss.imbue(std::locale("C")); | ||
ss.setf(std::ios_base::showpoint); | ||
ss << "#define DEVICE_PIXEL_RATIO " << pixelRatio << std::endl; | ||
if (overdraw) { | ||
ss << "#define OVERDRAW_INSPECTOR" << std::endl; | ||
} | ||
return ss.str(); | ||
}()), | ||
hash(std::hash<std::string>()(defines)), | ||
cacheDir(std::move(cacheDir_)) { | ||
} | ||
|
||
std::string ProgramParameters::cachePath(const char* name) const { | ||
std::ostringstream ss; | ||
ss << cacheDir << "/com.mapbox.gl.shader." << name << "." << std::setfill('0') | ||
<< std::setw(sizeof(size_t) * 2) << std::hex << hash << ".pbf"; | ||
return ss.str(); | ||
} | ||
|
||
} // namespace mbgl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters