[gtk+] gsk: Fix build on Visual Studio



commit 49a782413c63982a8c2cb1c99746e2d56d312994
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Dec 28 22:37:01 2016 +0800

    gsk: Fix build on Visual Studio
    
    One cannot use #if...#endif within macro calls in Visual Studio and
    possibly other compilers, and there are more uses of VLAs that need to be
    replaced with g_newa().
    
    There were also checks for the clip type in gskvulkanrenderpass.c which
    were possibly not done right (using the address of the type value to check
    for a type value), which triggered errors as one is attempting to compare
    a pointer type to an enum/int type.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773299

 gsk/gskvulkancommandpool.c |    8 ++++----
 gsk/gskvulkanrender.c      |    2 +-
 gsk/gskvulkanrenderpass.c  |    4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gsk/gskvulkancommandpool.c b/gsk/gskvulkancommandpool.c
index 09dd333..c2b9747 100644
--- a/gsk/gskvulkancommandpool.c
+++ b/gsk/gskvulkancommandpool.c
@@ -83,12 +83,12 @@ gsk_vulkan_command_pool_submit_buffer (GskVulkanCommandPool *self,
                                1,
                                &(VkSubmitInfo) {
                                   .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
-#if 0
+/*
                                   .waitSemaphoreCount = 1,
                                   .pWaitSemaphores = (VkSemaphore[1]) {
                                       gdk_vulkan_context_get_draw_semaphore (self->vulkan)
                                   },
-#endif
+*/
                                   .pWaitDstStageMask = (VkPipelineStageFlags []) {
                                       VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
                                   },
@@ -96,12 +96,12 @@ gsk_vulkan_command_pool_submit_buffer (GskVulkanCommandPool *self,
                                   .pCommandBuffers = (VkCommandBuffer[1]) {
                                       command_buffer
                                   },
-#if 0
+/*
                                   .signalSemaphoreCount = 1,
                                   .pSignalSemaphores = (VkSemaphore[1]) {
                                       gdk_vulkan_context_get_draw_semaphore (self->vulkan)
                                   }
-#endif
+*/
                                },
                                fence);
 }
diff --git a/gsk/gskvulkanrender.c b/gsk/gskvulkanrender.c
index 12dac4d..80b9418 100644
--- a/gsk/gskvulkanrender.c
+++ b/gsk/gskvulkanrender.c
@@ -414,7 +414,7 @@ gsk_vulkan_render_prepare_descriptor_sets (GskVulkanRender *self,
       self->n_descriptor_sets = needed_sets;
       self->descriptor_sets = g_renew (VkDescriptorSet, self->descriptor_sets, needed_sets);
 
-      VkDescriptorSetLayout layouts[needed_sets];
+      VkDescriptorSetLayout *layouts = g_newa (VkDescriptorSetLayout, needed_sets);
       for (i = 0; i < needed_sets; i++)
         {
           layouts[i] = gsk_vulkan_pipeline_layout_get_descriptor_set_layout (self->layout);
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index 44bc7f9..38947ba 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -199,7 +199,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
       {
         if (!gsk_vulkan_push_constants_intersect_rect (&op.constants.constants, constants, 
gsk_clip_node_peek_clip (node)))
           FALLBACK ("Failed to find intersection between clip of type %u and rectangle\n", 
constants->clip.type);
-        if (&op.constants.constants.clip.type == GSK_VULKAN_CLIP_ALL_CLIPPED)
+        if (op.constants.constants.clip.type == GSK_VULKAN_CLIP_ALL_CLIPPED)
           return;
 
         op.type = GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS;
@@ -218,7 +218,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass           *self,
                                                           constants,
                                                           gsk_rounded_clip_node_peek_clip (node)))
           FALLBACK ("Failed to find intersection between clip of type %u and rounded rectangle\n", 
constants->clip.type);
-        if (&op.constants.constants.clip.type == GSK_VULKAN_CLIP_ALL_CLIPPED)
+        if (op.constants.constants.clip.type == GSK_VULKAN_CLIP_ALL_CLIPPED)
           return;
 
         op.type = GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]