[Mesa-dev] [RFC 1/2] spirv: add/hookup SpvCapabilityStencilExportEXT

Gustavo Lima Chaves gustavo.lima.chaves at intel.com
Mon Feb 12 02:26:40 UTC 2018


---
 src/compiler/shader_info.h         | 1 +
 src/compiler/spirv/spirv_to_nir.c  | 4 ++++
 src/compiler/spirv/vtn_variables.c | 4 ++++
 3 files changed, 9 insertions(+)

diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index f6dedb8d62..0480af5be7 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -43,6 +43,7 @@ struct spirv_supported_capabilities {
    bool multiview;
    bool variable_pointers;
    bool storage_16bit;
+   bool stencil_export;
 };
 
 typedef struct shader_info {
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index c6df764682..e00dcafa12 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3196,6 +3196,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
          spv_check_supported(variable_pointers, cap);
          break;
 
+      case SpvCapabilityStencilExportEXT:
+         spv_check_supported(stencil_export, cap);
+         break;
+
       case SpvCapabilityStorageUniformBufferBlock16:
       case SpvCapabilityStorageUniform16:
       case SpvCapabilityStoragePushConstant16:
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index ead68b4784..36976798e9 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1294,6 +1294,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
       *location = SYSTEM_VALUE_VIEW_INDEX;
       set_mode_system_value(b, mode);
       break;
+   case SpvBuiltInFragStencilRefEXT:
+      *location = FRAG_RESULT_STENCIL;
+      vtn_assert(*mode == nir_var_shader_out);
+      break;
    default:
       vtn_fail("unsupported builtin");
    }
-- 
2.14.3



More information about the mesa-dev mailing list