From 0a7b1b0fe05f62667dd229d170f738132968085d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Thu, 21 Mar 2019 14:31:49 +0100 Subject: [xxx] rename uniformvalues --- src/mbgl/gl/program.hpp | 22 +++++++++------------- src/mbgl/gl/texture.hpp | 15 +++++++-------- 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; - using UniformValues = gfx::UniformValues; - using TextureBindings = gfx::TextureBindings; - 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 @@ -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& uniformValues, gfx::DrawScope& drawScope, - const AttributeBindings& attributeBindings, - const TextureBindings& textureBindings, + const gfx::AttributeBindings& attributeBindings, + const gfx::TextureBindings& 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(*drawScope.resource).vertexArray; vertexArray.bind(context, @@ -162,9 +158,9 @@ public: private: UniqueProgram program; - gl::UniformStates uniformStates; gl::AttributeLocations attributeLocations; - gl::Textures textures; + gl::UniformStates uniformStates; + gl::TextureStates 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 Textures; +class TextureStates; template -class Textures> { +class TextureStates> { +private: using State = IndexedTuple, TypeList>...>>; - using NamedLocations = std::vector>; + + 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().location }... }; + NamedUniformLocations getNamedLocations() const { + return NamedUniformLocations{ { Ts::name(), state.template get().location }... }; } void bind(gl::Context& context, const gfx::TextureBindings>& bindings) { @@ -43,9 +45,6 @@ public: gl::bindTexture(context, TypeIndex::value, bindings.template get()), 0)... }); } - -private: - State state; }; } // namespace gl -- cgit v1.2.1