nvk: Move populate_fs_key to nvk_shader.c

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
This commit is contained in:
Faith Ekstrand 2024-01-04 16:19:26 -06:00 committed by Marge Bot
parent 045741ac30
commit a4f519d72d
3 changed files with 29 additions and 24 deletions

View file

@ -4,7 +4,6 @@
*/
#include "nvk_pipeline.h"
#include "nvk_cmd_buffer.h"
#include "nvk_device.h"
#include "nvk_mme.h"
#include "nvk_physical_device.h"
@ -24,28 +23,6 @@
#include "nvk_clb197.h"
#include "nvk_clc397.h"
static void
nvk_populate_fs_key(struct nak_fs_key *key,
const struct vk_multisample_state *ms,
const struct vk_graphics_pipeline_state *state)
{
memset(key, 0, sizeof(*key));
key->sample_locations_cb = 0;
key->sample_locations_offset = nvk_root_descriptor_offset(draw.sample_locations);
if (state->pipeline_flags &
VK_PIPELINE_CREATE_2_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT)
key->zs_self_dep = true;
if (ms == NULL || ms->rasterization_samples <= 1)
return;
if (ms->sample_shading_enable &&
(ms->rasterization_samples * ms->min_sample_shading) > 1.0)
key->force_sample_shading = true;
}
static void
emit_pipeline_ct_write_state(struct nv_push *p,
const struct vk_color_blend_state *cb,
@ -188,7 +165,7 @@ nvk_graphics_pipeline_create(struct nvk_device *dev,
struct vk_pipeline_cache_object *cache_objs[MESA_SHADER_STAGES] = {};
struct nak_fs_key fs_key_tmp, *fs_key = NULL;
nvk_populate_fs_key(&fs_key_tmp, state.ms, &state);
nvk_populate_fs_key(&fs_key_tmp, &state);
fs_key = &fs_key_tmp;
for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) {

View file

@ -4,6 +4,7 @@
*/
#include "nvk_shader.h"
#include "nvk_cmd_buffer.h"
#include "nvk_descriptor_set_layout.h"
#include "nvk_device.h"
#include "nvk_physical_device.h"
@ -185,6 +186,28 @@ nvk_preprocess_nir(struct vk_physical_device *vk_pdev, nir_shader *nir)
nvk_cg_preprocess_nir(nir);
}
void
nvk_populate_fs_key(struct nak_fs_key *key,
const struct vk_graphics_pipeline_state *state)
{
memset(key, 0, sizeof(*key));
key->sample_locations_cb = 0;
key->sample_locations_offset = nvk_root_descriptor_offset(draw.sample_locations);
if (state->pipeline_flags &
VK_PIPELINE_CREATE_2_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT)
key->zs_self_dep = true;
const struct vk_multisample_state *ms = state->ms;
if (ms == NULL || ms->rasterization_samples <= 1)
return;
if (ms->sample_shading_enable &&
(ms->rasterization_samples * ms->min_sample_shading) > 1.0)
key->force_sample_shading = true;
}
static bool
lower_load_global_constant_offset_instr(nir_builder *b,
nir_intrinsic_instr *intrin,

View file

@ -19,6 +19,7 @@ struct nvk_device;
struct nvk_physical_device;
struct nvk_pipeline_compilation_ctx;
struct vk_descriptor_set_layout;
struct vk_graphics_pipeline_state;
struct vk_pipeline_cache;
struct vk_pipeline_layout;
struct vk_pipeline_robustness_state;
@ -122,6 +123,10 @@ nvk_shader_stage_to_nir(struct nvk_device *dev,
struct vk_pipeline_cache *cache,
void *mem_ctx, struct nir_shader **nir_out);
void
nvk_populate_fs_key(struct nak_fs_key *key,
const struct vk_graphics_pipeline_state *state);
void
nvk_lower_nir(struct nvk_device *dev, nir_shader *nir,
const struct vk_pipeline_robustness_state *rs,