Misc Vulkan framework fixes
authorPyry Haulos <phaulos@google.com>
Tue, 4 Aug 2015 20:52:35 +0000 (13:52 -0700)
committerPyry Haulos <phaulos@google.com>
Tue, 4 Aug 2015 20:52:35 +0000 (13:52 -0700)
 * Do not crash in vk::MemoryRequirement member variable static
initializers.

 * Fix some -Wshadow warnings in vkBuilderUtil.*

Change-Id: I5685626e0616966c124e1e271cafac53bdcfd02d

external/vulkancts/framework/vulkan/vkBuilderUtil.cpp
external/vulkancts/framework/vulkan/vkBuilderUtil.hpp
external/vulkancts/framework/vulkan/vkMemUtil.cpp

index 13aec2d..458432d 100644 (file)
@@ -141,7 +141,7 @@ DescriptorSetUpdateBuilder& DescriptorSetUpdateBuilder::write (VkDescriptorSet
                                                                                                                           VkDescriptorType                     descriptorType,
                                                                                                                           const VkDescriptorInfo*      pDescriptors)
 {
-       const VkWriteDescriptorSet write =
+       const VkWriteDescriptorSet writeParams =
        {
                VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
                DE_NULL,
@@ -152,7 +152,7 @@ DescriptorSetUpdateBuilder& DescriptorSetUpdateBuilder::write (VkDescriptorSet
                descriptorType,         //!< descriptorType
                pDescriptors,           //!< pDescriptors
        };
-       m_writes.push_back(write);
+       m_writes.push_back(writeParams);
        return *this;
 }
 
@@ -164,7 +164,7 @@ DescriptorSetUpdateBuilder& DescriptorSetUpdateBuilder::copy (VkDescriptorSet       sr
                                                                                                                          deUint32                      destArrayElement,
                                                                                                                          deUint32                      count)
 {
-       const VkCopyDescriptorSet copy =
+       const VkCopyDescriptorSet copyParams =
        {
                VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET,
                DE_NULL,
@@ -176,7 +176,7 @@ DescriptorSetUpdateBuilder& DescriptorSetUpdateBuilder::copy (VkDescriptorSet       sr
                destArrayElement,       //!< destArrayElement
                count,                          //!< count
        };
-       m_copies.push_back(copy);
+       m_copies.push_back(copyParams);
        return *this;
 }
 
index be1bcd5..39e1910 100644 (file)
@@ -111,19 +111,19 @@ public:
        class Location
        {
        public:
-               static inline Location  binding                         (deUint32 binding)
+               static inline Location  binding                         (deUint32 binding_)
                {
-                       return Location(binding, 0u);
+                       return Location(binding_, 0u);
                }
-               static inline Location  bindingArrayElement     (deUint32 binding, deUint32 arrayElement)
+               static inline Location  bindingArrayElement     (deUint32 binding_, deUint32 arrayElement)
                {
-                       return Location(binding, arrayElement);
+                       return Location(binding_, arrayElement);
                }
 
        private:
                // \note private to force use of factory methods that have more descriptive names
-               inline                                  Location                        (deUint32 binding, deUint32 arrayElement)
-                       : m_binding                     (binding)
+               inline                                  Location                        (deUint32 binding_, deUint32 arrayElement)
+                       : m_binding                     (binding_)
                        , m_arrayElement        (arrayElement)
                {
                }
index 446953d..a3038e6 100644 (file)
@@ -84,6 +84,12 @@ const MemoryRequirement MemoryRequirement::LazilyAllocated   = MemoryRequirement(M
 
 bool MemoryRequirement::matchesHeap (VkMemoryPropertyFlags heapFlags) const
 {
+       // sanity check
+       if ((m_flags & FLAG_COHERENT) && !(m_flags & FLAG_HOST_VISIBLE))
+               DE_FATAL("Coherent memory must be host-visible");
+       if ((m_flags & FLAG_HOST_VISIBLE) && (m_flags & FLAG_LAZY_ALLOCATION))
+               DE_FATAL("Lazily allocated memory cannot be mappable");
+
        // host-visible
        if ((m_flags & FLAG_HOST_VISIBLE) && !(heapFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
                return false;
@@ -102,10 +108,6 @@ bool MemoryRequirement::matchesHeap (VkMemoryPropertyFlags heapFlags) const
 MemoryRequirement::MemoryRequirement (deUint32 flags)
        : m_flags(flags)
 {
-       if ((flags & FLAG_COHERENT) && !(flags & FLAG_HOST_VISIBLE))
-               DE_FATAL("Coherent memory must be host-visible");
-       if ((flags & FLAG_HOST_VISIBLE) && (flags & FLAG_LAZY_ALLOCATION))
-               DE_FATAL("Lazily allocated memory cannot be mappable");
 }
 
 // SimpleAllocator
@@ -146,7 +148,7 @@ MovePtr<Allocation> SimpleAllocator::allocate (const VkMemoryAllocInfo& allocInf
 MovePtr<Allocation> SimpleAllocator::allocate (const VkMemoryRequirements& memReqs, MemoryRequirement requirement)
 {
        const deUint32                  memoryTypeNdx   = selectMatchingMemoryType(m_memProps, memReqs.memoryTypeBits, requirement);
-       const VkMemoryAllocInfo allocInfo       =
+       const VkMemoryAllocInfo allocInfo               =
        {
                VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO,    //      VkStructureType                 sType;
                DE_NULL,                                                                //      const void*                             pNext;