spirv: add SPV_KHR_shader_draw_parameters support
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 25 Jan 2017 13:58:14 +0000 (13:58 +0000)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 1 Feb 2017 15:08:33 +0000 (15:08 +0000)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/compiler/spirv/nir_spirv.h
src/compiler/spirv/spirv_to_nir.c
src/compiler/spirv/vtn_variables.c

index e3f4ee85cc92166f0da25e508836dabe51e4200a..e0ebc6258448879c7d55674489a717830abe8533 100644 (file)
@@ -48,6 +48,7 @@ struct nir_spirv_supported_extensions {
    bool float64;
    bool image_ms_array;
    bool tessellation;
+   bool draw_parameters;
 };
 
 nir_function *spirv_to_nir(const uint32_t *words, size_t word_count,
index 6c54dca248debde5d34db347b2642c4553fd14ac..9f0b8fd366505bb11f04b0ce7ad2383200175729 100644 (file)
@@ -2683,6 +2683,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
          spv_check_supported(tessellation, cap);
          break;
 
+      case SpvCapabilityDrawParameters:
+         spv_check_supported(draw_parameters, cap);
+         break;
+
       default:
          unreachable("Unhandled capability");
       }
index 05345b303e5dd6ce5bd3a15f1aba1331b9e417b0..098cfb5de7ae6c1f9fbb6016c0671a731d310368 100644 (file)
@@ -1010,6 +1010,18 @@ vtn_get_builtin_location(struct vtn_builder *b,
       *location = SYSTEM_VALUE_GLOBAL_INVOCATION_ID;
       set_mode_system_value(mode);
       break;
+   case SpvBuiltInBaseVertex:
+      *location = SYSTEM_VALUE_BASE_VERTEX;
+      set_mode_system_value(mode);
+      break;
+   case SpvBuiltInBaseInstance:
+      *location = SYSTEM_VALUE_BASE_INSTANCE;
+      set_mode_system_value(mode);
+      break;
+   case SpvBuiltInDrawIndex:
+      *location = SYSTEM_VALUE_DRAW_ID;
+      set_mode_system_value(mode);
+      break;
    case SpvBuiltInHelperInvocation:
    default:
       unreachable("unsupported builtin");