summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorKristian H. Kristensen <[email protected]>2018-11-06 13:08:32 -0800
committerKristian H. Kristensen <[email protected]>2018-12-06 16:55:43 -0800
commit2710c40e3c817e269fde6fd3bb2727e0ee8d3598 (patch)
tree966eff674ac450c8486e82e26e08c53f0fb86635 /src/gallium/auxiliary
parent1b331ae505e63033634d9f5267ca1949336f75d8 (diff)
gallium: Add new PIPE_CAP_SURFACE_SAMPLE_COUNT
This new pipe cap and the new nr_samples field in pipe_surface lets a state tracker bind a render target with a different sample count than the resource. This allows for implementing EXT_multisampled_render_to_texture and EXT_multisampled_render_to_texture2. Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_framebuffer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_framebuffer.c b/src/gallium/auxiliary/util/u_framebuffer.c
index 5bafddc726f..f569511393b 100644
--- a/src/gallium/auxiliary/util/u_framebuffer.c
+++ b/src/gallium/auxiliary/util/u_framebuffer.c
@@ -229,13 +229,19 @@ util_framebuffer_get_num_samples(const struct pipe_framebuffer_state *fb)
if (!(fb->nr_cbufs || fb->zsbuf))
return MAX2(fb->samples, 1);
+ /**
+ * If a driver doesn't advertise PIPE_CAP_SURFACE_SAMPLE_COUNT,
+ * pipe_surface::nr_samples will always be 0.
+ */
for (i = 0; i < fb->nr_cbufs; i++) {
if (fb->cbufs[i]) {
- return MAX2(1, fb->cbufs[i]->texture->nr_samples);
+ return MAX3(1, fb->cbufs[i]->texture->nr_samples,
+ fb->cbufs[i]->nr_samples);
}
}
if (fb->zsbuf) {
- return MAX2(1, fb->zsbuf->texture->nr_samples);
+ return MAX3(1, fb->zsbuf->texture->nr_samples,
+ fb->zsbuf->nr_samples);
}
return 1;