gl: fixed multiple textures binding

This commit is contained in:
DHrpcs3 2016-01-05 22:38:18 +02:00
parent 509bbddac1
commit dbccf5fbad
3 changed files with 7 additions and 5 deletions

View file

@ -325,13 +325,15 @@ void GLGSRender::end()
for (int i = 0; i < rsx::limits::textures_count; ++i)
{
if (!textures[i].enabled())
{
continue;
}
int location;
if (m_program->uniforms.has_location("tex" + std::to_string(i), &location))
{
__glcheck m_gl_textures[i].init(textures[i]);
__glcheck m_program->uniforms.texture(location, i, gl::texture_view(gl::texture::target::texture2D, m_gl_textures[i].id()));
__glcheck m_gl_textures[i].init(i, textures[i]);
glProgramUniform1i(m_program->id(), location, i);
}
}

View file

@ -51,7 +51,6 @@ namespace rsx
}
glGenTextures(1, &m_id);
bind();
}
int texture::gl_wrap(int wrap)
@ -90,13 +89,14 @@ namespace rsx
return 1.0f;
}
void texture::init(rsx::texture& tex)
void texture::init(int index, rsx::texture& tex)
{
if (!m_id)
{
create();
}
glActiveTexture(GL_TEXTURE0 + index);
bind();
const u32 texaddr = rsx::get_address(tex.offset(), tex.location());

View file

@ -34,7 +34,7 @@ namespace rsx
return (v << 2) | (v >> 4);
}
void init(rsx::texture& tex);
void init(int index, rsx::texture& tex);
void bind();
void unbind();
void remove();