mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 22:08:26 +02:00
nvk: Use nak_fs_key instead of rolling our own
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197>
This commit is contained in:
parent
0f086401e3
commit
a946071546
4 changed files with 12 additions and 28 deletions
|
|
@ -700,7 +700,7 @@ nvk_hdr_interp_mode(const struct nv50_ir_varying *var)
|
|||
|
||||
|
||||
static int
|
||||
nvk_fs_gen_header(struct nvk_shader *fs, const struct nvk_fs_key *key,
|
||||
nvk_fs_gen_header(struct nvk_shader *fs, const struct nak_fs_key *key,
|
||||
struct nv50_ir_prog_info_out *info)
|
||||
{
|
||||
unsigned i, c, a, m;
|
||||
|
|
@ -843,7 +843,7 @@ nvk_fill_transform_feedback_state(struct nir_shader *nir,
|
|||
|
||||
VkResult
|
||||
nvk_cg_compile_nir(struct nvk_physical_device *pdev, nir_shader *nir,
|
||||
const struct nvk_fs_key *fs_key,
|
||||
const struct nak_fs_key *fs_key,
|
||||
struct nvk_shader *shader)
|
||||
{
|
||||
struct nv50_ir_prog_info *info;
|
||||
|
|
@ -880,9 +880,9 @@ nvk_cg_compile_nir(struct nvk_physical_device *pdev, nir_shader *nir,
|
|||
|
||||
if (info_out.bin.fixupData) {
|
||||
nv50_ir_apply_fixups(info_out.bin.fixupData, info_out.bin.code,
|
||||
fs_key && fs_key->force_per_sample,
|
||||
fs_key && fs_key->force_sample_shading,
|
||||
false /* flatshade */, false /* alphatest */,
|
||||
fs_key && fs_key->msaa);
|
||||
fs_key && fs_key->force_sample_shading);
|
||||
}
|
||||
|
||||
shader->stage = nir->info.stage;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ emit_pipeline_rs_state(struct nv_push *p,
|
|||
}
|
||||
|
||||
static void
|
||||
nvk_populate_fs_key(struct nvk_fs_key *key,
|
||||
nvk_populate_fs_key(struct nak_fs_key *key,
|
||||
const struct vk_multisample_state *ms,
|
||||
const struct vk_graphics_pipeline_state *state)
|
||||
{
|
||||
|
|
@ -55,10 +55,9 @@ nvk_populate_fs_key(struct nvk_fs_key *key,
|
|||
if (ms == NULL || ms->rasterization_samples <= 1)
|
||||
return;
|
||||
|
||||
key->msaa = ms->rasterization_samples;
|
||||
if (ms->sample_shading_enable &&
|
||||
(ms->rasterization_samples * ms->min_sample_shading) > 1.0)
|
||||
key->force_per_sample = true;
|
||||
key->force_sample_shading = true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -356,7 +355,7 @@ nvk_graphics_pipeline_create(struct nvk_device *dev,
|
|||
if (nir[stage] == NULL)
|
||||
continue;
|
||||
|
||||
struct nvk_fs_key fs_key_tmp, *fs_key = NULL;
|
||||
struct nak_fs_key fs_key_tmp, *fs_key = NULL;
|
||||
if (stage == MESA_SHADER_FRAGMENT) {
|
||||
nvk_populate_fs_key(&fs_key_tmp, state.ms, &state);
|
||||
fs_key = &fs_key_tmp;
|
||||
|
|
|
|||
|
|
@ -395,19 +395,9 @@ nvk_shader_dump(struct nvk_shader *shader)
|
|||
static VkResult
|
||||
nvk_compile_nir_with_nak(struct nvk_physical_device *pdev,
|
||||
nir_shader *nir,
|
||||
const struct nvk_fs_key *nvk_fs_key,
|
||||
const struct nak_fs_key *fs_key,
|
||||
struct nvk_shader *shader)
|
||||
{
|
||||
struct nak_fs_key fs_key_tmp;
|
||||
const struct nak_fs_key *fs_key = NULL;
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT && nvk_fs_key != NULL) {
|
||||
fs_key_tmp = (struct nak_fs_key) {
|
||||
.zs_self_dep = nvk_fs_key->zs_self_dep,
|
||||
.force_sample_shading = nvk_fs_key->force_per_sample,
|
||||
};
|
||||
fs_key = &fs_key_tmp;
|
||||
}
|
||||
|
||||
struct nak_shader_bin *bin = nak_compile_shader(nir, pdev->nak, fs_key);
|
||||
|
||||
shader->stage = nir->info.stage;
|
||||
|
|
@ -481,7 +471,7 @@ nvk_compile_nir_with_nak(struct nvk_physical_device *pdev,
|
|||
|
||||
VkResult
|
||||
nvk_compile_nir(struct nvk_physical_device *pdev, nir_shader *nir,
|
||||
const struct nvk_fs_key *fs_key,
|
||||
const struct nak_fs_key *fs_key,
|
||||
struct nvk_shader *shader)
|
||||
{
|
||||
if (use_nak(pdev, nir->info.stage))
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "nvk_private.h"
|
||||
#include "nvk_device_memory.h"
|
||||
|
||||
#include "nak.h"
|
||||
#include "nir.h"
|
||||
#include "nouveau_bo.h"
|
||||
|
||||
|
|
@ -24,12 +25,6 @@ struct vk_shader_module;
|
|||
#define TU102_SHADER_HEADER_SIZE (32 * 4)
|
||||
#define NVC0_MAX_SHADER_HEADER_SIZE TU102_SHADER_HEADER_SIZE
|
||||
|
||||
struct nvk_fs_key {
|
||||
bool msaa;
|
||||
bool force_per_sample;
|
||||
bool zs_self_dep;
|
||||
};
|
||||
|
||||
struct nvk_transform_feedback_state {
|
||||
uint32_t stride[4];
|
||||
uint8_t stream[4];
|
||||
|
|
@ -145,7 +140,7 @@ nvk_lower_nir(struct nvk_device *dev, nir_shader *nir,
|
|||
|
||||
VkResult
|
||||
nvk_compile_nir(struct nvk_physical_device *dev, nir_shader *nir,
|
||||
const struct nvk_fs_key *fs_key,
|
||||
const struct nak_fs_key *fs_key,
|
||||
struct nvk_shader *shader);
|
||||
|
||||
VkResult
|
||||
|
|
@ -169,7 +164,7 @@ void nvk_cg_preprocess_nir(nir_shader *nir);
|
|||
void nvk_cg_optimize_nir(nir_shader *nir);
|
||||
|
||||
VkResult nvk_cg_compile_nir(struct nvk_physical_device *pdev, nir_shader *nir,
|
||||
const struct nvk_fs_key *fs_key,
|
||||
const struct nak_fs_key *fs_key,
|
||||
struct nvk_shader *shader);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue