Fix T58392 Texture limit size not working

It was removed by inadvertence.
This commit is contained in:
Clément Foucault 2019-03-22 15:38:41 +01:00
parent 8b4e0eb88e
commit 6c0bd89047
Notes: blender-bot 2023-02-14 04:49:43 +01:00
Referenced by issue #62099, texture visibility
Referenced by issue #58392, Texture limit size not working
1 changed files with 22 additions and 0 deletions

View File

@ -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);