i965: Don't use MAX_SURFACES in mark_surface_used
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 1 Mar 2017 01:15:04 +0000 (17:15 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 2 Mar 2017 00:14:01 +0000 (16:14 -0800)
Vulkan doesn't respect MAX_SURFACES so this assert isn't valid in that
case.  It should, however, assert that it isn't insanely large.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_shader.cpp

index 02aa0b206ce629827d5c3df0aae3ef4c7335efd1..8b852d52721379bb8a110175d0185e2ca9f084d8 100644 (file)
@@ -33,7 +33,10 @@ extern "C" void
 brw_mark_surface_used(struct brw_stage_prog_data *prog_data,
                       unsigned surf_index)
 {
-   assert(surf_index < BRW_MAX_SURFACES);
+   /* A binding table index is 8 bits and the top 3 values are reserved for
+    * special things (stateless and SLM).
+    */
+   assert(surf_index <= 252);
 
    prog_data->binding_table.size_bytes =
       MAX2(prog_data->binding_table.size_bytes, (surf_index + 1) * 4);