[core] move ProgramMap to within the gl::Program object
This commit is contained in:
@@ -5,6 +5,7 @@ require('flow-remove-types/register');
|
||||
const path = require('path');
|
||||
const outputPath = 'src/mbgl/programs/gl';
|
||||
const zlib = require('zlib');
|
||||
const crypto = require('crypto');
|
||||
|
||||
var shaders = require('../mapbox-gl-js/src/shaders');
|
||||
|
||||
@@ -28,18 +29,23 @@ for (const key in shaders) {
|
||||
// https://github.com/mapbox/mapbox-gl-native/issues/13984
|
||||
shaders[key].vertexSource = shaders[key].vertexSource.replace(/\ba_(\w+)_t\b/mg, 'u_$1_t');
|
||||
|
||||
const hash = crypto.createHash('sha1');
|
||||
|
||||
const vertex = concatenated.length;
|
||||
concatenated += basicMinify(shaders[key].vertexSource);
|
||||
concatenated += '\n\0';
|
||||
const vertexSource = basicMinify(shaders[key].vertexSource) + '\n\0';
|
||||
hash.update(vertexSource);
|
||||
concatenated += vertexSource;
|
||||
|
||||
const fragment = concatenated.length;
|
||||
concatenated += basicMinify(shaders[key].fragmentSource);
|
||||
concatenated += '\n\0';
|
||||
const fragmentSource = basicMinify(shaders[key].fragmentSource) + '\n\0';
|
||||
hash.update(fragmentSource);
|
||||
concatenated += fragmentSource;
|
||||
|
||||
offsets[key] = {
|
||||
vertex,
|
||||
fragment,
|
||||
originalKey: key,
|
||||
hash: hash.digest('hex').substring(0, 16).match(/.{1,2}/g).map(n => `0x${n}`).join(', '),
|
||||
shaderName: key.replace(/[A-Z]+/g, (match) => `_${match.toLowerCase()}`),
|
||||
ShaderName: key.replace(/^[a-z]/g, (match) => match.toUpperCase())
|
||||
};
|
||||
@@ -49,6 +55,7 @@ for (const key in shaders) {
|
||||
offsets.symbolSDFIcon = {
|
||||
vertex: offsets.symbolSDF.vertex,
|
||||
fragment: offsets.symbolSDF.fragment,
|
||||
hash: offsets.symbolSDF.hash,
|
||||
originalKey: 'symbolSDF',
|
||||
shaderName: 'symbol_sdf_icon',
|
||||
ShaderName: 'SymbolSDFIcon',
|
||||
@@ -57,6 +64,7 @@ offsets.symbolSDFIcon = {
|
||||
offsets.symbolSDFText = {
|
||||
vertex: offsets.symbolSDF.vertex,
|
||||
fragment: offsets.symbolSDF.fragment,
|
||||
hash: offsets.symbolSDF.hash,
|
||||
originalKey: 'symbolSDF',
|
||||
shaderName: 'symbol_sdf_text',
|
||||
ShaderName: 'SymbolSDFText',
|
||||
@@ -71,10 +79,6 @@ const compressed = zlib.deflateSync(concatenated, {level: zlib.Z_BEST_COMPRESSIO
|
||||
.join(',\n ')
|
||||
.trim();
|
||||
|
||||
function sourceOffset(key, type) {
|
||||
return `programs::gl::shaderSource() + ${offsets[key][type]}`
|
||||
}
|
||||
|
||||
writeIfModified(path.join(outputPath, 'shader_source.hpp'), `// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#pragma once
|
||||
@@ -85,6 +89,9 @@ namespace gl {
|
||||
|
||||
const char* shaderSource();
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
} // namespace mbgl
|
||||
@@ -119,29 +126,15 @@ writeIfModified(path.join(outputPath, 'preludes.hpp'), `// NOTE: DO NOT CHANGE T
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
extern const char* vertexShaderPrelude;
|
||||
extern const char* fragmentShaderPrelude;
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
} // namespace mbgl
|
||||
`);
|
||||
|
||||
writeIfModified(path.join(outputPath, 'preludes.cpp'), `// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
const char* vertexShaderPrelude = ${sourceOffset('prelude', 'vertex')};
|
||||
const char* fragmentShaderPrelude = ${sourceOffset('prelude', 'fragment')};
|
||||
constexpr const uint8_t preludeHash[8] = { ${offsets['prelude'].hash} };
|
||||
constexpr const auto vertexPreludeOffset = ${offsets['prelude'].vertex};
|
||||
constexpr const auto fragmentPreludeOffset = ${offsets['prelude'].fragment};
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
@@ -157,18 +150,37 @@ for (const key in offsets) {
|
||||
writeIfModified(path.join(outputPath, `${shaderName}.cpp`), `// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/${shaderName}_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<${ShaderName}Program> {
|
||||
static constexpr const char* name = "${shaderName}";
|
||||
static constexpr const uint8_t hash[8] = { ${offsets[key].hash} };
|
||||
static constexpr const auto vertexOffset = ${offsets[key].vertex};
|
||||
static constexpr const auto fragmentOffset = ${offsets[key].fragment};
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<${ShaderName}Program>::name;
|
||||
constexpr const uint8_t ShaderSource<${ShaderName}Program>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<${ShaderName}Program>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<${ShaderName}Program>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "${shaderName}",
|
||||
${sourceOffset(key, 'vertex')}, ${sourceOffset(key, 'fragment')});
|
||||
return std::make_unique<gl::Program<${ShaderName}Program>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -82,7 +82,6 @@
|
||||
"src/mbgl/programs/gl/line_gradient.cpp",
|
||||
"src/mbgl/programs/gl/line_pattern.cpp",
|
||||
"src/mbgl/programs/gl/line_sdf.cpp",
|
||||
"src/mbgl/programs/gl/preludes.cpp",
|
||||
"src/mbgl/programs/gl/raster.cpp",
|
||||
"src/mbgl/programs/gl/shader_source.cpp",
|
||||
"src/mbgl/programs/gl/shaders.cpp",
|
||||
|
||||
@@ -95,5 +95,36 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class>
|
||||
class AttributeKey;
|
||||
|
||||
constexpr auto attributeDefinePrefix() {
|
||||
return "#define HAS_UNIFORM_u_";
|
||||
}
|
||||
|
||||
template <class... As>
|
||||
class AttributeKey<TypeList<As...>> final {
|
||||
public:
|
||||
static_assert(sizeof...(As) <= 32, "attribute count exceeds 32");
|
||||
|
||||
static uint32_t compute(const gfx::AttributeBindings<TypeList<As...>>& bindings) {
|
||||
uint32_t value = 0;
|
||||
util::ignore(
|
||||
{ (bindings.template get<As>() ? (void)(value |= 1 << TypeIndex<As, As...>::value)
|
||||
: (void)0,
|
||||
0)... });
|
||||
return value;
|
||||
}
|
||||
|
||||
static std::string defines(const gfx::AttributeBindings<TypeList<As...>>& bindings) {
|
||||
std::string result;
|
||||
util::ignore({ (!bindings.template get<As>()
|
||||
? (void)(result += concat_literals<&attributeDefinePrefix, &As::name, &string_literal<'\n'>::value>::value())
|
||||
: (void)0,
|
||||
0)... });
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gl
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -160,12 +160,10 @@ void Context::enableDebugging() {
|
||||
MBGL_CHECK_ERROR(debugging->debugMessageCallback(extension::Debugging::DebugCallback, nullptr));
|
||||
}
|
||||
|
||||
UniqueShader Context::createShader(ShaderType type, const std::string& source) {
|
||||
UniqueShader Context::createShader(ShaderType type, const std::initializer_list<const char*>& sources) {
|
||||
UniqueShader result { MBGL_CHECK_ERROR(glCreateShader(static_cast<GLenum>(type))), { this } };
|
||||
|
||||
const GLchar* sources = source.data();
|
||||
const auto lengths = static_cast<GLsizei>(source.length());
|
||||
MBGL_CHECK_ERROR(glShaderSource(result, 1, &sources, &lengths));
|
||||
MBGL_CHECK_ERROR(glShaderSource(result, static_cast<GLsizei>(sources.size()), sources.begin(), nullptr));
|
||||
MBGL_CHECK_ERROR(glCompileShader(result));
|
||||
|
||||
GLint status = 0;
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
void enableDebugging();
|
||||
|
||||
UniqueShader createShader(ShaderType type, const std::string& source);
|
||||
UniqueShader createShader(ShaderType type, const std::initializer_list<const char*>& sources);
|
||||
UniqueProgram createProgram(ShaderID vertexShader, ShaderID fragmentShader);
|
||||
UniqueProgram createProgram(BinaryProgramFormat binaryFormat, const std::string& binaryProgram);
|
||||
void verifyProgramLinkage(ProgramID);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <mbgl/util/logging.hpp>
|
||||
#include <mbgl/programs/program_parameters.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/programs/gl/shaders.hpp>
|
||||
|
||||
#include <string>
|
||||
@@ -31,93 +32,128 @@ public:
|
||||
using AttributeList = typename Name::AttributeList;
|
||||
using UniformList = typename Name::UniformList;
|
||||
using TextureList = typename Name::TextureList;
|
||||
|
||||
Program(Context& context, const std::string& vertexSource, const std::string& fragmentSource)
|
||||
: program(
|
||||
context.createProgram(context.createShader(ShaderType::Vertex, vertexSource),
|
||||
context.createShader(ShaderType::Fragment, fragmentSource))),
|
||||
attributeLocations(context, program) {
|
||||
// Re-link program after manually binding only active attributes in Attributes::queryLocations
|
||||
context.linkProgram(program);
|
||||
|
||||
// We have to re-initialize the uniforms state from the bindings as the uniform locations
|
||||
// get shifted on some implementations
|
||||
uniformStates.queryLocations(program);
|
||||
|
||||
// Texture units are specified via uniforms as well, so we need query their locations
|
||||
textureStates.queryLocations(program);
|
||||
Program(ProgramParameters programParameters_)
|
||||
: programParameters(std::move(programParameters_)) {
|
||||
}
|
||||
|
||||
template <class BinaryProgram>
|
||||
Program(Context& context, const BinaryProgram& binaryProgram)
|
||||
: program(context.createProgram(binaryProgram.format(), binaryProgram.code())),
|
||||
attributeLocations(binaryProgram) {
|
||||
uniformStates.loadNamedLocations(binaryProgram);
|
||||
textureStates.loadNamedLocations(binaryProgram);
|
||||
}
|
||||
const ProgramParameters programParameters;
|
||||
|
||||
static std::unique_ptr<Program> createProgram(gl::Context& context,
|
||||
const ProgramParameters& programParameters,
|
||||
const char* name,
|
||||
const char* vertexSource_,
|
||||
const char* fragmentSource_) {
|
||||
const std::string vertexSource = programs::gl::vertexSource(programParameters, vertexSource_);
|
||||
const std::string fragmentSource = programs::gl::fragmentSource(programParameters, fragmentSource_);
|
||||
static constexpr const auto vertexOffset = programs::gl::ShaderSource<Name>::vertexOffset;
|
||||
static constexpr const auto fragmentOffset = programs::gl::ShaderSource<Name>::fragmentOffset;
|
||||
|
||||
class Instance {
|
||||
public:
|
||||
Instance(Context& context,
|
||||
const std::initializer_list<const char*>& vertexSource,
|
||||
const std::initializer_list<const char*>& fragmentSource)
|
||||
: program(context.createProgram(
|
||||
context.createShader(ShaderType::Vertex, vertexSource),
|
||||
context.createShader(ShaderType::Fragment, fragmentSource))),
|
||||
attributeLocations(context, program) {
|
||||
// Re-link program after manually binding only active attributes in Attributes::queryLocations
|
||||
context.linkProgram(program);
|
||||
|
||||
// We have to re-initialize the uniforms state from the bindings as the uniform locations
|
||||
// get shifted on some implementations
|
||||
uniformStates.queryLocations(program);
|
||||
|
||||
// Texture units are specified via uniforms as well, so we need query their locations
|
||||
textureStates.queryLocations(program);
|
||||
}
|
||||
|
||||
template <class BinaryProgram>
|
||||
Instance(Context& context, const BinaryProgram& binaryProgram)
|
||||
: program(context.createProgram(binaryProgram.format(), binaryProgram.code())),
|
||||
attributeLocations(binaryProgram) {
|
||||
uniformStates.loadNamedLocations(binaryProgram);
|
||||
textureStates.loadNamedLocations(binaryProgram);
|
||||
}
|
||||
|
||||
static std::unique_ptr<Instance>
|
||||
createInstance(gl::Context& context,
|
||||
const ProgramParameters& programParameters,
|
||||
const std::string& additionalDefines) {
|
||||
|
||||
|
||||
|
||||
#if MBGL_HAS_BINARY_PROGRAMS
|
||||
optional<std::string> cachePath = programParameters.cachePath(name);
|
||||
if (cachePath && context.supportsProgramBinaries()) {
|
||||
const std::string identifier = programs::gl::programIdentifier(vertexSource, fragmentSource);
|
||||
optional<std::string> cachePath =
|
||||
programParameters.cachePath(programs::gl::ShaderSource<Name>::name);
|
||||
std::string programIdentifier;
|
||||
if (cachePath && context.supportsProgramBinaries()) {
|
||||
programIdentifier = programs::gl::programIdentifier(
|
||||
programParameters.getDefines(), additionalDefines, programs::gl::preludeHash,
|
||||
programs::gl::ShaderSource<Name>::hash);
|
||||
|
||||
try {
|
||||
if (auto cachedBinaryProgram = util::readFile(*cachePath)) {
|
||||
const BinaryProgram binaryProgram(std::move(*cachedBinaryProgram));
|
||||
if (binaryProgram.identifier() == identifier) {
|
||||
return std::make_unique<Program>(context, binaryProgram);
|
||||
} else {
|
||||
Log::Warning(Event::OpenGL,
|
||||
"Cached program %s changed. Recompilation required.",
|
||||
name);
|
||||
try {
|
||||
if (auto cachedBinaryProgram = util::readFile(*cachePath)) {
|
||||
const BinaryProgram binaryProgram(std::move(*cachedBinaryProgram));
|
||||
if (binaryProgram.identifier() == programIdentifier) {
|
||||
return std::make_unique<Instance>(context, binaryProgram);
|
||||
} else {
|
||||
Log::Warning(Event::OpenGL,
|
||||
"Cached program %s changed. Recompilation required.",
|
||||
programs::gl::ShaderSource<Name>::name);
|
||||
}
|
||||
}
|
||||
} catch (std::runtime_error& error) {
|
||||
Log::Warning(Event::OpenGL, "Could not load cached program: %s",
|
||||
error.what());
|
||||
}
|
||||
} catch (std::runtime_error& error) {
|
||||
Log::Warning(Event::OpenGL, "Could not load cached program: %s",
|
||||
error.what());
|
||||
}
|
||||
|
||||
// Compile the shader
|
||||
auto result = std::make_unique<Program>(context, vertexSource, fragmentSource);
|
||||
|
||||
try {
|
||||
if (const auto binaryProgram =
|
||||
result->template get<BinaryProgram>(context, identifier)) {
|
||||
util::write_file(*cachePath, binaryProgram->serialize());
|
||||
Log::Warning(Event::OpenGL, "Caching program in: %s", (*cachePath).c_str());
|
||||
}
|
||||
} catch (std::runtime_error& error) {
|
||||
Log::Warning(Event::OpenGL, "Failed to cache program: %s", error.what());
|
||||
}
|
||||
|
||||
return std::move(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
(void)name;
|
||||
return std::make_unique<Program>(context, vertexSource, fragmentSource);
|
||||
}
|
||||
// Compile the shader
|
||||
const std::initializer_list<const char*> vertexSource = {
|
||||
programParameters.getDefines().c_str(),
|
||||
additionalDefines.c_str(),
|
||||
(programs::gl::shaderSource() + programs::gl::vertexPreludeOffset),
|
||||
(programs::gl::shaderSource() + vertexOffset)
|
||||
};
|
||||
const std::initializer_list<const char*> fragmentSource = {
|
||||
programParameters.getDefines().c_str(),
|
||||
additionalDefines.c_str(),
|
||||
(programs::gl::shaderSource() + programs::gl::fragmentPreludeOffset),
|
||||
(programs::gl::shaderSource() + fragmentOffset)
|
||||
};
|
||||
auto result = std::make_unique<Instance>(context, vertexSource, fragmentSource);
|
||||
|
||||
template <class BinaryProgram>
|
||||
optional<BinaryProgram> get(Context& context, const std::string& identifier) const {
|
||||
if (auto binaryProgram = context.getBinaryProgram(program)) {
|
||||
return BinaryProgram{ binaryProgram->first,
|
||||
std::move(binaryProgram->second),
|
||||
identifier,
|
||||
attributeLocations.getNamedLocations(),
|
||||
uniformStates.getNamedLocations(),
|
||||
textureStates.getNamedLocations() };
|
||||
#if MBGL_HAS_BINARY_PROGRAMS
|
||||
if (cachePath && context.supportsProgramBinaries()) {
|
||||
try {
|
||||
if (const auto binaryProgram =
|
||||
result->template get<BinaryProgram>(context, programIdentifier)) {
|
||||
util::write_file(*cachePath, binaryProgram->serialize());
|
||||
Log::Warning(Event::OpenGL, "Caching program in: %s", (*cachePath).c_str());
|
||||
}
|
||||
} catch (std::runtime_error& error) {
|
||||
Log::Warning(Event::OpenGL, "Failed to cache program: %s", error.what());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return std::move(result);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
template <class BinaryProgram>
|
||||
optional<BinaryProgram> get(Context& context, const std::string& identifier) const {
|
||||
if (auto binaryProgram = context.getBinaryProgram(program)) {
|
||||
return BinaryProgram{ binaryProgram->first,
|
||||
std::move(binaryProgram->second),
|
||||
identifier,
|
||||
attributeLocations.getNamedLocations(),
|
||||
uniformStates.getNamedLocations(),
|
||||
textureStates.getNamedLocations() };
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
UniqueProgram program;
|
||||
gl::AttributeLocations<AttributeList> attributeLocations;
|
||||
gl::UniformStates<UniformList> uniformStates;
|
||||
gl::TextureStates<TextureList> textureStates;
|
||||
};
|
||||
|
||||
void draw(gfx::Context& genericContext,
|
||||
const gfx::DrawMode& drawMode,
|
||||
@@ -139,16 +175,29 @@ public:
|
||||
context.setColorMode(colorMode);
|
||||
context.setCullFaceMode(cullFaceMode);
|
||||
|
||||
context.program = program;
|
||||
const uint32_t key = gl::AttributeKey<AttributeList>::compute(attributeBindings);
|
||||
auto it = instances.find(key);
|
||||
if (it == instances.end()) {
|
||||
it = instances
|
||||
.emplace(key,
|
||||
Instance::createInstance(
|
||||
context,
|
||||
programParameters,
|
||||
gl::AttributeKey<AttributeList>::defines(attributeBindings)))
|
||||
.first;
|
||||
}
|
||||
|
||||
uniformStates.bind(uniformValues);
|
||||
auto& instance = *it->second;
|
||||
context.program = instance.program;
|
||||
|
||||
textureStates.bind(context, textureBindings);
|
||||
instance.uniformStates.bind(uniformValues);
|
||||
|
||||
instance.textureStates.bind(context, textureBindings);
|
||||
|
||||
auto& vertexArray = reinterpret_cast<gl::DrawScopeResource&>(*drawScope.resource).vertexArray;
|
||||
vertexArray.bind(context,
|
||||
indexBuffer,
|
||||
attributeLocations.toBindingArray(attributeBindings));
|
||||
instance.attributeLocations.toBindingArray(attributeBindings));
|
||||
|
||||
context.draw(drawMode,
|
||||
indexOffset,
|
||||
@@ -156,11 +205,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
UniqueProgram program;
|
||||
|
||||
gl::AttributeLocations<AttributeList> attributeLocations;
|
||||
gl::UniformStates<UniformList> uniformStates;
|
||||
gl::TextureStates<TextureList> textureStates;
|
||||
std::map<uint32_t, std::unique_ptr<Instance>> instances;
|
||||
};
|
||||
|
||||
} // namespace gl
|
||||
|
||||
@@ -52,7 +52,7 @@ class CircleLayerPrograms final : public LayerTypePrograms {
|
||||
public:
|
||||
CircleLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters)
|
||||
: circle(context, programParameters) {}
|
||||
ProgramMap<CircleProgram> circle;
|
||||
CircleProgram circle;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -117,8 +117,8 @@ public:
|
||||
: fillExtrusion(context, programParameters),
|
||||
fillExtrusionPattern(context, programParameters),
|
||||
extrusionTexture(context, programParameters) {}
|
||||
ProgramMap<FillExtrusionProgram> fillExtrusion;
|
||||
ProgramMap<FillExtrusionPatternProgram> fillExtrusionPattern;
|
||||
FillExtrusionProgram fillExtrusion;
|
||||
FillExtrusionPatternProgram fillExtrusionPattern;
|
||||
ExtrusionTextureProgram extrusionTexture;
|
||||
};
|
||||
|
||||
|
||||
@@ -110,10 +110,10 @@ public:
|
||||
fillPattern(context, programParameters),
|
||||
fillOutline(context, programParameters),
|
||||
fillOutlinePattern(context, programParameters) {}
|
||||
ProgramMap<FillProgram> fill;
|
||||
ProgramMap<FillPatternProgram> fillPattern;
|
||||
ProgramMap<FillOutlineProgram> fillOutline;
|
||||
ProgramMap<FillOutlinePatternProgram> fillOutlinePattern;
|
||||
FillProgram fill;
|
||||
FillPatternProgram fillPattern;
|
||||
FillOutlineProgram fillOutline;
|
||||
FillOutlinePatternProgram fillOutlinePattern;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/background_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<BackgroundProgram> {
|
||||
static constexpr const char* name = "background";
|
||||
static constexpr const uint8_t hash[8] = { 0x2d, 0xef, 0x97, 0xa2, 0xec, 0xb5, 0x67, 0xef };
|
||||
static constexpr const auto vertexOffset = 1429;
|
||||
static constexpr const auto fragmentOffset = 1525;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<BackgroundProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<BackgroundProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<BackgroundProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<BackgroundProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "background",
|
||||
programs::gl::shaderSource() + 1429, programs::gl::shaderSource() + 1525);
|
||||
return std::make_unique<gl::Program<BackgroundProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/background_pattern_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<BackgroundPatternProgram> {
|
||||
static constexpr const char* name = "background_pattern";
|
||||
static constexpr const uint8_t hash[8] = { 0x70, 0x13, 0xc8, 0x7e, 0xba, 0x18, 0xf5, 0x19 };
|
||||
static constexpr const auto vertexOffset = 1675;
|
||||
static constexpr const auto fragmentOffset = 2266;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<BackgroundPatternProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<BackgroundPatternProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<BackgroundPatternProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<BackgroundPatternProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "background_pattern",
|
||||
programs::gl::shaderSource() + 1675, programs::gl::shaderSource() + 2266);
|
||||
return std::make_unique<gl::Program<BackgroundPatternProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/circle_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<CircleProgram> {
|
||||
static constexpr const char* name = "circle";
|
||||
static constexpr const uint8_t hash[8] = { 0xf0, 0x3e, 0x18, 0xb7, 0x75, 0xb2, 0xde, 0xa9 };
|
||||
static constexpr const auto vertexOffset = 2927;
|
||||
static constexpr const auto fragmentOffset = 6093;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<CircleProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<CircleProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<CircleProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<CircleProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "circle",
|
||||
programs::gl::shaderSource() + 2927, programs::gl::shaderSource() + 6093);
|
||||
return std::make_unique<gl::Program<CircleProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/clipping_mask_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<ClippingMaskProgram> {
|
||||
static constexpr const char* name = "clipping_mask";
|
||||
static constexpr const uint8_t hash[8] = { 0x3e, 0x17, 0xc2, 0x3a, 0x1f, 0xf0, 0xa8, 0xa3 };
|
||||
static constexpr const auto vertexOffset = 7848;
|
||||
static constexpr const auto fragmentOffset = 7944;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<ClippingMaskProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<ClippingMaskProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<ClippingMaskProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<ClippingMaskProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "clipping_mask",
|
||||
programs::gl::shaderSource() + 7848, programs::gl::shaderSource() + 7944);
|
||||
return std::make_unique<gl::Program<ClippingMaskProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/collision_box_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<CollisionBoxProgram> {
|
||||
static constexpr const char* name = "collision_box";
|
||||
static constexpr const uint8_t hash[8] = { 0xcb, 0x6a, 0x9b, 0xd1, 0x1f, 0x31, 0xf8, 0x5b };
|
||||
static constexpr const auto vertexOffset = 9956;
|
||||
static constexpr const auto fragmentOffset = 10635;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<CollisionBoxProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<CollisionBoxProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<CollisionBoxProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<CollisionBoxProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "collision_box",
|
||||
programs::gl::shaderSource() + 9956, programs::gl::shaderSource() + 10635);
|
||||
return std::make_unique<gl::Program<CollisionBoxProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/collision_circle_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<CollisionCircleProgram> {
|
||||
static constexpr const char* name = "collision_circle";
|
||||
static constexpr const uint8_t hash[8] = { 0x99, 0x2e, 0xad, 0x8c, 0xd3, 0x88, 0xae, 0x82 };
|
||||
static constexpr const auto vertexOffset = 10858;
|
||||
static constexpr const auto fragmentOffset = 11774;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<CollisionCircleProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<CollisionCircleProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<CollisionCircleProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<CollisionCircleProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "collision_circle",
|
||||
programs::gl::shaderSource() + 10858, programs::gl::shaderSource() + 11774);
|
||||
return std::make_unique<gl::Program<CollisionCircleProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/debug_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<DebugProgram> {
|
||||
static constexpr const char* name = "debug";
|
||||
static constexpr const uint8_t hash[8] = { 0xa8, 0x7d, 0x87, 0x6e, 0x36, 0xa8, 0x81, 0xe3 };
|
||||
static constexpr const auto vertexOffset = 12450;
|
||||
static constexpr const auto fragmentOffset = 12546;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<DebugProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<DebugProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<DebugProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<DebugProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "debug",
|
||||
programs::gl::shaderSource() + 12450, programs::gl::shaderSource() + 12546);
|
||||
return std::make_unique<gl::Program<DebugProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/extrusion_texture_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<ExtrusionTextureProgram> {
|
||||
static constexpr const char* name = "extrusion_texture";
|
||||
static constexpr const uint8_t hash[8] = { 0xd9, 0x77, 0x11, 0xd2, 0x03, 0xc7, 0x27, 0xcb };
|
||||
static constexpr const auto vertexOffset = 27554;
|
||||
static constexpr const auto fragmentOffset = 27734;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<ExtrusionTextureProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<ExtrusionTextureProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<ExtrusionTextureProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<ExtrusionTextureProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "extrusion_texture",
|
||||
programs::gl::shaderSource() + 27554, programs::gl::shaderSource() + 27734);
|
||||
return std::make_unique<gl::Program<ExtrusionTextureProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/fill_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<FillProgram> {
|
||||
static constexpr const char* name = "fill";
|
||||
static constexpr const uint8_t hash[8] = { 0x87, 0xea, 0x65, 0x7f, 0x0c, 0x9b, 0x97, 0x5d };
|
||||
static constexpr const auto vertexOffset = 12610;
|
||||
static constexpr const auto fragmentOffset = 13254;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<FillProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<FillProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<FillProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "fill",
|
||||
programs::gl::shaderSource() + 12610, programs::gl::shaderSource() + 13254);
|
||||
return std::make_unique<gl::Program<FillProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/fill_extrusion_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<FillExtrusionProgram> {
|
||||
static constexpr const char* name = "fill_extrusion";
|
||||
static constexpr const uint8_t hash[8] = { 0x49, 0x8a, 0xa2, 0x8b, 0x21, 0x74, 0x27, 0x93 };
|
||||
static constexpr const auto vertexOffset = 21238;
|
||||
static constexpr const auto fragmentOffset = 23121;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<FillExtrusionProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<FillExtrusionProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillExtrusionProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<FillExtrusionProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "fill_extrusion",
|
||||
programs::gl::shaderSource() + 21238, programs::gl::shaderSource() + 23121);
|
||||
return std::make_unique<gl::Program<FillExtrusionProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/fill_extrusion_pattern_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<FillExtrusionPatternProgram> {
|
||||
static constexpr const char* name = "fill_extrusion_pattern";
|
||||
static constexpr const uint8_t hash[8] = { 0x93, 0x2b, 0xd1, 0xab, 0xa3, 0xf2, 0x24, 0x63 };
|
||||
static constexpr const auto vertexOffset = 23237;
|
||||
static constexpr const auto fragmentOffset = 26157;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<FillExtrusionPatternProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<FillExtrusionPatternProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillExtrusionPatternProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<FillExtrusionPatternProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "fill_extrusion_pattern",
|
||||
programs::gl::shaderSource() + 23237, programs::gl::shaderSource() + 26157);
|
||||
return std::make_unique<gl::Program<FillExtrusionPatternProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/fill_outline_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<FillOutlineProgram> {
|
||||
static constexpr const char* name = "fill_outline";
|
||||
static constexpr const uint8_t hash[8] = { 0x56, 0x65, 0x69, 0x4b, 0x70, 0x2d, 0x3d, 0xc4 };
|
||||
static constexpr const auto vertexOffset = 13678;
|
||||
static constexpr const auto fragmentOffset = 14503;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<FillOutlineProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<FillOutlineProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillOutlineProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<FillOutlineProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "fill_outline",
|
||||
programs::gl::shaderSource() + 13678, programs::gl::shaderSource() + 14503);
|
||||
return std::make_unique<gl::Program<FillOutlineProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/fill_outline_pattern_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<FillOutlinePatternProgram> {
|
||||
static constexpr const char* name = "fill_outline_pattern";
|
||||
static constexpr const uint8_t hash[8] = { 0x56, 0x9c, 0x2f, 0x58, 0x6b, 0x31, 0xff, 0x84 };
|
||||
static constexpr const auto vertexOffset = 15092;
|
||||
static constexpr const auto fragmentOffset = 16952;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<FillOutlinePatternProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<FillOutlinePatternProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillOutlinePatternProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<FillOutlinePatternProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "fill_outline_pattern",
|
||||
programs::gl::shaderSource() + 15092, programs::gl::shaderSource() + 16952);
|
||||
return std::make_unique<gl::Program<FillOutlinePatternProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/fill_pattern_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<FillPatternProgram> {
|
||||
static constexpr const char* name = "fill_pattern";
|
||||
static constexpr const uint8_t hash[8] = { 0x74, 0xa9, 0x97, 0x01, 0x96, 0xbd, 0x87, 0x36 };
|
||||
static constexpr const auto vertexOffset = 18259;
|
||||
static constexpr const auto fragmentOffset = 20038;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<FillPatternProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<FillPatternProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<FillPatternProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<FillPatternProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "fill_pattern",
|
||||
programs::gl::shaderSource() + 18259, programs::gl::shaderSource() + 20038);
|
||||
return std::make_unique<gl::Program<FillPatternProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/heatmap_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<HeatmapProgram> {
|
||||
static constexpr const char* name = "heatmap";
|
||||
static constexpr const uint8_t hash[8] = { 0xab, 0x97, 0x81, 0x5c, 0xa2, 0x88, 0xaa, 0x7e };
|
||||
static constexpr const auto vertexOffset = 7983;
|
||||
static constexpr const auto fragmentOffset = 9030;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<HeatmapProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<HeatmapProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<HeatmapProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<HeatmapProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "heatmap",
|
||||
programs::gl::shaderSource() + 7983, programs::gl::shaderSource() + 9030);
|
||||
return std::make_unique<gl::Program<HeatmapProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/heatmap_texture_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<HeatmapTextureProgram> {
|
||||
static constexpr const char* name = "heatmap_texture";
|
||||
static constexpr const uint8_t hash[8] = { 0x9f, 0xc7, 0x56, 0xb2, 0x9e, 0x8f, 0x15, 0xff };
|
||||
static constexpr const auto vertexOffset = 9491;
|
||||
static constexpr const auto fragmentOffset = 9671;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<HeatmapTextureProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<HeatmapTextureProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<HeatmapTextureProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<HeatmapTextureProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "heatmap_texture",
|
||||
programs::gl::shaderSource() + 9491, programs::gl::shaderSource() + 9671);
|
||||
return std::make_unique<gl::Program<HeatmapTextureProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/hillshade_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<HillshadeProgram> {
|
||||
static constexpr const char* name = "hillshade";
|
||||
static constexpr const uint8_t hash[8] = { 0x8a, 0x11, 0x29, 0x18, 0x52, 0x7f, 0x3b, 0xbb };
|
||||
static constexpr const auto vertexOffset = 29340;
|
||||
static constexpr const auto fragmentOffset = 29511;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<HillshadeProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<HillshadeProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<HillshadeProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<HillshadeProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "hillshade",
|
||||
programs::gl::shaderSource() + 29340, programs::gl::shaderSource() + 29511);
|
||||
return std::make_unique<gl::Program<HillshadeProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/hillshade_prepare_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<HillshadePrepareProgram> {
|
||||
static constexpr const char* name = "hillshade_prepare";
|
||||
static constexpr const uint8_t hash[8] = { 0xe6, 0x01, 0xf2, 0xbb, 0xa0, 0x77, 0x1d, 0xeb };
|
||||
static constexpr const auto vertexOffset = 27925;
|
||||
static constexpr const auto fragmentOffset = 28218;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<HillshadePrepareProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<HillshadePrepareProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<HillshadePrepareProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<HillshadePrepareProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "hillshade_prepare",
|
||||
programs::gl::shaderSource() + 27925, programs::gl::shaderSource() + 28218);
|
||||
return std::make_unique<gl::Program<HillshadePrepareProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/line_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<LineProgram> {
|
||||
static constexpr const char* name = "line";
|
||||
static constexpr const uint8_t hash[8] = { 0x44, 0x46, 0x9e, 0x59, 0x02, 0xbb, 0xaa, 0xae };
|
||||
static constexpr const auto vertexOffset = 30585;
|
||||
static constexpr const auto fragmentOffset = 33509;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<LineProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<LineProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<LineProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<LineProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "line",
|
||||
programs::gl::shaderSource() + 30585, programs::gl::shaderSource() + 33509);
|
||||
return std::make_unique<gl::Program<LineProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/line_gradient_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<LineGradientProgram> {
|
||||
static constexpr const char* name = "line_gradient";
|
||||
static constexpr const uint8_t hash[8] = { 0xee, 0xdd, 0x10, 0x3d, 0x1a, 0x21, 0x26, 0x25 };
|
||||
static constexpr const auto vertexOffset = 34335;
|
||||
static constexpr const auto fragmentOffset = 37054;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<LineGradientProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<LineGradientProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<LineGradientProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<LineGradientProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "line_gradient",
|
||||
programs::gl::shaderSource() + 34335, programs::gl::shaderSource() + 37054);
|
||||
return std::make_unique<gl::Program<LineGradientProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/line_pattern_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<LinePatternProgram> {
|
||||
static constexpr const char* name = "line_pattern";
|
||||
static constexpr const uint8_t hash[8] = { 0x73, 0xa0, 0x59, 0x46, 0x57, 0xa5, 0x60, 0x25 };
|
||||
static constexpr const auto vertexOffset = 37841;
|
||||
static constexpr const auto fragmentOffset = 41162;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<LinePatternProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<LinePatternProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<LinePatternProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<LinePatternProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "line_pattern",
|
||||
programs::gl::shaderSource() + 37841, programs::gl::shaderSource() + 41162);
|
||||
return std::make_unique<gl::Program<LinePatternProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/line_sdf_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<LineSDFProgram> {
|
||||
static constexpr const char* name = "line_sdf";
|
||||
static constexpr const uint8_t hash[8] = { 0x66, 0x20, 0x75, 0x4e, 0xbe, 0x02, 0x9e, 0x67 };
|
||||
static constexpr const auto vertexOffset = 43475;
|
||||
static constexpr const auto fragmentOffset = 47089;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<LineSDFProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<LineSDFProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<LineSDFProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<LineSDFProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "line_sdf",
|
||||
programs::gl::shaderSource() + 43475, programs::gl::shaderSource() + 47089);
|
||||
return std::make_unique<gl::Program<LineSDFProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
const char* vertexShaderPrelude = programs::gl::shaderSource() + 0;
|
||||
const char* fragmentShaderPrelude = programs::gl::shaderSource() + 1252;
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
} // namespace mbgl
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
extern const char* vertexShaderPrelude;
|
||||
extern const char* fragmentShaderPrelude;
|
||||
constexpr const uint8_t preludeHash[8] = { 0x24, 0x91, 0x82, 0x37, 0x02, 0xad, 0x98, 0x0a };
|
||||
constexpr const auto vertexPreludeOffset = 0;
|
||||
constexpr const auto fragmentPreludeOffset = 1252;
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/raster_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<RasterProgram> {
|
||||
static constexpr const char* name = "raster";
|
||||
static constexpr const uint8_t hash[8] = { 0x40, 0x3d, 0x6c, 0xf4, 0xd0, 0x41, 0x51, 0x0e };
|
||||
static constexpr const auto vertexOffset = 48592;
|
||||
static constexpr const auto fragmentOffset = 48941;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<RasterProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<RasterProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<RasterProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<RasterProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "raster",
|
||||
programs::gl::shaderSource() + 48592, programs::gl::shaderSource() + 48941);
|
||||
return std::make_unique<gl::Program<RasterProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -8,6 +8,9 @@ namespace gl {
|
||||
|
||||
const char* shaderSource();
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <mbgl/programs/gl/shaders.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/program_parameters.hpp>
|
||||
#include <mbgl/util/string.hpp>
|
||||
@@ -9,20 +10,17 @@ namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
std::string fragmentSource(const ProgramParameters& parameters, const char* fragmentSource) {
|
||||
return parameters.getDefines() + fragmentShaderPrelude + fragmentSource;
|
||||
}
|
||||
|
||||
std::string vertexSource(const ProgramParameters& parameters, const char* vertexSource) {
|
||||
return parameters.getDefines() + vertexShaderPrelude + vertexSource;
|
||||
}
|
||||
|
||||
std::string programIdentifier(const std::string& vertexSource, const std::string& fragmentSource) {
|
||||
std::string programIdentifier(const std::string& defines1,
|
||||
const std::string& defines2,
|
||||
const uint8_t hash1[8],
|
||||
const uint8_t hash2[8]) {
|
||||
std::string result;
|
||||
result.reserve((sizeof(size_t) * 2) * 2 + 2); // 2 size_t hex values + "v2"
|
||||
result += util::toHex(std::hash<std::string>()(vertexSource));
|
||||
result += util::toHex(std::hash<std::string>()(fragmentSource));
|
||||
result += "v3";
|
||||
result.reserve(8 + 8 + (sizeof(size_t) * 2) * 2 + 2);
|
||||
result.append(util::toHex(std::hash<std::string>()(defines1)));
|
||||
result.append(util::toHex(std::hash<std::string>()(defines2)));
|
||||
result.append(hash1, hash2 + 8);
|
||||
result.append(hash2, hash2 + 8);
|
||||
result.append("v3");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ class ProgramParameters;
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
std::string fragmentSource(const ProgramParameters&, const char* fragmentSource);
|
||||
std::string vertexSource(const ProgramParameters&, const char* vertexSource);
|
||||
std::string programIdentifier(const std::string& vertexSource, const std::string& fragmentSource);
|
||||
std::string programIdentifier(const std::string& defines1,
|
||||
const std::string& defines2,
|
||||
const uint8_t hash1[8],
|
||||
const uint8_t hash2[8]);
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/symbol_icon_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<SymbolIconProgram> {
|
||||
static constexpr const char* name = "symbol_icon";
|
||||
static constexpr const uint8_t hash[8] = { 0x96, 0x0c, 0xef, 0xec, 0x37, 0x23, 0xf9, 0xb1 };
|
||||
static constexpr const auto vertexOffset = 50000;
|
||||
static constexpr const auto fragmentOffset = 52654;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<SymbolIconProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<SymbolIconProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<SymbolIconProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<SymbolIconProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "symbol_icon",
|
||||
programs::gl::shaderSource() + 50000, programs::gl::shaderSource() + 52654);
|
||||
return std::make_unique<gl::Program<SymbolIconProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/symbol_sdf_icon_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<SymbolSDFIconProgram> {
|
||||
static constexpr const char* name = "symbol_sdf_icon";
|
||||
static constexpr const uint8_t hash[8] = { 0x13, 0xfc, 0x05, 0x2a, 0xd1, 0x93, 0xfb, 0x7d };
|
||||
static constexpr const auto vertexOffset = 53059;
|
||||
static constexpr const auto fragmentOffset = 57099;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<SymbolSDFIconProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<SymbolSDFIconProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<SymbolSDFIconProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<SymbolSDFIconProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "symbol_sdf_icon",
|
||||
programs::gl::shaderSource() + 53059, programs::gl::shaderSource() + 57099);
|
||||
return std::make_unique<gl::Program<SymbolSDFIconProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#include <mbgl/programs/symbol_sdf_text_program.hpp>
|
||||
#include <mbgl/programs/gl/preludes.hpp>
|
||||
#include <mbgl/programs/gl/shader_source.hpp>
|
||||
#include <mbgl/gl/program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace programs {
|
||||
namespace gl {
|
||||
|
||||
template <typename>
|
||||
struct ShaderSource;
|
||||
|
||||
template <>
|
||||
struct ShaderSource<SymbolSDFTextProgram> {
|
||||
static constexpr const char* name = "symbol_sdf_text";
|
||||
static constexpr const uint8_t hash[8] = { 0x13, 0xfc, 0x05, 0x2a, 0xd1, 0x93, 0xfb, 0x7d };
|
||||
static constexpr const auto vertexOffset = 53059;
|
||||
static constexpr const auto fragmentOffset = 57099;
|
||||
};
|
||||
|
||||
constexpr const char* ShaderSource<SymbolSDFTextProgram>::name;
|
||||
constexpr const uint8_t ShaderSource<SymbolSDFTextProgram>::hash[8];
|
||||
|
||||
} // namespace gl
|
||||
} // namespace programs
|
||||
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<Program<SymbolSDFTextProgram>>
|
||||
Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
|
||||
return gl::Program<SymbolSDFTextProgram>::createProgram(
|
||||
reinterpret_cast<gl::Context&>(*this), programParameters, "symbol_sdf_text",
|
||||
programs::gl::shaderSource() + 53059, programs::gl::shaderSource() + 57099);
|
||||
return std::make_unique<gl::Program<SymbolSDFTextProgram>>(programParameters);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
HeatmapLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters)
|
||||
: heatmap(context, programParameters),
|
||||
heatmapTexture(context, programParameters) {}
|
||||
ProgramMap<HeatmapProgram> heatmap;
|
||||
HeatmapProgram heatmap;
|
||||
HeatmapTextureProgram heatmapTexture;
|
||||
};
|
||||
|
||||
|
||||
@@ -189,10 +189,10 @@ public:
|
||||
lineGradient(context, programParameters),
|
||||
lineSDF(context, programParameters),
|
||||
linePattern(context, programParameters) {}
|
||||
ProgramMap<LineProgram> line;
|
||||
ProgramMap<LineGradientProgram> lineGradient;
|
||||
ProgramMap<LineSDFProgram> lineSDF;
|
||||
ProgramMap<LinePatternProgram> linePattern;
|
||||
LineProgram line;
|
||||
LineGradientProgram lineGradient;
|
||||
LineSDFProgram lineSDF;
|
||||
LinePatternProgram linePattern;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -109,36 +109,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class Program>
|
||||
class ProgramMap {
|
||||
public:
|
||||
using PaintProperties = typename Program::PaintProperties;
|
||||
using Binders = typename Program::Binders;
|
||||
using Bitset = typename Binders::Bitset;
|
||||
|
||||
ProgramMap(gfx::Context& context_, ProgramParameters parameters_)
|
||||
: context(context_),
|
||||
parameters(std::move(parameters_)) {
|
||||
}
|
||||
|
||||
Program& get(const typename PaintProperties::PossiblyEvaluated& currentProperties) {
|
||||
Bitset bits = Binders::constants(currentProperties);
|
||||
auto it = programs.find(bits);
|
||||
if (it != programs.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return programs.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(bits),
|
||||
std::forward_as_tuple(context,
|
||||
parameters.withAdditionalDefines(Binders::defines(currentProperties)))).first->second;
|
||||
}
|
||||
|
||||
private:
|
||||
gfx::Context& context;
|
||||
ProgramParameters parameters;
|
||||
std::unordered_map<Bitset, Program> programs;
|
||||
};
|
||||
|
||||
class LayerTypePrograms {
|
||||
public:
|
||||
virtual ~LayerTypePrograms() = default;
|
||||
|
||||
@@ -40,13 +40,4 @@ optional<std::string> ProgramParameters::cachePath(const char* name) const {
|
||||
}
|
||||
}
|
||||
|
||||
ProgramParameters ProgramParameters::withAdditionalDefines(const std::vector<std::string>& additionalDefines) const {
|
||||
ProgramParameters result(*this);
|
||||
for (const auto& define : additionalDefines) {
|
||||
result.defines += define;
|
||||
result.defines += "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <mbgl/util/optional.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
@@ -14,8 +13,6 @@ public:
|
||||
const std::string& getDefines() const;
|
||||
optional<std::string> cachePath(const char* name) const;
|
||||
|
||||
ProgramParameters withAdditionalDefines(const std::vector<std::string>& defines) const;
|
||||
|
||||
private:
|
||||
std::string defines;
|
||||
optional<std::string> cacheDir;
|
||||
|
||||
@@ -468,9 +468,9 @@ public:
|
||||
symbolGlyph(context, programParameters),
|
||||
collisionBox(context, programParameters),
|
||||
collisionCircle(context, programParameters) {}
|
||||
ProgramMap<SymbolIconProgram> symbolIcon;
|
||||
ProgramMap<SymbolSDFIconProgram> symbolIconSDF;
|
||||
ProgramMap<SymbolSDFTextProgram> symbolGlyph;
|
||||
SymbolIconProgram symbolIcon;
|
||||
SymbolSDFIconProgram symbolIconSDF;
|
||||
SymbolSDFTextProgram symbolGlyph;
|
||||
CollisionBoxProgram collisionBox;
|
||||
CollisionCircleProgram collisionCircle;
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ void RenderCircleLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
|
||||
const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID());
|
||||
|
||||
auto& programInstance = parameters.programs.getCircleLayerPrograms().circle.get(evaluated);
|
||||
auto& programInstance = parameters.programs.getCircleLayerPrograms().circle;
|
||||
|
||||
const auto allUniformValues = programInstance.computeAllUniformValues(
|
||||
CircleProgram::LayoutUniformValues {
|
||||
|
||||
@@ -119,7 +119,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
|
||||
FillExtrusionBucket& bucket = *bucket_;
|
||||
|
||||
draw(
|
||||
parameters.programs.getFillExtrusionLayerPrograms().fillExtrusion.get(evaluated),
|
||||
parameters.programs.getFillExtrusionLayerPrograms().fillExtrusion,
|
||||
bucket,
|
||||
FillExtrusionProgram::layoutUniformValues(
|
||||
tile.translatedClipMatrix(evaluated.get<FillExtrusionTranslate>(),
|
||||
@@ -146,7 +146,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
|
||||
FillExtrusionBucket& bucket = *bucket_;
|
||||
|
||||
draw(
|
||||
parameters.programs.getFillExtrusionLayerPrograms().fillExtrusionPattern.get(evaluated),
|
||||
parameters.programs.getFillExtrusionLayerPrograms().fillExtrusionPattern,
|
||||
bucket,
|
||||
FillExtrusionPatternProgram::layoutUniformValues(
|
||||
tile.translatedClipMatrix(evaluated.get<FillExtrusionTranslate>(),
|
||||
|
||||
@@ -74,14 +74,12 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
}
|
||||
FillBucket& bucket = *bucket_;
|
||||
|
||||
auto draw = [&] (auto& program,
|
||||
auto draw = [&] (auto& programInstance,
|
||||
const auto& drawMode,
|
||||
const auto& depthMode,
|
||||
const auto& indexBuffer,
|
||||
const auto& segments,
|
||||
auto&& textureBindings) {
|
||||
auto& programInstance = program.get(evaluated);
|
||||
|
||||
const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID());
|
||||
|
||||
const auto allUniformValues = programInstance.computeAllUniformValues(
|
||||
@@ -162,14 +160,12 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
}
|
||||
FillBucket& bucket = *bucket_;
|
||||
|
||||
auto draw = [&] (auto& program,
|
||||
auto draw = [&] (auto& programInstance,
|
||||
const auto& drawMode,
|
||||
const auto& depthMode,
|
||||
const auto& indexBuffer,
|
||||
const auto& segments,
|
||||
auto&& textureBindings) {
|
||||
auto& programInstance = program.get(evaluated);
|
||||
|
||||
const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID());
|
||||
paintPropertyBinders.setPatternParameters(patternPosA, patternPosB, crossfade);
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
|
||||
const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID());
|
||||
|
||||
auto& programInstance = parameters.programs.getHeatmapLayerPrograms().heatmap.get(evaluated);
|
||||
auto& programInstance = parameters.programs.getHeatmapLayerPrograms().heatmap;
|
||||
|
||||
const auto allUniformValues = programInstance.computeAllUniformValues(
|
||||
HeatmapProgram::LayoutUniformValues {
|
||||
|
||||
@@ -65,11 +65,10 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
}
|
||||
LineBucket& bucket = *bucket_;
|
||||
|
||||
auto draw = [&](auto& program, auto&& uniformValues,
|
||||
auto draw = [&](auto& programInstance,
|
||||
auto&& uniformValues,
|
||||
const optional<ImagePosition>& patternPositionA,
|
||||
const optional<ImagePosition>& patternPositionB, auto&& textureBindings) {
|
||||
auto& programInstance = program.get(evaluated);
|
||||
|
||||
const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID());
|
||||
|
||||
paintPropertyBinders.setPatternParameters(patternPositionA, patternPositionB, crossfade);
|
||||
|
||||
@@ -88,17 +88,14 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
const auto& evaluated_ = bucketPaintProperties.evaluated;
|
||||
const auto& layout = bucket.layout;
|
||||
|
||||
auto draw = [&] (auto& program,
|
||||
auto draw = [&] (auto& programInstance,
|
||||
auto&& uniformValues,
|
||||
const auto& buffers,
|
||||
const auto& symbolSizeBinder,
|
||||
const SymbolPropertyValues& values_,
|
||||
const auto& binders,
|
||||
const auto& paintProperties,
|
||||
auto&& textureBindings)
|
||||
{
|
||||
auto& programInstance = program.get(paintProperties);
|
||||
|
||||
auto&& textureBindings) {
|
||||
const auto allUniformValues = programInstance.computeAllUniformValues(
|
||||
std::move(uniformValues),
|
||||
*symbolSizeBinder,
|
||||
|
||||
@@ -545,33 +545,6 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class>
|
||||
struct UniformDefines;
|
||||
|
||||
template <class... Us>
|
||||
struct UniformDefines<TypeList<Us...>> {
|
||||
static constexpr auto define() {
|
||||
return "#define HAS_UNIFORM_u_";
|
||||
}
|
||||
|
||||
static void appendDefines(std::vector<std::string>& defines) {
|
||||
util::ignore({
|
||||
(defines.push_back(concat_literals<&define, &Us::name, &string_literal<'\n'>::value>::value()), 0)...
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
template <class EvaluatedProperties>
|
||||
static std::vector<std::string> defines(const EvaluatedProperties& currentProperties) {
|
||||
std::vector<std::string> result;
|
||||
util::ignore({
|
||||
(currentProperties.template get<Ps>().isConstant()
|
||||
? UniformDefines<typename Ps::UniformList>::appendDefines(result)
|
||||
: (void) 0, 0)...
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
Binders binders;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user