[Bf-blender-cvs] [6c0bd890475] master: Fix T58392 Texture limit size not working

Clément Foucault noreply at git.blender.org
Fri Mar 22 19:43:10 CET 2019


Commit: 6c0bd890475c7de2406c9383774ba8777724313f
Author: Clément Foucault
Date:   Fri Mar 22 15:38:41 2019 +0100
Branches: master
https://developer.blender.org/rB6c0bd890475c7de2406c9383774ba8777724313f

Fix T58392 Texture limit size not working

It was removed by inadvertence.

===================================================================

M	source/blender/gpu/intern/gpu_draw.c

===================================================================

diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 65c07ea01a8..c9989703d5b 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -429,6 +429,28 @@ void GPU_create_gl_tex(
 {
 	ImBuf *ibuf = NULL;
 
+	if (textarget == GL_TEXTURE_2D &&
+	    is_over_resolution_limit(textarget, rectw, recth))
+	{
+		int tpx = rectw;
+		int tpy = recth;
+		rectw = smaller_power_of_2_limit(rectw);
+		recth = smaller_power_of_2_limit(recth);
+
+		if (use_high_bit_depth) {
+			ibuf = IMB_allocFromBuffer(NULL, frect, tpx, tpy);
+			IMB_scaleImBuf(ibuf, rectw, recth);
+
+			frect = ibuf->rect_float;
+		}
+		else {
+			ibuf = IMB_allocFromBuffer(rect, NULL, tpx, tpy);
+			IMB_scaleImBuf(ibuf, rectw, recth);
+
+			rect = ibuf->rect;
+		}
+	}
+
 	/* create image */
 	glGenTextures(1, (GLuint *)bind);
 	glBindTexture(textarget, *bind);



More information about the Bf-blender-cvs mailing list