From 20beebb0414a53b85556d2750bba83847aa776a8 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Wed, 28 Jun 2023 17:30:43 +0200 Subject: [PATCH] amd: Move ac_hw_stage to its own file Otherwise ACO has to include ac_shader_util.h which also includes NIR. Reviewed-by: Alyssa Rosenzweig Reviewed-by: Friedrich Vock Part-of: --- src/amd/common/ac_hw_stage.h | 105 +++++++++++++++++++ src/amd/common/ac_shader_util.h | 96 ----------------- src/amd/compiler/aco_ir.h | 2 +- src/amd/compiler/aco_shader_info.h | 2 +- src/amd/vulkan/radv_aco_shader_info.h | 1 + src/gallium/drivers/radeonsi/si_shader_aco.c | 1 + 6 files changed, 109 insertions(+), 98 deletions(-) create mode 100644 src/amd/common/ac_hw_stage.h diff --git a/src/amd/common/ac_hw_stage.h b/src/amd/common/ac_hw_stage.h new file mode 100644 index 00000000000..bcf8083c466 --- /dev/null +++ b/src/amd/common/ac_hw_stage.h @@ -0,0 +1,105 @@ +/* + * Copyright 2023 Advanced Micro Devices, Inc. + * SPDX-License-Identifier: MIT + */ + +#ifndef AC_HW_STAGE_H +#define AC_HW_STAGE_H + +/** + * Shader stages as understood by AMD HW. + * + * Every HW generation has a dedicated stage for compute and PS, + * but it varies greatly over other geometry processing stages. + * + * Valid graphics shader configurations: + * (-> = merged with the next stage) + * + * -------------------------|-----|-----|----|----|---- + * API shaders: VS | TCS | TES | GS |copy| FS + * Are compiled as: | | | | | + * GFX6-8 ------------------|-----|-----|----|----|---- + * - VS & PS: VS | | | | | PS + * - with GS: ES | | | GS | VS | PS + * - with tess: LS | HS | VS | | | PS + * - with both: LS | HS | ES | GS | VS | PS + * GFX9-10.3/legacy --------|-----|-----|----|----|---- + * - VS & PS: VS | | | | | PS + * - with GS: -> | | | GS | VS | PS + * - with tess: -> | HS | VS | | | PS + * - with both: -> | HS | -> | GS | VS | PS + * GFX10+/NGG --------------|-----|-----|----|----|---- + * - VS & PS: GS | | | | | PS + * - with GS: -> | | | GS | | PS + * - with tess: -> | HS | GS | | | PS + * - with both: -> | HS | -> | GS | | PS + * -------------------------|-----|-----|----|----|---- + * + * Valid mesh shading graphics pipeline configurations: + * + * -------------------------------|---------------|---- + * API shaders: TS | MS | FS + * Are compiled as: | | + * GFX10.3+/NGG ------------------|---------------|---- + * - mesh only: | GS | PS + * - task & mesh: CS | GS | PS + * -------------------------------|---------------|---- + * + */ +enum ac_hw_stage +{ + /* GFX6-8 only, merged into HS on GFX9+: + * - vertex shader (when tess is used) + */ + AC_HW_LOCAL_SHADER, + + /* GFX6-8: + * - tess control shader + * + * GFX9+: + * Also known as surface shader. + * - merged vertex and tess control shader + */ + AC_HW_HULL_SHADER, + + /* GFX6-8 only, merged into GS on GFX9+: + * - vertex shader before GS (when tess is not used) + * - tess eval shader before GS (when tess is used) + */ + AC_HW_EXPORT_SHADER, + + /* GFX6-8: + * - geometry shader + * GFX9-10/legacy: + * - merged vertex + geometry (when tess is not used) + * - merged tess eval + geometry (when tess is used) + */ + AC_HW_LEGACY_GEOMETRY_SHADER, + + /* GFX6-10/legacy only: + * - vertex shader (when tess and GS are not used) + * - tess eval shader (when GS is not used), + * - "GS copy" shader (always when GS is used) + */ + AC_HW_VERTEX_SHADER, + + /* GFX10+/NGG: + * All pre-rasterization stages (after tess). Also known as primitive shader. + * - vertex shader (when tess and GS are not used) + * - tess eval shader (when GS is not used) + * - merged vertex + geometry shader (when GS is used but tess is not) + * - merged tess eval + geometry shader (when both tess and GS are used) + * - mesh shader + */ + AC_HW_NEXT_GEN_GEOMETRY_SHADER, + + /* Fragment shader. + * Call it "pixel shader" because that is how HW docs call it. + */ + AC_HW_PIXEL_SHADER, + + /* Compute and compute-like shaders, such as task shader and ray tracing. */ + AC_HW_COMPUTE_SHADER, +}; + +#endif diff --git a/src/amd/common/ac_shader_util.h b/src/amd/common/ac_shader_util.h index ff144ae295c..01f816378ca 100644 --- a/src/amd/common/ac_shader_util.h +++ b/src/amd/common/ac_shader_util.h @@ -141,102 +141,6 @@ enum ac_descriptor_type AC_DESC_PLANE_2, }; -/** - * Shader stages as understood by AMD HW. - * - * Every HW generation has a dedicated stage for compute and PS, - * but it varies greatly over other geometry processing stages. - * - * Valid graphics shader configurations: - * (-> = merged with the next stage) - * - * -------------------------|-----|-----|----|----|---- - * API shaders: VS | TCS | TES | GS |copy| FS - * Are compiled as: | | | | | - * GFX6-8 ------------------|-----|-----|----|----|---- - * - VS & PS: VS | | | | | PS - * - with GS: ES | | | GS | VS | PS - * - with tess: LS | HS | VS | | | PS - * - with both: LS | HS | ES | GS | VS | PS - * GFX9-10.3/legacy --------|-----|-----|----|----|---- - * - VS & PS: VS | | | | | PS - * - with GS: -> | | | GS | VS | PS - * - with tess: -> | HS | VS | | | PS - * - with both: -> | HS | -> | GS | VS | PS - * GFX10+/NGG --------------|-----|-----|----|----|---- - * - VS & PS: GS | | | | | PS - * - with GS: -> | | | GS | | PS - * - with tess: -> | HS | GS | | | PS - * - with both: -> | HS | -> | GS | | PS - * -------------------------|-----|-----|----|----|---- - * - * Valid mesh shading graphics pipeline configurations: - * - * -------------------------------|---------------|---- - * API shaders: TS | MS | FS - * Are compiled as: | | - * GFX10.3+/NGG ------------------|---------------|---- - * - mesh only: | GS | PS - * - task & mesh: CS | GS | PS - * -------------------------------|---------------|---- - * - */ -enum ac_hw_stage -{ - /* GFX6-8 only, merged into HS on GFX9+: - * - vertex shader (when tess is used) - */ - AC_HW_LOCAL_SHADER, - - /* GFX6-8: - * - tess control shader - * - * GFX9+: - * Also known as surface shader. - * - merged vertex and tess control shader - */ - AC_HW_HULL_SHADER, - - /* GFX6-8 only, merged into GS on GFX9+: - * - vertex shader before GS (when tess is not used) - * - tess eval shader before GS (when tess is used) - */ - AC_HW_EXPORT_SHADER, - - /* GFX6-8: - * - geometry shader - * GFX9-10/legacy: - * - merged vertex + geometry (when tess is not used) - * - merged tess eval + geometry (when tess is used) - */ - AC_HW_LEGACY_GEOMETRY_SHADER, - - /* GFX6-10/legacy only: - * - vertex shader (when tess and GS are not used) - * - tess eval shader (when GS is not used), - * - "GS copy" shader (always when GS is used) - */ - AC_HW_VERTEX_SHADER, - - /* GFX10+/NGG: - * All pre-rasterization stages (after tess). Also known as primitive shader. - * - vertex shader (when tess and GS are not used) - * - tess eval shader (when GS is not used) - * - merged vertex + geometry shader (when GS is used but tess is not) - * - merged tess eval + geometry shader (when both tess and GS are used) - * - mesh shader - */ - AC_HW_NEXT_GEN_GEOMETRY_SHADER, - - /* Fragment shader. - * Call it "pixel shader" because that is how HW docs call it. - */ - AC_HW_PIXEL_SHADER, - - /* Compute and compute-like shaders, such as task shader and ray tracing. */ - AC_HW_COMPUTE_SHADER, -}; - unsigned ac_get_spi_shader_z_format(bool writes_z, bool writes_stencil, bool writes_samplemask, bool writes_mrt0_alpha); diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index 212fbca979c..e5adf95cf40 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -32,7 +32,7 @@ #include "util/compiler.h" #include "ac_binary.h" -#include "ac_shader_util.h" +#include "ac_hw_stage.h" #include "amd_family.h" #include #include diff --git a/src/amd/compiler/aco_shader_info.h b/src/amd/compiler/aco_shader_info.h index 576b787d035..9bba7697f8b 100644 --- a/src/amd/compiler/aco_shader_info.h +++ b/src/amd/compiler/aco_shader_info.h @@ -27,8 +27,8 @@ #ifndef ACO_SHADER_INFO_H #define ACO_SHADER_INFO_H +#include "ac_hw_stage.h" #include "ac_shader_args.h" -#include "ac_shader_util.h" #include "amd_family.h" #include "shader_enums.h" diff --git a/src/amd/vulkan/radv_aco_shader_info.h b/src/amd/vulkan/radv_aco_shader_info.h index eb72ec97e28..8f54ccf6c48 100644 --- a/src/amd/vulkan/radv_aco_shader_info.h +++ b/src/amd/vulkan/radv_aco_shader_info.h @@ -29,6 +29,7 @@ /* this will convert from radv shader info to the ACO one. */ +#include "ac_hw_stage.h" #include "aco_shader_info.h" #define ASSIGN_FIELD(x) aco_info->x = radv->x diff --git a/src/gallium/drivers/radeonsi/si_shader_aco.c b/src/gallium/drivers/radeonsi/si_shader_aco.c index 9ec2646cfec..4eadb0eecfc 100644 --- a/src/gallium/drivers/radeonsi/si_shader_aco.c +++ b/src/gallium/drivers/radeonsi/si_shader_aco.c @@ -24,6 +24,7 @@ #include "si_shader_internal.h" #include "si_pipe.h" +#include "ac_hw_stage.h" #include "aco_interface.h" static void