Module: Mesa Branch: main Commit: e0f3133447b082b844ae06bb2abba209ee4aa1a7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0f3133447b082b844ae06bb2abba209ee4aa1a7
Author: Erik Faye-Lund <[email protected]> Date: Wed Aug 25 14:22:04 2021 +0200 microsoft/compiler: return errors from get_n_src Reviewed-by: Jesse Natalie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12541> --- src/microsoft/compiler/nir_to_dxil.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index ab9b99314ee..7ca9e29a1a0 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -3815,7 +3815,8 @@ get_n_src(struct ntd_context *ctx, const struct dxil_value **values, for (i = 0; i < num_components; ++i) { values[i] = get_src(ctx, &src->src, i, type); - assert(values[i] != NULL); + if (!values[i]) + return 0; } return num_components; @@ -4000,11 +4001,15 @@ emit_tex(struct ntd_context *ctx, nir_tex_instr *instr) case nir_tex_src_coord: coord_components = get_n_src(ctx, params.coord, ARRAY_SIZE(params.coord), &instr->src[i], type); + if (!coord_components) + return false; break; case nir_tex_src_offset: offset_components = get_n_src(ctx, params.offset, ARRAY_SIZE(params.offset), &instr->src[i], nir_type_int); + if (!offset_components) + return false; break; case nir_tex_src_bias: @@ -4039,13 +4044,15 @@ emit_tex(struct ntd_context *ctx, nir_tex_instr *instr) case nir_tex_src_ddx: dx_components = get_n_src(ctx, params.dx, ARRAY_SIZE(params.dx), &instr->src[i], nir_type_float); - assert(dx_components != 0); + if (!dx_components) + return false; break; case nir_tex_src_ddy: dy_components = get_n_src(ctx, params.dy, ARRAY_SIZE(params.dy), &instr->src[i], nir_type_float); - assert(dy_components != 0); + if (!dy_components) + return false; break; case nir_tex_src_ms_index:
