| 866 | } |
| 867 | |
| 868 | rdcstr GetTextureCompleteStatus(GLenum target, GLuint tex, GLuint sampler) |
| 869 | { |
| 870 | // unbound and texture buffers don't need to be checked |
| 871 | if(tex == 0 || target == eGL_TEXTURE_BUFFER) |
| 872 | return rdcstr(); |
| 873 | |
| 874 | // the completeness rules are fairly complex. The relevant spec is copied here and each rule is |
| 875 | // annotated with a number for easier reference. |
| 876 | /* |
| 877 | For one-, two-, and three-dimensional and one- and two-dimensional array textures, a texture is |
| 878 | mipmap complete if all of the following conditions hold true: |
| 879 | |
| 880 | * The set of mipmap images levelBase through q (where q is defined in section 8.14.3) were each |
| 881 | specified with the same internal format. [RULE_1] |
| 882 | * The dimensions of the images follow the sequence described in section 8.14.3. [RULE_2] |
| 883 | * level base <= level max [RULE_3] |
| 884 | |
| 885 | [q is the usual definition - natural mip numbering, clamped by either immutable number of mips |
| 886 | or MAX_LEVEL] |
| 887 | |
| 888 | Image levels k where k < level base or k > q are insignificant to the definition of |
| 889 | completeness. |
| 890 | |
| 891 | A cube map texture is mipmap complete if each of the six texture images, considered |
| 892 | individually, is mipmap complete. [RULE_4] |
| 893 | |
| 894 | Additionally, a cube map texture is cube complete if the following conditions all hold true: |
| 895 | |
| 896 | * The level base texture images of each of the six cubemap faces have identical, positive, and |
| 897 | square dimensions. [RULE_5] |
| 898 | * The level base images were each specified with the same internal format. [RULE_6] |
| 899 | |
| 900 | A cube map array texture is cube array complete if it is complete when treated as a |
| 901 | two-dimensional array [RULE_7] and cube complete for every cube map slice within the array |
| 902 | texture. [RULE_8] |
| 903 | |
| 904 | Using the preceding definitions, a texture is complete unless any of the following conditions |
| 905 | hold true: |
| 906 | |
| 907 | * Any dimension of the level base image is not positive. For a rectangle or multisample texture, |
| 908 | level base is always zero. [RULE_9] |
| 909 | * The texture is a cube map texture, and is not cube complete. [RULE_10] |
| 910 | * The texture is a cube map array texture, and is not cube array complete. [RULE_11] |
| 911 | * The minification filter requires a mipmap (is neither NEAREST nor LINEAR), and the texture is |
| 912 | not mipmap complete. [RULE_12] |
| 913 | * Any of |
| 914 | - The internal format of the texture is integer (see table 8.12). [RULE_13] |
| 915 | - The internal format is STENCIL_INDEX. [RULE_14] |
| 916 | - The internal format is DEPTH_STENCIL, and the value of DEPTH_STENCIL_TEXTURE_MODE for the |
| 917 | texture is STENCIL_INDEX. [RULE_15] |
| 918 | and either the magnification filter is not NEAREST, or the minification filter is neither |
| 919 | NEAREST nor NEAREST_MIPMAP_NEAREST |
| 920 | */ |
| 921 | |
| 922 | GLint isImmutable = 0, levelBase = 0, levelMax = 1000; |
| 923 | GL.glGetTextureParameterivEXT(tex, target, eGL_TEXTURE_IMMUTABLE_FORMAT, &isImmutable); |
| 924 | GL.glGetTextureParameterivEXT(tex, target, eGL_TEXTURE_BASE_LEVEL, &levelBase); |
| 925 | GL.glGetTextureParameterivEXT(tex, target, eGL_TEXTURE_MAX_LEVEL, &levelMax); |
no test coverage detected