summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-06-07 15:10:19 +0800
committerChia-I Wu <[email protected]>2013-06-08 01:39:47 +0800
commit7916d5ed88a29177f1dc2a11fbacbd95e512e025 (patch)
treec05b637423bb9fb7c56940243c500f339b4b1c5a
parentd6c2708e1eb319e577f61ea137471a1966d231ab (diff)
ilo: fix textureSize() for single-layered array textures
We returned 0 instead of 1 for the number of layers when the array texutre is single-layered. This fixed it on GEN7+.
-rw-r--r--src/gallium/drivers/ilo/ilo_gpe_gen7.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen7.c b/src/gallium/drivers/ilo/ilo_gpe_gen7.c
index f9533ff4806..c3211b53873 100644
--- a/src/gallium/drivers/ilo/ilo_gpe_gen7.c
+++ b/src/gallium/drivers/ilo/ilo_gpe_gen7.c
@@ -25,6 +25,7 @@
* Chia-I Wu <[email protected]>
*/
+#include "util/u_resource.h"
#include "brw_defines.h"
#include "intel_reg.h"
@@ -1591,8 +1592,23 @@ ilo_gpe_init_view_surface_for_texture_gen7(const struct ilo_dev_info *dev,
surface_format << BRW_SURFACE_FORMAT_SHIFT |
ilo_gpe_gen6_translate_winsys_tiling(tex->tiling) << 13;
- if (surface_type != BRW_SURFACE_3D && depth > 1)
- dw[0] |= GEN7_SURFACE_IS_ARRAY;
+ /*
+ * From the Ivy Bridge PRM, volume 4 part 1, page 63:
+ *
+ * "If this field (Surface Array) is enabled, the Surface Type must be
+ * SURFTYPE_1D, SURFTYPE_2D, or SURFTYPE_CUBE. If this field is
+ * disabled and Surface Type is SURFTYPE_1D, SURFTYPE_2D, or
+ * SURFTYPE_CUBE, the Depth field must be set to zero."
+ *
+ * For non-3D sampler surfaces, resinfo (the sampler message) always
+ * returns zero for the number of layers when this field is not set.
+ */
+ if (surface_type != BRW_SURFACE_3D) {
+ if (util_resource_is_array_texture(&tex->base))
+ dw[0] |= GEN7_SURFACE_IS_ARRAY;
+ else
+ assert(depth == 1);
+ }
if (tex->valign_4)
dw[0] |= GEN7_SURFACE_VALIGN_4;