mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
kk: Add ds state to fragment key since it's part of the pipeline we compile
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/15301 Signed-off-by: Aitor Camacho <aitor@lunarg.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41128>
This commit is contained in:
parent
91f5fcdcd5
commit
f2938d2708
1 changed files with 20 additions and 16 deletions
|
|
@ -90,6 +90,22 @@ kk_preprocess_nir(UNUSED struct vk_physical_device *vk_pdev, nir_shader *nir,
|
|||
NIR_PASS(_, nir, nir_lower_compute_system_values, &csv_options);
|
||||
}
|
||||
|
||||
static bool
|
||||
has_static_depth_stencil_state(const struct vk_graphics_pipeline_state *state)
|
||||
{
|
||||
if (!state->ds)
|
||||
return false;
|
||||
|
||||
return !(
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_DEPTH_TEST_ENABLE) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_DEPTH_WRITE_ENABLE) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_DEPTH_COMPARE_OP) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_STENCIL_TEST_ENABLE) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_STENCIL_OP) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_STENCIL_COMPARE_MASK) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_STENCIL_WRITE_MASK));
|
||||
}
|
||||
|
||||
struct kk_vs_key {
|
||||
bool is_points;
|
||||
struct vk_vertex_input_state vi;
|
||||
|
|
@ -108,6 +124,7 @@ kk_populate_vs_key(struct kk_vs_key *key,
|
|||
struct kk_fs_key {
|
||||
VkFormat color_formats[MESA_VK_MAX_COLOR_ATTACHMENTS];
|
||||
struct vk_color_blend_state color_blend;
|
||||
struct vk_depth_stencil_state ds;
|
||||
uint32_t rasterization_samples;
|
||||
uint16_t static_sample_mask;
|
||||
bool has_depth;
|
||||
|
|
@ -124,6 +141,9 @@ kk_populate_fs_key(struct kk_fs_key *key,
|
|||
memcpy(key->color_formats, state->rp->color_attachment_formats,
|
||||
sizeof(key->color_formats));
|
||||
|
||||
if (has_static_depth_stencil_state(state))
|
||||
key->ds = *(state->ds);
|
||||
|
||||
/* Blend state gets [de]serialized, so we need to hash it */
|
||||
if (state->cb)
|
||||
key->color_blend = *(state->cb);
|
||||
|
|
@ -832,22 +852,6 @@ kk_compile_compute_pipeline(struct kk_device *device, struct kk_shader *shader)
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static bool
|
||||
has_static_depth_stencil_state(const struct vk_graphics_pipeline_state *state)
|
||||
{
|
||||
if (!state->ds)
|
||||
return false;
|
||||
|
||||
return !(
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_DEPTH_TEST_ENABLE) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_DEPTH_WRITE_ENABLE) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_DEPTH_COMPARE_OP) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_STENCIL_TEST_ENABLE) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_STENCIL_OP) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_STENCIL_COMPARE_MASK) |
|
||||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_DS_STENCIL_WRITE_MASK));
|
||||
}
|
||||
|
||||
static mtl_depth_stencil_state *
|
||||
kk_compile_ds_state(struct kk_device *device, struct kk_shader_info *info)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue