int run() { int Error(0); gli::texture Texture(gli::TARGET_1D, gli::FORMAT_RGBA8_UNORM_PACK8, gli::texture::extent_type(1), 1, 1, 1); gli::texture1d Texture1D(Texture); gli::texture1d_array Texture1DArray(Texture); gli::texture2d Texture2D(Texture); gli::texture2d_array Texture2DArray(Texture); gli::texture3d Texture3D(Texture); gli::texture_cube TextureCube(Texture); gli::texture_cube_array TextureCubeArray(Texture); Error += Texture == Texture1D ? 0 : 1; Error += Texture != Texture1DArray ? 0 : 1; Error += Texture != Texture2D ? 0 : 1; Error += Texture != Texture2DArray ? 0 : 1; Error += Texture != Texture3D ? 0 : 1; Error += Texture != TextureCube ? 0 : 1; Error += Texture != TextureCubeArray ? 0 : 1; gli::texture Texture1D_B(Texture1D); gli::texture Texture1DArray_B(Texture1DArray); gli::texture Texture2D_B(Texture2D); gli::texture Texture2DArray_B(Texture2DArray); gli::texture Texture3D_B(Texture3D); gli::texture TextureCube_B(TextureCube); gli::texture TextureCubeArray_B(TextureCubeArray); Error += Texture == Texture1D_B ? 0 : 1; Error += Texture != Texture1DArray_B ? 0 : 1; Error += Texture != Texture2D_B ? 0 : 1; Error += Texture != Texture2DArray_B ? 0 : 1; Error += Texture != Texture3D_B ? 0 : 1; Error += Texture != TextureCube_B ? 0 : 1; Error += Texture != TextureCubeArray_B ? 0 : 1; Error += Texture1D == Texture1D_B ? 0 : 1; Error += Texture1DArray == Texture1DArray_B ? 0 : 1; Error += Texture2D == Texture2D_B ? 0 : 1; Error += Texture2DArray == Texture2DArray_B ? 0 : 1; Error += Texture3D == Texture3D_B ? 0 : 1; Error += TextureCube == TextureCube_B ? 0 : 1; Error += TextureCubeArray == TextureCubeArray_B ? 0 : 1; return Error; }
int run() { int Error(0); gli::texture Texture(gli::TARGET_1D, gli::FORMAT_RGBA8_UNORM, gli::texture::texelcoord_type(1), 1, 1, 1); gli::texture1D Texture1D(Texture); gli::texture1DArray Texture1DArray(Texture); gli::texture2D Texture2D(Texture); gli::texture2DArray Texture2DArray(Texture); gli::texture3D Texture3D(Texture); gli::textureCube TextureCube(Texture); gli::textureCubeArray TextureCubeArray(Texture); Error += Texture == Texture1D ? 0 : 1; Error += Texture != Texture1DArray ? 0 : 1; Error += Texture != Texture2D ? 0 : 1; Error += Texture != Texture2DArray ? 0 : 1; Error += Texture != Texture3D ? 0 : 1; Error += Texture != TextureCube ? 0 : 1; Error += Texture != TextureCubeArray ? 0 : 1; gli::texture Texture1D_B(Texture1D); gli::texture Texture1DArray_B(Texture1DArray); gli::texture Texture2D_B(Texture2D); gli::texture Texture2DArray_B(Texture2DArray); gli::texture Texture3D_B(Texture3D); gli::texture TextureCube_B(TextureCube); gli::texture TextureCubeArray_B(TextureCubeArray); Error += Texture == Texture1D_B ? 0 : 1; Error += Texture != Texture1DArray_B ? 0 : 1; Error += Texture != Texture2D_B ? 0 : 1; Error += Texture != Texture2DArray_B ? 0 : 1; Error += Texture != Texture3D_B ? 0 : 1; Error += Texture != TextureCube_B ? 0 : 1; Error += Texture != TextureCubeArray_B ? 0 : 1; Error += Texture1D == Texture1D_B ? 0 : 1; Error += Texture1DArray == Texture1DArray_B ? 0 : 1; Error += Texture2D == Texture2D_B ? 0 : 1; Error += Texture2DArray == Texture2DArray_B ? 0 : 1; Error += Texture3D == Texture3D_B ? 0 : 1; Error += TextureCube == TextureCube_B ? 0 : 1; Error += TextureCubeArray == TextureCubeArray_B ? 0 : 1; return Error; }
int test_textureCubeArray_textureCube_access() { int Error(0); { gli::textureCubeArray TextureCubeArray( 2, 6, gli::textureCubeArray::size_type(1), gli::RGBA8U, gli::textureCubeArray::dimensions_type(2)); assert(!TextureCubeArray.empty()); std::vector<glm::u8vec4> Colors; Colors.push_back(glm::u8vec4(255, 0, 0, 255)); Colors.push_back(glm::u8vec4( 0, 0, 255, 255)); gli::textureCube TextureCube = TextureCubeArray[1]; glm::u8vec4* PointerA = TextureCube.data<glm::u8vec4>(); glm::u8vec4* PointerB = TextureCubeArray.data<glm::u8vec4>() + TextureCube.size() / sizeof(glm::u8vec4); Error += PointerA == PointerB ? 0 : 1; } { gli::textureCube TextureCube( 6, gli::textureCube::size_type(2), gli::RGBA8U, gli::textureCube::dimensions_type(2)); assert(!TextureCube.empty()); gli::texture2D TextureA = TextureCube[0]; gli::texture2D TextureB = TextureCube[1]; std::size_t Size0 = TextureA.size(); std::size_t Size1 = TextureB.size(); Error += Size0 == sizeof(glm::u8vec4) * 5 ? 0 : 1; Error += Size1 == sizeof(glm::u8vec4) * 5 ? 0 : 1; *TextureA.data<glm::u8vec4>() = glm::u8vec4(255, 127, 0, 255); *TextureB.data<glm::u8vec4>() = glm::u8vec4(0, 127, 255, 255); glm::u8vec4 * PointerA = TextureA.data<glm::u8vec4>(); glm::u8vec4 * PointerB = TextureB.data<glm::u8vec4>(); glm::u8vec4 * Pointer0 = TextureCube.data<glm::u8vec4>() + 0; glm::u8vec4 * Pointer1 = TextureCube.data<glm::u8vec4>() + 5; Error += PointerA == Pointer0 ? 0 : 1; Error += PointerB == Pointer1 ? 0 : 1; glm::u8vec4 ColorA = *TextureA.data<glm::u8vec4>(); glm::u8vec4 ColorB = *TextureB.data<glm::u8vec4>(); glm::u8vec4 Color0 = *Pointer0; glm::u8vec4 Color1 = *Pointer1; Error += glm::all(glm::equal(Color0, glm::u8vec4(255, 127, 0, 255))) ? 0 : 1; Error += glm::all(glm::equal(Color1, glm::u8vec4(0, 127, 255, 255))) ? 0 : 1; } { gli::textureCube TextureCube( 1, gli::textureCube::size_type(1), gli::RGBA8U, gli::textureCube::dimensions_type(2)); std::size_t SizeA = TextureCube.size(); Error += SizeA == sizeof(glm::u8vec4) * 4 ? 0 : 1; gli::texture2D Texture2D = TextureCube[0]; std::size_t Size0 = Texture2D.size(); Error += Size0 == sizeof(glm::u8vec4) * 4 ? 0 : 1; *Texture2D.data<glm::u8vec4>() = glm::u8vec4(255, 127, 0, 255); glm::u8vec4 * PointerA = Texture2D.data<glm::u8vec4>(); glm::u8vec4 * Pointer0 = TextureCube.data<glm::u8vec4>(); Error += PointerA == Pointer0 ? 0 : 1; glm::u8vec4 ColorA = *PointerA; glm::u8vec4 Color0 = *Pointer0; Error += glm::all(glm::equal(ColorA, glm::u8vec4(255, 127, 0, 255))) ? 0 : 1; Error += glm::all(glm::equal(Color0, glm::u8vec4(255, 127, 0, 255))) ? 0 : 1; } return Error; }
TextureCubeArray Texture::to_texture_cube_array() const { return TextureCubeArray(impl); }