summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-03-27 16:29:10 -0700
committerEric Anholt <[email protected]>2018-03-27 21:16:23 -0700
commita691fa4a1be3730f0cfc9566944bd23adb03966d (patch)
tree6ebfb009ae8eaa95192ecbcf0c4ff86e63b36dfc /src/gallium
parent92fa89a08d1e9905897dfb5cd30b8d572f83e941 (diff)
broadcom/vc5: Fix padding of NPOT miplevels >= 2.
The power-of-two padded size that gets minified is based on level 1's dimensions, not level 0's, which starts to differ at a width of 9. Fixes all failures on texelFetch fs sampler2D 1x1x1-64x64x1
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/vc5/vc5_resource.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gallium/drivers/vc5/vc5_resource.c b/src/gallium/drivers/vc5/vc5_resource.c
index 1f0ddb1a295..321a14b9046 100644
--- a/src/gallium/drivers/vc5/vc5_resource.c
+++ b/src/gallium/drivers/vc5/vc5_resource.c
@@ -390,9 +390,14 @@ vc5_setup_slices(struct vc5_resource *rsc)
uint32_t width = prsc->width0;
uint32_t height = prsc->height0;
uint32_t depth = prsc->depth0;
- uint32_t pot_width = util_next_power_of_two(width);
- uint32_t pot_height = util_next_power_of_two(height);
- uint32_t pot_depth = util_next_power_of_two(depth);
+ /* Note that power-of-two padding is based on level 1. These are not
+ * equivalent to just util_next_power_of_two(dimension), because at a
+ * level 0 dimension of 9, the level 1 power-of-two padded value is 4,
+ * not 8.
+ */
+ uint32_t pot_width = 2 * util_next_power_of_two(u_minify(width, 1));
+ uint32_t pot_height = 2 * util_next_power_of_two(u_minify(height, 1));
+ uint32_t pot_depth = 2 * util_next_power_of_two(u_minify(depth, 1));
uint32_t offset = 0;
uint32_t utile_w = vc5_utile_width(rsc->cpp);
uint32_t utile_h = vc5_utile_height(rsc->cpp);