summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2014-03-21 11:06:41 -0600
committerJosé Fonseca <[email protected]>2014-05-30 18:52:39 +0100
commitfa55c2402c11aaccfc30b198b22b136142574a9c (patch)
tree078633fc43a74546fab4a2e124c41651b52a3aeb
parente4a5165562ec21c86dcc8069ef424485aa6f2ac3 (diff)
st/wgl: add debug code to check that pixel format initialization worked
If the assertion fails, it means something is really broken. Before, if this happened we reverted to the GDI renderer without any warning. Reviewed-by: Matthew McClure <[email protected]>
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c
index dc5160d868e..96169e2b5f9 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c
@@ -214,13 +214,14 @@ stw_pixelformat_add(
/**
* Add the depth/stencil/accum/ms variants for a particular color format.
*/
-static void
+static unsigned
add_color_format_variants(const struct stw_pf_color_info *color,
boolean extended)
{
struct pipe_screen *screen = stw_dev->screen;
unsigned ms, db, ds, acc;
unsigned bind_flags = PIPE_BIND_RENDER_TARGET;
+ unsigned num_added = 0;
if (!extended) {
bind_flags |= PIPE_BIND_DISPLAY_TARGET;
@@ -228,7 +229,7 @@ add_color_format_variants(const struct stw_pf_color_info *color,
if (!screen->is_format_supported(screen, color->format,
PIPE_TEXTURE_2D, 0, bind_flags)) {
- return;
+ return 0;
}
for (ms = 0; ms < Elements(stw_pf_multisample); ms++) {
@@ -253,10 +254,13 @@ add_color_format_variants(const struct stw_pf_color_info *color,
for (acc = 0; acc < 2; acc++) {
stw_pixelformat_add(stw_dev, extended, color, depth,
acc * 16, doublebuffer, samples);
+ num_added++;
}
}
}
}
+
+ return num_added;
}
@@ -264,14 +268,16 @@ void
stw_pixelformat_init( void )
{
unsigned i;
+ unsigned num_formats = 0;
assert( !stw_dev->pixelformat_count );
assert( !stw_dev->pixelformat_extended_count );
/* normal, displayable formats */
for (i = 0; i < Elements(stw_pf_color); i++) {
- add_color_format_variants(&stw_pf_color[i], FALSE);
+ num_formats += add_color_format_variants(&stw_pf_color[i], FALSE);
}
+ assert(num_formats > 0);
/* extended, pbuffer-only formats */
for (i = 0; i < Elements(stw_pf_color_extended); i++) {