Commit e0f34c4f authored by Timur Kristóf's avatar Timur Kristóf
Browse files

radv: Enable NGG culling and add env var that can disable it.


Signed-off-by: Timur Kristóf's avatarTimur Kristóf <timur.kristof@gmail.com>
parent d42bc4ad
Pipeline #337759 waiting for manual action with stages
...@@ -592,6 +592,8 @@ RADV driver environment variables ...@@ -592,6 +592,8 @@ RADV driver environment variables
disable memory shaders cache disable memory shaders cache
``nongg`` ``nongg``
disable NGG for GFX10+ disable NGG for GFX10+
``nonggc``
disable NGG culling for GFX10+
``nooutoforder`` ``nooutoforder``
disable out-of-order rasterization disable out-of-order rasterization
``notccompatcmask`` ``notccompatcmask``
......
...@@ -4,3 +4,4 @@ VK_EXT_extended_dynamic_state2 on RADV. ...@@ -4,3 +4,4 @@ VK_EXT_extended_dynamic_state2 on RADV.
VK_EXT_global_priority_query on RADV. VK_EXT_global_priority_query on RADV.
32-bit x86 builds now default disable x87 math and use sse2. 32-bit x86 builds now default disable x87 math and use sse2.
GL ES 3.1 on GT21x hardware. GL ES 3.1 on GT21x hardware.
NGG culling in RADV.
\ No newline at end of file
...@@ -62,6 +62,7 @@ enum { ...@@ -62,6 +62,7 @@ enum {
RADV_DEBUG_NO_DISPLAY_DCC = 1ull << 31, RADV_DEBUG_NO_DISPLAY_DCC = 1ull << 31,
RADV_DEBUG_NO_TC_COMPAT_CMASK = 1ull << 32, RADV_DEBUG_NO_TC_COMPAT_CMASK = 1ull << 32,
RADV_DEBUG_NO_VRS_FLAT_SHADING = 1ull << 33, RADV_DEBUG_NO_VRS_FLAT_SHADING = 1ull << 33,
RADV_DEBUG_NO_NGG_CULLING = 1ull << 34,
}; };
enum { enum {
......
...@@ -763,6 +763,7 @@ static const struct debug_control radv_debug_options[] = { ...@@ -763,6 +763,7 @@ static const struct debug_control radv_debug_options[] = {
{"checkir", RADV_DEBUG_CHECKIR}, {"checkir", RADV_DEBUG_CHECKIR},
{"nobinning", RADV_DEBUG_NOBINNING}, {"nobinning", RADV_DEBUG_NOBINNING},
{"nongg", RADV_DEBUG_NO_NGG}, {"nongg", RADV_DEBUG_NO_NGG},
{"nonggc", RADV_DEBUG_NO_NGG_CULLING},
{"metashaders", RADV_DEBUG_DUMP_META_SHADERS}, {"metashaders", RADV_DEBUG_DUMP_META_SHADERS},
{"nomemorycache", RADV_DEBUG_NO_MEMORY_CACHE}, {"nomemorycache", RADV_DEBUG_NO_MEMORY_CACHE},
{"discardtodemote", RADV_DEBUG_DISCARD_TO_DEMOTE}, {"discardtodemote", RADV_DEBUG_DISCARD_TO_DEMOTE},
......
...@@ -218,6 +218,8 @@ get_hash_flags(const struct radv_device *device, bool stats) ...@@ -218,6 +218,8 @@ get_hash_flags(const struct radv_device *device, bool stats)
if (device->instance->debug_flags & RADV_DEBUG_NO_NGG) if (device->instance->debug_flags & RADV_DEBUG_NO_NGG)
hash_flags |= RADV_HASH_SHADER_NO_NGG; hash_flags |= RADV_HASH_SHADER_NO_NGG;
if (device->instance->debug_flags & RADV_DEBUG_NO_NGG_CULLING)
hash_flags |= RADV_HASH_SHADER_NO_NGG_CULLING;
if (device->physical_device->cs_wave_size == 32) if (device->physical_device->cs_wave_size == 32)
hash_flags |= RADV_HASH_SHADER_CS_WAVE32; hash_flags |= RADV_HASH_SHADER_CS_WAVE32;
if (device->physical_device->ps_wave_size == 32) if (device->physical_device->ps_wave_size == 32)
......
...@@ -1654,6 +1654,7 @@ struct radv_event { ...@@ -1654,6 +1654,7 @@ struct radv_event {
#define RADV_HASH_SHADER_FORCE_VRS_2x2 (1 << 9) #define RADV_HASH_SHADER_FORCE_VRS_2x2 (1 << 9)
#define RADV_HASH_SHADER_FORCE_VRS_2x1 (1 << 10) #define RADV_HASH_SHADER_FORCE_VRS_2x1 (1 << 10)
#define RADV_HASH_SHADER_FORCE_VRS_1x2 (1 << 11) #define RADV_HASH_SHADER_FORCE_VRS_1x2 (1 << 11)
#define RADV_HASH_SHADER_NO_NGG_CULLING (1 << 12)
void radv_hash_shaders(unsigned char *hash, const VkPipelineShaderStageCreateInfo **stages, void radv_hash_shaders(unsigned char *hash, const VkPipelineShaderStageCreateInfo **stages,
const struct radv_pipeline_layout *layout, const struct radv_pipeline_layout *layout,
......
...@@ -862,6 +862,9 @@ bool radv_lower_ngg(struct radv_device *device, struct nir_shader *nir, bool has ...@@ -862,6 +862,9 @@ bool radv_lower_ngg(struct radv_device *device, struct nir_shader *nir, bool has
if (has_gs || !key->vs_common_out.as_ngg) if (has_gs || !key->vs_common_out.as_ngg)
return false; return false;
bool is_meta_shader = !!nir->info.name;
bool consider_culling = !(device->instance->debug_flags & RADV_DEBUG_NO_NGG_CULLING) && !is_meta_shader;
out_conf = out_conf =
ac_nir_lower_ngg_nogs( ac_nir_lower_ngg_nogs(
nir, nir,
...@@ -869,7 +872,7 @@ bool radv_lower_ngg(struct radv_device *device, struct nir_shader *nir, bool has ...@@ -869,7 +872,7 @@ bool radv_lower_ngg(struct radv_device *device, struct nir_shader *nir, bool has
num_vertices_per_prim, num_vertices_per_prim,
max_workgroup_size, max_workgroup_size,
info->wave_size, info->wave_size,
false, consider_culling,
key->vs_common_out.as_ngg_passthrough, key->vs_common_out.as_ngg_passthrough,
key->vs_common_out.export_prim_id, key->vs_common_out.export_prim_id,
key->vs.provoking_vtx_last); key->vs.provoking_vtx_last);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment