mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 13:26:30 -05:00
gl_state: Fix samplers memory corruption
It was possible for "samplers" to be read without being written. This addresses that.
This commit is contained in:
parent
83b830eb2f
commit
d74cb16535
1 changed files with 6 additions and 4 deletions
|
@ -471,8 +471,9 @@ void OpenGLState::ApplyTextures() const {
|
||||||
const auto& texture_unit = texture_units[i];
|
const auto& texture_unit = texture_units[i];
|
||||||
auto& cur_state_texture_unit = cur_state.texture_units[i];
|
auto& cur_state_texture_unit = cur_state.texture_units[i];
|
||||||
textures[i] = texture_unit.texture;
|
textures[i] = texture_unit.texture;
|
||||||
if (cur_state_texture_unit.texture == textures[i])
|
if (cur_state_texture_unit.texture == textures[i]) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
cur_state_texture_unit.texture = textures[i];
|
cur_state_texture_unit.texture = textures[i];
|
||||||
if (!has_delta) {
|
if (!has_delta) {
|
||||||
first = i;
|
first = i;
|
||||||
|
@ -493,10 +494,11 @@ void OpenGLState::ApplySamplers() const {
|
||||||
std::array<GLuint, Maxwell::NumTextureSamplers> samplers;
|
std::array<GLuint, Maxwell::NumTextureSamplers> samplers;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < std::size(samplers); ++i) {
|
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;
|
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) {
|
if (!has_delta) {
|
||||||
first = i;
|
first = i;
|
||||||
has_delta = true;
|
has_delta = true;
|
||||||
|
|
Loading…
Reference in a new issue