mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 11:08:03 +02:00
zink: add a function for getting the minimum framebuffer layers
this clamps the layer count to the smallest number of layers rather
than the largest
cc: mesa-stable
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17061>
(cherry picked from commit f74df6205d)
Conflicts:
src/gallium/drivers/zink/zink_framebuffer.h
This commit is contained in:
parent
494b4d0c41
commit
0c283ca156
3 changed files with 28 additions and 1 deletions
|
|
@ -895,7 +895,7 @@
|
|||
"description": "zink: add a function for getting the minimum framebuffer layers",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -378,3 +378,26 @@ zink_get_framebuffer(struct zink_context *ctx)
|
|||
|
||||
return fb;
|
||||
}
|
||||
|
||||
/* same as u_framebuffer_get_num_layers, but clamp to lowest layer count */
|
||||
unsigned
|
||||
zink_framebuffer_get_num_layers(const struct pipe_framebuffer_state *fb)
|
||||
{
|
||||
unsigned i, num_layers = UINT32_MAX;
|
||||
if (!(fb->nr_cbufs || fb->zsbuf))
|
||||
return MAX2(fb->layers, 1);
|
||||
|
||||
for (i = 0; i < fb->nr_cbufs; i++) {
|
||||
if (fb->cbufs[i]) {
|
||||
unsigned num = fb->cbufs[i]->u.tex.last_layer -
|
||||
fb->cbufs[i]->u.tex.first_layer + 1;
|
||||
num_layers = MIN2(num_layers, num);
|
||||
}
|
||||
}
|
||||
if (fb->zsbuf) {
|
||||
unsigned num = fb->zsbuf->u.tex.last_layer -
|
||||
fb->zsbuf->u.tex.first_layer + 1;
|
||||
num_layers = MIN2(num_layers, num);
|
||||
}
|
||||
return MAX2(num_layers, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,4 +95,8 @@ zink_get_framebuffer_imageless(struct zink_context *ctx);
|
|||
|
||||
struct zink_framebuffer *
|
||||
zink_get_framebuffer(struct zink_context *ctx);
|
||||
|
||||
unsigned
|
||||
zink_framebuffer_get_num_layers(const struct pipe_framebuffer_state *fb);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue