mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
xrt: Remove array_size field on xrt_swapchain
This commit is contained in:
parent
09baeb91bc
commit
fb867b02c3
3
doc/changes/xrt/mr.359.md
Normal file
3
doc/changes/xrt/mr.359.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
compositor: Remove the `array_size` field from the struct, this was the only
|
||||
state tracker supplied value that was on the struct, only have values that the
|
||||
compositor decides over on the struct.
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2019, Collabora, Ltd.
|
||||
// Copyright 2019-2020, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
|
@ -49,6 +49,8 @@ struct comp_swapchain_image
|
|||
//! Views used by the renderer and distortion code, for each array
|
||||
//! layer.
|
||||
VkImageView *views;
|
||||
//! The number of array slices in a texture, 1 == regular 2D texture.
|
||||
size_t array_size;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -298,17 +300,6 @@ comp_swapchain_create(struct xrt_compositor *xc,
|
|||
void
|
||||
comp_swapchain_really_destroy(struct comp_swapchain *sc);
|
||||
|
||||
/*!
|
||||
* Free and destroy any initialized fields on the given image, safe to pass in
|
||||
* images that has one or all fields set to NULL.
|
||||
*
|
||||
* @ingroup comp_main
|
||||
*/
|
||||
void
|
||||
comp_swapchain_image_cleanup(struct vk_bundle *vk,
|
||||
uint32_t array_size,
|
||||
struct comp_swapchain_image *image);
|
||||
|
||||
/*!
|
||||
* Printer helper.
|
||||
*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2019, Collabora, Ltd.
|
||||
// Copyright 2019-2020, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
|
@ -239,7 +239,6 @@ comp_swapchain_create(struct xrt_compositor *xc,
|
|||
sc->base.base.wait_image = swapchain_wait_image;
|
||||
sc->base.base.release_image = swapchain_release_image;
|
||||
sc->base.base.num_images = num_images;
|
||||
sc->base.base.array_size = array_size;
|
||||
sc->c = c;
|
||||
|
||||
COMP_DEBUG(c, "CREATE %p %dx%d", (void *)sc, width, height);
|
||||
|
@ -267,6 +266,7 @@ comp_swapchain_create(struct xrt_compositor *xc,
|
|||
for (uint32_t i = 0; i < num_images; i++) {
|
||||
sc->images[i].views =
|
||||
U_TYPED_ARRAY_CALLOC(VkImageView, array_size);
|
||||
sc->images[i].array_size = array_size;
|
||||
|
||||
for (uint32_t layer = 0; layer < array_size; ++layer) {
|
||||
VkImageSubresourceRange subresource_range = {
|
||||
|
@ -318,15 +318,18 @@ comp_swapchain_create(struct xrt_compositor *xc,
|
|||
return &sc->base.base;
|
||||
}
|
||||
|
||||
void
|
||||
/*!
|
||||
* Free and destroy any initialized fields on the given image, safe to pass in
|
||||
* images that has one or all fields set to NULL.
|
||||
*/
|
||||
static void
|
||||
comp_swapchain_image_cleanup(struct vk_bundle *vk,
|
||||
uint32_t array_size,
|
||||
struct comp_swapchain_image *image)
|
||||
{
|
||||
vk->vkDeviceWaitIdle(vk->device);
|
||||
|
||||
if (image->views != NULL) {
|
||||
for (uint32_t i = 0; i < array_size; ++i) {
|
||||
for (uint32_t i = 0; i < image->array_size; ++i) {
|
||||
if (image->views[i] == VK_NULL_HANDLE) {
|
||||
continue;
|
||||
}
|
||||
|
@ -336,6 +339,7 @@ comp_swapchain_image_cleanup(struct vk_bundle *vk,
|
|||
image->views[i] = VK_NULL_HANDLE;
|
||||
}
|
||||
free(image->views);
|
||||
image->array_size = 0;
|
||||
image->views = NULL;
|
||||
}
|
||||
|
||||
|
@ -363,8 +367,7 @@ comp_swapchain_really_destroy(struct comp_swapchain *sc)
|
|||
COMP_SPEW(sc->c, "REALLY DESTROY");
|
||||
|
||||
for (uint32_t i = 0; i < sc->base.base.num_images; i++) {
|
||||
comp_swapchain_image_cleanup(vk, sc->base.base.array_size,
|
||||
&sc->images[i]);
|
||||
comp_swapchain_image_cleanup(vk, &sc->images[i]);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < sc->base.base.num_images; i++) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2019, Collabora, Ltd.
|
||||
// Copyright 2019-2020, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
|
@ -81,11 +81,6 @@ struct xrt_swapchain
|
|||
*/
|
||||
uint32_t num_images;
|
||||
|
||||
/*!
|
||||
* Number of array layers per image.
|
||||
*/
|
||||
uint32_t array_size;
|
||||
|
||||
/*!
|
||||
* Must have called release_image before calling this function.
|
||||
*/
|
||||
|
|
|
@ -199,7 +199,6 @@ ipc_compositor_swapchain_create(struct xrt_compositor *xc,
|
|||
|
||||
struct ipc_client_swapchain *ics =
|
||||
U_TYPED_CALLOC(struct ipc_client_swapchain);
|
||||
ics->base.base.array_size = 1;
|
||||
ics->base.base.num_images = num_images;
|
||||
ics->base.base.wait_image = ipc_compositor_swapchain_wait_image;
|
||||
ics->base.base.acquire_image = ipc_compositor_swapchain_acquire_image;
|
||||
|
|
|
@ -509,12 +509,14 @@ verify_quad_layer(struct xrt_compositor *xc,
|
|||
layer_index, p->x, p->y, p->z);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (quad->subImage.imageArrayIndex > 0 &&
|
||||
sc->swapchain->array_size <= quad->subImage.imageArrayIndex) {
|
||||
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE,
|
||||
"Invalid swapchain array index for layer %u.",
|
||||
layer_index);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sc->released_index == -1) {
|
||||
return oxr_error(log, XR_ERROR_LAYER_INVALID,
|
||||
|
|
Loading…
Reference in a new issue