summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2015-12-16 17:27:35 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2015-12-16 17:34:57 -0800
commitc643e9cea87b4676e648e431d5c39f2880a1454c (patch)
treebfd1160456c40b6263ef993a6b026dce89ae99c9 /src
parentb2fe8b4673c5c52b6c85c7db4ec7f626e1cb6b79 (diff)
downloadexternal_mesa3d-c643e9cea87b4676e648e431d5c39f2880a1454c.zip
external_mesa3d-c643e9cea87b4676e648e431d5c39f2880a1454c.tar.gz
external_mesa3d-c643e9cea87b4676e648e431d5c39f2880a1454c.tar.bz2
anv/state: Allow levelCount to be 0
This can happen if the client is creating an image view of a textureable surface and they only ever intend to render to that view.
Diffstat (limited to 'src')
-rw-r--r--src/vulkan/gen7_state.c4
-rw-r--r--src/vulkan/gen8_state.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/vulkan/gen7_state.c b/src/vulkan/gen7_state.c
index c6de40d..cb299a3 100644
--- a/src/vulkan/gen7_state.c
+++ b/src/vulkan/gen7_state.c
@@ -329,7 +329,7 @@ genX(image_view_init)(struct anv_image_view *iview,
* sampler engine is [SurfaceMinLOD, SurfaceMinLOD + MIPCountLOD].
*/
surface_state.SurfaceMinLOD = range->baseMipLevel;
- surface_state.MIPCountLOD = range->levelCount - 1;
+ surface_state.MIPCountLOD = MIN2(range->levelCount, 1) - 1;
GENX(RENDER_SURFACE_STATE_pack)(NULL, iview->nonrt_surface_state.map,
&surface_state);
@@ -369,7 +369,7 @@ genX(image_view_init)(struct anv_image_view *iview,
format->surface_format);
surface_state.SurfaceMinLOD = range->baseMipLevel;
- surface_state.MIPCountLOD = range->levelCount - 1;
+ surface_state.MIPCountLOD = MIN2(range->levelCount, 1) - 1;
GENX(RENDER_SURFACE_STATE_pack)(NULL, iview->storage_surface_state.map,
&surface_state);
diff --git a/src/vulkan/gen8_state.c b/src/vulkan/gen8_state.c
index fe9f088..199905b 100644
--- a/src/vulkan/gen8_state.c
+++ b/src/vulkan/gen8_state.c
@@ -305,7 +305,7 @@ genX(image_view_init)(struct anv_image_view *iview,
* sampler engine is [SurfaceMinLOD, SurfaceMinLOD + MIPCountLOD].
*/
surface_state.SurfaceMinLOD = range->baseMipLevel;
- surface_state.MIPCountLOD = range->levelCount - 1;
+ surface_state.MIPCountLOD = MIN2(range->levelCount, 1) - 1;
GENX(RENDER_SURFACE_STATE_pack)(NULL, iview->nonrt_surface_state.map,
&surface_state);
@@ -344,7 +344,7 @@ genX(image_view_init)(struct anv_image_view *iview,
format_info->surface_format);
surface_state.SurfaceMinLOD = range->baseMipLevel;
- surface_state.MIPCountLOD = range->levelCount - 1;
+ surface_state.MIPCountLOD = MIN2(range->levelCount, 1) - 1;
GENX(RENDER_SURFACE_STATE_pack)(NULL, iview->storage_surface_state.map,
&surface_state);