diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 00a64e96750..aebb8fb9f89 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -179,6 +179,11 @@ const char *_mesa_shader_stage_to_abbrev(unsigned stage); */ #define MESA_SHADER_STAGES (MESA_SHADER_COMPUTE + 1) +/** + * GL related stages with mesh shader (not including CL) + */ +#define MESA_SHADER_MESH_STAGES (MESA_SHADER_MESH + 1) + /** * Vulkan stages (not including CL) */ diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 6f8dd0271c9..54a9dbeca97 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -83,7 +83,7 @@ struct cso_context_priv { struct sampler_info fragment_samplers_saved; struct sampler_info compute_samplers_saved; - struct sampler_info samplers[PIPE_SHADER_MESH_TYPES]; + struct sampler_info samplers[MESA_SHADER_MESH_STAGES]; /* Temporary number until cso_single_sampler_done is called. * It tracks the highest sampler seen in cso_single_sampler. @@ -184,13 +184,13 @@ sanitize_hash(struct cso_hash *hash, enum cso_cache_type type, return; if (type == CSO_SAMPLER) { - samplers_to_restore = MALLOC((PIPE_SHADER_MESH_TYPES + 2) * PIPE_MAX_SAMPLERS * + samplers_to_restore = MALLOC((MESA_SHADER_MESH_STAGES + 2) * PIPE_MAX_SAMPLERS * sizeof(*samplers_to_restore)); /* Temporarily remove currently bound sampler states from the hash * table, to prevent them from being deleted */ - for (int i = 0; i < PIPE_SHADER_MESH_TYPES; i++) { + for (int i = 0; i < MESA_SHADER_MESH_STAGES; i++) { for (int j = 0; j < PIPE_MAX_SAMPLERS; j++) { struct cso_sampler *sampler = ctx->samplers[i].cso_samplers[j]; @@ -364,7 +364,7 @@ cso_unbind_context(struct cso_context *cso) static void *zeros[PIPE_MAX_SAMPLERS] = { NULL }; struct pipe_screen *scr = ctx->base.pipe->screen; enum pipe_shader_type sh; - for (sh = 0; sh < PIPE_SHADER_MESH_TYPES; sh++) { + for (sh = 0; sh < MESA_SHADER_MESH_STAGES; sh++) { switch (sh) { case MESA_SHADER_GEOMETRY: if (!ctx->has_geometry_shader) diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h b/src/gallium/auxiliary/tgsi/tgsi_strings.h index f494319c0e1..fd19376c338 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h @@ -38,7 +38,7 @@ extern "C" { #endif -extern const char *tgsi_processor_type_names[PIPE_SHADER_MESH_TYPES]; +extern const char *tgsi_processor_type_names[MESA_SHADER_MESH_STAGES]; extern const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT]; diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index d79d111a8ec..2a537fc0659 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -84,7 +84,7 @@ llvmpipe_destroy(struct pipe_context *pipe) util_unreference_framebuffer_state(&llvmpipe->framebuffer); - for (enum pipe_shader_type s = MESA_SHADER_VERTEX; s < PIPE_SHADER_MESH_TYPES; s++) { + for (enum pipe_shader_type s = MESA_SHADER_VERTEX; s < MESA_SHADER_MESH_STAGES; s++) { for (i = 0; i < ARRAY_SIZE(llvmpipe->sampler_views[0]); i++) { pipe_sampler_view_reference(&llvmpipe->sampler_views[s][i], NULL); } diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index f05e3c6189d..defb4037744 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -62,7 +62,7 @@ struct llvmpipe_context { struct list_head list; /** Constant state objects */ const struct pipe_blend_state *blend; - struct pipe_sampler_state *samplers[PIPE_SHADER_MESH_TYPES][PIPE_MAX_SAMPLERS]; + struct pipe_sampler_state *samplers[MESA_SHADER_MESH_STAGES][PIPE_MAX_SAMPLERS]; const struct pipe_depth_stencil_alpha_state *depth_stencil; const struct pipe_rasterizer_state *rasterizer; @@ -86,21 +86,21 @@ struct llvmpipe_context { struct pipe_blend_color blend_color; struct pipe_stencil_ref stencil_ref; struct pipe_clip_state clip; - struct pipe_constant_buffer constants[PIPE_SHADER_MESH_TYPES][LP_MAX_TGSI_CONST_BUFFERS]; + struct pipe_constant_buffer constants[MESA_SHADER_MESH_STAGES][LP_MAX_TGSI_CONST_BUFFERS]; struct pipe_framebuffer_state framebuffer; struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissors[PIPE_MAX_VIEWPORTS]; - struct pipe_sampler_view *sampler_views[PIPE_SHADER_MESH_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS]; + struct pipe_sampler_view *sampler_views[MESA_SHADER_MESH_STAGES][PIPE_MAX_SHADER_SAMPLER_VIEWS]; struct pipe_viewport_state viewports[PIPE_MAX_VIEWPORTS]; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; - struct pipe_shader_buffer ssbos[PIPE_SHADER_MESH_TYPES][LP_MAX_TGSI_SHADER_BUFFERS]; - struct pipe_image_view images[PIPE_SHADER_MESH_TYPES][LP_MAX_TGSI_SHADER_IMAGES]; + struct pipe_shader_buffer ssbos[MESA_SHADER_MESH_STAGES][LP_MAX_TGSI_SHADER_BUFFERS]; + struct pipe_image_view images[MESA_SHADER_MESH_STAGES][LP_MAX_TGSI_SHADER_IMAGES]; uint32_t fs_ssbo_write_mask; - unsigned num_samplers[PIPE_SHADER_MESH_TYPES]; - unsigned num_sampler_views[PIPE_SHADER_MESH_TYPES]; - unsigned num_images[PIPE_SHADER_MESH_TYPES]; + unsigned num_samplers[MESA_SHADER_MESH_STAGES]; + unsigned num_sampler_views[MESA_SHADER_MESH_STAGES]; + unsigned num_images[MESA_SHADER_MESH_STAGES]; unsigned num_vertex_buffers; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 4cc29955ac5..3c2d94ab4cb 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -983,7 +983,7 @@ llvmpipe_create_screen(struct sw_winsys *winsys) screen->num_threads); screen->num_threads = MIN2(screen->num_threads, LP_MAX_THREADS); - for (unsigned i = 0; i < PIPE_SHADER_MESH_TYPES; i++) + for (unsigned i = 0; i < MESA_SHADER_MESH_STAGES; i++) screen->base.nir_options[i] = &gallivm_nir_options; #if defined(HAVE_LIBDRM) && defined(HAVE_LINUX_UDMABUF_H) diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index c360ed4f2b6..75cd9d5074d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -4219,7 +4219,7 @@ llvmpipe_set_constant_buffer(struct pipe_context *pipe, struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); struct pipe_constant_buffer *constants = &llvmpipe->constants[shader][index]; - assert(shader < PIPE_SHADER_MESH_TYPES); + assert(shader < MESA_SHADER_MESH_STAGES); assert(index < ARRAY_SIZE(llvmpipe->constants[shader])); /* note: reference counting */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 82b93780ab5..2f480aa7902 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -74,7 +74,7 @@ llvmpipe_bind_sampler_states(struct pipe_context *pipe, { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); - assert(shader < PIPE_SHADER_MESH_TYPES); + assert(shader < MESA_SHADER_MESH_STAGES); assert(start + num <= ARRAY_SIZE(llvmpipe->samplers[shader])); draw_flush(llvmpipe->draw); @@ -138,7 +138,7 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe, assert(num <= PIPE_MAX_SHADER_SAMPLER_VIEWS); - assert(shader < PIPE_SHADER_MESH_TYPES); + assert(shader < MESA_SHADER_MESH_STAGES); assert(start + num <= ARRAY_SIZE(llvmpipe->sampler_views[shader])); draw_flush(llvmpipe->draw); diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h index fe125db3c74..cb13a084392 100644 --- a/src/gallium/frontends/lavapipe/lvp_private.h +++ b/src/gallium/frontends/lavapipe/lvp_private.h @@ -135,7 +135,7 @@ void __lvp_finishme(const char *file, int line, const char *format, ...) #define LVP_SHADER_STAGES (MESA_SHADER_CALLABLE + 1) #define LVP_STAGE_MASK BITFIELD_MASK(LVP_SHADER_STAGES) -#define LVP_STAGE_MASK_GFX (BITFIELD_MASK(PIPE_SHADER_MESH_TYPES) & ~BITFIELD_BIT(MESA_SHADER_COMPUTE)) +#define LVP_STAGE_MASK_GFX (BITFIELD_MASK(MESA_SHADER_MESH_STAGES) & ~BITFIELD_BIT(MESA_SHADER_COMPUTE)) #define lvp_foreach_stage(stage, stage_bits) \ for (gl_shader_stage stage, \ diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 8dcca064306..aecfdec1298 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -93,9 +93,9 @@ struct pipe_screen { void *winsys_priv; const struct pipe_caps caps; - const struct pipe_shader_caps shader_caps[PIPE_SHADER_MESH_TYPES]; + const struct pipe_shader_caps shader_caps[MESA_SHADER_MESH_STAGES]; const struct pipe_compute_caps compute_caps; - const struct nir_shader_compiler_options *nir_options[PIPE_SHADER_MESH_TYPES]; + const struct nir_shader_compiler_options *nir_options[MESA_SHADER_MESH_STAGES]; /** * Get the fd associated with the screen diff --git a/src/vulkan/runtime/vk_pipeline.c b/src/vulkan/runtime/vk_pipeline.c index 66aeb32c694..b4312112f55 100644 --- a/src/vulkan/runtime/vk_pipeline.c +++ b/src/vulkan/runtime/vk_pipeline.c @@ -1044,7 +1044,7 @@ vk_graphics_pipeline_cmd_bind(struct vk_command_buffer *cmd_buffer, const struct vk_device_shader_ops *ops = device->shader_ops; struct vk_graphics_pipeline *gfx_pipeline = NULL; - struct vk_shader *stage_shader[PIPE_SHADER_MESH_TYPES] = { NULL, }; + struct vk_shader *stage_shader[MESA_SHADER_MESH_STAGES] = { NULL, }; if (pipeline != NULL) { assert(pipeline->bind_point == VK_PIPELINE_BIND_POINT_GRAPHICS); assert(!(pipeline->flags & VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR)); @@ -1629,10 +1629,10 @@ vk_create_graphics_pipeline(struct vk_device *device, if (pipeline == NULL) return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); - struct vk_pipeline_stage stages[PIPE_SHADER_MESH_TYPES]; + struct vk_pipeline_stage stages[MESA_SHADER_MESH_STAGES]; memset(stages, 0, sizeof(stages)); - VkPipelineCreationFeedback stage_feedbacks[PIPE_SHADER_MESH_TYPES]; + VkPipelineCreationFeedback stage_feedbacks[MESA_SHADER_MESH_STAGES]; memset(stage_feedbacks, 0, sizeof(stage_feedbacks)); struct vk_graphics_pipeline_state state_tmp, *state;