From 0a4b030145fdad2b36290454bbd3ba37406d4f9a Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 17 Mar 2013 14:38:58 +0000 Subject: New feature: Automatic switching for drawing pixel buffers via glDrawPixels or using GPU textures It works with a User Preference limit, in megapixels, to define whether to use GPU or direct pixel drawing. Default is now initialized to 10 MP (4k buffers). Especially for zooming out (draw smaller) texture drawing is much smaller. Also Nvidia cards typically draw much faster with textures in general. Added to node backdrop first now, the other editors follow in a next commit. For coders: added new DNA function to initialize new struct variables, so you don't have to sub-version files anymore. DNA_struct_elem_find(fd->filesdna, "structname", "typename", "varname") "filesdna" is the sdna description of the current file being versioned. --- source/blender/makesdna/DNA_genfile.h | 2 ++ source/blender/makesdna/DNA_userdef_types.h | 2 +- source/blender/makesdna/intern/dna_genfile.c | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h index ac75b03c742..96d71288c62 100644 --- a/source/blender/makesdna/DNA_genfile.h +++ b/source/blender/makesdna/DNA_genfile.h @@ -71,6 +71,8 @@ void *DNA_struct_reconstruct(struct SDNA *newsdna, struct SDNA *oldsdna, char *c int DNA_elem_array_size(const char *astr, int len); int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, const char *name); +bool DNA_struct_elem_find(struct SDNA *sdna, const char *stype, const char *vartype, const char *name); + int DNA_elem_type_size(const eSDNA_Type elem_nr); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 10e85437e5f..5a16ff39e68 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -451,7 +451,7 @@ typedef struct UserDef { short ogl_multisamples; /* amount of samples for OpenGL FSA, if zero no FSA */ - short pad4; + short image_gpubuffer_limit; /* If set, amount of mega-pixels to use for texture drawing of images */ float glalphaclip; diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 86014c4e80e..1225821102a 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -1314,6 +1314,22 @@ int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const ch return (int)((intptr_t)cp); } +bool DNA_struct_elem_find(SDNA *sdna, const char *stype, const char *vartype, const char *name) +{ + + const int SDNAnr = DNA_struct_find_nr(sdna, stype); + + if (SDNAnr >= 0) { + const short * const spo = sdna->structs[SDNAnr]; + char * const cp = find_elem(sdna, vartype, name, spo, NULL, NULL); + + if (cp) return true; + return (int)((intptr_t)cp); + } + return false; +} + + /** * Returns the size in bytes of a primitive type. */ -- cgit v1.2.3