Exemple #1
0
int test_textureCubeArray
(
	std::vector<gli::format> const & Formats,
	gli::texture_cube_array::extent_type const & TextureSize
)
{
	int Error(0);

	for(std::size_t i = 0; i < Formats.size(); ++i)
	{
		gli::texture_cube_array TextureA(
			Formats[i],
			TextureSize,
			gli::texture_cube_array::size_type(4));

		gli::texture_cube_array TextureB(gli::duplicate(TextureA));

		Error += TextureA == TextureB ? 0 : 1;

		gli::texture_cube_array TextureC(TextureA, 
			gli::texture_cube_array::size_type(0), TextureA.layers() - 1,
			gli::texture_cube_array::size_type(0), TextureA.faces() - 1,
			gli::texture_cube_array::size_type(1), gli::texture_cube_array::size_type(2));

		Error += TextureA[0][0][1] == TextureC[0][0][0] ? 0 : 1;
		Error += TextureA[0][0][2] == TextureC[0][0][1] ? 0 : 1;
		Error += TextureA[0][1][1] == TextureC[0][1][0] ? 0 : 1;
		Error += TextureA[0][1][2] == TextureC[0][1][1] ? 0 : 1;

		gli::texture_cube_array TextureD(gli::duplicate(TextureC));

		Error += TextureC == TextureD ? 0 : 1;

		gli::texture_cube_array TextureG(gli::duplicate(
			TextureA,
			gli::texture_cube_array::size_type(0), TextureA.layers() - 1,
			gli::texture_cube_array::size_type(0), TextureA.faces() - 1,
			gli::texture_cube_array::size_type(0), TextureA.levels() - 1));
		Error += TextureA == TextureG ? 0 : 1;

		gli::texture_cube_array TextureK(
			Formats[i],
			TextureSize,
			4);

		gli::texture_cube_array TextureH(TextureK, 1, 2, 0, 5, 1, 2);
		gli::texture_cube_array TextureI(gli::duplicate(TextureH));

		Error += TextureH == TextureI ? 0 : 1;

		gli::texture_cube_array TextureJ(gli::duplicate(TextureK, 1, 2, 0, 5, 1, 2));
		Error += TextureH == TextureJ ? 0 : 1;
		Error += TextureI == TextureJ ? 0 : 1;
	}

	return Error;
}
Exemple #2
0
int test_texture1D
(
	std::vector<gli::format> const & Formats, 
	gli::texture1d::extent_type const & TextureSize
)
{
	int Error(0);

	for(std::size_t i = 0; i < Formats.size(); ++i)
	{
		gli::texture1d TextureA(
			Formats[i],
			TextureSize,
			gli::levels(TextureSize));

		gli::texture1d TextureB(gli::duplicate(TextureA));

		Error += TextureA == TextureB ? 0 : 1;

		gli::texture1d TextureC(TextureA, gli::texture1d::size_type(1), gli::texture1d::size_type(2));

		Error += TextureA[1] == TextureC[0] ? 0 : 1;
		Error += TextureA[2] == TextureC[1] ? 0 : 1;

		gli::texture1d TextureD(gli::duplicate(TextureC));

		Error += TextureC == TextureD ? 0 : 1;

		gli::texture1d TextureG(gli::duplicate(TextureA, 0, TextureA.levels() - 1));
		Error += TextureA == TextureG ? 0 : 1;

		gli::texture1d TextureE(gli::duplicate(TextureA, 1, TextureA.levels() - 2));
		Error += TextureA[1] == TextureE[0] ? 0 : 1;

		gli::texture1d TextureF(TextureA, 1, TextureA.levels() - 2);

		Error += TextureE == TextureF ? 0 : 1;
	}

	return Error;
}
Exemple #3
0
int test_texture2D
(
	std::vector<gli::format> const & Formats, 
	gli::texture2D::texelcoord_type const & TextureSize
)
{
	int Error(0);

	for(std::size_t i = 0; i < Formats.size(); ++i)
	{
		gli::texture2D TextureA(Formats[i], TextureSize);

		gli::texture2D TextureB(gli::copy(TextureA));
		Error += TextureA == TextureB ? 0 : 1;

		gli::texture2D TextureC(gli::view(
			TextureA, gli::texture2D::size_type(1), gli::texture2D::size_type(2)));

		Error += TextureA[1] == TextureC[0] ? 0 : 1;
		Error += TextureA[2] == TextureC[1] ? 0 : 1;

		gli::texture2D TextureD(gli::copy(TextureC));

		Error += TextureC == TextureD ? 0 : 1;

		gli::texture2D TextureG(gli::copy(TextureA, 0, TextureA.levels() - 1));
		Error += TextureA == TextureG ? 0 : 1;

		gli::texture2D TextureE(gli::copy(TextureA, 1, TextureA.levels() - 1));
		Error += TextureA[1] == TextureE[0] ? 0 : 1;

		gli::texture2D TextureF(gli::view(
			TextureA, 1, TextureA.levels() - 1));

		Error += TextureE == TextureF ? 0 : 1;
	}

	return Error;
}
Exemple #4
0
	int test_texture(typename texture::dim_type Size, gli::format const & Format, std::vector<genType> const & Colors)
	{
		int Error(0);

		texture TextureA(Format, Size);

		for(std::size_t Level = 0; Level < TextureA.levels(); ++Level)
			TextureA[Level].clear(Colors[Level]);

		texture TextureB = TextureA;
		Error += TextureB == TextureA ? 0 : 1;

		texture TextureC(gli::copy(TextureA));
		Error += TextureC == TextureA ? 0 : 1;

		texture TextureD(gli::copy(TextureB));
		Error += TextureD == TextureB ? 0 : 1;

		texture TextureE(gli::copy(TextureC, 1, 2));
		texture TextureF(TextureC, 1, 2);
		Error += TextureE == TextureF ? 0 : 1;

		texture TextureG(gli::copy(TextureD, 1, 2));
		texture TextureH(TextureD, 1, 2);
		Error += TextureG == TextureH ? 0 : 1;

		TextureG.clear(Colors[Colors.size() - 1]);
		TextureH.clear(Colors[Colors.size() - 1]);
		Error += TextureG == TextureH ? 0 : 1;

		TextureG.clear();
		TextureH.clear();
		Error += TextureG == TextureH ? 0 : 1;

		return Error;
	}
