aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_framebuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_framebuffer.c')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_framebuffer.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_framebuffer.c b/mesalib/src/gallium/auxiliary/util/u_framebuffer.c
index 683967237..2e0ef749e 100644
--- a/mesalib/src/gallium/auxiliary/util/u_framebuffer.c
+++ b/mesalib/src/gallium/auxiliary/util/u_framebuffer.c
@@ -127,6 +127,9 @@ util_framebuffer_min_size(const struct pipe_framebuffer_state *fb,
unsigned i;
for (i = 0; i < fb->nr_cbufs; i++) {
+ if (!fb->cbufs[i])
+ continue;
+
w = MIN2(w, fb->cbufs[i]->width);
h = MIN2(h, fb->cbufs[i]->height);
}
@@ -171,3 +174,24 @@ util_framebuffer_get_num_layers(const struct pipe_framebuffer_state *fb)
}
return num_layers;
}
+
+
+/**
+ * Return the number of MSAA samples.
+ */
+unsigned
+util_framebuffer_get_num_samples(const struct pipe_framebuffer_state *fb)
+{
+ unsigned i;
+
+ for (i = 0; i < fb->nr_cbufs; i++) {
+ if (fb->cbufs[i]) {
+ return MAX2(1, fb->cbufs[i]->texture->nr_samples);
+ }
+ }
+ if (fb->zsbuf) {
+ return MAX2(1, fb->zsbuf->texture->nr_samples);
+ }
+
+ return 1;
+}