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 7. Test memory aliasing for partially resident images 16 8. Test OpImageSparse* shader intrinsics 17 18 Description: 19 20 1. Test fully resident buffer created with VK_BUFFER_CREATE_SPARSE_BINDING_BIT flag bit 21 22 The test creates buffer object with VK_BUFFER_CREATE_SPARSE_BINDING_BIT flag bit. The size of the buffer is one 23 of the test parameters. The memory requirements of the buffer are being checked. Device memory is allocated 24 in chunks equal to the alignment parameter of buffer's memory requirements. The number of allocations is equal to 25 bufferRequirements.size / bufferRequirements.alignment. 26 27 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 28 29 First queue is used to perform binding of device memory to sparse buffer. The binding operation signals semaphore 30 used for synchronization. 31 32 The second queue is used to perform transfer operations. The test creates two non-sparse buffer objects, 33 one used as input and the second as output. The input buffer is used to transfer data to sparse buffer. The data is then 34 transfered further from sparse buffer to output buffer. The transer queue waits on a semaphore, before transfer operations 35 can be issued. 36 37 The validation part retrieves data back from output buffer to host memory. The data is then compared with reference data, 38 that was originally sent to input buffer. If the two data sets match, the test passes. 39 40 2. Test fully resident image created with VK_IMAGE_CREATE_SPARSE_BINDING_BIT flag bit 41 42 The test checks all supported types of images. It creates image with VK_IMAGE_CREATE_SPARSE_BINDING_BIT flag bit. 43 The memory requirements of the image are being checked. Device memory is allocated in chunks equal to the alignment parameter 44 of the image memory requirements. The number of allocations is equal to imageRequirements.size / imageRequirements.alignment. 45 46 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 47 48 First queue is used to perform binding of device memory to sparse image. The binding operation signals semaphore 49 used for synchronization. 50 51 The second queue is used to perform transfer operations. The test creates two non-sparse buffer objects, 52 one used as input and the second as output. The input buffer is used to transfer data to sparse image. The data is then 53 transfered further from sparse image to output buffer. The transfer queue waits on a semaphore, before transfer operations 54 can be issued. 55 56 The validation part retrieves data back from output buffer to host memory. The data is then compared with reference data, 57 that was originally sent to input buffer. If the two data sets match, the test passes. 58 59 3. Test partially resident buffer created with VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT flag bit 60 61 The test creates buffer object with VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT flag bit. The size of the buffer is one 62 of the test parameters. The sparse memory requirements of the buffer are being checked. Device memory is allocated 63 in chunks equal to the alignment parameter of buffer's memory requirements. Memory is bound to the buffer object leaving gaps 64 between bound blocks with the size equal to alignment. 65 66 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 67 68 First queue is used to perform binding of device memory to sparse buffer. The binding operation signals semaphore 69 used for synchronization. 70 71 The second queue is used to perform compute and transfer operations. A compute shader is invoked to fill the whole buffer with data. 72 Afterwards the data is transfered from sparse buffer to non-sparse output buffer. 73 74 The validation part retrieves data back from output buffer to host memory. The data is compared against the expected output 75 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 76 against expected output from compute shader. For parts that correspond to gaps, the data is random or should be filled with zeros if 77 residencyNonResidentStrict device sparse property is set to TRUE. 78 79 4. Test partially resident image created with VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag bit 80 81 The test creates image with VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag bit. The sparse memory requirements of the image are being checked. 82 Device memory is allocated in chunks equal to the alignment parameter of image's memory requirements. 83 Memory is bound to the image leaving gaps between bound blocks with the size equal to alignment. 84 85 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 86 87 First queue is used to perform binding of device memory to sparse image. The binding operation signals semaphore 88 used for synchronization. 89 90 The second queue is used to perform compute and transfer operations. A compute shader is invoked to fill the whole image with data. 91 Afterwards the data is transfered from sparse image to non-sparse output buffer. 92 93 The validation part retrieves data back from output buffer to host memory. The data is compared against the expected output 94 from compute shader. For parts of the data that correspond to the regions of image that have device memory bound, the comparison is done 95 against expected output from compute shader. For parts that correspond to gaps, the data is random or should be filled with zeros if residencyNonResidentStrict 96 device sparse property is set to TRUE. 97 98 5. Test partially resident image with mipmaps, put some mipmap levels in mip tail region 99 100 The test creates image with maximum allowed number of mipmap levels. The sparse memory requirements of the image are being checked. 101 Each layer of each mipmap level receives a separate device memory binding. The mipmaps levels that end up in mip tail region receive one 102 binding for each mipmap level or one binding for all levels, depending on the value of VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT. 103 104 A compute shader is invoked to fill each mipmap level with data. Afterwards the data is transfered to a non-sparse buffer object. 105 106 The validation part retrieves data back from output buffer to host memory. The data is compared against the expected output 107 from compute shader. The test passes if the data sets are equal. 108 109 6. Test memory aliasing for fully resident buffer objects 110 111 The test creates two fully resident buffers (READ and WRITE) with VK_BUFFER_CREATE_SPARSE_ALIASED_BIT 112 and VK_BUFFER_CREATE_SPARSE_BINDING_BIT flag bits. Both buffers have the same size. 113 114 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 115 116 First queue is used to perform binding of device memory to sparse buffers. One block of device memory is allocated 117 and bound to both buffers (buffers share memory). 118 119 The second queue is used to perform compute and transfer operations. A compute shader is invoked to fill the whole WRITE buffer with data. 120 Afterwards the data from READ buffer is being transfered to non-sparse output buffer. 121 122 The validation part retrieves data back from output buffer to host memory. The data is compared against the expected output 123 from compute shader. The test passes if the data sets are equal. 124 125 7. Test memory aliasing for partially resident images 126 127 The test creates two partially resident images (READ and WRITE) with VK_IMAGE_CREATE_SPARSE_ALIASED_BIT and VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag bits. 128 Both images have the same type, format and dimensions. 129 130 The test creates two queues - one supporting sparse binding operations, the second one supporting compute and transfer operations. 131 132 First queue is used to perform binding of device memory to sparse images. The memory bound via VkSparseImageMemoryBind is shared between 133 both images. The mipmap levels that land in the mip tail region have separate memory regions for both images. 134 135 The second queue is used to perform compute and transfer operations. The test creates two non-sparse buffer objects, 136 one used as input and the second as output. The input buffer is used to transfer data to READ sparse image to create some initial state. 137 Afterwards compute shaders are invoked to write data to each mipmap level of WRITE sparse image. The mipmap levels of READ image that share memory with 138 WRITE image should be overwritten by this operation, the mip tail region should be left intact. Next the data is copied from the READ image to the output buffer. 139 140 The validation part retrieves data back from output buffer to host memory. For each mipmap level that both images share memory for, the data is 141 compared against the expected output from compute shader. On the other hand for each mipmap level that landed in the mip tail region, the data is compared 142 against data stored in the input buffer (the compute shader could not have changed this data). The test passes if for each mipmap level 143 the comparison results in both data sets being the same. 144 145 8. Test OpImageSparse* shader intrinsics 146 147 The test creates sparse partially resident image. The memory is bound to the image every second mipmap level. 148 149 The test creates also a second non-sparse texels image with the same dimensions and format as the sparse one and 150 a third residency image with the same dimensions as the sparse one and unsigned int format. 151 152 For OpImageSparse* opcodes that are fed with float image coordinates the test creates a graphics queue, otherwise a compute queue is created. 153 In both cases the commands submited to queue have the purpose of copying the data from sparse image to texels and residency images using one 154 of the OpImageSparse* shader intrinsics. For graphics operations the data is copied via rendering to two color attachments, for compute operations 155 the data is copied via image load/store. 156 157 Data is retreived from the non-sparse images back to the CPU. Contents of the texels image are compared against the data originaly sent to the sparse image. 158 For mipmap levels of the sparse image that do not have backing device memory, the fetched data is compared against zeroed memory if residencyNonResidentStrict is set to VK_TRUE, 159 otherwise comparion for those mipmap levels is ommited. The data fetched from the residency image is checked, if for each mipmap level the OpImageSparseTexelsResident 160 returned correct residency information. 161