mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
comp: Get num_images from the fd compositor
This commit is contained in:
parent
9d009784b6
commit
6fe02588f9
1
doc/changes/compositor/mr.270.md
Normal file
1
doc/changes/compositor/mr.270.md
Normal file
|
@ -0,0 +1 @@
|
|||
client: Make sure that the number of images is decided by the fd compositor.
|
|
@ -173,7 +173,6 @@ client_gl_swapchain_create(struct xrt_compositor *xc,
|
|||
uint32_t mip_count)
|
||||
{
|
||||
struct client_gl_compositor *c = client_gl_compositor(xc);
|
||||
uint32_t num_images = 3;
|
||||
|
||||
if (array_size > 1) {
|
||||
const char *version_str = (const char *)glGetString(GL_VERSION);
|
||||
|
@ -200,13 +199,15 @@ client_gl_swapchain_create(struct xrt_compositor *xc,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
struct client_gl_swapchain *sc =
|
||||
U_TYPED_CALLOC(struct client_gl_swapchain);
|
||||
sc->base.base.destroy = client_gl_swapchain_destroy;
|
||||
sc->base.base.acquire_image = client_gl_swapchain_acquire_image;
|
||||
sc->base.base.wait_image = client_gl_swapchain_wait_image;
|
||||
sc->base.base.release_image = client_gl_swapchain_release_image;
|
||||
sc->base.base.num_images = num_images;
|
||||
// Fetch the number of images from the fd swapchain.
|
||||
sc->base.base.num_images = xsc->num_images;
|
||||
sc->xscfd = xrt_swapchain_fd(xsc);
|
||||
|
||||
GLuint prev_texture = 0;
|
||||
|
@ -214,14 +215,14 @@ client_gl_swapchain_create(struct xrt_compositor *xc,
|
|||
: GL_TEXTURE_BINDING_2D_ARRAY,
|
||||
(GLint *)&prev_texture);
|
||||
|
||||
glGenTextures(num_images, sc->base.images);
|
||||
for (uint32_t i = 0; i < num_images; i++) {
|
||||
glGenTextures(xsc->num_images, sc->base.images);
|
||||
for (uint32_t i = 0; i < xsc->num_images; i++) {
|
||||
glBindTexture(array_size == 1 ? GL_TEXTURE_2D
|
||||
: GL_TEXTURE_2D_ARRAY,
|
||||
sc->base.images[i]);
|
||||
}
|
||||
glCreateMemoryObjectsEXT(num_images, &sc->base.memory[0]);
|
||||
for (uint32_t i = 0; i < num_images; i++) {
|
||||
glCreateMemoryObjectsEXT(xsc->num_images, &sc->base.memory[0]);
|
||||
for (uint32_t i = 0; i < xsc->num_images; i++) {
|
||||
GLint dedicated = GL_TRUE;
|
||||
glMemoryObjectParameterivEXT(sc->base.memory[i],
|
||||
GL_DEDICATED_MEMORY_OBJECT_EXT,
|
||||
|
|
|
@ -183,7 +183,6 @@ client_vk_swapchain_create(struct xrt_compositor *xc,
|
|||
{
|
||||
struct client_vk_compositor *c = client_vk_compositor(xc);
|
||||
VkCommandBuffer cmd_buffer;
|
||||
uint32_t num_images = 3;
|
||||
VkResult ret;
|
||||
|
||||
struct xrt_swapchain *xsc = c->xcfd->base.create_swapchain(
|
||||
|
@ -213,11 +212,12 @@ client_vk_swapchain_create(struct xrt_compositor *xc,
|
|||
sc->base.base.acquire_image = client_vk_swapchain_acquire_image;
|
||||
sc->base.base.wait_image = client_vk_swapchain_wait_image;
|
||||
sc->base.base.release_image = client_vk_swapchain_release_image;
|
||||
sc->base.base.num_images = num_images;
|
||||
// Fetch the number of images from the fd swapchain.
|
||||
sc->base.base.num_images = xsc->num_images;
|
||||
sc->c = c;
|
||||
sc->xscfd = xrt_swapchain_fd(xsc);
|
||||
|
||||
for (uint32_t i = 0; i < num_images; i++) {
|
||||
for (uint32_t i = 0; i < xsc->num_images; i++) {
|
||||
ret = vk_create_image_from_fd(
|
||||
&c->vk, bits, format, width, height, array_size, mip_count,
|
||||
&sc->xscfd->images[i], &sc->base.images[i],
|
||||
|
|
Loading…
Reference in a new issue