[Mesa-dev] [PATCH 1/2] spirv: add support for SPV_KHR_post_depth_coverage

Ilia Mirkin imirkin at alum.mit.edu
Fri Sep 15 18:18:32 UTC 2017


Allow the capability to be exposed, and convert the new execution mode
into fs state.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/compiler/spirv/nir_spirv.h    | 1 +
 src/compiler/spirv/spirv_to_nir.c | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h
index 83577fb5d2..0e5699dc6f 100644
--- a/src/compiler/spirv/nir_spirv.h
+++ b/src/compiler/spirv/nir_spirv.h
@@ -52,6 +52,7 @@ struct nir_spirv_supported_extensions {
    bool int64;
    bool multiview;
    bool variable_pointers;
+   bool post_depth_coverage;
 };
 
 nir_function *spirv_to_nir(const uint32_t *words, size_t word_count,
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 86536856b6..bc01520155 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2789,6 +2789,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
          spv_check_supported(variable_pointers, cap);
          break;
 
+      case SpvCapabilitySampleMaskPostDepthCoverage:
+         spv_check_supported(post_depth_coverage, cap);
+         break;
+
       default:
          unreachable("Unhandled capability");
       }
@@ -2866,6 +2870,11 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
       b->shader->info.fs.early_fragment_tests = true;
       break;
 
+   case SpvExecutionModePostDepthCoverage:
+      assert(b->shader->stage == MESA_SHADER_FRAGMENT);
+      b->shader->info.fs.post_depth_coverage = true;
+      break;
+
    case SpvExecutionModeInvocations:
       assert(b->shader->stage == MESA_SHADER_GEOMETRY);
       b->shader->info.gs.invocations = MAX2(1, mode->literals[0]);
-- 
2.13.5



More information about the mesa-dev mailing list