[Mesa-dev] [PATCH] gallium/util: remove dummy function util_format_is_supported
Marek Olšák
maraeo at gmail.com
Wed Jun 27 20:10:53 UTC 2018
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/auxiliary/util/u_format.c | 13 -------------
src/gallium/auxiliary/util/u_format.h | 7 -------
src/gallium/drivers/freedreno/a2xx/fd2_screen.c | 3 +--
src/gallium/drivers/freedreno/a3xx/fd3_screen.c | 3 +--
src/gallium/drivers/freedreno/a4xx/fd4_screen.c | 3 +--
src/gallium/drivers/freedreno/a5xx/fd5_screen.c | 3 +--
src/gallium/drivers/i915/i915_screen.c | 3 ---
src/gallium/drivers/nouveau/nv30/nv30_screen.c | 4 ----
src/gallium/drivers/nouveau/nv50/nv50_screen.c | 3 ---
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 3 ---
src/gallium/drivers/r300/r300_screen.c | 3 ---
src/gallium/drivers/r600/evergreen_state.c | 3 ---
src/gallium/drivers/r600/r600_state.c | 3 ---
src/gallium/drivers/radeonsi/si_state.c | 3 ---
src/gallium/drivers/v3d/v3d_screen.c | 3 +--
src/gallium/drivers/vc4/vc4_screen.c | 3 +--
16 files changed, 6 insertions(+), 57 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
index e0325e9c534..1dd724d9b84 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -228,33 +228,20 @@ util_format_is_subsampled_422(enum pipe_format format)
{
const struct util_format_description *desc =
util_format_description(format);
return desc->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED &&
desc->block.width == 2 &&
desc->block.height == 1 &&
desc->block.bits == 32;
}
-boolean
-util_format_is_supported(enum pipe_format format, unsigned bind)
-{
- if (format >= PIPE_FORMAT_COUNT) {
- return FALSE;
- }
-
- (void)bind;
-
- return TRUE;
-}
-
-
/**
* Calculates the MRD for the depth format. MRD is used in depth bias
* for UNORM and unbound depth buffers. When the depth buffer is floating
* point, the depth bias calculation does not use the MRD. However, the
* default MRD will be 1.0 / ((1 << 24) - 1).
*/
double
util_get_depth_format_mrd(const struct util_format_description *desc)
{
/*
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index e497b4b3375..f421222f854 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -710,27 +710,20 @@ util_format_is_snorm8(enum pipe_format format);
/**
* Check if the src format can be blitted to the destination format with
* a simple memcpy. For example, blitting from RGBA to RGBx is OK, but not
* the reverse.
*/
boolean
util_is_format_compatible(const struct util_format_description *src_desc,
const struct util_format_description *dst_desc);
-/**
- * Whether the format is supported by Gallium for the given bindings.
- * This covers S3TC textures and floating-point render targets.
- */
-boolean
-util_format_is_supported(enum pipe_format format, unsigned bind);
-
/**
* Whether this format is a rgab8 variant.
*
* That is, any format that matches the
*
* PIPE_FORMAT_?8?8?8?8_UNORM
*/
static inline boolean
util_format_is_rgba8_variant(const struct util_format_description *desc)
{
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
index c2a60c683f8..4fdf6914ab2 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
@@ -36,22 +36,21 @@
static boolean
fd2_screen_is_format_supported(struct pipe_screen *pscreen,
enum pipe_format format,
enum pipe_texture_target target,
unsigned sample_count,
unsigned usage)
{
unsigned retval = 0;
if ((target >= PIPE_MAX_TEXTURE_TYPES) ||
- (sample_count > 1) || /* TODO add MSAA */
- !util_format_is_supported(format, usage)) {
+ (sample_count > 1)) { /* TODO add MSAA */
DBG("not supported: format=%s, target=%d, sample_count=%d, usage=%x",
util_format_name(format), target, sample_count, usage);
return FALSE;
}
/* TODO figure out how to render to other formats.. */
if ((usage & PIPE_BIND_RENDER_TARGET) &&
((format != PIPE_FORMAT_B5G6R5_UNORM) &&
(format != PIPE_FORMAT_B5G5R5A1_UNORM) &&
(format != PIPE_FORMAT_B5G5R5X1_UNORM) &&
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
index 998ec7a0bdb..6de92e8e0e8 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
@@ -37,22 +37,21 @@
static boolean
fd3_screen_is_format_supported(struct pipe_screen *pscreen,
enum pipe_format format,
enum pipe_texture_target target,
unsigned sample_count,
unsigned usage)
{
unsigned retval = 0;
if ((target >= PIPE_MAX_TEXTURE_TYPES) ||
- (sample_count > 1) || /* TODO add MSAA */
- !util_format_is_supported(format, usage)) {
+ (sample_count > 1)) { || /* TODO add MSAA */
DBG("not supported: format=%s, target=%d, sample_count=%d, usage=%x",
util_format_name(format), target, sample_count, usage);
return FALSE;
}
if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
(fd3_pipe2vtx(format) != (enum a3xx_vtx_fmt)~0)) {
retval |= PIPE_BIND_VERTEX_BUFFER;
}
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
index 1b81f8db2f3..30124e4485d 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
@@ -37,22 +37,21 @@
static boolean
fd4_screen_is_format_supported(struct pipe_screen *pscreen,
enum pipe_format format,
enum pipe_texture_target target,
unsigned sample_count,
unsigned usage)
{
unsigned retval = 0;
if ((target >= PIPE_MAX_TEXTURE_TYPES) ||
- (sample_count > 1) || /* TODO add MSAA */
- !util_format_is_supported(format, usage)) {
+ (sample_count > 1)) { /* TODO add MSAA */
DBG("not supported: format=%s, target=%d, sample_count=%d, usage=%x",
util_format_name(format), target, sample_count, usage);
return FALSE;
}
if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
(fd4_pipe2vtx(format) != (enum a4xx_vtx_fmt)~0)) {
retval |= PIPE_BIND_VERTEX_BUFFER;
}
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c
index 6f614751f46..f441b0cc29f 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c
@@ -52,22 +52,21 @@ valid_sample_count(unsigned sample_count)
static boolean
fd5_screen_is_format_supported(struct pipe_screen *pscreen,
enum pipe_format format,
enum pipe_texture_target target,
unsigned sample_count,
unsigned usage)
{
unsigned retval = 0;
if ((target >= PIPE_MAX_TEXTURE_TYPES) ||
- !valid_sample_count(sample_count) ||
- !util_format_is_supported(format, usage)) {
+ !valid_sample_count(sample_count)) {
DBG("not supported: format=%s, target=%d, sample_count=%d, usage=%x",
util_format_name(format), target, sample_count, usage);
return FALSE;
}
if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
(fd5_pipe2vtx(format) != (enum a5xx_vtx_fmt)~0)) {
retval |= PIPE_BIND_VERTEX_BUFFER;
}
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index d917048e2b9..a03840a3aa4 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -506,23 +506,20 @@ i915_is_format_supported(struct pipe_screen *screen,
static const enum pipe_format depth_supported[] = {
/* XXX why not?
PIPE_FORMAT_Z16_UNORM, */
PIPE_FORMAT_Z24X8_UNORM,
PIPE_FORMAT_Z24_UNORM_S8_UINT,
PIPE_FORMAT_NONE /* list terminator */
};
const enum pipe_format *list;
uint i;
- if (!util_format_is_supported(format, tex_usage))
- return FALSE;
-
if (sample_count > 1)
return FALSE;
if(tex_usage & PIPE_BIND_DEPTH_STENCIL)
list = depth_supported;
else if (tex_usage & PIPE_BIND_RENDER_TARGET)
list = render_supported;
else if (tex_usage & PIPE_BIND_SAMPLER_VIEW)
list = tex_supported;
else
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index 95de832f6c7..155ddeef65e 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -415,24 +415,20 @@ nv30_screen_is_format_supported(struct pipe_screen *pscreen,
enum pipe_texture_target target,
unsigned sample_count,
unsigned bindings)
{
if (sample_count > nv30_screen(pscreen)->max_sample_count)
return false;
if (!(0x00000017 & (1 << sample_count)))
return false;
- if (!util_format_is_supported(format, bindings)) {
- return false;
- }
-
/* shared is always supported */
bindings &= ~PIPE_BIND_SHARED;
return (nv30_format_info(pscreen, format)->bindings & bindings) == bindings;
}
static void
nv30_screen_fence_emit(struct pipe_screen *pscreen, uint32_t *sequence)
{
struct nv30_screen *screen = nv30_screen(pscreen);
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 3a3c43b7749..44a1a8a9374 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -48,23 +48,20 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
unsigned sample_count,
unsigned bindings)
{
if (sample_count > 8)
return false;
if (!(0x117 & (1 << sample_count))) /* 0, 1, 2, 4 or 8 */
return false;
if (sample_count == 8 && util_format_get_blocksizebits(format) >= 128)
return false;
- if (!util_format_is_supported(format, bindings))
- return false;
-
switch (format) {
case PIPE_FORMAT_Z16_UNORM:
if (nv50_screen(pscreen)->tesla->oclass < NVA0_3D_CLASS)
return false;
break;
default:
break;
}
if (bindings & PIPE_BIND_LINEAR)
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 02890c71652..a217f9e1665 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -50,23 +50,20 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen,
return false;
if (!(0x117 & (1 << sample_count))) /* 0, 1, 2, 4 or 8 */
return false;
/* Short-circuit the rest of the logic -- this is used by the state tracker
* to determine valid MS levels in a no-attachments scenario.
*/
if (format == PIPE_FORMAT_NONE && bindings & PIPE_BIND_RENDER_TARGET)
return true;
- if (!util_format_is_supported(format, bindings))
- return false;
-
if ((bindings & PIPE_BIND_SAMPLER_VIEW) && (target != PIPE_BUFFER))
if (util_format_get_blocksizebits(format) == 3 * 32)
return false;
if (bindings & PIPE_BIND_LINEAR)
if (util_format_is_depth_or_stencil(format) ||
(target != PIPE_TEXTURE_1D &&
target != PIPE_TEXTURE_2D &&
target != PIPE_TEXTURE_RECT) ||
sample_count > 1)
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 793b0ba8d89..3331a6e90ff 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -608,23 +608,20 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
format == PIPE_FORMAT_RGTC2_SNORM ||
format == PIPE_FORMAT_LATC2_UNORM ||
format == PIPE_FORMAT_LATC2_SNORM;
boolean is_half_float = format == PIPE_FORMAT_R16_FLOAT ||
format == PIPE_FORMAT_R16G16_FLOAT ||
format == PIPE_FORMAT_R16G16B16_FLOAT ||
format == PIPE_FORMAT_R16G16B16A16_FLOAT ||
format == PIPE_FORMAT_R16G16B16X16_FLOAT;
const struct util_format_description *desc;
- if (!util_format_is_supported(format, usage))
- return FALSE;
-
/* Check multisampling support. */
switch (sample_count) {
case 0:
case 1:
break;
case 2:
case 4:
case 6:
/* No texturing and scanout. */
if (usage & (PIPE_BIND_SAMPLER_VIEW |
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index a484f0078aa..629385075b2 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -246,23 +246,20 @@ boolean evergreen_is_format_supported(struct pipe_screen *screen,
unsigned usage)
{
struct r600_screen *rscreen = (struct r600_screen*)screen;
unsigned retval = 0;
if (target >= PIPE_MAX_TEXTURE_TYPES) {
R600_ERR("r600: unsupported texture type %d\n", target);
return FALSE;
}
- if (!util_format_is_supported(format, usage))
- return FALSE;
-
if (sample_count > 1) {
if (!rscreen->has_msaa)
return FALSE;
switch (sample_count) {
case 2:
case 4:
case 8:
break;
default:
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 2c3a5ab4422..d241d27d1b9 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -165,23 +165,20 @@ boolean r600_is_format_supported(struct pipe_screen *screen,
unsigned usage)
{
struct r600_screen *rscreen = (struct r600_screen*)screen;
unsigned retval = 0;
if (target >= PIPE_MAX_TEXTURE_TYPES) {
R600_ERR("r600: unsupported texture type %d\n", target);
return FALSE;
}
- if (!util_format_is_supported(format, usage))
- return FALSE;
-
if (sample_count > 1) {
if (!rscreen->has_msaa)
return FALSE;
/* R11G11B10 is broken on R6xx. */
if (rscreen->b.chip_class == R600 &&
format == PIPE_FORMAT_R11G11B10_FLOAT)
return FALSE;
/* MSAA integer colorbuffers hang. */
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index a27b244c834..1214f446fc1 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2135,23 +2135,20 @@ static boolean si_is_format_supported(struct pipe_screen *screen,
unsigned usage)
{
struct si_screen *sscreen = (struct si_screen *)screen;
unsigned retval = 0;
if (target >= PIPE_MAX_TEXTURE_TYPES) {
PRINT_ERR("r600: unsupported texture type %d\n", target);
return false;
}
- if (!util_format_is_supported(format, usage))
- return false;
-
if (sample_count > 1) {
if (!screen->get_param(screen, PIPE_CAP_TEXTURE_MULTISAMPLE))
return false;
if (usage & PIPE_BIND_SHADER_IMAGE)
return false;
switch (sample_count) {
case 2:
case 4:
diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c
index 2eba557a64f..c0f70d0a92e 100644
--- a/src/gallium/drivers/v3d/v3d_screen.c
+++ b/src/gallium/drivers/v3d/v3d_screen.c
@@ -439,22 +439,21 @@ v3d_screen_is_format_supported(struct pipe_screen *pscreen,
enum pipe_format format,
enum pipe_texture_target target,
unsigned sample_count,
unsigned usage)
{
struct v3d_screen *screen = v3d_screen(pscreen);
if (sample_count > 1 && sample_count != VC5_MAX_SAMPLES)
return FALSE;
- if ((target >= PIPE_MAX_TEXTURE_TYPES) ||
- !util_format_is_supported(format, usage)) {
+ if (target >= PIPE_MAX_TEXTURE_TYPES) {
return FALSE;
}
if (usage & PIPE_BIND_VERTEX_BUFFER) {
switch (format) {
case PIPE_FORMAT_R32G32B32A32_FLOAT:
case PIPE_FORMAT_R32G32B32_FLOAT:
case PIPE_FORMAT_R32G32_FLOAT:
case PIPE_FORMAT_R32_FLOAT:
case PIPE_FORMAT_R32G32B32A32_SNORM:
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index 527ebeb2f48..17776fa4d9b 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -479,22 +479,21 @@ vc4_screen_is_format_supported(struct pipe_screen *pscreen,
enum pipe_format format,
enum pipe_texture_target target,
unsigned sample_count,
unsigned usage)
{
struct vc4_screen *screen = vc4_screen(pscreen);
if (sample_count > 1 && sample_count != VC4_MAX_SAMPLES)
return FALSE;
- if ((target >= PIPE_MAX_TEXTURE_TYPES) ||
- !util_format_is_supported(format, usage)) {
+ if (target >= PIPE_MAX_TEXTURE_TYPES) {
return FALSE;
}
if (usage & PIPE_BIND_VERTEX_BUFFER) {
switch (format) {
case PIPE_FORMAT_R32G32B32A32_FLOAT:
case PIPE_FORMAT_R32G32B32_FLOAT:
case PIPE_FORMAT_R32G32_FLOAT:
case PIPE_FORMAT_R32_FLOAT:
case PIPE_FORMAT_R32G32B32A32_SNORM:
--
2.17.1
More information about the mesa-dev
mailing list