diff options
author | Ton Roosendaal <ton@blender.org> | 2013-03-17 18:38:58 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2013-03-17 18:38:58 +0400 |
commit | 0a4b030145fdad2b36290454bbd3ba37406d4f9a (patch) | |
tree | 2d3434c6e2f70a5c30fedeb8b5afdaf733876014 /source/blender/makesdna | |
parent | 50c28740d4a18a77dc71cd31722a0607faad676d (diff) |
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.
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_genfile.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_genfile.c | 16 |
3 files changed, 19 insertions, 1 deletions
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. */ |