[Piglit] [PATCH] arb_shader_image_load_store: fix MSVC build

Brian Paul brianp at vmware.com
Tue Feb 3 11:06:27 PST 2015


MSVC doesn't seem to like function calls inside struct initializers.
---
 tests/spec/arb_shader_image_load_store/image.h    | 20 +++++++++----------
 tests/spec/arb_shader_image_load_store/max-size.c | 24 +++++++++++++----------
 2 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/image.h b/tests/spec/arb_shader_image_load_store/image.h
index 54d32ed..ba4134a 100644
--- a/tests/spec/arb_shader_image_load_store/image.h
+++ b/tests/spec/arb_shader_image_load_store/image.h
@@ -316,11 +316,11 @@ image_info(GLenum target, GLenum format, unsigned w, unsigned h)
 {
         const struct image_target_info *t = get_image_target(target);
         const struct image_format_info *f = get_image_format(format);
-        const struct image_info img = {
-                t, f,
-                image_extent_for_target(t, w, h),
-                image_format_epsilon(f)
-        };
+        struct image_info img;
+        img.target = t;
+        img.format = f;
+        img.size = image_extent_for_target(t, w, h);
+        img.epsilon = image_format_epsilon(f);
 
         return img;
 }
@@ -374,11 +374,11 @@ image_level_offset(const struct image_info img, unsigned l)
 static inline struct image_info
 image_info_for_level(struct image_info img, unsigned l)
 {
-        const struct image_info level_img = {
-                img.target, img.format,
-                image_level_size(img, l),
-                img.epsilon
-        };
+        struct image_info level_img;
+        level_img.target = img.target;
+        level_img.format = img.format;
+        level_img.size = image_level_size(img, l);
+        level_img.epsilon = img.epsilon;
 
         return level_img;
 }
diff --git a/tests/spec/arb_shader_image_load_store/max-size.c b/tests/spec/arb_shader_image_load_store/max-size.c
index bd08091..dbab17c 100644
--- a/tests/spec/arb_shader_image_load_store/max-size.c
+++ b/tests/spec/arb_shader_image_load_store/max-size.c
@@ -80,16 +80,20 @@ static bool
 run_test(const struct image_target_info *target,
          const struct image_extent size)
 {
-        const struct grid_info grid = {
-                GL_FRAGMENT_SHADER_BIT,
-                get_image_format(GL_RGBA32F),
-                image_optimal_extent(size)
-        };
-        const struct image_info img = {
-                target, grid.format, size,
-                image_format_epsilon(grid.format)
-        };
-        GLuint prog = generate_program(
+        struct grid_info grid;
+        struct image_info img;
+        GLuint prog;
+
+        grid.stages = GL_FRAGMENT_SHADER_BIT;
+        grid.format = get_image_format(GL_RGBA32F);
+        grid.size = image_optimal_extent(size);
+
+        img.target = target;
+        img.format = grid.format;
+        img.size = size;
+        img.epsilon = image_format_epsilon(grid.format);
+
+        prog = generate_program(
                 grid, GL_FRAGMENT_SHADER,
                 concat(image_hunk(img, ""),
                        hunk("readonly uniform IMAGE_T src_img;\n"
-- 
1.9.1



More information about the Piglit mailing list