nir: Add an info bit for uses_sample_qualifier
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 10 May 2016 00:15:21 +0000 (17:15 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 14 May 2016 20:33:52 +0000 (13:33 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/nir/glsl_to_nir.cpp
src/compiler/nir/nir.h
src/compiler/nir/nir_gather_info.c

index fb1d4218e336f73b11ee79596250976a6dae1f8d..8a256506f8f72326569d7706e383a9e437301b51 100644 (file)
@@ -182,6 +182,7 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
          (struct gl_fragment_program *)sh->Program;
 
       shader->info.fs.uses_discard = fp->UsesKill;
+      shader->info.fs.uses_sample_qualifier = fp->IsSample != 0;
       shader->info.fs.early_fragment_tests = sh->EarlyFragmentTests;
       shader->info.fs.depth_layout = fp->FragDepthLayout;
       break;
index 20927a26abfbf92717a96d7fe34124c6dbe2eb91..d3934fb791654c9791717fa31ab2caad658e29ff 100644 (file)
@@ -1743,6 +1743,11 @@ typedef struct nir_shader_info {
       struct {
          bool uses_discard;
 
+         /**
+          * Whether any inputs are declared with the "sample" qualifier.
+          */
+         bool uses_sample_qualifier;
+
          /**
           * Whether early fragment tests are enabled as defined by
           * ARB_shader_image_load_store.
index d45b1a2fec04a0d4b603401a2e6fe6fcc8eda5d6..89a6302d4fca5c0179feebd9d29e207de43345f8 100644 (file)
@@ -125,9 +125,15 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
           shader->stage == MESA_SHADER_FRAGMENT ||
           shader->stage == MESA_SHADER_COMPUTE);
 
+   bool uses_sample_qualifier = false;
    shader->info.inputs_read = 0;
-   foreach_list_typed(nir_variable, var, node, &shader->inputs)
+   foreach_list_typed(nir_variable, var, node, &shader->inputs) {
       shader->info.inputs_read |= get_io_mask(var, shader->stage);
+      uses_sample_qualifier |= var->data.sample;
+   }
+
+   if (shader->stage == MESA_SHADER_FRAGMENT)
+      shader->info.fs.uses_sample_qualifier = uses_sample_qualifier;
 
    /* TODO: Some day we may need to add stream support to NIR */
    shader->info.outputs_written = 0;