anv/state: Fix reversed MIN vs. MAX in levelCount handling.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 29 Dec 2015 23:50:15 +0000 (15:50 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 29 Dec 2015 23:51:14 +0000 (15:51 -0800)
The point is to promote a levelCount of 0 to 1 before subtracting 1.
This needs MAX, not MIN.

src/vulkan/gen7_state.c
src/vulkan/gen8_state.c

index cb299a3278bc1a501b59d54127cf27ccffbe723d..88a508a1be94de2b40e8607347c695b77296b8d9 100644 (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 = MIN2(range->levelCount, 1) - 1;
+      surface_state.MIPCountLOD = MAX2(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 = MIN2(range->levelCount, 1) - 1;
+      surface_state.MIPCountLOD = MAX2(range->levelCount, 1) - 1;
 
       GENX(RENDER_SURFACE_STATE_pack)(NULL, iview->storage_surface_state.map,
                                       &surface_state);
index 199905b60dc62323e97cb3c6fe05daa75b8cee92..34c4d26b20f7a3bbe02bbea7b12fd49e64c53bf8 100644 (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 = MIN2(range->levelCount, 1) - 1;
+      surface_state.MIPCountLOD = MAX2(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 = MIN2(range->levelCount, 1) - 1;
+      surface_state.MIPCountLOD = MAX2(range->levelCount, 1) - 1;
 
       GENX(RENDER_SURFACE_STATE_pack)(NULL, iview->storage_surface_state.map,
                                       &surface_state);