summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-06-16 15:32:45 -0600
committerBrian Paul <[email protected]>2015-06-19 08:45:00 -0600
commit9405c1b3b0b207409931166a608276198a068cb8 (patch)
treec0302a13349d93a1e7d7fdc3aa162a01c30a0b07
parent0925e5f5bc843237e534313dd5b99095ecbdd987 (diff)
st/wgl: add support for multisample pixel formats
Create pixel formats with 0, 4, 8 and 16 samples per pixel. Add a SVGA_FORCE_MSAA env var to force creating all pixel formats with a particular sample count. This is useful for testing Mesa/GLUT/ etc. programs which don't ordinarily use multisample. Reviewed-by: Matthew McClure <[email protected]>
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c
index b0cd5abd27a..db6cf8ee30f 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c
@@ -113,7 +113,9 @@ stw_pf_doublebuffer[] = {
const unsigned
stw_pf_multisample[] = {
0,
- 4
+ 4,
+ 8,
+ 16
};
@@ -222,23 +224,32 @@ add_color_format_variants(const struct stw_pf_color_info *color,
unsigned ms, db, ds, acc;
unsigned bind_flags = PIPE_BIND_RENDER_TARGET;
unsigned num_added = 0;
+ int force_samples = 0;
- if (!extended) {
- bind_flags |= PIPE_BIND_DISPLAY_TARGET;
+ /* Since GLUT for Windows doesn't support MSAA we have an env var
+ * to force all pixel formats to have a particular number of samples.
+ */
+ {
+ const char *samples= getenv("SVGA_FORCE_MSAA");
+ if (samples)
+ force_samples = atoi(samples);
}
- if (!screen->is_format_supported(screen, color->format,
- PIPE_TEXTURE_2D, 0, bind_flags)) {
- return 0;
+ if (!extended) {
+ bind_flags |= PIPE_BIND_DISPLAY_TARGET;
}
for (ms = 0; ms < Elements(stw_pf_multisample); ms++) {
unsigned samples = stw_pf_multisample[ms];
- /* FIXME: re-enabled MSAA when we can query it */
- if (samples)
+ if (force_samples && samples != force_samples)
continue;
+ if (!screen->is_format_supported(screen, color->format,
+ PIPE_TEXTURE_2D, samples, bind_flags)) {
+ continue;
+ }
+
for (db = 0; db < Elements(stw_pf_doublebuffer); db++) {
unsigned doublebuffer = stw_pf_doublebuffer[db];
@@ -246,7 +257,7 @@ add_color_format_variants(const struct stw_pf_color_info *color,
const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[ds];
if (!screen->is_format_supported(screen, depth->format,
- PIPE_TEXTURE_2D, 0,
+ PIPE_TEXTURE_2D, samples,
PIPE_BIND_DEPTH_STENCIL)) {
continue;
}