X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Ffreedreno%2Ffreedreno_util.c;h=bf1e05ba740ac0f4089b1cfa0d3b44539f56d699;hp=c8f2127c9100203df7d06fd03f7b11d887b0ba44;hb=76f9eae7bb2b503e46ebe2847619bba1cec393b6;hpb=005c8e01062e8e88a86904b955d5422742bd32e7 diff --git a/src/gallium/drivers/freedreno/freedreno_util.c b/src/gallium/drivers/freedreno/freedreno_util.c index c8f2127c910..bf1e05ba740 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.c +++ b/src/gallium/drivers/freedreno/freedreno_util.c @@ -1,5 +1,3 @@ -/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */ - /* * Copyright (C) 2012 Rob Clark * @@ -27,7 +25,7 @@ */ #include "pipe/p_defines.h" -#include "util/u_format.h" +#include "util/format/u_format.h" #include "freedreno_util.h" @@ -67,6 +65,26 @@ fd_pipe2index(enum pipe_format format) } } +/* we need to special case a bit the depth/stencil restore, because we are + * using the texture sampler to blit into the depth/stencil buffer, *not* + * into a color buffer. Otherwise fdN_tex_swiz() will do the wrong thing, + * as it is assuming that you are sampling into normal render target.. + */ +enum pipe_format +fd_gmem_restore_format(enum pipe_format format) +{ + switch (format) { + case PIPE_FORMAT_Z24X8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_UINT: + return PIPE_FORMAT_R8G8B8A8_UNORM; + case PIPE_FORMAT_Z16_UNORM: + return PIPE_FORMAT_R8G8_UNORM; + case PIPE_FORMAT_S8_UINT: + return PIPE_FORMAT_R8_UNORM; + default: + return format; + } +} enum adreno_rb_blend_factor fd_blend_factor(unsigned factor)