[drape] remove texture from GLState

This commit is contained in:
ExMix 2014-02-24 16:23:16 +03:00 committed by Alex Zolotarev
parent 6b840c4e95
commit ae3b4fbdf8
6 changed files with 6 additions and 30 deletions

View file

@ -147,7 +147,7 @@ UNIT_TEST(BatchLists_Test)
EXPECTGL(glDeleteProgram(ProgramID));
}
GLState state(0, 0, TextureBinding("", false, 0, RefPointer<Texture>()));
GLState state(0, 0);
BindingInfo binding(1);
BindingDecl & decl = binding.GetBindingDecl(0);

View file

@ -3,10 +3,9 @@
#include "../std/bind.hpp"
GLState::GLState(uint32_t gpuProgramIndex, int16_t depthLayer, const TextureBinding & texture)
GLState::GLState(uint32_t gpuProgramIndex, int16_t depthLayer)
: m_gpuProgramIndex(gpuProgramIndex)
, m_depthLayer(depthLayer)
, m_texture(texture)
{
}
@ -14,17 +13,6 @@ int GLState::GetProgramIndex() const
{
return m_gpuProgramIndex;
}
const TextureBinding & GLState::GetTextureBinding() const
{
return m_texture;
}
TextureBinding & GLState::GetTextureBinding()
{
return m_texture;
}
const UniformValuesStorage &GLState::GetUniformValues() const
{
return m_uniforms;
@ -50,13 +38,5 @@ void ApplyUniforms(const UniformValuesStorage & uniforms, RefPointer<GpuProgram>
void ApplyState(GLState state, RefPointer<GpuProgram> program)
{
TextureBinding & binding = state.GetTextureBinding();
if (binding.IsEnabled())
{
int8_t textureLocation = program->GetUniformLocation(binding.GetUniformName());
if (textureLocation != -1)
binding.Bind(textureLocation);
}
ApplyUniforms(state.GetUniformValues(), program);
}

View file

@ -8,11 +8,9 @@
class GLState
{
public:
GLState(uint32_t gpuProgramIndex, int16_t depthLayer, const TextureBinding & texture);
GLState(uint32_t gpuProgramIndex, int16_t depthLayer);
int GetProgramIndex() const;
const TextureBinding & GetTextureBinding() const;
TextureBinding & GetTextureBinding();
const UniformValuesStorage & GetUniformValues() const;
UniformValuesStorage & GetUniformValues();
@ -29,7 +27,6 @@ public:
private:
uint32_t m_gpuProgramIndex;
uint16_t m_depthLayer;
TextureBinding m_texture;
UniformValuesStorage m_uniforms;
};

View file

@ -105,8 +105,7 @@ void ListGenerator::Generate(int count, Batcher & batcher)
provider.InitStream(1, info, MakeStackRefPointer(&depthMemory[0]));
}
TextureBinding textureBinding("", false, 0, RefPointer<Texture>());
GLState state(m_programIndex, (int16_t)m_depth, textureBinding);
GLState state(m_programIndex, (int16_t)m_depth);
state.GetUniformValues() = m_uniforms;
batcher.InsertTriangleList(state, MakeStackRefPointer(&provider));
}

View file

@ -21,7 +21,7 @@ namespace df
void AreaShape::Draw(RefPointer<Batcher> batcher) const
{
GLState state(gpu::SOLID_AREA_PROGRAM, 0, TextureBinding("", false, 0, MakeStackRefPointer<Texture>(NULL)));
GLState state(gpu::SOLID_AREA_PROGRAM, 0);
float r, g, b, a;
::Convert(m_color, r, g, b, a);
state.GetUniformValues().SetFloatValue("color", r, g, b, a);

View file

@ -197,7 +197,7 @@ namespace df
}
//
GLState state(gpu::SOLID_LINE_PROGRAM, 0, TextureBinding("", false, 0, MakeStackRefPointer<Texture>(NULL)));
GLState state(gpu::SOLID_LINE_PROGRAM, 0);
float r, g, b, a;
::Convert(GetColor(), r, g, b, a);
state.GetUniformValues().SetFloatValue("u_color", r, g, b, a);