[Mesa-dev] [PATCH] mesa/llvmpipe: add fake MSAA support
Jose Fonseca
jfonseca at vmware.com
Wed Nov 27 09:09:57 PST 2013
Looks great. Thanks for doing this! Future is now.
Jose
----- Original Message -----
> This adds a gallium cap that allows us to fake GL3.0 by
> not exposing MSAA on sw rendering. It also forces the
> extra extensions needed for GL3.2. Along with a patch to
> raise the GLSL version in llvmpipe this will expose GL3.3
> on llvmpipe.
>
> However we still need Marek's code for layered clears.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/gallium/drivers/llvmpipe/lp_screen.c | 2 ++
> src/gallium/include/pipe/p_defines.h | 3 ++-
> src/mesa/main/mtypes.h | 1 +
> src/mesa/main/version.c | 2 +-
> src/mesa/state_tracker/st_extensions.c | 7 +++++++
> 5 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c
> b/src/gallium/drivers/llvmpipe/lp_screen.c
> index f61df98..218b3f8 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -234,6 +234,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum
> pipe_cap param)
> return PIPE_MAX_VIEWPORTS;
> case PIPE_CAP_ENDIANNESS:
> return PIPE_ENDIAN_NATIVE;
> + case PIPE_CAP_FAKE_SW_MSAA:
> + return 1;
> }
> /* should only get here on unhandled cases */
> debug_printf("Unexpected PIPE_CAP %d query\n", param);
> diff --git a/src/gallium/include/pipe/p_defines.h
> b/src/gallium/include/pipe/p_defines.h
> index db6db32..27f1bcf 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -513,7 +513,8 @@ enum pipe_cap {
> PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE = 83,
> PIPE_CAP_MAX_VIEWPORTS = 84,
> PIPE_CAP_ENDIANNESS = 85,
> - PIPE_CAP_MIXED_FRAMEBUFFER_SIZES = 86
> + PIPE_CAP_MIXED_FRAMEBUFFER_SIZES = 86,
> + PIPE_CAP_FAKE_SW_MSAA = 87
> };
>
> #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index ecfb5e0..39b8abd 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -3302,6 +3302,7 @@ struct gl_constants
> /** GL_ARB_vertex_attrib_binding */
> GLint MaxVertexAttribRelativeOffset;
> GLint MaxVertexAttribBindings;
> + GLboolean FakeSWMSAA;
> };
>
>
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 55411fa..1dfce09 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -229,7 +229,7 @@ compute_version(struct gl_context *ctx)
> ctx->Extensions.EXT_texture_sRGB);
> const GLboolean ver_3_0 = (ver_2_1 &&
> ctx->Const.GLSLVersion >= 130 &&
> - ctx->Const.MaxSamples >= 4 &&
> + (ctx->Const.MaxSamples >= 4 ||
> ctx->Const.FakeSWMSAA) &&
> (ctx->API == API_OPENGL_CORE ||
> ctx->Extensions.ARB_color_buffer_float) &&
> ctx->Extensions.ARB_depth_buffer_float &&
> diff --git a/src/mesa/state_tracker/st_extensions.c
> b/src/mesa/state_tracker/st_extensions.c
> index cd10a0c..701086a 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -715,6 +715,13 @@ void st_init_extensions(struct st_context *st)
> ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE;
> }
>
> + if (ctx->Const.MaxSamples == 0 && screen->get_param(screen,
> PIPE_CAP_FAKE_SW_MSAA)) {
> + ctx->Const.FakeSWMSAA = GL_TRUE;
> + ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
> + ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE;
> + ctx->Extensions.ARB_texture_multisample = GL_TRUE;
> + }
> +
> if (ctx->Const.MaxDualSourceDrawBuffers > 0 &&
> !st->options.disable_blend_func_extended)
> ctx->Extensions.ARB_blend_func_extended = GL_TRUE;
> --
> 1.8.3.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=1xgfm7klIhkbdFhXv%2BVT%2BbSODyva1JcPkn8e6J5df6k%3D%0A&s=b9c729d850a706176cc517e7516cc780e4bd2672a660c5a646045dbb3329379c
>
More information about the mesa-dev
mailing list