[Mesa-dev] [PATCH 2/7] spirv: add SPV_KHR_shader_draw_parameters support

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Tue Jan 31 19:43:03 UTC 2017


Patches 1 and 2 are

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

On Tue, Jan 31, 2017, at 16:00, Lionel Landwerlin wrote:
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> ---
>  src/compiler/spirv/nir_spirv.h     |  1 +
>  src/compiler/spirv/spirv_to_nir.c  |  4 ++++
>  src/compiler/spirv/vtn_variables.c | 12 ++++++++++++
>  3 files changed, 17 insertions(+)
> 
> diff --git a/src/compiler/spirv/nir_spirv.h
> b/src/compiler/spirv/nir_spirv.h
> index e3f4ee85cc..e0ebc62584 100644
> --- a/src/compiler/spirv/nir_spirv.h
> +++ b/src/compiler/spirv/nir_spirv.h
> @@ -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,
> diff --git a/src/compiler/spirv/spirv_to_nir.c
> b/src/compiler/spirv/spirv_to_nir.c
> index 6c54dca248..9f0b8fd366 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -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");
>        }
> diff --git a/src/compiler/spirv/vtn_variables.c
> b/src/compiler/spirv/vtn_variables.c
> index 05345b303e..098cfb5de7 100644
> --- a/src/compiler/spirv/vtn_variables.c
> +++ b/src/compiler/spirv/vtn_variables.c
> @@ -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");
> -- 
> 2.11.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list