summaryrefslogtreecommitdiffstats
path: root/src/vulkan/gen7_state.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-12-16 17:27:35 -0800
committerJason Ekstrand <[email protected]>2015-12-16 17:34:57 -0800
commitc643e9cea87b4676e648e431d5c39f2880a1454c (patch)
treebfd1160456c40b6263ef993a6b026dce89ae99c9 /src/vulkan/gen7_state.c
parentb2fe8b4673c5c52b6c85c7db4ec7f626e1cb6b79 (diff)
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/vulkan/gen7_state.c')
-rw-r--r--src/vulkan/gen7_state.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vulkan/gen7_state.c b/src/vulkan/gen7_state.c
index c6de40d3b9a..cb299a3278b 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);