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.
This commit is contained in:
Jason Ekstrand
2015-12-16 17:27:35 -08:00
parent b2fe8b4673
commit c643e9cea8
2 changed files with 4 additions and 4 deletions

View File

@@ -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);

View File

@@ -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);