Ejemplo n.º 1
0
    def expect(self):
        """Expect that the applicationInfoPointer is not null for the second
         vkCreateInstance, and that it contains some of the expected data."""
        architecture = self.architecture

        create_instance = require(self.nth_call_of("vkCreateInstance", 1))
        require_not_equal(create_instance.hex_pCreateInfo, 0)

        create_info_memory = require(
            create_instance.get_read_data(create_instance.hex_pCreateInfo,
                                          architecture.int_integerSize))
        require_equal(little_endian_bytes_to_int(create_info_memory),
                      VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)

        applicationInfoPointer = require(
            create_instance.get_read_data(
                create_instance.hex_pCreateInfo +
                architecture.int_pointerSize * 3,
                architecture.int_pointerSize))
        require_not_equal(little_endian_bytes_to_int(applicationInfoPointer),
                          0)
        # The 2nd pointer(3rd element) in VkApplicationInfo should be the string
        # Application
        application_info_application_name_ptr = require(
            create_instance.get_read_data(
                little_endian_bytes_to_int(applicationInfoPointer) +
                2 * architecture.int_pointerSize,
                architecture.int_pointerSize))
        application_name = require(
            create_instance.get_read_string(
                little_endian_bytes_to_int(
                    application_info_application_name_ptr)))
        require_equal(application_name, "Application")
    def expect(self):
        set_blend_constants = require(
            self.next_call_of("vkCmdSetBlendConstants"))

        require_not_equal(0, set_blend_constants.int_commandBuffer)
        require_equal([1.25, 2.5, 5.0, 10.0],
                      set_blend_constants.float_blendConstants)
    def expect(self):
        """The first call to vkCmdSetLineWidth should have line width value: 1.0
        """
        set_line_width = require(self.nth_call_of("vkCmdSetLineWidth", 1))

        require_not_equal(0, set_line_width.int_commandBuffer)
        require_equal(1.0, set_line_width.float_lineWidth)
    def expect(self):
        architecture = self.architecture
        device_properties = require(
            self.next_call_of("vkGetPhysicalDeviceProperties"))

        get_cache_data_with_null_pdata = require(
            self.nth_call_of("vkGetPipelineCacheData", 3))
        write_data_size = VulkanStruct(
            architecture, DATA_SIZE,
            get_write_offset_function(
                get_cache_data_with_null_pdata,
                get_cache_data_with_null_pdata.hex_pDataSize))
        # The pipeline cache data size must be at least as large as its header
        # size
        require_true(16 + VK_UUID_SIZE <= write_data_size.dataSize)

        get_cache_data_with_not_null_pdata = require(
            self.next_call_of("vkGetPipelineCacheData"))
        cache_data_header = VulkanStruct(
            architecture, DATA_HEADER,
            get_write_offset_function(
                get_cache_data_with_not_null_pdata,
                get_cache_data_with_not_null_pdata.hex_pData))
        require_equal(16 + VK_UUID_SIZE, cache_data_header.headerSize)
        require_equal(1, cache_data_header.headerVersion)
        require_not_equal(0, cache_data_header.venderID)
        require_not_equal(0, cache_data_header.deviceID)

        destroy_pipeline_cache = require(
            self.next_call_of("vkDestroyPipelineCache"))
Ejemplo n.º 5
0
    def expect(self):
        """1. One descriptor set."""

        arch = self.architecture
        # Get the VkDescriptorPool handle returned from the driver.
        # This will also locate us to the proper position in the stream
        # so we can call next_call_of() for querying the other atoms.
        pool = get_descriptor_pool(self, 1)
        # Get the VkDescriptorSetLayout handle returned from the driver.
        set_layout = get_descriptor_set_layout(self)

        alloc_descriptor_set, device, p_sets = \
            check_alloc_descriptor_set(self, arch)
        info = get_descriptor_set_alloc_info(alloc_descriptor_set, arch)
        require_equal(info.sType,
                      VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO)
        require_equal(0, info.pNext)
        require_equal(pool, info.descriptorPool)
        require_equal(1, info.descriptorSetCount)

        # Read the VkDescriptorSetLayout conveyed in the alloc info.
        layout = little_endian_bytes_to_int(
            require(alloc_descriptor_set.get_read_data(
                info.pSetLayouts, NON_DISPATCHABLE_HANDLE_SIZE)))
        require_equal(set_layout, layout)

        # Get the real VkDescriptorSet returned form the driver.
        actual_set = little_endian_bytes_to_int(
            require(alloc_descriptor_set.get_write_data(
                alloc_descriptor_set.hex_pDescriptorSets,
                NON_DISPATCHABLE_HANDLE_SIZE)))
        require_not_equal(0, actual_set)

        check_free_descriptor_set(self, device, pool, [actual_set])
