[Bf-blender-cvs] [70ff63e] blender2.8: OpenGL: tweak image shaders & code that uses them
Commit: 70ff63e63fc3a63dccc6a6c567bbc347c64d6c7d Author: Mike Erwin Date: Tue Oct 18 00:08:34 2016 -0400 Branches: blender2.8 https://developer.blender.org/rB70ff63e63fc3a63dccc6a6c567bbc347c64d6c7d OpenGL: tweak image shaders & code that uses them - rename image shaders to describe exactly what they do - rename inputs to match other built-in shaders - set & use active texture unit - no need to enable/disable textures with GLSL - pull vertex format setup out of loops === M source/blender/editors/space_view3d/drawobject.c M source/blender/gpu/CMakeLists.txt M source/blender/gpu/GPU_shader.h M source/blender/gpu/intern/gpu_shader.c D source/blender/gpu/shaders/gpu_shader_2D_texture_vert.glsl A source/blender/gpu/shaders/gpu_shader_3D_image_vert.glsl R056source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl R055source/blender/gpu/shaders/gpu_shader_2D_texture_rect_frag.glsl source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl M source/blender/windowmanager/intern/wm_draw.c M source/blender/windowmanager/intern/wm_stereo.c === diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 408d27e..02702af 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -675,11 +675,11 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char } VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "position", GL_FLOAT, 2, KEEP_FLOAT); - unsigned texCoord = add_attrib(format, "texcoord", GL_FLOAT, 2, KEEP_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_TEXTURE_2D); /* TODO: rename GPU_SHADER_3D_IMAGE_2D_MODULATE_ALPHA */ + unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_MODULATE_ALPHA); immUniform1f("alpha", ob_alpha); - immUniform1i("texture_map", texUnit); /* TODO: rename "image" */ + immUniform1i("image", texUnit); immBegin(GL_TRIANGLE_FAN, 4); immAttrib2f(texCoord, 0.0f, 0.0f); diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index b2a7c78..e960a81 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -133,9 +133,9 @@ data_to_c_simple(shaders/gpu_shader_2D_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_2D_flat_color_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_2D_smooth_color_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_2D_smooth_color_frag.glsl SRC) -data_to_c_simple(shaders/gpu_shader_2D_texture_2D_frag.glsl SRC) -data_to_c_simple(shaders/gpu_shader_2D_texture_rect_frag.glsl SRC) -data_to_c_simple(shaders/gpu_shader_2D_texture_vert.glsl SRC) +data_to_c_simple(shaders/gpu_shader_image_modulate_alpha_frag.glsl SRC) +data_to_c_simple(shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl SRC) +data_to_c_simple(shaders/gpu_shader_3D_image_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_flat_color_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_smooth_color_vert.glsl SRC) diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index d52a0a2..1fe0f6f 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -101,9 +101,9 @@ typedef enum GPUBuiltinShader { GPU_SHADER_3D_FLAT_COLOR, GPU_SHADER_3D_SMOOTH_COLOR, GPU_SHADER_3D_DEPTH_ONLY, - /* basic 2D texture drawing */ - GPU_SHADER_2D_TEXTURE_2D, - GPU_SHADER_2D_TEXTURE_RECT, + /* basic image drawing */ + GPU_SHADER_3D_IMAGE_MODULATE_ALPHA, + GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA, /* points */ GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR, GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_SMOOTH, diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 4641354..e8ea642 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -53,9 +53,9 @@ extern char datatoc_gpu_shader_2D_vert_glsl[]; extern char datatoc_gpu_shader_2D_flat_color_vert_glsl[]; extern char datatoc_gpu_shader_2D_smooth_color_vert_glsl[]; extern char datatoc_gpu_shader_2D_smooth_color_frag_glsl[]; -extern char datatoc_gpu_shader_2D_texture_vert_glsl[]; -extern char datatoc_gpu_shader_2D_texture_2D_frag_glsl[]; -extern char
[Bf-blender-cvs] [8327795] blender2.8: OpenGL: draw image empties with new API
Commit: 8327795f8db13b4a66ba70c4bc01091bab1d847b Author: Mike Erwin Date: Mon Oct 17 20:33:59 2016 -0400 Branches: blender2.8 https://developer.blender.org/rB8327795f8db13b4a66ba70c4bc01091bab1d847b OpenGL: draw image empties with new API This extensive rewrite caches the image texture in VRAM. Can handle images up to OpenGL limits (8K or 16K). Part of T49043 & T49450 === M source/blender/editors/space_view3d/drawobject.c === diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 9472624..408d27e 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -633,92 +633,104 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype) static void draw_empty_image(Object *ob, const short dflag, const unsigned char ob_wire_col[4]) { Image *ima = ob->data; - ImBuf *ibuf = BKE_image_acquire_ibuf(ima, ob->iuser, NULL); - if (ibuf && (ibuf->rect == NULL) && (ibuf->rect_float != NULL)) { - IMB_rect_from_float(ibuf); - } + const float ob_alpha = ob->col[3]; + float width, height; - int ima_x, ima_y; + const int texUnit = GL_TEXTURE0; + int bindcode = 0; - /* Get the buffer dimensions so we can fallback to fake ones */ - if (ibuf && ibuf->rect) { - ima_x = ibuf->x; - ima_y = ibuf->y; + if (ima) { + if (ob_alpha > 0.0f) { + glActiveTexture(texUnit); + bindcode = GPU_verify_image(ima, ob->iuser, GL_TEXTURE_2D, 0, false, false, false); + /* don't bother drawing the image if alpha = 0 */ + } + + int w, h; + BKE_image_get_size(ima, ob->iuser, , ); + width = w; + height = h; } else { - ima_x = 1; - ima_y = 1; + /* if no image, make it a 1x1 empty square, honor scale & offset */ + width = height = 1.0f; } - float sca_x = 1.0f; - float sca_y = 1.0f; + const float aspect = height / width; - /* Get the image aspect even if the buffer is invalid */ - if (ima) { - if (ima->aspx > ima->aspy) { - sca_y = ima->aspy / ima->aspx; - } - else if (ima->aspx < ima->aspy) { - sca_x = ima->aspx / ima->aspy; - } - } + float left = ob->ima_ofs[0]; + float right = ob->ima_ofs[0] + ob->empty_drawsize; + float top = ob->ima_ofs[1] + ob->empty_drawsize * aspect; + float bottom = ob->ima_ofs[1]; - /* Calculate the scale center based on object's origin */ - float ofs_x = ob->ima_ofs[0] * ima_x; - float ofs_y = ob->ima_ofs[1] * ima_y; + bool use_blend = false; - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + if (bindcode) { + use_blend = ob_alpha < 1.0f || BKE_image_has_alpha(ima); - /* Calculate Image scale */ - float scale = ob->empty_drawsize / max_ff((float)ima_x * sca_x, (float)ima_y * sca_y); + if (use_blend) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } - /* Set the object scale */ - glScalef(scale * sca_x, scale * sca_y, 1.0f); + VertexFormat *format = immVertexFormat(); + unsigned pos = add_attrib(format, "position", GL_FLOAT, 2, KEEP_FLOAT); + unsigned texCoord = add_attrib(format, "texcoord", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_TEXTURE_2D); /* TODO: rename GPU_SHADER_3D_IMAGE_2D_MODULATE_ALPHA */ + immUniform1f("alpha", ob_alpha); + immUniform1i("texture_map", texUnit); /* TODO: rename "image" */ - if (ibuf && ibuf->rect) { - const bool use_clip = (U.glalphaclip != 1.0f); - int zoomfilter = (U.gameflags & USER_DISABLE_MIPMAP) ? GL_NEAREST : GL_LINEAR; - /* Setup GL params */ - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + immBegin(GL_TRIANGLE_FAN, 4); + immAttrib2f(texCoord, 0.0f, 0.0f); + immVertex2f(pos, left, bottom); - if (use_clip) { - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GREATER, U.glalphaclip); - } + immAttrib2f(texCoord, 1.0f, 0.0f); + immVertex2f(pos, right, bottom); - /* Use the object color and alpha */ - glColor4fv(ob->col); +
[Bf-blender-cvs] [0c6939f] blender2.8: minor cleanup & deprecation
Commit: 0c6939f5f597e4e7fe5777de7a49b49ff53fa987 Author: Mike Erwin Date: Mon Oct 17 23:48:12 2016 -0400 Branches: blender2.8 https://developer.blender.org/rB0c6939f5f597e4e7fe5777de7a49b49ff53fa987 minor cleanup & deprecation === M source/blender/editors/screen/glutil.c === diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 2d89398..a7e8c21 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -53,10 +53,6 @@ #include "UI_interface.h" -#ifndef GL_CLAMP_TO_EDGE -#define GL_CLAMP_TO_EDGE0x812F -#endif - void fdrawline(float x1, float y1, float x2, float y2) { @@ -157,6 +153,7 @@ void fdrawXORcirc(float xofs, float yofs, float rad) void glutil_draw_filled_arc(float start, float angle, float radius, int nsegments) { + /* DEPRECATED */ int i; glBegin(GL_TRIANGLE_FAN); @@ -172,6 +169,7 @@ void glutil_draw_filled_arc(float start, float angle, float radius, int nsegment void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments) { + /* DEPRECATED */ int i; glBegin(GL_LINE_STRIP); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [cccd3eb] master: Fixup for doversion (rB8d573aa0 and rBa7e74791)
Commit: cccd3eb5a8107cd215fc5e3b8ecdf275ed5c48f2 Author: Dalai Felinto Date: Mon Oct 17 19:43:35 2016 + Branches: master https://developer.blender.org/rBcccd3eb5a8107cd215fc5e3b8ecdf275ed5c48f2 Fixup for doversion (rB8d573aa0 and rBa7e74791) === M source/blender/blenloader/intern/versioning_270.c M source/blender/editors/interface/resources.c === diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index a2a10f5..14e02c9 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1393,7 +1393,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } - if (!MAIN_VERSION_ATLEAST(main, 279, 0)) { + if (!MAIN_VERSION_ATLEAST(main, 278, 2)) { if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "ffmpeg_preset")) { for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { /* "medium" is the preset FFmpeg uses when no presets are given. */ diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 9187ab6..5e24dc9 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -2742,7 +2742,7 @@ void init_userdef_do_versions(void) } } - if (!USER_VERSION_ATLEAST(278, 1)) { + if (!USER_VERSION_ATLEAST(278, 2)) { bTheme *btheme; for (btheme = U.themes.first; btheme; btheme = btheme->next) { rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6a0292c] blender2.8: Fix for gpu_shader_2D_texture_2D_frag.glsl
Commit: 6a0292cc192dbb5aa40abd214156e10148fe0f0b Author: Dalai Felinto Date: Mon Oct 17 19:23:01 2016 + Branches: blender2.8 https://developer.blender.org/rB6a0292cc192dbb5aa40abd214156e10148fe0f0b Fix for gpu_shader_2D_texture_2D_frag.glsl Report and patch by Willian Padovani Germano (ianwill) === M source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl === diff --git a/source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl index e052d8c..cd4f0d2 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_texture_2D_frag.glsl @@ -12,6 +12,6 @@ uniform sampler2D texture_map; void main() { - fragColor = texture2D(texture_map, texture_coord) + fragColor = texture2D(texture_map, texture_coord); fragColor.a *= alpha; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4811b2d] blender2.8: Proper fix for crash when joining areas that doesn't break manipulators
Commit: 4811b2d3565cf72a08d8bc55d1717e71d18f7df1 Author: Julian Eisel Date: Mon Oct 17 19:25:56 2016 +0200 Branches: blender2.8 https://developer.blender.org/rB4811b2d3565cf72a08d8bc55d1717e71d18f7df1 Proper fix for crash when joining areas that doesn't break manipulators Turns out CTX_wm_region returns mostly NULL in wm_manipulatormaps_handled_modal_update. Now propertly unsetting area/region data of handlers when deleting area/region. === M source/blender/editors/screen/screen_edit.c M source/blender/windowmanager/WM_api.h M source/blender/windowmanager/intern/wm_event_system.c M source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c === diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 3d30f2b..5e00d15 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1277,25 +1277,28 @@ void ED_screens_initialize(wmWindowManager *wm) void ED_region_exit(bContext *C, ARegion *ar) { wmWindowManager *wm = CTX_wm_manager(C); + wmWindow *win = CTX_wm_window(C); ARegion *prevar = CTX_wm_region(C); if (ar->type && ar->type->exit) ar->type->exit(wm, ar); CTX_wm_region_set(C, ar); + WM_event_remove_handlers(C, >handlers); + WM_event_modal_handler_region_replace(win, ar, NULL); if (ar->swinid) { - wm_subwindow_close(CTX_wm_window(C), ar->swinid); + wm_subwindow_close(win, ar->swinid); ar->swinid = 0; } - + if (ar->headerstr) { MEM_freeN(ar->headerstr); ar->headerstr = NULL; } if (ar->regiontimer) { - WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), ar->regiontimer); + WM_event_remove_timer(wm, win, ar->regiontimer); ar->regiontimer = NULL; } @@ -1305,6 +1308,7 @@ void ED_region_exit(bContext *C, ARegion *ar) void ED_area_exit(bContext *C, ScrArea *sa) { wmWindowManager *wm = CTX_wm_manager(C); + wmWindow *win = CTX_wm_window(C); ScrArea *prevsa = CTX_wm_area(C); ARegion *ar; @@ -1312,10 +1316,13 @@ void ED_area_exit(bContext *C, ScrArea *sa) sa->type->exit(wm, sa); CTX_wm_area_set(C, sa); + for (ar = sa->regionbase.first; ar; ar = ar->next) ED_region_exit(C, ar); WM_event_remove_handlers(C, >handlers); + WM_event_modal_handler_area_replace(win, sa, NULL); + CTX_wm_area_set(C, prevsa); } diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 4d159c6..2809795 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -67,6 +67,7 @@ struct wmDrag; struct ImBuf; struct ImageFormatData; struct ARegion; +struct ScrArea; #ifdef WITH_INPUT_NDOF struct wmNDOFMotionData; @@ -177,6 +178,9 @@ void WM_event_free_ui_handler_all( wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove); struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op); +void WM_event_modal_handler_area_replace(wmWindow *win, const struct ScrArea *old_area, struct ScrArea *new_area); +void WM_event_modal_handler_region_replace(wmWindow *win, const struct ARegion *old_region, struct ARegion *new_region); + void WM_event_remove_handlers(struct bContext *C, ListBase *handlers); /* handler flag */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index a75b3b1..b15b47c 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2717,6 +2717,33 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op) return handler; } +/** + * Modal handlers store a pointer to an area which might be freed while the handler runs. + * Use this function to NULL all handler pointers to \a old_area. + */ +void WM_event_modal_handler_area_replace(wmWindow *win, const ScrArea *old_area, ScrArea *new_area) +{ + for (wmEventHandler *handler = win->modalhandlers.first; handler; handler = handler->next) { + if (handler->op_area == old_area) { + handler->op_area = new_area; + } + } +} + +/** + * Modal handlers store a pointer to a region which might be freed while the handler runs. + * Use this function to NULL all handler pointers to \a old_region. + */ +void WM_event_modal_handler_region_replace(wmWindow *win, const ARegion *old_region, ARegion *new_region) +{ + for (wmEventHandler *handler = win->modalhandlers.first; handler; handler
[Bf-blender-cvs] [aadb4c0] custom-manipulators: Fix Blenderplayer not compiling....
Commit: aadb4c06406859d2846c8b76efa24edef713467b Author: Julian Eisel Date: Mon Oct 17 17:13:51 2016 +0200 Branches: custom-manipulators https://developer.blender.org/rBaadb4c06406859d2846c8b76efa24edef713467b Fix Blenderplayer not compiling === M source/blenderplayer/bad_level_call_stubs/stubs.c === diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index d6c794d..48648cc 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -342,7 +342,6 @@ void WM_report(ReportType type, const char *message) RET_NONE struct wmManipulatorMapType *WM_manipulatormaptype_find(const struct wmManipulatorMapType_Params *wmap_params) RET_NULL struct wmManipulatorMapType *WM_manipulatormaptype_ensure(const struct wmManipulatorMapType_Params *wmap_params) RET_NULL struct wmManipulatorMap *WM_manipulatormap_new_from_type(const struct wmManipulatorMapType_Params *wmap_params) RET_NULL -void WM_manipulatormap_delete(struct wmManipulatorMap *wmap) RET_NONE void WM_manipulatorgrouptype_init_runtime(const struct Main *bmain, struct wmManipulatorMapType *wmaptype, struct wmManipulatorGroupType *wgrouptype) RET_NONE void WM_manipulatorgrouptype_unregister(struct bContext *C, struct Main *bmain, struct wmManipulatorGroupType *wgroup) RET_NONE ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [32f6a04] cycles_split_kernel: Merge branch 'master' into cycles_split_kernel
Commit: 32f6a04b10725bc6ee8d45d20b9bbc19ea3e05bb Author: Mai Lavelle Date: Mon Oct 17 14:51:23 2016 +0200 Branches: cycles_split_kernel https://developer.blender.org/rB32f6a04b10725bc6ee8d45d20b9bbc19ea3e05bb Merge branch 'master' into cycles_split_kernel === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5e92a0f] master: Fix T49722: Appending Bug (Groups).
Commit: 5e92a0faad987a84d4a1c1a9d7459c2847865577 Author: Bastien Montagne Date: Mon Oct 17 14:49:35 2016 +0200 Branches: master https://developer.blender.org/rB5e92a0faad987a84d4a1c1a9d7459c2847865577 Fix T49722: Appending Bug (Groups). One day we'll have to reconsider why some many 'real' ID usages are not refcounting... :( To be backported to 2.78a. === M source/blender/blenkernel/intern/library.c === diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index a2802d2..93bf5e1 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1746,6 +1746,11 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged ob->proxy = ob->proxy_from = ob->proxy_group = NULL; } } + /* Special hack for groups... Thing is, since we can't instantiate them here, we need to ensure +* they remain 'alive' (only instantiation is a real group 'user'... *sigh* See T49722. */ + else if (GS(id->name) == ID_GR && (id->tag & LIB_TAG_INDIRECT) != 0) { + id_us_ensure_real(id->newid); + } BKE_library_ID_test_usages(bmain, id, _local, _lib); if (!is_local && !is_lib) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c2d0832] master: UV Editor: Add filter option to control what is visible when Draw Other Objects is enabled
Commit: c2d0832c6ee11e1575744ab18233e41a9e7c2730 Author: Sergey Sharybin Date: Mon Oct 17 14:28:16 2016 +0200 Branches: master https://developer.blender.org/rBc2d0832c6ee11e1575744ab18233e41a9e7c2730 UV Editor: Add filter option to control what is visible when Draw Other Objects is enabled Previously the editor will always try to only show UV faces with the same exact active image or image texture, which is quite difficult to control on a production shaders, where each material can have multiple objects assigned. The idea of this commit is to bring option which allows to easily control what to display when "Draw Other Objects" is enabled, so currently we can have old behavior ("Same Image") or tell editor to show everything ("All"). In the future we can extend it with such filters as "Same Material" and things like that. Hopefully this will help @eyecandy's workflow of texturing. === M release/scripts/startup/bl_ui/space_image.py M source/blender/editors/uvedit/uvedit_draw.c M source/blender/makesdna/DNA_space_types.h M source/blender/makesrna/intern/rna_space.c === diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index bf6df05..b608718 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -687,6 +687,12 @@ class IMAGE_PT_view_properties(Panel): sub.active = uvedit.show_stretch sub.row().prop(uvedit, "draw_stretch_type", expand=True) +col = layout.column() +col.prop(uvedit, "show_other_objects") +row = col.row() +row.active = uvedit.show_other_objects +row.prop(uvedit, "other_uv_filter", text="Filter") + if show_render and ima: layout.separator() render_slot = ima.render_slots.active diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 94d69a0..5c5e84e 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -377,7 +377,7 @@ static void draw_uvs_lineloop_mpoly(Mesh *me, MPoly *mpoly) glEnd(); } -static void draw_uvs_other_mesh_texface(Object *ob, const Image *curimage) +static void draw_uvs_other_mesh_texface(Object *ob, const Image *curimage, const int other_uv_filter) { Mesh *me = ob->data; MPoly *mpoly = me->mpoly; @@ -389,14 +389,19 @@ static void draw_uvs_other_mesh_texface(Object *ob, const Image *curimage) } for (a = me->totpoly; a != 0; a--, mpoly++, mtpoly++) { - if (mtpoly->tpage != curimage) { - continue; + if (other_uv_filter == SI_FILTER_ALL) { + /* Nothing to compare, all UV faces are visible. */ + } + else if (other_uv_filter == SI_FILTER_SAME_IMAGE) { + if (mtpoly->tpage != curimage) { + continue; + } } draw_uvs_lineloop_mpoly(me, mpoly); } } -static void draw_uvs_other_mesh_new_shading(Object *ob, const Image *curimage) +static void draw_uvs_other_mesh_new_shading(Object *ob, const Image *curimage, const int other_uv_filter) { Mesh *me = ob->data; MPoly *mpoly = me->mpoly; @@ -436,27 +441,34 @@ static void draw_uvs_other_mesh_new_shading(Object *ob, const Image *curimage) } for (a = me->totpoly; a != 0; a--, mpoly++) { - const int mat_nr = mpoly->mat_nr; - if ((mat_nr >= totcol) || - (BLI_BITMAP_TEST(mat_test_array, mat_nr)) == 0) - { - continue; + if (other_uv_filter == SI_FILTER_ALL) { + /* Nothing to compare, all UV faces are visible. */ + } + else if (other_uv_filter == SI_FILTER_SAME_IMAGE) { + const int mat_nr = mpoly->mat_nr; + if ((mat_nr >= totcol) || + (BLI_BITMAP_TEST(mat_test_array, mat_nr)) == 0) + { + continue; + } } draw_uvs_lineloop_mpoly(me, mpoly); } } -static void draw_uvs_other_mesh(Object *ob, const Image *curimage, const bool new_shading_nodes) +static void draw_uvs_other_mesh(Object *ob, const Image *curimage, const bool new_shading_nodes, +const int other_uv_filter) { if (new_shading_nodes) { - draw_uvs_other_mesh_new_shading(ob, curimage); + draw_uvs_other_mesh_new_shading(ob, curimage, other_uv_filter); } else { -
[Bf-blender-cvs] [86f3d22] cycles_split_kernel: Cycles: Refactor so all split kernels have same signature
Commit: 86f3d223fd4356af549057a70cd90674c6b69a75 Author: Mai Lavelle Date: Mon Oct 17 13:47:19 2016 +0200 Branches: cycles_split_kernel https://developer.blender.org/rB86f3d223fd4356af549057a70cd90674c6b69a75 Cycles: Refactor so all split kernels have same signature This is to set things up for supporting the split kernel on cpu and other devices. By having the same signature for each kernel we can deduplicate a lot of code without needing any trickery. The only kernel that doesn't share this signature is the `data_init` kernel, which might end up being different for each device type. === M intern/cycles/device/opencl/opencl_split.cpp M intern/cycles/kernel/kernel_globals.h M intern/cycles/kernel/kernels/opencl/kernel_background_buffer_update.cl M intern/cycles/kernel/kernels/opencl/kernel_data_init.cl M intern/cycles/kernel/kernels/opencl/kernel_direct_lighting.cl M intern/cycles/kernel/kernels/opencl/kernel_holdout_emission_blurring_pathtermination_ao.cl M intern/cycles/kernel/kernels/opencl/kernel_lamp_emission.cl M intern/cycles/kernel/kernels/opencl/kernel_next_iteration_setup.cl M intern/cycles/kernel/kernels/opencl/kernel_queue_enqueue.cl M intern/cycles/kernel/kernels/opencl/kernel_scene_intersect.cl M intern/cycles/kernel/kernels/opencl/kernel_shader_eval.cl M intern/cycles/kernel/kernels/opencl/kernel_shadow_blocked.cl M intern/cycles/kernel/kernels/opencl/kernel_sum_all_radiance.cl M intern/cycles/kernel/split/kernel_data_init.h M intern/cycles/kernel/split/kernel_split_data.h === diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp index ce0c702..fc80173 100644 --- a/intern/cycles/device/opencl/opencl_split.cpp +++ b/intern/cycles/device/opencl/opencl_split.cpp @@ -223,6 +223,7 @@ public: void *sd_input; void *isect_shadow; SplitData split_data; + SplitParams split_param_data; } KernelGlobals; return sizeof(KernelGlobals); @@ -422,6 +423,7 @@ public: kernel_set_args(program_data_init(), start_arg_index, start_sample, + end_sample, d_x, d_y, d_w, @@ -438,128 +440,24 @@ public: work_pool_wgs, num_samples, #endif - num_parallel_samples); - - //printf("kernel_set_args scene_intersect\n"); - kernel_set_args(program_scene_intersect(), - 0, - kgbuffer, - d_data, - d_w, - d_h, - Queue_index, - dQueue_size, - use_queues_flag, - num_parallel_samples); - - //printf("kernel_set_args lamp_emission\n"); - kernel_set_args(program_lamp_emission(), - 0, - kgbuffer, - d_data, - d_w, - d_h, - Queue_index, - dQueue_size, - use_queues_flag, - num_parallel_samples); - - //printf("kernel_set_args queue_enqueue\n"); - kernel_set_args(program_queue_enqueue(), - 0, - kgbuffer, - d_data, - Queue_index, - dQueue_size); - - //printf("kernel_set_args background_buffer_update\n"); - kernel_set_args(program_background_buffer_update(), -0, -kgbuffer, -d_data, -d_rng_state, -d_w, -d_h, -d_x, -d_y, -d_stride, -rtile.rng_state_offset_x, -rtile.rng_state_offset_y, -rtile.buffer_rng_state_stride, -Queue_index, -dQueue_size, -
[Bf-blender-cvs] [7f19c4f] master: Fix T49738: Hair Add Brush doesn't work
Commit: 7f19c4fdf920c47d288a279af64bcf151e021877 Author: Sergey Sharybin Date: Mon Oct 17 12:37:50 2016 +0200 Branches: master https://developer.blender.org/rB7f19c4fdf920c47d288a279af64bcf151e021877 Fix T49738: Hair Add Brush doesn't work the issue was caused by wrong default value for brush particle count which was clamped on display from 0 to 1. This is technically a regression but how to port this to 2.78a? === M source/blender/blenloader/intern/versioning_270.c M source/blender/blenloader/intern/versioning_defaults.c === diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 0d4ff00..a2a10f5 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1425,4 +1425,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } + + { + for (Scene *scene = main->scene.first; scene != NULL; scene = scene->id.next) { + if (scene->toolsettings != NULL) { + ToolSettings *ts = scene->toolsettings; + ParticleEditSettings *pset = >particle; + for (int a = 0; a < PE_TOT_BRUSH; a++) { + if (pset->brush[a].count == 0) { + pset->brush[a].count = 10; + } + } + } + } + } } diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index ec817b9..99d9e14 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -147,6 +147,7 @@ void BLO_update_defaults_startup_blend(Main *bmain) ParticleEditSettings *pset = >particle; for (int a = 0; a < PE_TOT_BRUSH; a++) { pset->brush[a].strength = 0.5f; + pset->brush[a].count = 10; } pset->brush[PE_BRUSH_CUT].strength = 1.0f; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [cd84340] master: Fix T49630: Cycles: Swapped shader and bake kernels
Commit: cd843409d3b702d319d841a07849ea8824414083 Author: Lukas Stockner Date: Mon Oct 17 12:28:01 2016 +0200 Branches: master https://developer.blender.org/rBcd843409d3b702d319d841a07849ea8824414083 Fix T49630: Cycles: Swapped shader and bake kernels The problem here was, as the title says, that the two kernels were swapped. Since shader evaluation is only used for building the samling map when World MIS is enabled, rendering without it would still work fine, although baking also was broken. === M intern/cycles/device/opencl/opencl_base.cpp === diff --git a/intern/cycles/device/opencl/opencl_base.cpp b/intern/cycles/device/opencl/opencl_base.cpp index 025a61c..ea65be3 100644 --- a/intern/cycles/device/opencl/opencl_base.cpp +++ b/intern/cycles/device/opencl/opencl_base.cpp @@ -489,9 +489,9 @@ void OpenCLDeviceBase::shader(DeviceTask& task) cl_kernel kernel; if(task.shader_eval_type >= SHADER_EVAL_BAKE) - kernel = base_program(ustring("shader")); - else kernel = base_program(ustring("bake")); + else + kernel = base_program(ustring("shader")); cl_uint start_arg_index = kernel_set_args(kernel, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d5dd12e] master: Cycles: Improve OpenCL kernel compilation logging
Commit: d5dd12e56cd142c8d95cdb538658bae45a3f510c Author: Lukas Stockner Date: Mon Oct 17 11:48:24 2016 +0200 Branches: master https://developer.blender.org/rBd5dd12e56cd142c8d95cdb538658bae45a3f510c Cycles: Improve OpenCL kernel compilation logging The previous refactor changed the code to use a separate logging mechanism to support multithreaded compilation. However, since that's not supported by any frameworks yes, it just resulted in bad logging behaviour. So, this commit changes the logging to go diectly to stdout/stderr once again by default. === M intern/cycles/device/opencl/opencl.h M intern/cycles/device/opencl/opencl_base.cpp M intern/cycles/device/opencl/opencl_util.cpp === diff --git a/intern/cycles/device/opencl/opencl.h b/intern/cycles/device/opencl/opencl.h index 032a97a..30a35ac 100644 --- a/intern/cycles/device/opencl/opencl.h +++ b/intern/cycles/device/opencl/opencl.h @@ -191,7 +191,8 @@ public: OpenCLProgram(OpenCLDeviceBase *device, string program_name, string kernel_name, - string kernel_build_options); + string kernel_build_options, + bool use_stdout = true); ~OpenCLProgram(); void add_kernel(ustring name); @@ -212,6 +213,9 @@ public: bool load_binary(const string& clbin, const string *debug_src = NULL); bool save_binary(const string& clbin); + void add_log(string msg, bool is_debug); + void add_error(string msg); + bool loaded; cl_program program; OpenCLDeviceBase *device; @@ -220,8 +224,10 @@ public: string program_name; string kernel_file, kernel_build_options, device_md5; - string error_msg, output_msg; - string log; + + bool use_stdout; + string log, error_msg; + string compile_output; mapkernels; }; diff --git a/intern/cycles/device/opencl/opencl_base.cpp b/intern/cycles/device/opencl/opencl_base.cpp index 1e8fd26..025a61c 100644 --- a/intern/cycles/device/opencl/opencl_base.cpp +++ b/intern/cycles/device/opencl/opencl_base.cpp @@ -212,6 +212,11 @@ bool OpenCLDeviceBase::load_kernels(const DeviceRequestedFeatures& requested_fea /* Call actual class to fill the vector with its programs. */ load_kernels(requested_features, programs); + /* Parallel compilation is supported by Cycles, but currently all OpenCL frameworks +* serialize the calls internally, so it's not much use right now. +* Note: When enabling parallel compilation, use_stdout in the OpenCLProgram constructor +* should be set to false as well. */ +#if 0 TaskPool task_pool; foreach(OpenCLProgram *program, programs) { task_pool.push(function_bind(::load, program)); @@ -225,6 +230,11 @@ bool OpenCLDeviceBase::load_kernels(const DeviceRequestedFeatures& requested_fea return false; } } +#else + foreach(OpenCLProgram *program, programs) { + program->load(); + } +#endif return true; } diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp index 9650455..86aa805 100644 --- a/intern/cycles/device/opencl/opencl_util.cpp +++ b/intern/cycles/device/opencl/opencl_util.cpp @@ -239,11 +239,16 @@ string OpenCLCache::get_kernel_md5() return self.kernel_md5; } -OpenCLDeviceBase::OpenCLProgram::OpenCLProgram(OpenCLDeviceBase *device, string program_name, string kernel_file, string kernel_build_options) +OpenCLDeviceBase::OpenCLProgram::OpenCLProgram(OpenCLDeviceBase *device, + string program_name, + string kernel_file, + string kernel_build_options, + bool use_stdout) : device(device), program_name(program_name), kernel_file(kernel_file), - kernel_build_options(kernel_build_options) + kernel_build_options(kernel_build_options), + use_stdout(use_stdout) { loaded = false; program = NULL; @@ -268,6 +273,30 @@ void OpenCLDeviceBase::OpenCLProgram::release() } } +void OpenCLDeviceBase::OpenCLProgram::add_log(string msg, bool debug) +{ + if(!use_stdout) { + log += msg + "\n"; + } + else if(!debug) { + printf("%s\n", msg.c_str()); + } + else { + VLOG(2) << msg; + } +} + +void
[Bf-blender-cvs] [e7fddc0] blender2.8: OpenGL: disable checks for NPOT texture support
Commit: e7fddc077297f2f722b6eb8350ac2115f7f4a685 Author: Mike Erwin Date: Mon Oct 17 02:36:51 2016 -0400 Branches: blender2.8 https://developer.blender.org/rBe7fddc077297f2f722b6eb8350ac2115f7f4a685 OpenGL: disable checks for NPOT texture support Non-power-of-two textures are always allowed. Keeping the disabled checks in the code in case we support OpenGL ES in the future. Even then it should be a compile-time check, not at run-time. === M source/blender/editors/interface/interface_icons.c M source/blender/gpu/intern/gpu_draw.c M source/blender/gpu/intern/gpu_texture.c === diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index f96a270..f82ed82 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -728,8 +728,12 @@ static void init_internal_icons(void) icongltex.id = 0; } +#if 0 /* should be a compile-time check (if needed at all) */ /* we only use a texture for cards with non-power of two */ if (GPU_full_non_power_of_two_support()) { +#else + { +#endif glGenTextures(1, ); if (icongltex.id) { diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 6717ad0..49faaef 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -852,6 +852,7 @@ void GPU_create_gl_tex( int tpx = rectw; int tpy = recth; +#if 0 /* NPOT support should be a compile-time check */ /* scale if not a power of two. this is not strictly necessary for newer * GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures * Then don't bother scaling for hardware that supports NPOT textures! */ @@ -875,6 +876,7 @@ void GPU_create_gl_tex( rect = ibuf->rect; } } +#endif /* create image */ glGenTextures(1, (GLuint *)bind); @@ -1200,8 +1202,12 @@ void GPU_paint_set_mipmap(bool mipmap) /* check if image has been downscaled and do scaled partial update */ static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x, int y, int w, int h) { +#if 0 /* NPOT suport should be a compile-time check */ if ((!GPU_full_non_power_of_two_support() && !is_power_of_2_resolution(ibuf->x, ibuf->y)) || is_over_resolution_limit(GL_TEXTURE_2D, ibuf->x, ibuf->y)) +#else + if (is_over_resolution_limit(GL_TEXTURE_2D, ibuf->x, ibuf->y)) +#endif { int x_limit = smaller_power_of_2_limit(ibuf->x); int y_limit = smaller_power_of_2_limit(ibuf->y); diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 7b30053..c6cf4de 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -126,10 +126,12 @@ static GPUTexture *GPU_texture_create_nD( return NULL; } +#if 0 /* this should be a compile-time check */ if (!GPU_full_non_power_of_two_support()) { tex->w = power_of_2_max_i(tex->w); tex->h = power_of_2_max_i(tex->h); } +#endif tex->number = 0; glBindTexture(tex->target, tex->bindcode); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs