i965: Rework passthrough TCS checks.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 3 May 2016 20:14:31 +0000 (13:14 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 5 May 2016 21:24:00 +0000 (14:24 -0700)
According to Timothy, using program_string_id == 0 to identify the
passthrough TCS is going to be problematic for his shader cache work.

So, change it to strcmp() the name at visitor creation time.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_shader.h
src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp

index 4d14fda4a863de453177f7e9d93ab9e847e74ca1..c9deb6d623539d3625fdf5c7aa8d9a9d27e85cd2 100644 (file)
@@ -2164,7 +2164,7 @@ fs_visitor::nir_emit_tcs_intrinsic(const fs_builder &bld,
 
       if (indirect_offset.file != BAD_FILE) {
          srcs[header_regs++] = indirect_offset;
-      } else if (tcs_key->program_string_id != 0) {
+      } else if (!is_passthrough_shader) {
          if (imm_offset == 0) {
             value.type = BRW_REGISTER_TYPE_F;
 
index 068244b299d0bcf4ab2a44075b782f08a665fc1f..f3d7c777d8dd38c3db86e6f530eed322900322d7 100644 (file)
@@ -646,6 +646,8 @@ backend_shader::backend_shader(const struct brw_compiler *compiler,
    debug_enabled = INTEL_DEBUG & intel_debug_flag_for_shader_stage(stage);
    stage_name = _mesa_shader_stage_to_string(stage);
    stage_abbrev = _mesa_shader_stage_to_abbrev(stage);
+   is_passthrough_shader =
+      nir->info.name && strcmp(nir->info.name, "passthrough") == 0;
 }
 
 bool
index d77531c11da6b6c2afe5aabaa7c31e93645a8fdd..0acaa4df1dc287d91a7bd6448b8b33955c229c67 100644 (file)
@@ -208,6 +208,7 @@ public:
    bool debug_enabled;
    const char *stage_name;
    const char *stage_abbrev;
+   bool is_passthrough_shader;
 
    brw::simple_allocator alloc;
 
index 4da30b9c47d86a7e2fafd551d8183cb0b4c9a282..6d39474e251d88f0bd85da025cbac9358ab7fad5 100644 (file)
@@ -349,7 +349,7 @@ vec4_tcs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
       /* The passthrough shader writes the whole patch header as two vec4s;
        * skip all the gl_TessLevelInner/Outer swizzling.
        */
-      if (indirect_offset.file == BAD_FILE && key->program_string_id != 0) {
+      if (indirect_offset.file == BAD_FILE && !is_passthrough_shader) {
          if (imm_offset == 0) {
             value.type = BRW_REGISTER_TYPE_F;