mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-16 23:17:29 +00:00
gl: Properly preserve texture state
- Remove rogue glBindTexture calls and use gl commandstate object instead
This commit is contained in:
parent
fcc6c2384b
commit
964fd1095e
@ -415,7 +415,7 @@ void GLGSRender::bind_texture_env()
|
||||
}
|
||||
else
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, GL_NONE);
|
||||
cmd->bind_texture(GL_VERTEX_TEXTURES_START + i, GL_TEXTURE_2D, GL_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1460,7 +1460,7 @@ namespace gl
|
||||
|
||||
rsx::format_class m_format_class = RSX_FORMAT_CLASS_UNDEFINED;
|
||||
|
||||
private:
|
||||
public:
|
||||
class save_binding_state
|
||||
{
|
||||
GLenum target = GL_NONE;
|
||||
@ -1498,7 +1498,7 @@ namespace gl
|
||||
glBindTexture(target, old_binding);
|
||||
}
|
||||
};
|
||||
public:
|
||||
|
||||
texture(const texture&) = delete;
|
||||
texture(texture&& texture_) = delete;
|
||||
|
||||
@ -1870,6 +1870,7 @@ namespace gl
|
||||
component_swizzle[2] = argb_swizzle[3];
|
||||
component_swizzle[3] = argb_swizzle[0];
|
||||
|
||||
texture::save_binding_state save(m_target);
|
||||
glBindTexture(m_target, m_id);
|
||||
glTexParameteriv(m_target, GL_TEXTURE_SWIZZLE_RGBA, reinterpret_cast<GLint*>(component_swizzle));
|
||||
}
|
||||
@ -1886,6 +1887,7 @@ namespace gl
|
||||
constexpr u32 depth_stencil_mask = (image_aspect::depth | image_aspect::stencil);
|
||||
ensure((aspect_flags & depth_stencil_mask) != depth_stencil_mask); // "Invalid aspect mask combination"
|
||||
|
||||
texture::save_binding_state save(m_target);
|
||||
glBindTexture(m_target, m_id);
|
||||
glTexParameteri(m_target, GL_DEPTH_STENCIL_TEXTURE_MODE, GL_STENCIL_INDEX);
|
||||
}
|
||||
@ -2628,15 +2630,6 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
/*int texture(GLint location, int active_texture, const gl::texture_view& texture)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + active_texture);
|
||||
texture.bind();
|
||||
(*this)[location] = active_texture;
|
||||
|
||||
return active_texture;
|
||||
}*/
|
||||
|
||||
uniform_t operator[](GLint location)
|
||||
{
|
||||
return{ m_program, location };
|
||||
|
@ -465,7 +465,7 @@ namespace gl
|
||||
case rsx::overlays::image_resource_id::none:
|
||||
{
|
||||
texture_read = GL_FALSE;
|
||||
glBindTexture(GL_TEXTURE_2D, GL_NONE);
|
||||
cmd_->bind_texture(31, GL_TEXTURE_2D, GL_NONE);
|
||||
break;
|
||||
}
|
||||
case rsx::overlays::image_resource_id::raw_image:
|
||||
@ -476,14 +476,12 @@ namespace gl
|
||||
case rsx::overlays::image_resource_id::font_file:
|
||||
{
|
||||
texture_read = (GL_TRUE + 1);
|
||||
glActiveTexture(GL_TEXTURE0 + 30);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, find_font(cmd.config.font_ref)->id());
|
||||
glActiveTexture(GL_TEXTURE0 + 31);
|
||||
cmd_->bind_texture(30, GL_TEXTURE_2D_ARRAY, find_font(cmd.config.font_ref)->id());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, view_cache[cmd.config.texture_ref - 1]->id());
|
||||
cmd_->bind_texture(30, GL_TEXTURE_2D, view_cache[cmd.config.texture_ref - 1]->id());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -671,6 +671,7 @@ namespace gl
|
||||
caps.supports_vtc_decoding = driver_caps.vendor_NVIDIA;
|
||||
unpack_settings.apply();
|
||||
|
||||
texture::save_binding_state save(static_cast<GLenum>(dst->get_target()));
|
||||
glBindTexture(static_cast<GLenum>(dst->get_target()), dst->id());
|
||||
|
||||
const GLsizei format_block_size = (format == CELL_GCM_TEXTURE_COMPRESSED_DXT1) ? 8 : 16;
|
||||
|
Loading…
Reference in New Issue
Block a user