Fix T52855: Eevee: viewport artifacts

Partial revert of 9068c0743e.
This commit tried to do two things:

(1) Fix UBO binding logic [good]
(2) "Improve" texture binding logic [bad]

Don't ever mix different fixes and refactors in the same commit.
This commit is contained in:
Dalai Felinto 2017-09-21 17:40:08 +02:00
parent a99c64b12f
commit 803c757c2b
Notes: blender-bot 2023-02-14 10:43:47 +01:00
Referenced by commit d97f52f015, Revert "Fix T52855: Eevee: viewport artifacts"
Referenced by issue #52866, Eevee: Texture and colorramp issues
Referenced by issue #52855, Eevee: viewport artifacts
1 changed files with 4 additions and 7 deletions

View File

@ -364,8 +364,6 @@ static struct DRWResourceState {
GPUTexture **bound_texs;
bool *bound_tex_slots;
int bind_tex_inc;
int bind_ubo_inc;
} RST = {NULL};
@ -1839,11 +1837,10 @@ static void bind_texture(GPUTexture *tex)
int bind_num = GPU_texture_bound_number(tex);
if (bind_num == -1) {
for (int i = 0; i < GPU_max_textures(); ++i) {
RST.bind_tex_inc = (RST.bind_tex_inc + 1) % GPU_max_textures();
if (RST.bound_tex_slots[RST.bind_tex_inc] == false) {
GPU_texture_bind(tex, RST.bind_tex_inc);
RST.bound_texs[RST.bind_tex_inc] = tex;
RST.bound_tex_slots[RST.bind_tex_inc] = true;
if (RST.bound_tex_slots[i] == false) {
GPU_texture_bind(tex, i);
RST.bound_texs[i] = tex;
RST.bound_tex_slots[i] = true;
return;
}
}