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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-04-10 20:28:26 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-04-10 20:28:26 +0400
commita08fdf1f2a31a8107520ab7c7902d365d5cf3959 (patch)
tree8d8e18c348e286f29991ed08006c58476b894057 /source/blender/editors/space_view3d/drawmesh.c
parent297fde9e5f6ea84eadce49689dc59409ed34c532 (diff)
Fix #30874: Single texture display in Edit Mode
It was a regression since 2.62 caused by how texface is passing to drawParamsMapped Previously it was used from CD layer but now it's getting copied from MexPoly into a variable allocated in stack for function void emDM_drawFacesTex_common. To set texture needed to draw particular face function set_draw_settings_cached is used, which tries to not to copy texture into GPU when it's not needed (for example, when drawing bunch of faces with the same texture) and one of condition if texture should be updated in GPU was comparing address of texface passed to this function and cached texface. But this address are exactly the sane and points to a memory inside stack of emDM_drawFacesTex_common. Fixed by cacheing texface content, not it's address.
Diffstat (limited to 'source/blender/editors/space_view3d/drawmesh.c')
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index dacefabd92b..88f0e86cddb 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -242,21 +242,25 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
{
static Material *c_ma;
static int c_textured;
- static MTFace *c_texface;
+ static MTFace c_texface;
static int c_backculled;
static int c_badtex;
static int c_lit;
+ static int c_has_texface;
Object *litob = NULL; //to get mode to turn off mipmap in painting mode
int backculled = GEMAT_BACKCULL;
int alphablend = 0;
int textured = 0;
int lit = 0;
-
+ int has_texface = texface != NULL;
+ int need_set_tpage = FALSE;
+
if (clearcache) {
c_textured = c_lit = c_backculled = -1;
- c_texface = (MTFace *) -1;
+ memset(&c_texface, 0, sizeof(MTFace));
c_badtex = 0;
+ c_has_texface = -1;
}
else {
textured = gtexdraw.istex;
@@ -290,7 +294,12 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
c_backculled = backculled;
}
- if (textured != c_textured || texface != c_texface) {
+ /* need to re-set tpage if textured flag changed or existsment of texface changed.. */
+ need_set_tpage = textured != c_textured || has_texface != c_has_texface;
+ /* ..or if settings inside texface were changed (if texface was used) */
+ need_set_tpage |= texface && memcmp(&c_texface, texface, sizeof(c_texface));
+
+ if (need_set_tpage) {
if (textured) {
c_badtex = !GPU_set_tpage(texface, !(litob->mode & OB_MODE_TEXTURE_PAINT), alphablend);
}
@@ -299,7 +308,9 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
c_badtex = 0;
}
c_textured = textured;
- c_texface = texface;
+ c_has_texface = has_texface;
+ if (texface)
+ memcpy(&c_texface, texface, sizeof(c_texface));
}
if (c_badtex) lit = 0;