aboutsummaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_image.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2015-08-28 08:04:59 -0700
committerChad Versace <[email protected]>2015-08-28 08:04:59 -0700
commit053d32d2a5906057519e12ffd8bc946bee2f5c60 (patch)
treecdc039ac595c4af38cee63ad27112c373aafef68 /src/vulkan/anv_image.c
parent14e1d58fb79ccb5034587092eaa3678f2642edc5 (diff)
vk/image: Linear stencil buffers are illegal
The hardware requires that stencil buffer memory be W-tiled. From the Sandybridge PRM: This buffer is supported only in Tile W memory.
Diffstat (limited to 'src/vulkan/anv_image.c')
-rw-r--r--src/vulkan/anv_image.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c
index 656193f774e..736a76881ff 100644
--- a/src/vulkan/anv_image.c
+++ b/src/vulkan/anv_image.c
@@ -103,20 +103,32 @@ static const struct anv_tile_info {
[WMAJOR] = { 128, 32, 4096 },
};
-static uint32_t
+/**
+ * Return -1 on failure.
+ */
+static int8_t
anv_image_choose_tile_mode(const struct anv_image_create_info *anv_info)
{
if (anv_info->force_tile_mode)
return anv_info->tile_mode;
- if (anv_info->vk_info->format == VK_FORMAT_S8_UINT)
- return WMAJOR;
+ /* The Sandybridge PRM says that the stencil buffer "is supported
+ * only in Tile W memory".
+ */
switch (anv_info->vk_info->tiling) {
case VK_IMAGE_TILING_LINEAR:
- return LINEAR;
+ if (unlikely(anv_info->vk_info->format == VK_FORMAT_S8_UINT)) {
+ return -1;
+ } else {
+ return LINEAR;
+ }
case VK_IMAGE_TILING_OPTIMAL:
- return YMAJOR;
+ if (unlikely(anv_info->vk_info->format == VK_FORMAT_S8_UINT)) {
+ return WMAJOR;
+ } else {
+ return YMAJOR;
+ }
default:
assert(!"bad VKImageTiling");
return LINEAR;
@@ -143,7 +155,9 @@ anv_image_make_surface(const struct anv_image_create_info *create_info,
const uint32_t levels = create_info->vk_info->mipLevels;
const uint32_t array_size = create_info->vk_info->arraySize;
- const uint8_t tile_mode = anv_image_choose_tile_mode(create_info);
+ const int8_t tile_mode = anv_image_choose_tile_mode(create_info);
+ if (tile_mode == -1)
+ return vk_error(VK_ERROR_INVALID_IMAGE);
const struct anv_tile_info *tile_info =
&anv_tile_info_table[tile_mode];