OpenGL: disable checks for NPOT texture support

Non-power-of-two textures are always allowed. Keeping the disabled checks in the code in case we support OpenGL ES in the future. Even then it should be a compile-time check, not at run-time.
This commit is contained in:
Mike Erwin 2016-10-17 02:36:51 -04:00
parent 42677fa937
commit e7fddc0772
3 changed files with 12 additions and 0 deletions

View File

@ -728,8 +728,12 @@ static void init_internal_icons(void)
icongltex.id = 0;
}
#if 0 /* should be a compile-time check (if needed at all) */
/* we only use a texture for cards with non-power of two */
if (GPU_full_non_power_of_two_support()) {
#else
{
#endif
glGenTextures(1, &icongltex.id);
if (icongltex.id) {

View File

@ -852,6 +852,7 @@ void GPU_create_gl_tex(
int tpx = rectw;
int tpy = recth;
#if 0 /* NPOT support should be a compile-time check */
/* scale if not a power of two. this is not strictly necessary for newer
* GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures
* Then don't bother scaling for hardware that supports NPOT textures! */
@ -875,6 +876,7 @@ void GPU_create_gl_tex(
rect = ibuf->rect;
}
}
#endif
/* create image */
glGenTextures(1, (GLuint *)bind);
@ -1200,8 +1202,12 @@ void GPU_paint_set_mipmap(bool mipmap)
/* check if image has been downscaled and do scaled partial update */
static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x, int y, int w, int h)
{
#if 0 /* NPOT suport should be a compile-time check */
if ((!GPU_full_non_power_of_two_support() && !is_power_of_2_resolution(ibuf->x, ibuf->y)) ||
is_over_resolution_limit(GL_TEXTURE_2D, ibuf->x, ibuf->y))
#else
if (is_over_resolution_limit(GL_TEXTURE_2D, ibuf->x, ibuf->y))
#endif
{
int x_limit = smaller_power_of_2_limit(ibuf->x);
int y_limit = smaller_power_of_2_limit(ibuf->y);

View File

@ -126,10 +126,12 @@ static GPUTexture *GPU_texture_create_nD(
return NULL;
}
#if 0 /* this should be a compile-time check */
if (!GPU_full_non_power_of_two_support()) {
tex->w = power_of_2_max_i(tex->w);
tex->h = power_of_2_max_i(tex->h);
}
#endif
tex->number = 0;
glBindTexture(tex->target, tex->bindcode);