d3d12: Subgroup ballot

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27528>
This commit is contained in:
Jesse Natalie
2024-02-08 09:07:20 -08:00
committed by Marge Bot
parent 94e0091190
commit 6d8461f545
3 changed files with 36 additions and 1 deletions

View File

@@ -306,7 +306,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve
GL_ARB_robustness_isolation not started
GL_ARB_sample_locations DONE (freedreno/a6xx, nvc0, zink)
GL_ARB_seamless_cubemap_per_texture DONE (etnaviv/SEAMLESS_CUBE_MAP, freedreno, nvc0, r600, radeonsi, softpipe, virgl, zink, asahi, iris, crocus)
GL_ARB_shader_ballot DONE (nvc0, radeonsi, zink, iris, crocus/gen8)
GL_ARB_shader_ballot DONE (nvc0, radeonsi, zink, iris, crocus/gen8, d3d12)
GL_ARB_shader_clock DONE (nv50, nvc0, r600, radeonsi, llvmpipe, virgl, zink, iris, crocus/gen7+)
GL_ARB_shader_stencil_export DONE (r600, radeonsi, softpipe, llvmpipe, virgl, panfrost, zink, asahi, iris/gen9+)
GL_ARB_shader_viewport_layer_array DONE (freedreno/a6xx, nvc0, radeonsi, zink, iris, crocus/gen6+)

View File

@@ -131,6 +131,40 @@ compile_nir(struct d3d12_context *ctx, struct d3d12_shader_selector *sel,
shader->has_default_ubo0 = num_uniforms_before_lower_to_ubo > 0 &&
nir->info.num_ubos > num_ubos_before_lower_to_ubo;
NIR_PASS_V(nir, dxil_nir_lower_subgroup_id);
NIR_PASS_V(nir, dxil_nir_lower_num_subgroups);
nir_lower_subgroups_options subgroup_options = {};
subgroup_options.ballot_bit_size = 32;
subgroup_options.ballot_components = 4;
subgroup_options.lower_subgroup_masks = true;
subgroup_options.lower_to_scalar = true;
subgroup_options.lower_relative_shuffle = true;
subgroup_options.lower_inverse_ballot = true;
if (nir->info.stage != MESA_SHADER_FRAGMENT && nir->info.stage != MESA_SHADER_COMPUTE)
subgroup_options.lower_quad = true;
NIR_PASS_V(nir, nir_lower_subgroups, &subgroup_options);
NIR_PASS_V(nir, nir_lower_bit_size, [](const nir_instr *instr, void *) -> unsigned {
if (instr->type != nir_instr_type_intrinsic)
return 0;
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
switch (intr->intrinsic) {
case nir_intrinsic_quad_swap_horizontal:
case nir_intrinsic_quad_swap_vertical:
case nir_intrinsic_quad_swap_diagonal:
case nir_intrinsic_reduce:
case nir_intrinsic_inclusive_scan:
case nir_intrinsic_exclusive_scan:
return intr->def.bit_size == 1 ? 32 : 0;
default:
return 0;
}
}, NULL);
// Ensure subgroup scans on bools are gone
NIR_PASS_V(nir, nir_opt_dce);
NIR_PASS_V(nir, dxil_nir_lower_unsupported_subgroup_scan);
if (key->last_vertex_processing_stage) {
if (key->invert_depth)
NIR_PASS_V(nir, d3d12_nir_invert_depth, key->invert_depth, key->halfz);

View File

@@ -344,6 +344,7 @@ d3d12_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_GL_SPIRV:
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
case PIPE_CAP_SHADER_GROUP_VOTE:
case PIPE_CAP_SHADER_BALLOT:
case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
case PIPE_CAP_QUERY_SO_OVERFLOW:
return 1;