[Mesa-dev] [PATCH 2/2] llvmpipe: start faking multisample support
Roland Scheidegger
sroland at vmware.com
Mon Nov 25 09:44:06 PST 2013
Am 25.11.2013 11:41, schrieb Dave Airlie:
> From: Dave Airlie <airlied at redhat.com>
>
> We've talked in the past about just faking multisample support
> in the sw drivers as much as we possibly can, this just adds enough
> to llvmpipe to do that.
>
> It produces some valid fails in piglit, like the accuracy tests
> and the texelFetch tests fail due to lack of second texel,
>
> Some fails we might be able to mitigate but not sure what we'd gain,
> like alpha-to-one.
>
> Some of the format tests fail so could do with more investigation.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 7 ++++++-
> src/gallium/drivers/llvmpipe/lp_screen.c | 4 ++--
> src/gallium/drivers/llvmpipe/lp_surface.c | 8 --------
> 3 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> index 6d8dc8c..b732b72 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> @@ -1920,11 +1920,13 @@ emit_sample(struct lp_build_tgsi_soa_context *bld,
> num_derivs = 1;
> break;
> case TGSI_TEXTURE_2D:
> + case TGSI_TEXTURE_2D_MSAA:
> case TGSI_TEXTURE_RECT:
> num_offsets = 2;
> num_derivs = 2;
> break;
> case TGSI_TEXTURE_2D_ARRAY:
> + case TGSI_TEXTURE_2D_ARRAY_MSAA:
> layer_coord = 2;
> num_offsets = 2;
> num_derivs = 2;
> @@ -2088,10 +2090,12 @@ emit_fetch_texels( struct lp_build_tgsi_soa_context *bld,
> dims = 1;
> break;
> case TGSI_TEXTURE_2D:
> + case TGSI_TEXTURE_2D_MSAA:
> case TGSI_TEXTURE_RECT:
> dims = 2;
> break;
> case TGSI_TEXTURE_2D_ARRAY:
> + case TGSI_TEXTURE_2D_ARRAY_MSAA:
> layer_coord = 2;
> dims = 2;
> break;
> @@ -2104,7 +2108,8 @@ emit_fetch_texels( struct lp_build_tgsi_soa_context *bld,
> }
>
> /* always have lod except for buffers ? */
> - if (target != TGSI_TEXTURE_BUFFER) {
> + if (target != TGSI_TEXTURE_BUFFER && target != TGSI_TEXTURE_2D_MSAA &&
> + target != TGSI_TEXTURE_2D_ARRAY_MSAA) {
> explicit_lod = lp_build_emit_fetch(&bld->bld_base, inst, 0, 3);
> lod_property = lp_build_lod_property(&bld->bld_base, inst, 0);
> }
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index f61df98..34d536b 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -218,11 +218,11 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
> return 16;
> case PIPE_CAP_START_INSTANCE:
> - case PIPE_CAP_TEXTURE_MULTISAMPLE:
> case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
> case PIPE_CAP_CUBE_MAP_ARRAY:
> return 0;
> case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
> + case PIPE_CAP_TEXTURE_MULTISAMPLE:
> return 1;
> case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
> return 65536;
> @@ -327,7 +327,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
> target == PIPE_TEXTURE_3D ||
> target == PIPE_TEXTURE_CUBE);
>
> - if (sample_count > 1)
> + if (sample_count > 4)
> return FALSE;
>
> if (bind & PIPE_BIND_RENDER_TARGET) {
> diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
> index f033c46..5c059d7 100644
> --- a/src/gallium/drivers/llvmpipe/lp_surface.c
> +++ b/src/gallium/drivers/llvmpipe/lp_surface.c
> @@ -180,14 +180,6 @@ static void lp_blit(struct pipe_context *pipe,
> struct llvmpipe_context *lp = llvmpipe_context(pipe);
> struct pipe_blit_info info = *blit_info;
>
> - if (info.src.resource->nr_samples > 1 &&
> - info.dst.resource->nr_samples <= 1 &&
> - !util_format_is_depth_or_stencil(info.src.resource->format) &&
> - !util_format_is_pure_integer(info.src.resource->format)) {
> - debug_printf("llvmpipe: color resolve unimplemented\n");
> - return;
> - }
> -
> if (util_try_blit_via_copy_region(pipe, &info)) {
> return; /* done */
> }
>
I think some switch statements inside the sampling code would need
updates too, I don't think the two new cases are handled appropriately
everywhere.
Though actually I was thinking more about wrongly advertizing GL 3.0 (or
3.1 or whatever) and still just sample count of 1 rather than faking 4
samples support. Seemed like a neater hack.
Roland
More information about the mesa-dev
mailing list