Ejemplo n.º 6
0
    def expect(self):
        """Expect that the pInheritanceInfo is null for the first
        vkBeginCommandBuffer"""
        architecture = self.architecture

        begin_command_buffer = require(
            self.next_call_of("vkBeginCommandBuffer"))
        command_buffer_value = begin_command_buffer.int_commandBuffer
        require_not_equal(command_buffer_value, 0)

        # The command buffer begin info struct should start with correct
        # sType value.
        begin_info_stype_memory = require(
            begin_command_buffer.get_read_data(
                begin_command_buffer.hex_pBeginInfo,
                architecture.int_integerSize))
        require_equal(little_endian_bytes_to_int(begin_info_stype_memory),
                      VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)

        # The inheritance info pointer should be a nullptr.
        inheritance_info_pointer_memory = require(
            begin_command_buffer.get_read_data(
                begin_command_buffer.hex_pBeginInfo +
                architecture.int_pointerSize * 3,
                architecture.int_pointerSize))
        require_equal(
            little_endian_bytes_to_int(inheritance_info_pointer_memory), 0)

        # vkEndCommandBuffer() returns correctly
        end_command_buffer = require(self.next_call_of("vkEndCommandBuffer"))
        require_equal(end_command_buffer.int_commandBuffer,
                      command_buffer_value)
        require_equal(VK_SUCCESS, int(end_command_buffer.return_val))
    def expect(self):
        dispatch = require(self.next_call_of("vkCmdDispatch"))

        require_not_equal(0, dispatch.int_commandBuffer)
        require_equal(512, dispatch.int_groupCountX)
        require_equal(1, dispatch.int_groupCountY)
        require_equal(1, dispatch.int_groupCountZ)
Ejemplo n.º 8
0
    def expect(self):
        """Check the arguments to vkCmdExecuteCommands"""
        execute_commands = require(self.nth_call_of("vkCmdExecuteCommands", 1))

        require_not_equal(0, execute_commands.int_commandBuffer)
        require_equal(2, execute_commands.int_commandBufferCount)
        require_not_equal(0, execute_commands.hex_pCommandBuffers)
    def expect(self):
        architecture = self.architecture
        bind_buffer_memory = require(self.next_call_of("vkBindBufferMemory"))
        map_memory = require(self.next_call_of("vkMapMemory"))
        unmap_memory = require(self.next_call_of("vkUnmapMemory"))

        require_not_equal(0, bind_buffer_memory.int_device)
        require_not_equal(0, bind_buffer_memory.int_buffer)
        require_not_equal(0, bind_buffer_memory.int_memory)
        require_equal(0, bind_buffer_memory.int_memoryOffset)

        require_equal(bind_buffer_memory.int_device, map_memory.int_device)
        require_equal(bind_buffer_memory.int_memory, map_memory.int_memory)
        require_equal(0, map_memory.int_offset)
        require_equal(VK_WHOLE_SIZE, map_memory.int_size)
        require_equal(0, map_memory.int_flags)
        require_not_equal(0, map_memory.hex_ppData)

        written_pointer = little_endian_bytes_to_int(
            require(
                map_memory.get_write_data(map_memory.hex_ppData,
                                          architecture.int_pointerSize)))

        require_not_equal(0, written_pointer)

        require_equal(bind_buffer_memory.int_device, unmap_memory.int_device)
        require_equal(bind_buffer_memory.int_memory, unmap_memory.int_memory)
