mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
nvk: Use VkShaderStageFlags for shaders_dirty
This requires a bit more juggling of shader enums but it also cleans things up a bit since we're no longer using a bitfield which isn't VkShaderStageFlags. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31394>
This commit is contained in:
parent
a5f20591eb
commit
0e1545586d
3 changed files with 25 additions and 15 deletions
|
|
@ -167,7 +167,7 @@ struct nvk_graphics_state {
|
|||
struct nvk_rendering_state render;
|
||||
struct nvk_descriptor_state descriptors;
|
||||
|
||||
uint32_t shaders_dirty;
|
||||
VkShaderStageFlags shaders_dirty;
|
||||
struct nvk_shader *shaders[MESA_SHADER_MESH + 1];
|
||||
|
||||
struct nvk_cbuf_group {
|
||||
|
|
|
|||
|
|
@ -1232,7 +1232,7 @@ nvk_cmd_bind_graphics_shader(struct nvk_cmd_buffer *cmd,
|
|||
return;
|
||||
|
||||
cmd->state.gfx.shaders[stage] = shader;
|
||||
cmd->state.gfx.shaders_dirty |= BITFIELD_BIT(stage);
|
||||
cmd->state.gfx.shaders_dirty |= mesa_to_vk_shader_stage(stage);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
|
@ -1353,13 +1353,9 @@ nvk_flush_shaders(struct nvk_cmd_buffer *cmd)
|
|||
struct nvk_shader *type_shader[6] = { NULL, };
|
||||
uint32_t types_dirty = 0;
|
||||
|
||||
const uint32_t gfx_stages = BITFIELD_BIT(MESA_SHADER_VERTEX) |
|
||||
BITFIELD_BIT(MESA_SHADER_TESS_CTRL) |
|
||||
BITFIELD_BIT(MESA_SHADER_TESS_EVAL) |
|
||||
BITFIELD_BIT(MESA_SHADER_GEOMETRY) |
|
||||
BITFIELD_BIT(MESA_SHADER_FRAGMENT);
|
||||
|
||||
u_foreach_bit(stage, cmd->state.gfx.shaders_dirty & gfx_stages) {
|
||||
u_foreach_bit(s, cmd->state.gfx.shaders_dirty &
|
||||
NVK_SHADER_STAGE_GRAPHICS_BITS) {
|
||||
gl_shader_stage stage = vk_to_mesa_shader_stage(1 << s);
|
||||
uint32_t type = mesa_to_nv9097_shader_type(stage);
|
||||
types_dirty |= BITFIELD_BIT(type);
|
||||
|
||||
|
|
@ -1399,13 +1395,10 @@ nvk_flush_shaders(struct nvk_cmd_buffer *cmd)
|
|||
}
|
||||
}
|
||||
|
||||
const uint32_t vtgm_stages = BITFIELD_BIT(MESA_SHADER_VERTEX) |
|
||||
BITFIELD_BIT(MESA_SHADER_TESS_EVAL) |
|
||||
BITFIELD_BIT(MESA_SHADER_GEOMETRY) |
|
||||
BITFIELD_BIT(MESA_SHADER_MESH);
|
||||
if (cmd->state.gfx.shaders_dirty & vtgm_stages) {
|
||||
if (cmd->state.gfx.shaders_dirty & NVK_SHADER_STAGE_VTGM_BITS) {
|
||||
struct nvk_shader *last_vtgm = NULL;
|
||||
u_foreach_bit(stage, vtgm_stages) {
|
||||
u_foreach_bit(s, NVK_SHADER_STAGE_VTGM_BITS) {
|
||||
gl_shader_stage stage = vk_to_mesa_shader_stage(1 << s);
|
||||
if (cmd->state.gfx.shaders[stage] != NULL)
|
||||
last_vtgm = cmd->state.gfx.shaders[stage];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,23 @@ struct vk_shader_module;
|
|||
#define TU102_SHADER_HEADER_SIZE (32 * 4)
|
||||
#define NVC0_MAX_SHADER_HEADER_SIZE TU102_SHADER_HEADER_SIZE
|
||||
|
||||
#define NVK_SHADER_STAGE_VTGM_BITS \
|
||||
(VK_SHADER_STAGE_VERTEX_BIT | \
|
||||
VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT | \
|
||||
VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT | \
|
||||
VK_SHADER_STAGE_GEOMETRY_BIT)
|
||||
|
||||
#define NVK_SHADER_STAGE_GRAPHICS_BITS \
|
||||
(NVK_SHADER_STAGE_VTGM_BITS | VK_SHADER_STAGE_FRAGMENT_BIT)
|
||||
|
||||
static inline gl_shader_stage
|
||||
nvk_last_vtgm_shader_stage(VkShaderStageFlags stages)
|
||||
{
|
||||
stages &= ~VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
stages = 1 << (util_last_bit(stages) - 1);
|
||||
return vk_to_mesa_shader_stage(stages);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
nvk_cbuf_binding_for_stage(gl_shader_stage stage)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue