1 Sparse resources tests 2 3 Tests: 4 5 dEQP-VK.sparse_resources.* 6 7 Includes: 8 9 1. Test fully resident buffer created with VK_BUFFER_CREATE_SPARSE_BINDING_BIT flag bit 10 2. Test fully resident image created with VK_IMAGE_CREATE_SPARSE_BINDING_BIT flag bit 11 3. Test partially resident buffer created with VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT flag bit 12 4. Test partially resident image created with VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag bit 13 5. Test partially resident image with mipmaps, put some mipmap levels in mip tail region 14 6. Test memory aliasing for fully resident buffer objects 15 16 Description: 17 18 1. Test fully resident buffer created with VK_BUFFER_CREATE_SPARSE_BINDING_BIT flag bit 19 20 The test creates buffer object with VK_BUFFER_CREATE_SPARSE_BINDING_BIT flag bit. The size of the buffer is one 21 of the test parameters. The memory requirements of the buffer are being checked. Device memory is allocated 22 in chunks equal to the alignment parameter of buffer's memory requirements. The number of allocations is equal to 23 bufferRequirements.size / bufferRequirements.alignment. 24 25 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 26 27 First queue is used to perform binding of device memory to sparse buffer. The binding operation signals semaphore 28 used for synchronization. 29 30 The second queue is used to perform transfer operations. The test creates two non-sparse buffer objects, 31 one used as input and the second as output. The input buffer is used to transfer data to sparse buffer. The data is then 32 transfered further from sparse buffer to output buffer. The transer queue waits on a semaphore, before transfer operations 33 can be issued. 34 35 The validation part retrieves data back from output buffer to host memory. The data is then compared with reference data, 36 that was originally sent to input buffer. If the two data sets match, the test passes. 37 38 2. Test fully resident image created with VK_IMAGE_CREATE_SPARSE_BINDING_BIT flag bit 39 40 The test checks all supported types of images. It creates image with VK_IMAGE_CREATE_SPARSE_BINDING_BIT flag bit. 41 The memory requirements of the image are being checked. Device memory is allocated in chunks equal to the alignment parameter 42 of the image memory requirements. The number of allocations is equal to imageRequirements.size / imageRequirements.alignment. 43 44 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 45 46 First queue is used to perform binding of device memory to sparse image. The binding operation signals semaphore 47 used for synchronization. 48 49 The second queue is used to perform transfer operations. The test creates two non-sparse buffer objects, 50 one used as input and the second as output. The input buffer is used to transfer data to sparse image. The data is then 51 transfered further from sparse image to output buffer. The transfer queue waits on a semaphore, before transfer operations 52 can be issued. 53 54 The validation part retrieves data back from output buffer to host memory. The data is then compared with reference data, 55 that was originally sent to input buffer. If the two data sets match, the test passes. 56 57 3. Test partially resident buffer created with VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT flag bit 58 59 The test creates buffer object with VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT flag bit. The size of the buffer is one 60 of the test parameters. The sparse memory requirements of the buffer are being checked. Device memory is allocated 61 in chunks equal to the alignment parameter of buffer's memory requirements. Memory is bound to the buffer object leaving gaps 62 between bound blocks with the size equal to alignment. 63 64 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 65 66 First queue is used to perform binding of device memory to sparse buffer. The binding operation signals semaphore 67 used for synchronization. 68 69 The second queue is used to perform compute and transfer operations. A compute shader is invoked to fill the whole buffer with data. 70 Afterwards the data is transfered from sparse buffer to non-sparse output buffer. 71 72 The validation part retrieves data back from output buffer to host memory. The data is compared against the expected output 73 from compute shader. For parts of the data that correspond to the regions of sparse buffer that have device memory bound, the comparison is done 74 against expected output from compute shader. For parts that correspond to gaps, the data is random or should be filled with zeros if 75 residencyNonResidentStrict device sparse property is set to TRUE. 76 77 4. Test partially resident image created with VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag bit 78 79 The test creates image with VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag bit. The sparse memory requirements of the image are being checked. 80 Device memory is allocated in chunks equal to the alignment parameter of image's memory requirements. 81 Memory is bound to the image leaving gaps between bound blocks with the size equal to alignment. 82 83 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 84 85 First queue is used to perform binding of device memory to sparse image. The binding operation signals semaphore 86 used for synchronization. 87 88 The second queue is used to perform compute and transfer operations. A compute shader is invoked to fill the whole image with data. 89 Afterwards the data is transfered from sparse image to non-sparse output buffer. 90 91 The validation part retrieves data back from output buffer to host memory. The data is compared against the expected output 92 from compute shader. For parts of the data that correspond to the regions of image that have device memory bound, the comparison is done 93 against expected output from compute shader. For parts that correspond to gaps, the data is random or should be filled with zeros if residencyNonResidentStrict 94 device sparse property is set to TRUE. 95 96 5. Test partially resident image with mipmaps, put some mipmap levels in mip tail region 97 98 The test creates image with maximum allowed number of mipmap levels. The sparse memory requirements of the image are being checked. 99 Each layer of each mipmap level receives a separate device memory binding. The mipmaps levels that end up in mip tail region receive one 100 binding for each mipmap level or one binding for all levels, depending on the value of VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT. 101 102 A compute shader is invoked to fill each mipmap level with data. Afterwards the data is transfered to a non-sparse buffer object. 103 104 The validation part retrieves data back from output buffer to host memory. The data is compared against the expected output 105 from compute shader. The test passes if the data sets are equal. 106 107 6. Test memory aliasing for fully resident buffer objects 108 109 The test creates two fully resident buffers (READ and WRITE) with VK_BUFFER_CREATE_SPARSE_ALIASED_BIT 110 and VK_BUFFER_CREATE_SPARSE_BINDING_BIT flag bits. Both buffers have the same size. 111 112 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 113 114 First queue is used to perform binding of device memory to sparse buffers. One block of device memory is allocated 115 and bound to both buffers (buffers share memory). 116 117 The second queue is used to perform compute and transfer operations. A compute shader is invoked to fill the whole WRITE buffer with data. 118 Afterwards the data from READ buffer is being transfered to non-sparse output buffer. 119 120 The validation part retrieves data back from output buffer to host memory. The data is compared against the expected output 121 from compute shader. The test passes if the data sets are equal.