mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 04:36:07 +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)
|
uint32_t mip_count)
|
||||||
{
|
{
|
||||||
struct client_gl_compositor *c = client_gl_compositor(xc);
|
struct client_gl_compositor *c = client_gl_compositor(xc);
|
||||||
uint32_t num_images = 3;
|
|
||||||
|
|
||||||
if (array_size > 1) {
|
if (array_size > 1) {
|
||||||
const char *version_str = (const char *)glGetString(GL_VERSION);
|
const char *version_str = (const char *)glGetString(GL_VERSION);
|
||||||
|
@ -200,13 +199,15 @@ client_gl_swapchain_create(struct xrt_compositor *xc,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct client_gl_swapchain *sc =
|
struct client_gl_swapchain *sc =
|
||||||
U_TYPED_CALLOC(struct client_gl_swapchain);
|
U_TYPED_CALLOC(struct client_gl_swapchain);
|
||||||
sc->base.base.destroy = client_gl_swapchain_destroy;
|
sc->base.base.destroy = client_gl_swapchain_destroy;
|
||||||
sc->base.base.acquire_image = client_gl_swapchain_acquire_image;
|
sc->base.base.acquire_image = client_gl_swapchain_acquire_image;
|
||||||
sc->base.base.wait_image = client_gl_swapchain_wait_image;
|
sc->base.base.wait_image = client_gl_swapchain_wait_image;
|
||||||
sc->base.base.release_image = client_gl_swapchain_release_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);
|
sc->xscfd = xrt_swapchain_fd(xsc);
|
||||||
|
|
||||||
GLuint prev_texture = 0;
|
GLuint prev_texture = 0;
|
||||||
|
@ -214,14 +215,14 @@ client_gl_swapchain_create(struct xrt_compositor *xc,
|
||||||
: GL_TEXTURE_BINDING_2D_ARRAY,
|
: GL_TEXTURE_BINDING_2D_ARRAY,
|
||||||
(GLint *)&prev_texture);
|
(GLint *)&prev_texture);
|
||||||
|
|
||||||
glGenTextures(num_images, sc->base.images);
|
glGenTextures(xsc->num_images, sc->base.images);
|
||||||
for (uint32_t i = 0; i < num_images; i++) {
|
for (uint32_t i = 0; i < xsc->num_images; i++) {
|
||||||
glBindTexture(array_size == 1 ? GL_TEXTURE_2D
|
glBindTexture(array_size == 1 ? GL_TEXTURE_2D
|
||||||
: GL_TEXTURE_2D_ARRAY,
|
: GL_TEXTURE_2D_ARRAY,
|
||||||
sc->base.images[i]);
|
sc->base.images[i]);
|
||||||
}
|
}
|
||||||
glCreateMemoryObjectsEXT(num_images, &sc->base.memory[0]);
|
glCreateMemoryObjectsEXT(xsc->num_images, &sc->base.memory[0]);
|
||||||
for (uint32_t i = 0; i < num_images; i++) {
|
for (uint32_t i = 0; i < xsc->num_images; i++) {
|
||||||
GLint dedicated = GL_TRUE;
|
GLint dedicated = GL_TRUE;
|
||||||
glMemoryObjectParameterivEXT(sc->base.memory[i],
|
glMemoryObjectParameterivEXT(sc->base.memory[i],
|
||||||
GL_DEDICATED_MEMORY_OBJECT_EXT,
|
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);
|
struct client_vk_compositor *c = client_vk_compositor(xc);
|
||||||
VkCommandBuffer cmd_buffer;
|
VkCommandBuffer cmd_buffer;
|
||||||
uint32_t num_images = 3;
|
|
||||||
VkResult ret;
|
VkResult ret;
|
||||||
|
|
||||||
struct xrt_swapchain *xsc = c->xcfd->base.create_swapchain(
|
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.acquire_image = client_vk_swapchain_acquire_image;
|
||||||
sc->base.base.wait_image = client_vk_swapchain_wait_image;
|
sc->base.base.wait_image = client_vk_swapchain_wait_image;
|
||||||
sc->base.base.release_image = client_vk_swapchain_release_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->c = c;
|
||||||
sc->xscfd = xrt_swapchain_fd(xsc);
|
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(
|
ret = vk_create_image_from_fd(
|
||||||
&c->vk, bits, format, width, height, array_size, mip_count,
|
&c->vk, bits, format, width, height, array_size, mip_count,
|
||||||
&sc->xscfd->images[i], &sc->base.images[i],
|
&sc->xscfd->images[i], &sc->base.images[i],
|
||||||
|
|
Loading…
Reference in a new issue