Files
MapLibreParticleLab/include/mbgl/shaders/gl/shader_program_gl.hpp
Stefan Karschti 7f33ddfef4 Raster layer (Tiles) #1168 (#1195)
Co-authored-by: Bart Louwers <bart@emeel.net>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tim Sylvester <tim@wetdogweather.com>
Co-authored-by: Alex Cristici <alex.cristici@gmail.com>
2023-08-31 15:36:19 +02:00

53 lines
1.9 KiB
C++

#pragma once
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/uniform_block_gl.hpp>
#include <mbgl/gl/vertex_attribute_gl.hpp>
#include <mbgl/shaders/shader_program_base.hpp>
namespace mbgl {
class ProgramParameters;
namespace gl {
class ShaderProgramGL final : public gfx::ShaderProgramBase {
public:
ShaderProgramGL(UniqueProgram&& glProgram_);
ShaderProgramGL(UniqueProgram&&, UniformBlockArrayGL&& uniformBlocks, VertexAttributeArrayGL&& attributes);
ShaderProgramGL(ShaderProgramGL&& other);
~ShaderProgramGL() noexcept override = default;
static constexpr std::string_view Name{"GenericGLShader"};
const std::string_view typeName() const noexcept override { return Name; }
static std::shared_ptr<ShaderProgramGL> create(Context&,
const ProgramParameters& programParameters,
const std::string& name,
const std::string& vertexSource,
const std::string& fragmentSource,
const std::string& additionalDefines = "") noexcept(false);
std::optional<uint32_t> getSamplerLocation(const std::string& name) const override;
const gfx::UniformBlockArray& getUniformBlocks() const override { return uniformBlocks; }
const gfx::VertexAttributeArray& getVertexAttributes() const override { return vertexAttributes; }
ProgramID getGLProgramID() const { return glProgram; }
protected:
gfx::UniformBlockArray& mutableUniformBlocks() override { return uniformBlocks; }
gfx::VertexAttributeArray& mutableVertexAttributes() override { return vertexAttributes; }
protected:
UniqueProgram glProgram;
UniformBlockArrayGL uniformBlocks;
VertexAttributeArrayGL vertexAttributes;
};
} // namespace gl
} // namespace mbgl