Ejemplo n.º 10
0
    def expect(self):
        architecture = self.architecture
        device_properties = require(
            self.next_call_of("vkGetPhysicalDeviceProperties"))

        get_image_memory_requirements = require(
            self.next_call_of("vkGetImageMemoryRequirements"))
        memory_requirements = VulkanStruct(
            architecture, MEMORY_REQUIREMENTS,
            get_write_offset_function(
                get_image_memory_requirements,
                get_image_memory_requirements.hex_pMemoryRequirements))

        allocate_memory = require(self.next_call_of("vkAllocateMemory"))
        require_not_equal(0, allocate_memory.int_device)
        require_not_equal(0, allocate_memory.hex_pAllocateInfo)
        require_equal(0, allocate_memory.hex_pAllocator)
        require_not_equal(0, allocate_memory.hex_pMemory)

        allocate_memory_info = VulkanStruct(
            architecture, MEMORY_ALLOCATE_INFO,
            get_read_offset_function(allocate_memory,
                                     allocate_memory.hex_pAllocateInfo))

        require_equal(VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
                      allocate_memory_info.sType)
        require_equal(0, allocate_memory_info.pNext)
        require_equal(memory_requirements.size,
                      allocate_memory_info.allocationSize)

        free_memory = require(self.next_call_of("vkFreeMemory"))
        require_not_equal(0, free_memory.int_device)
        require_not_equal(0, free_memory.int_memory)
        require_equal(0, free_memory.hex_pAllocator)
Ejemplo n.º 11
0
    def expect(self):
        draw = require(self.next_call_of("vkCmdDrawIndexedIndirect"))

        require_not_equal(0, draw.int_commandBuffer)
        require_not_equal(0, draw.int_buffer)
        require_equal(0, draw.int_offset)
        require_equal(1, draw.int_drawCount)
        require_equal(0, draw.int_stride)
 def expect(self):
     """2. Expects vkCmdResetQueryPool() is called with firstQuery: 1,
     queryCount: 5."""
     reset_query_pool = require(self.nth_call_of("vkCmdResetQueryPool", 2))
     require_not_equal(0, reset_query_pool.int_commandBuffer)
     require_not_equal(0, reset_query_pool.int_queryPool)
     require_equal(1, reset_query_pool.int_firstQuery)
     require_equal(5, reset_query_pool.int_queryCount)
Ejemplo n.º 13
0
    def expect(self):
        draw = require(self.next_call_of("vkCmdDraw"))

        require_not_equal(0, draw.int_commandBuffer)
        require_equal(3, draw.int_vertexCount)
        require_equal(1, draw.int_instanceCount)
        require_equal(0, draw.int_firstVertex)
        require_equal(0, draw.int_firstInstance)
    def expect(self):
        architecture = self.architecture
        bind_pipeline = require(self.next_call_of("vkCmdBindPipeline"))

        require_not_equal(0, bind_pipeline.int_commandBuffer)
        require_equal(VK_PIPELINE_BIND_POINT_GRAPHICS,
                      bind_pipeline.int_pipelineBindPoint)
        require_not_equal(0, bind_pipeline.int_pipeline)
    def expect(self):
        architecture = self.architecture
        device_properties = require(
            self.next_call_of("vkGetPhysicalDeviceProperties"))

        createSwapchain = require(self.next_call_of("vkCreateSwapchainKHR"))
        destroySwapchain = require(self.next_call_of("vkDestroySwapchainKHR"))

        def get_swapchain_create_info_member(offset, size):
            return little_endian_bytes_to_int(
                require(
                    createSwapchain.get_read_data(
                        createSwapchain.hex_pCreateInfo + offset, size)))

        swapchain_create_info = VulkanStruct(
            architecture,
            [
                ("sType", UINT32_T),
                ("pNext", POINTER),
                ("flags", UINT32_T),
                ("surface", HANDLE),
                ("minImageCount", UINT32_T),
                ("imageFormat", UINT32_T),
                ("imageColorSpace", UINT32_T),
                ("extent.width", UINT32_T),
                ("extent.height", UINT32_T),
                ("imageArrayLayers", UINT32_T),
                ("imageUsage", UINT32_T),
                ("imageSharingMode", UINT32_T),
                ("queueFamilyIndexCount", UINT32_T),
                ("queueFamilyIndices", POINTER),
                ("preTransform", UINT32_T),
                ("compositeAlpha", UINT32_T),
                ("presentMode", UINT32_T),
                ("clipped", UINT32_T),
                ("oldSwapchain", HANDLE)  # oldSwapchain
            ],
            get_swapchain_create_info_member)

        require_equal(swapchain_create_info.sType,
                      VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)

        require_equal(swapchain_create_info.oldSwapchain, 0)
        require_equal(swapchain_create_info.clipped, 0)
        require_equal(swapchain_create_info.imageArrayLayers, 1)
        require_not_equal(0, destroySwapchain.int_swapchain)
        require_equal(True,
                      (swapchain_create_info.queueFamilyIndexCount == 0
                       or swapchain_create_info.queueFamilyIndexCount == 2))

        # Our second vkDestroySwapchain should have been called with
        # VK_NULL_HANDLE.
        if (self.not_device(device_properties, 0x5BCE4000, NVIDIA_K2200)
                and self.not_android_version("7.1.1")):
            destroySwapchain = require(
                self.next_call_of("vkDestroySwapchainKHR"))
            require_equal(0, destroySwapchain.int_swapchain)
