tests: Remove use of designated initializers in cpp
authorTony Barbour <tony@LunarG.com>
Wed, 1 Apr 2015 23:10:07 +0000 (17:10 -0600)
committerTony Barbour <tony@LunarG.com>
Fri, 3 Apr 2015 22:01:48 +0000 (16:01 -0600)
MS VC++ doesn't support designated initializers in C++, just C.

tests/image_tests.cpp
tests/test_environment.cpp
tests/xglrenderframework.cpp
tests/xgltestbinding.cpp
tests/xgltestframework.cpp

index a0d3bb5..1a5fcfd 100644 (file)
@@ -205,10 +205,10 @@ void XglImageTest::CreateImage(uint32_t w, uint32_t h)
     size_t img_reqs_size = sizeof(XGL_IMAGE_MEMORY_REQUIREMENTS);
     uint32_t num_allocations = 0;
     size_t num_alloc_size = sizeof(num_allocations);
-    XGL_MEMORY_ALLOC_IMAGE_INFO img_alloc = {
-        .sType = XGL_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO,
-        .pNext = NULL,
-    };
+    XGL_MEMORY_ALLOC_IMAGE_INFO img_alloc = {};
+    img_alloc.sType = XGL_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO;
+    img_alloc.pNext = NULL;
+
     XGL_MEMORY_ALLOC_INFO mem_info = {};
     mem_info.sType = XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO;
     mem_info.pNext = &img_alloc;
index b3f3a9e..7590200 100644 (file)
@@ -92,11 +92,10 @@ void Environment::X11SetUp()
 
     m_screen = iter.data;
 
-    const XGL_WSI_X11_CONNECTION_INFO connection_info = {
-        .pConnection = m_connection,
-        .root = m_screen->root,
-        .provider = 0,
-    };
+    XGL_WSI_X11_CONNECTION_INFO connection_info = {};
+    connection_info.pConnection = m_connection;
+    connection_info.root = m_screen->root;
+    connection_info.provider = 0;
 
     err = xglWsiX11AssociateConnection(gpus[0], &connection_info);
     assert(!err);
index acd2c98..b24e98e 100644 (file)
@@ -186,17 +186,17 @@ void XglRenderFramework::InitRenderTarget()
         dsBinding = &m_depthStencilBinding;
     else
         dsBinding = NULL;
-    const XGL_FRAMEBUFFER_CREATE_INFO fb_info = {
-         .sType = XGL_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
-         .pNext = NULL,
-         .colorAttachmentCount = m_renderTargetCount,
-         .pColorAttachments = m_colorBindings,
-         .pDepthStencilAttachment = dsBinding,
-         .sampleCount = 1,
-         .width = (uint32_t)m_width,
-         .height = (uint32_t)m_height,
-         .layers = 1,
-    };
+    XGL_FRAMEBUFFER_CREATE_INFO fb_info = {};
+    fb_info.sType = XGL_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
+    fb_info.pNext = NULL;
+    fb_info.colorAttachmentCount = m_renderTargetCount;
+    fb_info.pColorAttachments = m_colorBindings;
+    fb_info.pDepthStencilAttachment = dsBinding;
+    fb_info.sampleCount = 1;
+    fb_info.width = (uint32_t)m_width;
+    fb_info.height = (uint32_t)m_height;
+    fb_info.layers = 1;
+
     XGL_RENDER_PASS_CREATE_INFO rp_info;
     memset(&rp_info, 0 , sizeof(rp_info));
     xglCreateFramebuffer(device(), &fb_info, &(m_frameBuffer));
@@ -472,36 +472,37 @@ XglTextureObj::XglTextureObj(XglDevice *device, uint32_t *colors)
 
     m_textureViewInfo.sType = XGL_STRUCTURE_TYPE_IMAGE_VIEW_ATTACH_INFO;
 
-    const XGL_IMAGE_CREATE_INFO image = {
-        .sType = XGL_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
-        .pNext = NULL,
-        .imageType = XGL_IMAGE_2D,
-        .format = tex_format,
-        .extent = { 16, 16, 1 },
-        .mipLevels = 1,
-        .arraySize = 1,
-        .samples = 1,
-        .tiling = XGL_LINEAR_TILING,
-        .usage = XGL_IMAGE_USAGE_SHADER_ACCESS_READ_BIT,
-        .flags = 0,
-    };
+    XGL_IMAGE_CREATE_INFO image = {};
+    image.sType = XGL_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
+    image.pNext = NULL;
+    image.imageType = XGL_IMAGE_2D;
+    image.format = tex_format;
+    image.extent.width = 16;
+    image.extent.height = 16;
+    image.extent.depth = 1;
+    image.mipLevels = 1;
+    image.arraySize = 1;
+    image.samples = 1;
+    image.tiling = XGL_LINEAR_TILING;
+    image.usage = XGL_IMAGE_USAGE_SHADER_ACCESS_READ_BIT;
+    image.flags = 0;
 
     XGL_IMAGE_VIEW_CREATE_INFO view;
