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