Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-10-05 02:21:46 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-10-05 02:21:46 +0400
commit1e0f02c2ef1e89ceb9840ef59ca2c7067a817e72 (patch)
tree28a5926bb629c5d800c32aa5016bfa109e9c6174 /source/blender/gpu
parent639a4ff4364ecc0b2dd710cd28b935ef06227d36 (diff)
Fix for bug #17684: GLSL bug with shadows and material nodes,
missed unbinding a texture giving extremely slow frontbuffer drawing.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 1c29bdc8741..94c1910e3bc 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -516,10 +516,14 @@ static void codegen_set_unique_ids(ListBase *nodes)
input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, input->ima));
}
else {
- /* input is user created texture, we know there there is
- only one, so assign new texid */
- input->bindtex = 1;
- input->texid = texid++;
+ if (!BLI_ghash_haskey(bindhash, input->tex)) {
+ /* input is user created texture, check tex pointer */
+ input->texid = texid++;
+ input->bindtex = 1;
+ BLI_ghash_insert(bindhash, input->tex, SET_INT_IN_POINTER(input->texid));
+ }
+ else
+ input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, input->tex));
}
/* make sure this pixel is defined exactly once */
@@ -836,11 +840,9 @@ void GPU_pass_bind(GPUPass *pass, double time)
if (input->ima)
input->tex = GPU_texture_from_blender(input->ima, input->iuser, time);
- if(input->ima || input->tex) {
- if(input->tex) {
- GPU_texture_bind(input->tex, input->texid);
- GPU_shader_uniform_texture(shader, input->shaderloc, input->tex);
- }
+ if(input->tex && input->bindtex) {
+ GPU_texture_bind(input->tex, input->texid);
+ GPU_shader_uniform_texture(shader, input->shaderloc, input->tex);
}
}
}
@@ -871,9 +873,9 @@ void GPU_pass_unbind(GPUPass *pass)
return;
for (input=inputs->first; input; input=input->next) {
- if (input->tex)
- if(input->bindtex)
- GPU_texture_unbind(input->tex);
+ if(input->tex && input->bindtex)
+ GPU_texture_unbind(input->tex);
+
if (input->ima)
input->tex = 0;
}