[virglrenderer-devel] [PATCH virglrenderer] shader: improve TXQ translation

Marc-André Lureau marcandre.lureau at gmail.com
Sun Feb 21 18:14:29 UTC 2016


Nack,

although it fixes texturesize, there are a couple of regressions. I am
working on a better version.

On Sat, Feb 20, 2016 at 9:10 PM,  <marcandre.lureau at redhat.com> wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>
> TXQ queries levels and size. Fixes all piglit texturesize tests
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
>  src/vrend_shader.c | 43 ++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 38 insertions(+), 5 deletions(-)
>
> diff --git a/src/vrend_shader.c b/src/vrend_shader.c
> index 5a16223..7330759 100644
> --- a/src/vrend_shader.c
> +++ b/src/vrend_shader.c
> @@ -1009,13 +1009,46 @@ static int translate_tex(struct dump_ctx *ctx,
>
>        /* need to emit a textureQueryLevels */
>        if (inst->Dst[0].Register.WriteMask & 0x8) {
> -         ctx->uses_txq_levels = true;
> -         snprintf(buf, 255, "%s = %s(%s(textureQueryLevels(%s)));\n", dsts[0], dstconv, dtypeprefix, srcs[sampler_index]);
> -         return emit_buf(ctx, buf);
> +
> +         if (inst->Texture.Texture != TGSI_TEXTURE_BUFFER &&
> +             inst->Texture.Texture != TGSI_TEXTURE_RECT) {
> +            ctx->uses_txq_levels = true;
> +            snprintf(buf, 255, "%s.w = %s(textureQueryLevels(%s));\n", dsts[0], dtypeprefix, srcs[sampler_index]);
> +            emit_buf(ctx, buf);
> +         }
> +
> +         switch (inst->Texture.Texture) {
> +         case TGSI_TEXTURE_1D:
> +         case TGSI_TEXTURE_BUFFER:
> +         case TGSI_TEXTURE_SHADOW1D:
> +            twm = ".x";
> +            break;
> +         case TGSI_TEXTURE_1D_ARRAY:
> +         case TGSI_TEXTURE_SHADOW1D_ARRAY:
> +         case TGSI_TEXTURE_2D:
> +         case TGSI_TEXTURE_SHADOW2D:
> +         case TGSI_TEXTURE_RECT:
> +         case TGSI_TEXTURE_SHADOWRECT:
> +         case TGSI_TEXTURE_2D_MSAA:
> +         case TGSI_TEXTURE_CUBE:
> +         case TGSI_TEXTURE_SHADOWCUBE:
> +            twm = ".xy";
> +            break;
> +         case TGSI_TEXTURE_3D:
> +         case TGSI_TEXTURE_2D_ARRAY:
> +         case TGSI_TEXTURE_2D_ARRAY_MSAA:
> +         case TGSI_TEXTURE_SHADOW2D_ARRAY:
> +         case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
> +         case TGSI_TEXTURE_CUBE_ARRAY:
> +            twm = ".xyz";
> +            break;
> +         }
>        } else {
> -         snprintf(buf, 255, "%s = %s(%s(textureSize(%s%s)));\n", dsts[0], dstconv, dtypeprefix, srcs[sampler_index], bias);
> -         return emit_buf(ctx, buf);
> +         twm = "";
>        }
> +
> +      snprintf(buf, 255, "%s%s = %s(textureSize(%s%s));\n", dsts[0], twm, dtypeprefix, srcs[sampler_index], bias);
> +      return emit_buf(ctx, buf);
>     }
>
>     switch (inst->Texture.Texture) {
> --
> 2.5.0
>
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel



-- 
Marc-André Lureau


More information about the virglrenderer-devel mailing list