summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-06-01 08:45:07 -0600
committerJose Fonseca <[email protected]>2015-11-09 11:25:59 +0000
commit8083943e2e5b3f2a7201650a586b597dff481d43 (patch)
treea41a0d76c43da990d90b7fcb1e4f298b653b51c3
parente524df5ef32fe8fada0695417bd86413d836a6bb (diff)
st/wgl: reorder pixel formats to put MSAA formats last
And put 8-bit/channel formats before 5/6/5 formats. The ChoosePixelFormat() function seems to be finicky about format selection. Putting the MSAA formats after the non-MSAA formats means most apps get a low-numbered format. Now we generally get the same pixel format regardless of whether using vgpu9 or 10. VMware bug 1455030 Reviewed-by: José Fonseca <[email protected]>
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.c61
1 files changed, 32 insertions, 29 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c
index db6cf8ee30f..ef6158d3645 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c
@@ -74,10 +74,11 @@ stw_pf_color[] = {
/* no-alpha */
{ PIPE_FORMAT_B8G8R8X8_UNORM, { 8, 8, 8, 0}, {16, 8, 0, 0} },
{ PIPE_FORMAT_X8R8G8B8_UNORM, { 8, 8, 8, 0}, { 8, 16, 24, 0} },
- { PIPE_FORMAT_B5G6R5_UNORM, { 5, 6, 5, 0}, {11, 5, 0, 0} },
/* alpha */
{ PIPE_FORMAT_B8G8R8A8_UNORM, { 8, 8, 8, 8}, {16, 8, 0, 24} },
{ PIPE_FORMAT_A8R8G8B8_UNORM, { 8, 8, 8, 8}, { 8, 16, 24, 0} },
+ /* shallow bit depths */
+ { PIPE_FORMAT_B5G6R5_UNORM, { 5, 6, 5, 0}, {11, 5, 0, 0} },
#if 0
{ PIPE_FORMAT_R10G10B10A2_UNORM, {10, 10, 10, 2}, { 0, 10, 20, 30} },
#endif
@@ -214,14 +215,15 @@ stw_pixelformat_add(
/**
- * Add the depth/stencil/accum/ms variants for a particular color format.
+ * Add the depth/stencil/accum/ms variants for a list of color formats.
*/
static unsigned
-add_color_format_variants(const struct stw_pf_color_info *color,
+add_color_format_variants(const struct stw_pf_color_info *color_formats,
+ unsigned num_color_formats,
boolean extended)
{
struct pipe_screen *screen = stw_dev->screen;
- unsigned ms, db, ds, acc;
+ unsigned cfmt, ms, db, ds, acc;
unsigned bind_flags = PIPE_BIND_RENDER_TARGET;
unsigned num_added = 0;
int force_samples = 0;
@@ -245,27 +247,31 @@ add_color_format_variants(const struct stw_pf_color_info *color,
if (force_samples && samples != force_samples)
continue;
- if (!screen->is_format_supported(screen, color->format,
- PIPE_TEXTURE_2D, samples, bind_flags)) {
- continue;
- }
+ for (cfmt = 0; cfmt < num_color_formats; cfmt++) {
+ if (!screen->is_format_supported(screen, color_formats[cfmt].format,
+ PIPE_TEXTURE_2D, samples,
+ bind_flags)) {
+ continue;
+ }
- for (db = 0; db < Elements(stw_pf_doublebuffer); db++) {
- unsigned doublebuffer = stw_pf_doublebuffer[db];
+ for (db = 0; db < Elements(stw_pf_doublebuffer); db++) {
+ unsigned doublebuffer = stw_pf_doublebuffer[db];
- for (ds = 0; ds < Elements(stw_pf_depth_stencil); ds++) {
- const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[ds];
+ for (ds = 0; ds < Elements(stw_pf_depth_stencil); ds++) {
+ const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[ds];
- if (!screen->is_format_supported(screen, depth->format,
- PIPE_TEXTURE_2D, samples,
- PIPE_BIND_DEPTH_STENCIL)) {
- continue;
- }
+ if (!screen->is_format_supported(screen, depth->format,
+ PIPE_TEXTURE_2D, samples,
+ PIPE_BIND_DEPTH_STENCIL)) {
+ continue;
+ }
- for (acc = 0; acc < 2; acc++) {
- stw_pixelformat_add(stw_dev, extended, color, depth,
- acc * 16, doublebuffer, samples);
- num_added++;
+ for (acc = 0; acc < 2; acc++) {
+ stw_pixelformat_add(stw_dev, extended, &color_formats[cfmt],
+ depth,
+ acc * 16, doublebuffer, samples);
+ num_added++;
+ }
}
}
}
@@ -278,22 +284,19 @@ add_color_format_variants(const struct stw_pf_color_info *color,
void
stw_pixelformat_init( void )
{
- unsigned i;
- unsigned num_formats = 0;
+ unsigned num_formats;
assert( !stw_dev->pixelformat_count );
assert( !stw_dev->pixelformat_extended_count );
/* normal, displayable formats */
- for (i = 0; i < Elements(stw_pf_color); i++) {
- num_formats += add_color_format_variants(&stw_pf_color[i], FALSE);
- }
+ num_formats = add_color_format_variants(stw_pf_color,
+ Elements(stw_pf_color), FALSE);
assert(num_formats > 0);
/* extended, pbuffer-only formats */
- for (i = 0; i < Elements(stw_pf_color_extended); i++) {
- add_color_format_variants(&stw_pf_color_extended[i], TRUE);
- }
+ add_color_format_variants(stw_pf_color_extended,
+ Elements(stw_pf_color_extended), TRUE);
assert( stw_dev->pixelformat_count <= stw_dev->pixelformat_extended_count );
assert( stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS );