[Piglit] [PATCH 4/5] khr_texture_compression_astc: Fix code alignment issues

Anuj Phogat anuj.phogat at gmail.com
Thu Jul 7 23:28:12 UTC 2016


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 .../khr_compressed_astc-miptree-array.c            | 24 ++++++++-------
 .../khr_compressed_astc-miptree.c                  | 34 +++++++++++-----------
 2 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
index 0cc0ec8..0bcc506 100644
--- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
@@ -84,7 +84,7 @@ PIGLIT_GL_TEST_CONFIG_END
  */
 static void
 load_texture(const char *dir1, const char *dir2,
-	const char *filename, GLuint *tex_name)
+	     const char *filename, GLuint *tex_name)
 {
 	struct piglit_ktx *ktx;
 	const struct piglit_ktx_info *info;
@@ -107,7 +107,8 @@ load_texture(const char *dir1, const char *dir2,
 
 	info = piglit_ktx_get_info(ktx);
 	assert(info->num_miplevels == num_levels);
-	assert((info->target == GL_TEXTURE_2D_ARRAY) || (info->target == GL_TEXTURE_2D));
+	assert((info->target == GL_TEXTURE_2D_ARRAY) ||
+	       (info->target == GL_TEXTURE_2D));
 	assert(info->pixel_width == level0_width);
 	assert(info->pixel_height== level0_height);
 
@@ -119,10 +120,10 @@ load_texture(const char *dir1, const char *dir2,
 	piglit_ktx_destroy(ktx);
 }
 
-/** Compares the compresseed texture against the decompressed texture */
+/** Compares the compressed textures from two layers of an array texture. */
 bool draw_compare_levels(GLint index,
-			GLint level_pixel_size_loc, GLint pixel_offset_loc,
-			GLuint compressed_tex)
+			 GLint level_pixel_size_loc, GLint pixel_offset_loc,
+			 GLuint compressed_tex)
 {
 	unsigned y = 0;
 	unsigned x = 0;
@@ -169,6 +170,7 @@ bool draw_compare_levels(GLint index,
 enum piglit_result
 test_miptrees(void* odd)
 {
+	GLint index, pixel_offset_loc, level_pixel_size_loc;
 	int subtest =  0;
 	int block_dims = *(bool*)odd;
 
@@ -179,10 +181,9 @@ test_miptrees(void* odd)
 	static const char * block_dim_str[2] = {"12x12", "5x5"};
 
 
-	GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
-	GLint level_pixel_size_loc = glGetUniformLocation(prog,
-							"level_pixel_size");
-	GLint index = glGetUniformLocation(prog, "index");
+	pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
+	level_pixel_size_loc = glGetUniformLocation(prog, "level_pixel_size");
+	index = glGetUniformLocation(prog, "index");
 
 	/* Generate filename for compressed texture */
 	char cur_file[50];
@@ -194,7 +195,7 @@ test_miptrees(void* odd)
 
 		/* Load texture for current submode and block size */
 		load_texture("compressed/2D", tests[subtest], cur_file,
-		    &compressed_tex);
+			     &compressed_tex);
 
 		/* Draw and compare each level of the two textures */
 		glClear(GL_COLOR_BUFFER_BIT);
@@ -245,7 +246,8 @@ piglit_init(int argc, char **argv)
 		"\n"
 		"void main()\n"
 		"{\n"
-		"    vec4 t = texture(tex, vec3(tex_coord.x, tex_coord.y, index));\n"
+		"    vec4 t;\n"
+		"    t = texture(tex, vec3(tex_coord.x, tex_coord.y, index));\n"
 		"    fragment_color = vec4(t.rgb, 1.0);\n"
 		"}\n";
 
diff --git a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
index e20698b..fa60613 100644
--- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
@@ -111,7 +111,7 @@ PIGLIT_GL_TEST_CONFIG_END
  */
 static void
 load_texture(const char *dir1, const char *dir2,
-	const char *block_dim_str, GLuint *tex_name)
+	     const char *block_dim_str, GLuint *tex_name)
 {
 	struct piglit_ktx *ktx;
 	const struct piglit_ktx_info *info;
@@ -121,7 +121,7 @@ load_texture(const char *dir1, const char *dir2,
 
 	/* Generate filename for compressed texture */
 	snprintf(cur_file, sizeof(cur_file), "waffles-%s.ktx",
-				block_dim_str);
+		 block_dim_str);
 
 	piglit_join_paths(filepath, sizeof(filepath), 7,
 	                  piglit_source_dir(),
@@ -152,8 +152,8 @@ load_texture(const char *dir1, const char *dir2,
 
 /** Compares the compressed texture against the decompressed texture */
 bool draw_compare_levels(bool check_error, bool check_srgb,
-			GLint level_pixel_size_loc, GLint pixel_offset_loc,
-			GLuint compressed_tex, GLuint decompressed_tex)
+			 GLint level_pixel_size_loc, GLint pixel_offset_loc,
+			 GLuint compressed_tex, GLuint decompressed_tex)
 {
 	/* Fully-saturated magenta */
 	static const float error_color[4] = {1.0, 0.0, 1.0, 1.0};
@@ -222,6 +222,7 @@ bool draw_compare_levels(bool check_error, bool check_srgb,
 enum piglit_result
 test_miptrees(void* input_type)
 {
+	GLint pixel_offset_loc, level_pixel_size_loc;
 	const enum test_type subtest = *(enum test_type*) input_type;
 	const bool is_srgb_test = subtest == TEST_TYPE_SRGB;
 	const bool is_hdr_test  = subtest == TEST_TYPE_HDR;
@@ -247,9 +248,8 @@ test_miptrees(void* input_type)
 	if (is_srgb_test)
 		piglit_require_extension("GL_EXT_texture_sRGB_decode");
 
-	GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
-	GLint level_pixel_size_loc = glGetUniformLocation(prog,
-							"level_pixel_size");
+	pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
+	level_pixel_size_loc = glGetUniformLocation(prog, "level_pixel_size");
 
 	/*  Check for error color if an LDR-only sys reading an HDR
 	 *  texture. No need to draw a reference mipmap in this case.
@@ -266,24 +266,24 @@ test_miptrees(void* input_type)
 
 		/* Load texture for current submode and block size */
 		load_texture("compressed/2D", tests[subtest],
-				block_dim_str[block_dims],
-				&tex_compressed);
+			     block_dim_str[block_dims],
+			     &tex_compressed);
 		if (!check_error) {
 			load_texture("decompressed/2D", tests[subtest],
-					block_dim_str[block_dims],
-					&tex_decompressed);
+				     block_dim_str[block_dims],
+				     &tex_decompressed);
 		}
 
 		/* Draw and compare each level of the two textures */
 		glClear(GL_COLOR_BUFFER_BIT);
 		if (!draw_compare_levels(check_error, is_srgb_test,
-					level_pixel_size_loc,
-					pixel_offset_loc,
-					tex_compressed,
-					tex_decompressed)) {
+					 level_pixel_size_loc,
+					 pixel_offset_loc,
+					 tex_compressed,
+					 tex_decompressed)) {
 			piglit_loge("Mode %s Block %s.",
-					tests[subtest],
-					block_dim_str[block_dims]);
+				    tests[subtest],
+				    block_dim_str[block_dims]);
 			return PIGLIT_FAIL;
 		}
 	}
-- 
2.5.5



More information about the Piglit mailing list