glTexImage2D has incorrect max level check inside

This topic contains 2 replies, has 2 voices, and was last updated by  todi1856 7 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30275

    todi1856
    Member

    void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)

    According to OpenGL 2.0 documentation:

    “GL_INVALID_VALUE may be generated if level is greater than log 2 ⁡ max , where max is the returned value of GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.”

    on OpenGL ES 2.0 Emu, max texture size is 8192, thus max level is 12, so values from 0..12 are legal

    But if you pass for ex., 13 to glTexImage2D, the GL_INVALID_VALUE won’t popup…. I think this is a bug.

    The value 14 and above will produce GL_INVALID_VALUE.

    #34308

    Xmas
    Member

    With mipmap sizes ranging from 1 (2^0) to 8192 (2^13) you get 14 levels. The behaviour you observed is correct.

    #34309

    todi1856
    Member

    Whoops, log(maxTextureSizel)/log(2.0f) produced 12.99999 and when converting to int, it gave me 12…. 🙁

    Sorry, you’re right

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.