From 9634e7cdf6e10b8950f200a0988e2ae040a8225d Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Thu, 11 Aug 2022 15:55:19 -0700 Subject: [PATCH] microsoft/compiler: Fix PSV struct when numthreads is 0 Fixes: d9e575d4 ("microsoft/compiler: DXIL validator 1.6 uses a new PSV struct version") Reviewed-by: Giancarlo Devich Reviewed-by: Boris Brezillon Part-of: (cherry picked from commit 04e4de6faeb110a0a799e096a1a36775ac82fb3f) --- .pick_status.json | 2 +- src/microsoft/compiler/nir_to_dxil.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index c79c27586a1..37960399115 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -364,7 +364,7 @@ "description": "microsoft/compiler: Fix PSV struct when numthreads is 0", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "d9e575d4d7d33157b696c4b71fbe8a1a5dc22822" }, diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 5561c872709..8f79ad6f3fa 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -5649,9 +5649,9 @@ void dxil_fill_validation_state(struct ntd_context *ctx, ctx->mod.info.has_per_sample_input; break; case DXIL_COMPUTE_SHADER: - state->state.num_threads_x = ctx->shader->info.workgroup_size[0]; - state->state.num_threads_y = ctx->shader->info.workgroup_size[1]; - state->state.num_threads_z = ctx->shader->info.workgroup_size[2]; + state->state.num_threads_x = MAX2(ctx->shader->info.workgroup_size[0], 1); + state->state.num_threads_y = MAX2(ctx->shader->info.workgroup_size[1], 1); + state->state.num_threads_z = MAX2(ctx->shader->info.workgroup_size[2], 1); break; case DXIL_GEOMETRY_SHADER: state->state.psv1.max_vertex_count = ctx->shader->info.gs.vertices_out;