Ejemplo n.º 16
0
def get_descriptor_pool(test, index):
    """Returns the handle of the |index|th (starting from 1) descriptor pool
    created from vkCreateDescriptorPool."""
    create = require(test.nth_call_of("vkCreateDescriptorPool", index))
    require_equal(VK_SUCCESS, int(create.return_val))
    pool = little_endian_bytes_to_int(
        require(create.get_write_data(
            create.hex_pDescriptorPool, NON_DISPATCHABLE_HANDLE_SIZE)))
    require_not_equal(0, pool)
    return pool
Ejemplo n.º 17
0
def get_buffer(test):
    """Returns the next buffer handle created by vkCreateBuffer."""
    create = require(test.next_call_of("vkCreateBuffer"))
    require_equal(VK_SUCCESS, int(create.return_val))
    buf = little_endian_bytes_to_int(
        require(
            create.get_write_data(create.hex_pBuffer,
                                  NON_DISPATCHABLE_HANDLE_SIZE)))
    require_not_equal(0, buf)
    return buf
Ejemplo n.º 18
0
    def expect(self):
        architecture = self.architecture
        cmd_bind_vertex_buffers = require(
            self.nth_call_of("vkCmdBindIndexBuffer", 2))

        require_not_equal(0, cmd_bind_vertex_buffers.int_commandBuffer)
        require_not_equal(0, cmd_bind_vertex_buffers.int_buffer)
        require_equal(128 * 2, cmd_bind_vertex_buffers.int_offset)
        require_equal(VK_INDEX_TYPE_UINT16,
                      cmd_bind_vertex_buffers.int_indexType)
Ejemplo n.º 19
0
def get_descriptor_set_layout(test):
    """Returns the handle of the next descriptor set layout created from
    vkCreateDescriptorSetLayout."""
    create = require(test.next_call_of("vkCreateDescriptorSetLayout"))
    require_equal(VK_SUCCESS, int(create.return_val))
    layout = little_endian_bytes_to_int(
        require(create.get_write_data(
            create.hex_pSetLayout, NON_DISPATCHABLE_HANDLE_SIZE)))
    require_not_equal(0, layout)
    return layout
    def expect(self):
        device_properties = require(
            self.next_call_of("vkGetPhysicalDeviceProperties"))

        if (self.not_device(device_properties, 0x5BCE4000, NVIDIA_K2200)):
            destroy_pipeline = require(
                self.nth_call_of("vkDestroyPipelineLayout", 4))
            require_equal(0, destroy_pipeline.int_pipelineLayout)
            require_not_equal(0, destroy_pipeline.int_device)
            require_equal(0, destroy_pipeline.hex_pAllocator)
