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:
authorClément Foucault <foucault.clem@gmail.com>2020-02-25 17:05:53 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-02-25 17:14:32 +0300
commit4e9fffc2892601b3b11366f115f342ebeeb026f1 (patch)
tree88c969530d82f12952fbee0d96abd576e84031a6 /source/blender/makesrna/intern/rna_image.c
parent1bbc1eed6221fcdfad9c160d2979040d44aa888e (diff)
GPU: Add Image property to allow high bitdepth support on a per image basis
This adds the `Half Float Precision` option in the image property panel. This option is only available on float textures and is enabled by default. Adding a flag inside the imbuf (IB_halffloat) on load is done for EXR and PSD formats that can store half floating point (16bits/channels). The option is then not displayed in this case and forced. Related task T73086 Reviewed By: brecht Differential Revision: https://developer.blender.org/D6891
Diffstat (limited to 'source/blender/makesrna/intern/rna_image.c')
-rw-r--r--source/blender/makesrna/intern/rna_image.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 9f5f1635536..94b5786665c 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -193,6 +193,17 @@ static char *rna_ImageUser_path(PointerRNA *ptr)
return BLI_strdup("");
}
+static void rna_Image_gpu_texture_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Image *ima = (Image *)ptr->owner_id;
+
+ if (!G.background) {
+ GPU_free_image(ima);
+ }
+
+ WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
+}
+
static const EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C),
PointerRNA *ptr,
PropertyRNA *UNUSED(prop),
@@ -1119,6 +1130,13 @@ static void rna_def_image(BlenderRNA *brna)
"when saving and loading the image");
RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update");
+ prop = RNA_def_property(srna, "use_half_precision", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMA_HIGH_BITDEPTH);
+ RNA_def_property_ui_text(prop,
+ "Half Float Precision",
+ "Use 16bits per channel to lower the memory usage during rendering");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_gpu_texture_update");
+
/* multiview */
prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);