zink: Implement PIPE_CAP_OPENCL_INTEGER_FUNCTIONS and PIPE_CAP_INTEGER_MULTIPLY_32X16.

Enables GL_INTEL_shader_integer_functions2

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23197>
This commit is contained in:
Julia Tatz 2023-02-15 00:39:57 -05:00 committed by Marge Bot
parent b6d874ade2
commit 8dbd9925d5
3 changed files with 36 additions and 0 deletions

View file

@ -2318,6 +2318,12 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
get_fvec_constant(ctx, bit_size, num_components, 0));
break;
case nir_op_uclz:
assert(nir_op_infos[alu->op].num_inputs == 1);
result = emit_unop(ctx, SpvOpUCountLeadingZerosINTEL, dest_type, src[0]);
spirv_builder_emit_cap(&ctx->builder, SpvCapabilityIntegerFunctions2INTEL);
spirv_builder_emit_extension(&ctx->builder, "SPV_INTEL_shader_integer_functions2");
break;
#define BUILTIN_UNOP(nir_op, spirv_op) \
case nir_op: \
assert(nir_op_infos[alu->op].num_inputs == 1); \
@ -2449,6 +2455,28 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
BUILTIN_BINOP(nir_op_ldexp, GLSLstd450Ldexp)
#undef BUILTIN_BINOP
#define INTEL_BINOP(nir_op, spirv_op) \
case nir_op: \
assert(nir_op_infos[alu->op].num_inputs == 2); \
result = emit_binop(ctx, spirv_op, dest_type, src[0], src[1]); \
spirv_builder_emit_cap(&ctx->builder, SpvCapabilityIntegerFunctions2INTEL); \
spirv_builder_emit_extension(&ctx->builder, "SPV_INTEL_shader_integer_functions2"); \
break;
INTEL_BINOP(nir_op_uabs_isub, SpvOpAbsISubINTEL)
INTEL_BINOP(nir_op_uabs_usub, SpvOpAbsUSubINTEL)
INTEL_BINOP(nir_op_iadd_sat, SpvOpIAddSatINTEL)
INTEL_BINOP(nir_op_uadd_sat, SpvOpUAddSatINTEL)
INTEL_BINOP(nir_op_ihadd, SpvOpIAverageINTEL)
INTEL_BINOP(nir_op_uhadd, SpvOpUAverageINTEL)
INTEL_BINOP(nir_op_irhadd, SpvOpIAverageRoundedINTEL)
INTEL_BINOP(nir_op_urhadd, SpvOpUAverageRoundedINTEL)
INTEL_BINOP(nir_op_isub_sat, SpvOpISubSatINTEL)
INTEL_BINOP(nir_op_usub_sat, SpvOpUSubSatINTEL)
INTEL_BINOP(nir_op_imul_32x16, SpvOpIMul32x16INTEL)
INTEL_BINOP(nir_op_umul_32x16, SpvOpUMul32x16INTEL)
#undef INTEL_BINOP
case nir_op_fdot2:
case nir_op_fdot3:
case nir_op_fdot4:

View file

@ -191,6 +191,10 @@ EXTENSIONS = [
alias="shader_clock",
features=True,
conditions=["$feats.shaderSubgroupClock"]),
Extension("VK_INTEL_shader_integer_functions2",
alias="shader_int_fns2",
features=True,
conditions=["$feats.shaderIntegerFunctions2"]),
Extension("VK_EXT_sampler_filter_minmax",
alias="reduction",
properties=True,

View file

@ -857,6 +857,10 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_SAMPLER_REDUCTION_MINMAX_ARB:
return screen->info.feats12.samplerFilterMinmax || screen->info.have_EXT_sampler_filter_minmax;
case PIPE_CAP_OPENCL_INTEGER_FUNCTIONS:
case PIPE_CAP_INTEGER_MULTIPLY_32X16:
return screen->info.have_INTEL_shader_integer_functions2;
case PIPE_CAP_FS_FINE_DERIVATIVE:
return 1;