Exemple #5
0
int test_texture1DArray
(
	std::vector<gli::format> const & Formats,
	gli::texture1D::texelcoord_type const & TextureSize
)
{
	int Error(0);

	for(std::size_t i = 0; i < Formats.size(); ++i)
	{
		gli::texture1DArray TextureA(
			Formats[i],
			TextureSize,
			gli::texture1DArray::size_type(4));

		gli::texture1DArray TextureB(gli::copy(TextureA));

		Error += TextureA == TextureB ? 0 : 1;

		gli::texture1DArray TextureC(TextureA,
			gli::texture1DArray::size_type(0), TextureA.layers() - 1,
			gli::texture1DArray::size_type(1), gli::texture1DArray::size_type(2));

		Error += TextureA[0][1] == TextureC[0][0] ? 0 : 1;
		Error += TextureA[0][2] == TextureC[0][1] ? 0 : 1;
		Error += TextureA[1][1] == TextureC[1][0] ? 0 : 1;
		Error += TextureA[1][2] == TextureC[1][1] ? 0 : 1;

		gli::texture1DArray TextureD(gli::copy(TextureC));

		Error += TextureC == TextureD ? 0 : 1;

		gli::texture1DArray TextureG(gli::copy(
			TextureA,
			0, TextureA.layers() - 1,
			0, TextureA.levels() - 1));
		Error += TextureA == TextureG ? 0 : 1;

		gli::texture1DArray TextureE(gli::copy(
			TextureA,
			1, TextureA.layers() - 1,
			0, TextureA.levels() - 1));
		Error += TextureA[1] == TextureE[0] ? 0 : 1;

		gli::texture1DArray TextureF(
			TextureA, 
			1, TextureA.layers() - 1, 
			0, TextureA.levels() - 1); 

		Error += TextureE == TextureF ? 0 : 1;

		gli::texture1DArray TextureK(
			Formats[i],
			TextureSize,
			gli::texture1DArray::size_type(4),
			gli::levels(TextureSize));

		gli::texture1DArray TextureH(TextureK, 1, 2, 1, 2);
		gli::texture1DArray TextureI(gli::copy(TextureH));

		Error += TextureH == TextureI ? 0 : 1;

		gli::texture1DArray TextureJ(gli::copy(TextureK, 1, 2, 1, 2));
		Error += TextureH == TextureJ ? 0 : 1;
		Error += TextureI == TextureJ ? 0 : 1;
	}

	return Error;
}