From 777a42e309cfc420052c6eeaa563af8302c06d0f Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Fri, 14 Jan 2022 14:40:18 -0800 Subject: [PATCH] microsoft/compiler: Handle textureGatherCmp Reviewed-by: Sil Vilerino Part-of: --- src/microsoft/compiler/dxil_function.c | 1 + src/microsoft/compiler/nir_to_dxil.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/microsoft/compiler/dxil_function.c b/src/microsoft/compiler/dxil_function.c index ae6e37e5327..18507378400 100644 --- a/src/microsoft/compiler/dxil_function.c +++ b/src/microsoft/compiler/dxil_function.c @@ -60,6 +60,7 @@ static struct predefined_func_descr predefined_funcs[] = { {"dx.op.sampleCmpLevelZero", "R", "i@@ffffiiif", DXIL_ATTR_KIND_READ_ONLY}, {"dx.op.textureLoad", "R", "i@iiiiiii", DXIL_ATTR_KIND_READ_ONLY}, {"dx.op.textureGather", "R", "i@@ffffiii", DXIL_ATTR_KIND_READ_ONLY}, +{"dx.op.textureGatherCmp", "R", "i@@ffffiiif", DXIL_ATTR_KIND_READ_ONLY}, {"dx.op.discard", "v", "ib", DXIL_ATTR_KIND_READ_NONE}, {"dx.op.sampleIndex", "i", "i", DXIL_ATTR_KIND_READ_NONE}, {"dx.op.emitStream", "v", "ic", DXIL_ATTR_KIND_NONE}, diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 0f893253d4f..f2e5a2f9dd6 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -242,6 +242,7 @@ enum dxil_intr { DXIL_INTR_TEXTURE_SIZE = 72, DXIL_INTR_TEXTURE_GATHER = 73, + DXIL_INTR_TEXTURE_GATHER_CMP = 74, DXIL_INTR_TEXTURE2DMS_GET_SAMPLE_POSITION = 75, DXIL_INTR_RENDER_TARGET_GET_SAMPLE_POSITION = 76, @@ -4235,12 +4236,14 @@ emit_texture_lod(struct ntd_context *ctx, struct texop_parameters *params, bool static const struct dxil_value * emit_texture_gather(struct ntd_context *ctx, struct texop_parameters *params, unsigned component) { - const struct dxil_func *func = dxil_get_function(&ctx->mod, "dx.op.textureGather", params->overload); + const struct dxil_func *func = dxil_get_function(&ctx->mod, + params->cmp ? "dx.op.textureGatherCmp" : "dx.op.textureGather", params->overload); if (!func) return false; const struct dxil_value *args[] = { - dxil_module_get_int32_const(&ctx->mod, DXIL_INTR_TEXTURE_GATHER), + dxil_module_get_int32_const(&ctx->mod, params->cmp ? + DXIL_INTR_TEXTURE_GATHER_CMP : DXIL_INTR_TEXTURE_GATHER), params->tex, params->sampler, params->coord[0], @@ -4249,10 +4252,11 @@ emit_texture_gather(struct ntd_context *ctx, struct texop_parameters *params, un params->coord[3], params->offset[0], params->offset[1], - dxil_module_get_int32_const(&ctx->mod, component) + dxil_module_get_int32_const(&ctx->mod, component), + params->cmp }; - return dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args)); + return dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args) - (params->cmp ? 0 : 1)); } static bool