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:
authorJeroen Bakker <j.bakker@atmind.nl>2020-07-13 16:42:48 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2020-07-13 18:13:16 +0300
commit061869fe61fc5746a8df172a3f02752eff7019b3 (patch)
tree5fe7cc5adad31b059faae7fde884d14e332d2cbf
parentad0154aebc3d608745dac39511a99be8aa12b4cb (diff)
Fix T77759: "Not enough texture slots!" Message lags computer
Patch supplied by Clément Foucault
-rw-r--r--source/blender/draw/engines/workbench/workbench_engine.c6
-rw-r--r--source/blender/draw/engines/workbench/workbench_materials.c60
-rw-r--r--source/blender/draw/engines/workbench/workbench_private.h8
3 files changed, 67 insertions, 7 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c
index 9d6105af8fb..7744f54cbd8 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.c
+++ b/source/blender/draw/engines/workbench/workbench_engine.c
@@ -216,7 +216,11 @@ static void workbench_cache_hair_populate(WORKBENCH_PrivateData *wpd,
workbench_image_hair_setup(wpd, ob, matnr, ima, NULL, interp) :
workbench_material_hair_setup(wpd, ob, matnr, color_type);
- DRW_shgroup_hair_create_sub(ob, psys, md, grp);
+ grp = DRW_shgroup_hair_create_sub(ob, psys, md, grp);
+
+ if (use_texpaint_mode || (color_type == V3D_SHADING_TEXTURE_COLOR)) {
+ workbench_image_hair_setup_post(wpd, ob, matnr, use_texpaint_mode, ima, NULL, interp, grp);
+ }
}
/**
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c
index 0b7d313342b..00638aa9f61 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -283,14 +283,62 @@ DRWShadingGroup *workbench_image_setup_ex(WORKBENCH_PrivateData *wpd,
DRWShadingGroup *grp = (tex_tile_data) ? prepass->image_tiled_shgrp : prepass->image_shgrp;
*grp_tex = grp = DRW_shgroup_create_sub(grp);
- if (tex_tile_data) {
- DRW_shgroup_uniform_texture_persistent(grp, "imageTileArray", tex);
- DRW_shgroup_uniform_texture_persistent(grp, "imageTileData", tex_tile_data);
- }
- else {
- DRW_shgroup_uniform_texture_persistent(grp, "imageTexture", tex);
+ if (!hair) {
+ if (tex_tile_data) {
+ DRW_shgroup_uniform_texture(grp, "imageTileArray", tex);
+ DRW_shgroup_uniform_texture(grp, "imageTileData", tex_tile_data);
+ }
+ else {
+ DRW_shgroup_uniform_texture(grp, "imageTexture", tex);
+ }
}
DRW_shgroup_uniform_bool_copy(grp, "imagePremult", (ima && ima->alpha_mode == IMA_ALPHA_PREMUL));
DRW_shgroup_uniform_bool_copy(grp, "imageNearest", (interp == SHD_INTERP_CLOSEST));
return grp;
}
+
+/* Workaround for T77759 only present in LTS branch. */
+void workbench_image_hair_setup_post(WORKBENCH_PrivateData *wpd,
+ Object *ob,
+ int mat_nr,
+ const bool use_texpaint_mode,
+ Image *ima,
+ ImageUser *iuser,
+ int interp,
+ DRWShadingGroup *grp)
+{
+ GPUTexture *tex = NULL, *tex_tile_data = NULL;
+
+ if (!use_texpaint_mode) {
+ workbench_material_get_image(ob, mat_nr, &ima, &iuser, &interp);
+ if (ima == NULL) {
+ return;
+ }
+ }
+
+ if (ima == NULL) {
+ workbench_material_get_image(ob, mat_nr, &ima, &iuser, &interp);
+ }
+
+ if (ima) {
+ if (ima->source == IMA_SRC_TILED) {
+ tex = GPU_texture_from_blender(ima, iuser, NULL, GL_TEXTURE_2D_ARRAY);
+ tex_tile_data = GPU_texture_from_blender(ima, iuser, NULL, GL_TEXTURE_1D_ARRAY);
+ }
+ else {
+ tex = GPU_texture_from_blender(ima, iuser, NULL, GL_TEXTURE_2D);
+ }
+ }
+
+ if (tex == NULL) {
+ tex = wpd->dummy_image_tx;
+ }
+
+ if (tex_tile_data) {
+ DRW_shgroup_uniform_texture(grp, "imageTileArray", tex);
+ DRW_shgroup_uniform_texture(grp, "imageTileData", tex_tile_data);
+ }
+ else {
+ DRW_shgroup_uniform_texture(grp, "imageTexture", tex);
+ }
+} \ No newline at end of file
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index 967bdf9bae0..204d2e995c0 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -464,6 +464,14 @@ DRWShadingGroup *workbench_image_setup_ex(WORKBENCH_PrivateData *wpd,
ImageUser *iuser,
int interp,
bool hair);
+void workbench_image_hair_setup_post(WORKBENCH_PrivateData *wpd,
+ Object *ob,
+ int mat_nr,
+ const bool use_texpaint_mode,
+ Image *ima,
+ ImageUser *iuser,
+ int interp,
+ DRWShadingGroup *grp);
#define workbench_material_setup(wpd, ob, mat_nr, color_type, r_transp) \
workbench_material_setup_ex(wpd, ob, mat_nr, color_type, false, r_transp)