Ejemplo n.º 21
0
    def expect(self):
        """Expect that the pInheritanceInfo is not null for the second
        vkBeginCommandBuffer, and that it contains some of the expected data."""
        architecture = self.architecture

        begin_command_buffer = require(
            self.nth_call_of("vkBeginCommandBuffer", 2))
        command_buffer_value = begin_command_buffer.int_commandBuffer
        require_not_equal(command_buffer_value, 0)

        # The command buffer begin info struct should start with correct sType
        # value.
        begin_info_stype_memory = require(
            begin_command_buffer.get_read_data(
                begin_command_buffer.hex_pBeginInfo,
                architecture.int_integerSize))
        require_equal(little_endian_bytes_to_int(begin_info_stype_memory),
                      VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)

        # The inheritance info pointer should not be a nullptr.
        inheritance_info_pointer_memory = require(
            begin_command_buffer.get_read_data(
                begin_command_buffer.hex_pBeginInfo +
                architecture.int_pointerSize * 3,
                architecture.int_pointerSize))
        inheritance_info_addr = little_endian_bytes_to_int(
            inheritance_info_pointer_memory)
        require_not_equal(inheritance_info_addr, 0)

        # The inheritance info struct should start with correct sType value.
        inheritance_info_stype_memory = require(
            begin_command_buffer.get_read_data(inheritance_info_addr,
                                               architecture.int_integerSize))
        require_equal(
            little_endian_bytes_to_int(inheritance_info_stype_memory),
            VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO)

        # The last field of inheritance info struct: pipelineStatistics should
        # have value 0.
        # TODO(qining): Add tests for other fields.
        inheritance_info_pipeline_statistics_memory = require(
            begin_command_buffer.get_read_data(
                inheritance_info_addr + architecture.int_pointerSize * 2 +
                NON_DISPATCHABLE_HANDLE_SIZE * 3 +
                architecture.int_integerSize * 2,
                architecture.int_integerSize))
        require_equal(
            little_endian_bytes_to_int(
                inheritance_info_pipeline_statistics_memory), 0)

        # vkEndCommandBuffer() returns correctly
        end_command_buffer = require(self.next_call_of("vkEndCommandBuffer"))
        require_equal(end_command_buffer.int_commandBuffer,
                      command_buffer_value)
        require_equal(VK_SUCCESS, int(end_command_buffer.return_val))
    def expect(self):
        arch = self.architecture
        physical_devices = GetPhysicalDevices(self, arch)

        create_device = require(self.nth_call_of("vkCreateDevice", 1))
        require_equal(True, create_device.int_physicalDevice
                      in physical_devices)
        require_not_equal(0, create_device.hex_pCreateInfo)
        require_equal(0, create_device.hex_pAllocator)
        require_not_equal(0, create_device.hex_pDevice)

        create_info = VulkanStruct(
            arch, DEVICE_CREATE_INFO,
            get_read_offset_function(create_device,
                                     create_device.hex_pCreateInfo))
        require_equal(VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, create_info.sType)
        #  require_equal(0, create_info.pNext)
        require_equal(0, create_info.flags)
        require_equal(1, create_info.queueCreateInfoCount)
        require_not_equal(0, create_info.pQueueCreateInfos)
        require_equal(0, create_info.enabledLayerCount)
        require_equal(0, create_info.ppEnabledLayerNames)
        require_equal(0, create_info.enabledExtensionCount)
        require_equal(0, create_info.ppEnabledExtensionNames)
        require_equal(0, create_info.pEnabledFeatures)

        DEVICE = [("device", POINTER)]
        device = VulkanStruct(
            arch, DEVICE,
            get_write_offset_function(create_device,
                                      create_device.hex_pDevice)).device
        require_not_equal(0, device)

        queue_create_info = VulkanStruct(
            arch, DEVICE_QUEUE_CREATE_INFO,
            get_read_offset_function(create_device,
                                     create_info.pQueueCreateInfos))
        require_equal(VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
                      queue_create_info.sType)
        #  require_equal(0, queue_create_info.pNext)
        require_equal(0, queue_create_info.flags)
        require_equal(0, queue_create_info.queueFamilyIndex)
        require_equal(1, queue_create_info.queueCount)
        require_not_equal(0, queue_create_info.pQueuePriorities)

        PRIORITY = [("priority", FLOAT)]
        priority = VulkanStruct(
            arch, PRIORITY,
            get_read_offset_function(
                create_device, queue_create_info.pQueuePriorities)).priority
        require_equal(1.0, priority)

        destroy_device = require(self.next_call_of("vkDestroyDevice"))
        require_equal(device, destroy_device.int_device)
        require_equal(0, destroy_device.hex_pAllocator)
Ejemplo n.º 23
0
def get_descriptor_set(test, index):
    """Returns the descriptor set handle created by the |index|th
    (starting from 1) vkAllocateDescriptorSet."""
    allocate = require(test.nth_call_of("vkAllocateDescriptorSets", index))
    require_equal(VK_SUCCESS, int(allocate.return_val))
    d_set = little_endian_bytes_to_int(
        require(
            allocate.get_write_data(allocate.hex_pDescriptorSets,
                                    NON_DISPATCHABLE_HANDLE_SIZE)))
    require_not_equal(0, d_set)
    return d_set
