#include "util/u_debug.h"
+#define MSAA_VISUAL_MAX_SAMPLES 8
+
PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN
DRI_CONF_SECTION_PERFORMANCE
__DRIconfig **configs_x8r8g8b8 = NULL;
uint8_t depth_bits_array[5];
uint8_t stencil_bits_array[5];
- uint8_t msaa_samples_array[5];
+ uint8_t msaa_samples_array[MSAA_VISUAL_MAX_SAMPLES];
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
- unsigned msaa_samples_factor;
+ unsigned msaa_samples_factor, msaa_samples_max;
unsigned i;
struct pipe_screen *p_screen = screen->base.screen;
boolean pf_r5g6b5, pf_a8r8g8b8, pf_x8r8g8b8;
stencil_bits_array[0] = 0;
depth_buffer_factor = 1;
+ msaa_samples_max = (screen->st_api->feature_mask & ST_API_FEATURE_MS_VISUALS)
+ ? MSAA_VISUAL_MAX_SAMPLES : 1;
+
pf_x8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24X8_UNORM,
PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL);
msaa_samples_array[0] = 0;
back_buffer_factor = 3;
- /* also test color for msaa 2/4/6/8 - just assume it'll work for all depth buffers */
+ /* Also test for color multisample support - just assume it'll work
+ * for all depth buffers.
+ */
if (pf_r5g6b5) {
msaa_samples_factor = 1;
- for (i = 1; i < 5; i++) {
+ for (i = 2; i <= msaa_samples_max; i++) {
if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B5G6R5_UNORM,
- PIPE_TEXTURE_2D, i*2,
+ PIPE_TEXTURE_2D, i,
PIPE_BIND_RENDER_TARGET)) {
- msaa_samples_array[msaa_samples_factor] = i * 2;
+ msaa_samples_array[msaa_samples_factor] = i;
msaa_samples_factor++;
}
}
if (pf_a8r8g8b8) {
msaa_samples_factor = 1;
- for (i = 1; i < 5; i++) {
+ for (i = 2; i <= msaa_samples_max; i++) {
if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8A8_UNORM,
- PIPE_TEXTURE_2D, i*2,
+ PIPE_TEXTURE_2D, i,
PIPE_BIND_RENDER_TARGET)) {
- msaa_samples_array[msaa_samples_factor] = i * 2;
+ msaa_samples_array[msaa_samples_factor] = i;
msaa_samples_factor++;
}
}
if (pf_x8r8g8b8) {
msaa_samples_factor = 1;
- for (i = 1; i < 5; i++) {
+ for (i = 2; i <= msaa_samples_max; i++) {
if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8X8_UNORM,
- PIPE_TEXTURE_2D, i*2,
+ PIPE_TEXTURE_2D, i,
PIPE_BIND_RENDER_TARGET)) {
- msaa_samples_array[msaa_samples_factor] = i * 2;
+ msaa_samples_array[msaa_samples_factor] = i;
msaa_samples_factor++;
}
}