-        view.sType = XGL_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
-        view.pNext = NULL;
-        view.image = XGL_NULL_HANDLE;
-        view.viewType = XGL_IMAGE_VIEW_2D;
-        view.format = image.format;
-        view.channels.r = XGL_CHANNEL_SWIZZLE_R;
-        view.channels.g = XGL_CHANNEL_SWIZZLE_G;
-        view.channels.b = XGL_CHANNEL_SWIZZLE_B;
-        view.channels.a = XGL_CHANNEL_SWIZZLE_A;
-        view.subresourceRange.aspect = XGL_IMAGE_ASPECT_COLOR;
-        view.subresourceRange.baseMipLevel = 0;
-        view.subresourceRange.mipLevels = 1;
-        view.subresourceRange.baseArraySlice = 0;
-        view.subresourceRange.arraySize = 1;
-        view.minLod = 0.0f;
+    view.sType = XGL_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
+    view.pNext = NULL;
+    view.image = XGL_NULL_HANDLE;
+    view.viewType = XGL_IMAGE_VIEW_2D;
+    view.format = image.format;
+    view.channels.r = XGL_CHANNEL_SWIZZLE_R;
+    view.channels.g = XGL_CHANNEL_SWIZZLE_G;
+    view.channels.b = XGL_CHANNEL_SWIZZLE_B;
+    view.channels.a = XGL_CHANNEL_SWIZZLE_A;
+    view.subresourceRange.aspect = XGL_IMAGE_ASPECT_COLOR;
+    view.subresourceRange.baseMipLevel = 0;
+    view.subresourceRange.mipLevels = 1;
+    view.subresourceRange.baseArraySlice = 0;
+    view.subresourceRange.arraySize = 1;
+    view.minLod = 0.0f;
 
     /* create image */
     init(*m_device, image);
@@ -633,11 +634,11 @@ void XglConstantBufferObj::BufferMemoryBarrier(
     }
 
     // open the command buffer
-    XGL_CMD_BUFFER_BEGIN_INFO cmd_buf_info = {
-        .sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO,
-        .pNext = NULL,
-        .flags = 0,
-    };
+    XGL_CMD_BUFFER_BEGIN_INFO cmd_buf_info = {};
+    cmd_buf_info.sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO;
+    cmd_buf_info.pNext = NULL;
+    cmd_buf_info.flags = 0;
+
     err = m_commandBuffer->BeginCommandBuffer(&cmd_buf_info);
     ASSERT_XGL_SUCCESS(err);
 
index 3daa029..4823bb4 100644 (file)
@@ -897,11 +897,11 @@ void CmdBuffer::begin(const XGL_CMD_BUFFER_BEGIN_INFO *info)
 void CmdBuffer::begin(XGL_RENDER_PASS renderpass_obj)
 {
     XGL_CMD_BUFFER_BEGIN_INFO info = {};
-    XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO graphics_cmd_buf_info = {
-        .sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO,
-        .pNext = NULL,
-        .renderPass = renderpass_obj,
-    };
+    XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO graphics_cmd_buf_info = {};
+    graphics_cmd_buf_info.sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO;
+    graphics_cmd_buf_info.pNext = NULL;
+    graphics_cmd_buf_info.renderPass = renderpass_obj;
+
     info.flags = XGL_CMD_BUFFER_OPTIMIZE_GPU_SMALL_BATCH_BIT |
           XGL_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT;
     info.sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO;
index 0841a94..72e8de5 100644 (file)
@@ -411,10 +411,9 @@ void  TestFrameworkXglPresent::Display()
 {
     XGL_RESULT err;
 
-    XGL_WSI_X11_PRESENT_INFO present = {
-        .destWindow = m_window,
-        .srcImage = m_display_image->m_presentableImage,
-    };
+    XGL_WSI_X11_PRESENT_INFO present = {};
+    present.destWindow = m_window;
+    present.srcImage = m_display_image->m_presentableImage;
 
     xcb_change_property (environment->m_connection,
                          XCB_PROP_MODE_REPLACE,
@@ -506,15 +505,12 @@ void TestFrameworkXglPresent::CreatePresentableImages()
 
     for (int x=0; x < m_images.size(); x++)
     {
-        const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO presentable_image_info = {
-            .format = XGL_FMT_B8G8R8A8_UNORM,
-            .usage = XGL_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
-            .extent = {
-                .width = m_display_image->m_width,
-                .height = m_display_image->m_height,
-            },
-            .flags = 0,
-        };
+        XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO presentable_image_info = {};
+        presentable_image_info.format = XGL_FMT_B8G8R8A8_UNORM;
+        presentable_image_info.usage = XGL_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+        presentable_image_info.extent.width = m_display_image->m_width;
+        presentable_image_info.extent.height = m_display_image->m_height;
+        presentable_image_info.flags = 0;
 
         void *dest_ptr;