radv: Get rid of app_shaders_internal.

This will make sure the internal field is set to true for internal
shaders which are initialized outside of radv_device_init_meta.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20670>
This commit is contained in:
Timur Kristóf
2023-01-20 17:04:20 +01:00
committed by Marge Bot
parent 9419b4ee45
commit 22b350fa27
6 changed files with 11 additions and 13 deletions

View File

@@ -428,8 +428,6 @@ radv_device_init_meta(struct radv_device *device)
mtx_init(&device->meta_state.mtx, mtx_plain);
device->app_shaders_internal = true;
result = radv_device_init_meta_clear_state(device, on_demand);
if (result != VK_SUCCESS)
goto fail_clear;
@@ -501,8 +499,6 @@ radv_device_init_meta(struct radv_device *device)
goto fail_accel_struct;
}
device->app_shaders_internal = false;
return VK_SUCCESS;
fail_accel_struct:

View File

@@ -3121,7 +3121,8 @@ radv_pipeline_get_nir(struct radv_pipeline *pipeline, struct radv_pipeline_stage
if (pipeline->retained_shaders[s].nir) {
stages[s].nir = nir_shader_clone(NULL, pipeline->retained_shaders[s].nir);
} else {
stages[s].nir = radv_shader_spirv_to_nir(device, &stages[s], pipeline_key);
stages[s].nir = radv_shader_spirv_to_nir(device, &stages[s], pipeline_key,
pipeline->is_internal);
}
if (retain_shaders)
@@ -5083,6 +5084,7 @@ radv_graphics_pipeline_create(VkDevice _device, VkPipelineCache _cache,
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
radv_pipeline_init(device, &pipeline->base, RADV_PIPELINE_GRAPHICS);
pipeline->base.is_internal = is_internal;
result = radv_graphics_pipeline_init(pipeline, device, cache, pCreateInfo, extra);
if (result != VK_SUCCESS) {
@@ -5373,6 +5375,7 @@ radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache,
}
radv_pipeline_init(device, &pipeline->base, RADV_PIPELINE_COMPUTE);
pipeline->base.is_internal = is_internal;
const VkPipelineCreationFeedbackCreateInfo *creation_feedback =
vk_find_struct_const(pCreateInfo->pNext, PIPELINE_CREATION_FEEDBACK_CREATE_INFO);

View File

@@ -1005,9 +1005,6 @@ struct radv_device {
/* Whether per-vertex VRS is forced. */
bool force_vrs_enabled;
/* Whether shaders created through application entrypoints are considered internal. */
bool app_shaders_internal;
simple_mtx_t pstate_mtx;
unsigned pstate_cnt;
@@ -2042,6 +2039,7 @@ struct radv_pipeline {
struct radv_pipeline_slab *slab;
struct radeon_winsys_bo *slab_bo;
bool is_internal;
bool need_indirect_descriptor_sets;
struct radv_shader *shaders[MESA_VULKAN_SHADER_STAGES];
struct radv_shader *gs_copy_shader;

View File

@@ -802,7 +802,7 @@ parse_rt_stage(struct radv_device *device, const VkPipelineShaderStageCreateInfo
radv_pipeline_stage_init(sinfo, &rt_stage, vk_to_mesa_shader_stage(sinfo->stage));
nir_shader *shader = radv_shader_spirv_to_nir(device, &rt_stage, key);
nir_shader *shader = radv_shader_spirv_to_nir(device, &rt_stage, key, false);
if (shader->info.stage == MESA_SHADER_RAYGEN || shader->info.stage == MESA_SHADER_CLOSEST_HIT ||
shader->info.stage == MESA_SHADER_CALLABLE || shader->info.stage == MESA_SHADER_MISS) {

View File

@@ -716,7 +716,7 @@ is_not_xfb_output(nir_variable *var, void *data)
nir_shader *
radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_stage *stage,
const struct radv_pipeline_key *key)
const struct radv_pipeline_key *key, bool is_internal)
{
unsigned subgroup_size = 64, ballot_bit_size = 64;
if (key->cs.compute_subgroup_size) {
@@ -745,7 +745,7 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_
bool dump_meta = device->instance->debug_flags & RADV_DEBUG_DUMP_META_SHADERS;
if ((device->instance->debug_flags & RADV_DEBUG_DUMP_SPIRV) &&
(!device->app_shaders_internal || dump_meta))
(!is_internal || dump_meta))
radv_print_spirv(stage->spirv.data, stage->spirv.size, stderr);
uint32_t num_spec_entries = 0;
@@ -839,7 +839,7 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_
nir = spirv_to_nir(spirv, stage->spirv.size / 4, spec_entries, num_spec_entries, stage->stage,
stage->entrypoint, &spirv_options,
&device->physical_device->nir_options[stage->stage]);
nir->info.internal |= device->app_shaders_internal;
nir->info.internal |= is_internal;
assert(nir->info.stage == stage->stage);
nir_validate_shader(nir, "after spirv_to_nir");

View File

@@ -542,7 +542,8 @@ struct radv_pipeline_stage;
nir_shader *radv_shader_spirv_to_nir(struct radv_device *device,
const struct radv_pipeline_stage *stage,
const struct radv_pipeline_key *key);
const struct radv_pipeline_key *key,
bool is_internal);
void radv_nir_lower_abi(nir_shader *shader, enum amd_gfx_level gfx_level,
const struct radv_shader_info *info, const struct radv_shader_args *args,