Ejemplo n.º 24
0
    def expect(self):
        architecture = self.architecture
        device_properties = require(
            self.next_call_of("vkGetPhysicalDeviceProperties"))

        create_buffer = require(self.next_call_of("vkCreateBuffer"))

        buffer_create_info = VulkanStruct(
            architecture, BUFFER_CREATE_INFO,
            get_read_offset_function(create_buffer,
                                     create_buffer.hex_pCreateInfo))

        written_buffer = little_endian_bytes_to_int(
            require(
                create_buffer.get_write_data(create_buffer.hex_pBuffer,
                                             NON_DISPATCHABLE_HANDLE_SIZE)))

        require_not_equal(0, written_buffer)

        require_equal(buffer_create_info.sType,
                      VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
        require_equal(buffer_create_info.pNext, 0)
        require_equal(buffer_create_info.createFlags, 0)
        require_equal(buffer_create_info.size, 1024)
        require_equal(buffer_create_info.usage,
                      VK_BUFFER_USAGE_TRANSFER_SRC_BIT)
        require_equal(buffer_create_info.sharingMode,
                      VK_SHARING_MODE_EXCLUSIVE)
        require_equal(buffer_create_info.queueFamilyIndexCount, 0)
        require_equal(buffer_create_info.pQueueFamilyIndices, 0)

        get_buffer_memory_requirements = require(
            self.next_call_of("vkGetBufferMemoryRequirements"))
        require_not_equal(0, get_buffer_memory_requirements.int_device)
        require_equal(written_buffer,
                      get_buffer_memory_requirements.int_buffer)
        require_not_equal(
            0, get_buffer_memory_requirements.hex_pMemoryRequirements)

        memory_requirements = VulkanStruct(
            architecture, MEMORY_REQUIREMENTS,
            get_write_offset_function(
                get_buffer_memory_requirements,
                get_buffer_memory_requirements.hex_pMemoryRequirements))

        require_equal(True, memory_requirements.size >= 1)
        require_not_equal(0, memory_requirements.alignment)
        require_not_equal(0, memory_requirements.memoryTypeBits)

        destroy_buffer = require(self.next_call_of("vkDestroyBuffer"))
        require_equal(destroy_buffer.int_device,
                      get_buffer_memory_requirements.int_device)
        require_equal(written_buffer, destroy_buffer.int_buffer)
Ejemplo n.º 25
0
    def expect(self):

        architecture = self.architecture
        create_fence = require(self.nth_call_of("vkCreateFence", 1))
        wait_for_fences = require(self.next_call_of("vkWaitForFences"))
        reset_fences = require(self.next_call_of("vkResetFences"))
        destroy_fence = require(self.next_call_of("vkDestroyFence"))

        require_not_equal(0, create_fence.int_device)
        require_not_equal(0, create_fence.hex_pCreateInfo)
        require_equal(0, create_fence.hex_pAllocator)
        require_not_equal(0, create_fence.hex_pFence)

        create_info = VulkanStruct(
            architecture, FENCE_CREATE_INFO,
            get_read_offset_function(create_fence,
                                     create_fence.hex_pCreateInfo))

        require_equal(VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, create_info.sType)
        require_equal(0, create_info.pNext)
        require_equal(0, create_info.flags)

        returned_fence = little_endian_bytes_to_int(
            require(
                create_fence.get_write_data(create_fence.hex_pFence,
                                            NON_DISPATCHABLE_HANDLE_SIZE)))
        require_not_equal(0, returned_fence)

        require_equal(create_fence.int_device, wait_for_fences.int_device)
        require_equal(1, wait_for_fences.int_fenceCount)
        require_not_equal(1, wait_for_fences.hex_pFences)
        require_equal(0, wait_for_fences.int_waitAll)
        require_equal(100000000, wait_for_fences.int_timeout)

        waited_for_fence = little_endian_bytes_to_int(
            require(
                wait_for_fences.get_read_data(wait_for_fences.hex_pFences,
                                              NON_DISPATCHABLE_HANDLE_SIZE)))
        require_equal(waited_for_fence, returned_fence)

        require_equal(create_fence.int_device, reset_fences.int_device)
        require_equal(1, reset_fences.int_fenceCount)
        require_equal(create_fence.int_device, reset_fences.int_device)

        reset_fence = little_endian_bytes_to_int(
            require(
                reset_fences.get_read_data(wait_for_fences.hex_pFences,
                                           NON_DISPATCHABLE_HANDLE_SIZE)))
        require_equal(returned_fence, reset_fence)

        require_equal(create_fence.int_device, destroy_fence.int_device)
        require_equal(returned_fence, destroy_fence.int_fence)
        require_equal(0, destroy_fence.hex_pAllocator)
Ejemplo n.º 26
0
    def expect(self):
        """3. Expect vkEnumeratePhysicalDevices() to be called first, then
        vkGetPhysicalDeviceProperties() to be called num_phy_devices times
        and return physical device properties."""

        arch = self.architecture
        physical_devices = GetPhysicalDevices(self, arch)
        for pd in physical_devices:
            get_device_properties = require(self.next_call_of(
                "vkGetPhysicalDeviceProperties"))
            require_equal(pd, get_device_properties.int_physicalDevice)
            require_not_equal(0, get_device_properties.hex_pProperties)
    def expect(self):
        """The second call to vkCmdSetLineWidth should have line width value: 2.0
        """
        create_device = self.nth_call_of("vkCreateDevice", 3)
        if create_device[0] is None:
            raise GapidUnsupportedException(
                "physical device feature: wideLine not supported")

        set_line_width = require(self.nth_call_of("vkCmdSetLineWidth", 1))

        require_not_equal(0, set_line_width.int_commandBuffer)
        require_equal(2.0, set_line_width.float_lineWidth)
 def expect(self):
     arch = self.architecture
     physical_devices = GetPhysicalDevices(self, arch)
     for pd in physical_devices:
         for fmt in ALL_VK_FORMATS:
             get_properties = require(self.next_call_of(
                 "vkGetPhysicalDeviceFormatProperties"))
             require_equal(
                 True, get_properties.int_physicalDevice in physical_devices)
             require_equal(fmt, get_properties.int_format)
             require_not_equal(0, get_properties.hex_pFormatProperties)
             VulkanStruct(arch, FORMAT_PROPERTIES, get_write_offset_function(
                 get_properties, get_properties.hex_pFormatProperties))
    def expect(self):
        DEPTH_BIAS_CONSTANT_FACTOR = 1.1
        DEPTH_BIAS_CLAMP = 0.0
        DEPTH_BIAS_SLOPE_FACTOR = 3.3

        set_depth_bias = require(self.nth_call_of("vkCmdSetDepthBias", 1))

        require_not_equal(0, set_depth_bias.int_commandBuffer)
        require_equal(DEPTH_BIAS_CONSTANT_FACTOR,
                      set_depth_bias.float_depthBiasConstantFactor)
        require_equal(DEPTH_BIAS_CLAMP, set_depth_bias.float_depthBiasClamp)
        require_equal(DEPTH_BIAS_SLOPE_FACTOR,
                      set_depth_bias.float_depthBiasSlopeFactor)
Ejemplo n.º 30
0
    def expect(self):
        """1. Expects vkCmdClearDepthStencilImage() is called and traced
        successfully."""
        architecture = self.architecture
        clear_depth_image = require(
            self.nth_call_of("vkCmdClearDepthStencilImage", 1))
        require_not_equal(0, clear_depth_image.int_commandBuffer)
        require_not_equal(0, clear_depth_image.int_image)
        require_equal(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
                      clear_depth_image.int_imageLayout)
        require_not_equal(0, clear_depth_image.hex_pDepthStencil)
        require_equal(1, clear_depth_image.int_rangeCount)
        require_not_equal(0, clear_depth_image.hex_pRanges)

        depth_stencil = VulkanStruct(
            architecture, DEPTH_STENCIL_VALUE,
            get_read_offset_function(clear_depth_image,
                                     clear_depth_image.hex_pDepthStencil))
        # float comparison
        require_true(array('f', [0.2]) == array('f', [depth_stencil.depth]))
        require_equal(1, depth_stencil.stencil)

        subresource_range = VulkanStruct(
            architecture, SUBRESOURCE_RANGE,
            get_read_offset_function(clear_depth_image,
                                     clear_depth_image.hex_pRanges))
        require_equal(VK_IMAGE_ASPECT_DEPTH_BIT, subresource_range.aspectMask)
        require_equal(0, subresource_range.baseMipLevel)
        require_equal(1, subresource_range.levelCount)
        require_equal(0, subresource_range.baseArrayLayer)
        require_equal(1, subresource_range.layerCount)