X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Ffreedreno%2Ffreedreno_util.c;h=5d0ea4eea7f2b210800a9052676c537fdc3e4c6c;hb=831fb29252859c8aaf2bc1c2573a83f30d664204;hp=83a33db8f5bbef46900a3a81d72c9bb38f24dfb8;hpb=18c317b21ddc2ec4538544f9dd69dc568dcf821f;p=mesa.git diff --git a/src/gallium/drivers/freedreno/freedreno_util.c b/src/gallium/drivers/freedreno/freedreno_util.c index 83a33db8f5b..5d0ea4eea7f 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.c +++ b/src/gallium/drivers/freedreno/freedreno_util.c @@ -31,6 +31,8 @@ #include "freedreno_util.h" +unsigned marker_cnt; + enum adreno_rb_depth_format fd_pipe2depth(enum pipe_format format) { @@ -39,7 +41,12 @@ fd_pipe2depth(enum pipe_format format) return DEPTHX_16; case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z24_UNORM_S8_UINT: + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_S8_UINT_Z24_UNORM: return DEPTHX_24_8; + case PIPE_FORMAT_Z32_FLOAT: + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: + return DEPTHX_32; default: return ~0; } @@ -60,6 +67,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) @@ -97,36 +124,19 @@ fd_blend_factor(unsigned factor) case PIPE_BLENDFACTOR_INV_CONST_ALPHA: return FACTOR_ONE_MINUS_CONSTANT_ALPHA; case PIPE_BLENDFACTOR_INV_SRC1_COLOR: + return FACTOR_ONE_MINUS_SRC1_COLOR; case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: + return FACTOR_ONE_MINUS_SRC1_ALPHA; case PIPE_BLENDFACTOR_SRC1_COLOR: + return FACTOR_SRC1_COLOR; case PIPE_BLENDFACTOR_SRC1_ALPHA: - /* I don't think these are supported */ + return FACTOR_SRC1_ALPHA; default: DBG("invalid blend factor: %x", factor); return 0; } } -enum adreno_rb_blend_opcode -fd_blend_func(unsigned func) -{ - switch (func) { - case PIPE_BLEND_ADD: - return BLEND_DST_PLUS_SRC; - case PIPE_BLEND_MIN: - return BLEND_MIN_DST_SRC; - case PIPE_BLEND_MAX: - return BLEND_MAX_DST_SRC; - case PIPE_BLEND_SUBTRACT: - return BLEND_SRC_MINUS_DST; - case PIPE_BLEND_REVERSE_SUBTRACT: - return BLEND_DST_MINUS_SRC; - default: - DBG("invalid blend func: %x", func); - return 0; - } -} - enum adreno_pa_su_sc_draw fd_polygon_mode(unsigned mode) {