summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-03-21 14:31:49 +0100
committerKonstantin Käfer <mail@kkaefer.com>2019-03-21 14:31:49 +0100
commit0a7b1b0fe05f62667dd229d170f738132968085d (patch)
treeef617a2d2c7a5389f35d549d79812098e973cc5e
parent5da2f0dd4fe85d1fbf2caf0388c44a6e84bcbbbe (diff)
downloadqtlocation-mapboxgl-0a7b1b0fe05f62667dd229d170f738132968085d.tar.gz
[xxx] rename uniformvalues
-rw-r--r--src/mbgl/gl/program.hpp22
-rw-r--r--src/mbgl/gl/texture.hpp15
2 files changed, 16 insertions, 21 deletions
diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp
index cb6c118fe1..6a4693b033 100644
--- a/src/mbgl/gl/program.hpp
+++ b/src/mbgl/gl/program.hpp
@@ -29,10 +29,6 @@ class Program {
public:
using Primitive = P;
- using AttributeBindings = gfx::AttributeBindings<AttributeList>;
- using UniformValues = gfx::UniformValues<UniformList>;
- using TextureBindings = gfx::TextureBindings<TextureList>;
-
Program(Context& context, const std::string& vertexSource, const std::string& fragmentSource)
: program(
context.createProgram(context.createShader(ShaderType::Vertex, vertexSource),
@@ -46,7 +42,7 @@ public:
uniformStates.queryLocations(program);
// Texture units are specified via uniforms as well, so we need query their locations
- textures.queryLocations(program);
+ textureStates.queryLocations(program);
}
template <class BinaryProgram>
@@ -54,7 +50,7 @@ public:
: program(context.createProgram(binaryProgram.format(), binaryProgram.code())),
attributeLocations(binaryProgram) {
uniformStates.loadNamedLocations(binaryProgram);
- textures.loadNamedLocations(binaryProgram);
+ textureStates.loadNamedLocations(binaryProgram);
}
static Program createProgram(gl::Context& context,
@@ -115,7 +111,7 @@ public:
identifier,
attributeLocations.getNamedLocations(),
uniformStates.getNamedLocations(),
- textures.getNamedLocations() };
+ textureStates.getNamedLocations() };
}
return {};
}
@@ -127,10 +123,10 @@ public:
gfx::StencilMode stencilMode,
gfx::ColorMode colorMode,
gfx::CullFaceMode cullFaceMode,
- const UniformValues& uniformValues,
+ const gfx::UniformValues<UniformList>& uniformValues,
gfx::DrawScope& drawScope,
- const AttributeBindings& attributeBindings,
- const TextureBindings& textureBindings,
+ const gfx::AttributeBindings<AttributeList>& attributeBindings,
+ const gfx::TextureBindings<TextureList>& textureBindings,
const gfx::IndexBuffer& indexBuffer,
std::size_t indexOffset,
std::size_t indexLength) {
@@ -147,7 +143,7 @@ public:
uniformStates.bind(uniformValues);
- textures.bind(context, textureBindings);
+ textureStates.bind(context, textureBindings);
auto& vertexArray = reinterpret_cast<gl::DrawScopeResource&>(*drawScope.resource).vertexArray;
vertexArray.bind(context,
@@ -162,9 +158,9 @@ public:
private:
UniqueProgram program;
- gl::UniformStates<UniformList> uniformStates;
gl::AttributeLocations<AttributeList> attributeLocations;
- gl::Textures<TextureList> textures;
+ gl::UniformStates<UniformList> uniformStates;
+ gl::TextureStates<TextureList> textureStates;
};
} // namespace gl
diff --git a/src/mbgl/gl/texture.hpp b/src/mbgl/gl/texture.hpp
index 8230be1652..0569adc3b0 100644
--- a/src/mbgl/gl/texture.hpp
+++ b/src/mbgl/gl/texture.hpp
@@ -15,13 +15,15 @@ class Context;
void bindTexture(gl::Context&, uint8_t unit, const gfx::TextureBinding&);
template <class>
-class Textures;
+class TextureStates;
template <class... Ts>
-class Textures<TypeList<Ts...>> {
+class TextureStates<TypeList<Ts...>> {
+private:
using State =
IndexedTuple<TypeList<Ts...>, TypeList<ExpandToType<Ts, gl::UniformState<uint8_t>>...>>;
- using NamedLocations = std::vector<std::pair<const std::string, gl::UniformLocation>>;
+
+ State state;
public:
void queryLocations(const ProgramID& id) {
@@ -33,8 +35,8 @@ public:
state = State{ program.textureLocation(Ts::name())... };
}
- NamedLocations getNamedLocations() const {
- return NamedLocations{ { Ts::name(), state.template get<Ts>().location }... };
+ NamedUniformLocations getNamedLocations() const {
+ return NamedUniformLocations{ { Ts::name(), state.template get<Ts>().location }... };
}
void bind(gl::Context& context, const gfx::TextureBindings<TypeList<Ts...>>& bindings) {
@@ -43,9 +45,6 @@ public:
gl::bindTexture(context, TypeIndex<Ts, Ts...>::value, bindings.template get<Ts>()),
0)... });
}
-
-private:
- State state;
};
} // namespace gl