diff options
-rw-r--r-- | src/gallium/state_trackers/glx/xlib/glx_api.c | 25 | ||||
-rw-r--r-- | src/gallium/state_trackers/glx/xlib/xm_api.c | 19 | ||||
-rw-r--r-- | src/gallium/state_trackers/glx/xlib/xm_st.c | 1 |
3 files changed, 30 insertions, 15 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index 642ece7b0f8..c473a0fe541 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -181,7 +181,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, GLint depth_size, GLint stencil_size, GLint accumRedSize, GLint accumGreenSize, GLint accumBlueSize, GLint accumAlphaSize, - GLint level, GLint numAuxBuffers ) + GLint level, GLint numAuxBuffers, GLint num_samples ) { GLboolean ximageFlag = GL_TRUE; XMesaVisual xmvis; @@ -229,6 +229,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, if (v->display == dpy && v->mesa_visual.level == level && v->mesa_visual.numAuxBuffers == numAuxBuffers + && v->mesa_visual.samples == num_samples && v->ximage_flag == ximageFlag && v->mesa_visual.rgbMode == rgbFlag && v->mesa_visual.doubleBufferMode == dbFlag @@ -254,7 +255,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, stereoFlag, ximageFlag, depth_size, stencil_size, accumRedSize, accumBlueSize, - accumBlueSize, accumAlphaSize, 0, level, + accumBlueSize, accumAlphaSize, num_samples, level, GLX_NONE_EXT ); if (xmvis) { /* Save a copy of the pointer now so we can find this visual again @@ -344,7 +345,8 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) accBits, /* b */ accBits, /* a */ 0, /* level */ - 0 /* numAux */ + 0, /* numAux */ + 0 /* numSamples */ ); } else { @@ -739,6 +741,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) XMesaVisual xmvis = NULL; int desiredVisualID = -1; int numAux = 0; + GLint num_samples = 0; xmesa_init( dpy ); @@ -905,12 +908,13 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) * GLX_ARB_multisample */ case GLX_SAMPLE_BUFFERS_ARB: + /* ignore */ + parselist++; + parselist++; + break; case GLX_SAMPLES_ARB: parselist++; - if (*parselist++ != 0) { - /* ms not supported */ - return NULL; - } + num_samples = *parselist++; break; /* @@ -1067,7 +1071,8 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) xmvis = save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag, stereo_flag, depth_size, stencil_size, accumRedSize, accumGreenSize, - accumBlueSize, accumAlphaSize, level, numAux ); + accumBlueSize, accumAlphaSize, level, numAux, + num_samples ); } return xmvis; @@ -1602,10 +1607,10 @@ get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig ) * GLX_ARB_multisample */ case GLX_SAMPLE_BUFFERS_ARB: - *value = 0; + *value = xmvis->mesa_visual.sampleBuffers; return 0; case GLX_SAMPLES_ARB: - *value = 0; + *value = xmvis->mesa_visual.samples; return 0; /* diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 398152e09b3..881dd443232 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -453,11 +453,11 @@ choose_pixel_format(XMesaVisual v) * stencil sizes. */ static enum pipe_format -choose_depth_stencil_format(XMesaDisplay xmdpy, int depth, int stencil) +choose_depth_stencil_format(XMesaDisplay xmdpy, int depth, int stencil, + int sample_count) { const enum pipe_texture_target target = PIPE_TEXTURE_2D; const unsigned tex_usage = PIPE_BIND_DEPTH_STENCIL; - const unsigned sample_count = 0; enum pipe_format formats[8], fmt; int count, i; @@ -861,8 +861,8 @@ XMesaVisual XMesaCreateVisual( Display *display, vis->numAuxBuffers = 0; vis->level = 0; - vis->sampleBuffers = 0; - vis->samples = 0; + vis->sampleBuffers = num_samples > 1; + vis->samples = num_samples; } v->stvis.buffer_mask = ST_ATTACHMENT_FRONT_LEFT_MASK; @@ -875,6 +875,14 @@ XMesaVisual XMesaCreateVisual( Display *display, } v->stvis.color_format = choose_pixel_format(v); + + /* Check format support at requested num_samples (for multisample) */ + if (!xmdpy->screen->is_format_supported(xmdpy->screen, + v->stvis.color_format, + PIPE_TEXTURE_2D, num_samples, + PIPE_BIND_RENDER_TARGET)) + v->stvis.color_format = PIPE_FORMAT_NONE; + if (v->stvis.color_format == PIPE_FORMAT_NONE) { free(v->visinfo); free(v); @@ -882,7 +890,8 @@ XMesaVisual XMesaCreateVisual( Display *display, } v->stvis.depth_stencil_format = - choose_depth_stencil_format(xmdpy, depth_size, stencil_size); + choose_depth_stencil_format(xmdpy, depth_size, stencil_size, + num_samples); v->stvis.accum_format = (accum_red_size + accum_green_size + accum_blue_size + accum_alpha_size) ? diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c index f598430dc26..9e30efad60d 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.c +++ b/src/gallium/state_trackers/glx/xlib/xm_st.c @@ -134,6 +134,7 @@ xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi, templ.depth0 = 1; templ.array_size = 1; templ.last_level = 0; + templ.nr_samples = xstfb->stvis.samples; for (i = 0; i < ST_ATTACHMENT_COUNT; i++) { enum pipe_format format; |