intel/fs: use pull constant locations to check for first compile of a shader
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 22 Aug 2017 01:42:41 +0000 (18:42 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 7 Nov 2017 18:37:52 +0000 (10:37 -0800)
Before, we bailing in assign_constant_locations based on the minimum
dispatch size.  The more direct thing to do is simply to check for
whether or not we have constant locations and bail if we do.  For
nir_setup_uniforms, it's completely safe to do it multiple times because
we just copy a value from the NIR shader.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/intel/compiler/brw_fs.cpp
src/intel/compiler/brw_fs_nir.cpp

index c2907bf40b0f48c05a96ceecc89936282c5890ee..71fd8bf2f0663a0e784b1b6325208ca15bdc7b32 100644 (file)
@@ -1956,8 +1956,10 @@ void
 fs_visitor::assign_constant_locations()
 {
    /* Only the first compile gets to decide on locations. */
-   if (dispatch_width != min_dispatch_width)
+   if (push_constant_loc) {
+      assert(pull_constant_loc);
       return;
+   }
 
    bool is_live[uniforms];
    memset(is_live, 0, sizeof(is_live));
index 628d7b00c548a064597097c2df38c479d28aca73..04b6e5119a20c7e02a94e0d083d5781c96eb9525 100644 (file)
@@ -81,8 +81,11 @@ fs_visitor::nir_setup_outputs()
 void
 fs_visitor::nir_setup_uniforms()
 {
-   if (dispatch_width != min_dispatch_width)
+   /* Only the first compile gets to set up uniforms. */
+   if (push_constant_loc) {
+      assert(pull_constant_loc);
       return;
+   }
 
    uniforms = nir->num_uniforms / 4;
 }