2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #2422 from ReinUsesLisp/fixup-samplers

gl_state: Fix samplers memory corruption
This commit is contained in:
Hexagon12 2019-04-23 18:30:35 +03:00 committed by GitHub
commit 8df9449bb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -471,8 +471,9 @@ void OpenGLState::ApplyTextures() const {
const auto& texture_unit = texture_units[i];
auto& cur_state_texture_unit = cur_state.texture_units[i];
textures[i] = texture_unit.texture;
if (cur_state_texture_unit.texture == textures[i])
if (cur_state_texture_unit.texture == textures[i]) {
continue;
}
cur_state_texture_unit.texture = textures[i];
if (!has_delta) {
first = i;
@ -493,10 +494,11 @@ void OpenGLState::ApplySamplers() const {
std::array<GLuint, Maxwell::NumTextureSamplers> samplers;
for (std::size_t i = 0; i < std::size(samplers); ++i) {
if (cur_state.texture_units[i].sampler == texture_units[i].sampler)
continue;
cur_state.texture_units[i].sampler = texture_units[i].sampler;
samplers[i] = texture_units[i].sampler;
if (cur_state.texture_units[i].sampler == texture_units[i].sampler) {
continue;
}
cur_state.texture_units[i].sampler = texture_units[i].sampler;
if (!has_delta) {
first = i;
has_delta = true;