From 12256136e0c9652d84270469409dce78b86812fc Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 1 Jun 2023 23:03:34 +0800 Subject: [PATCH] compiler: Rename shader_prim to mesa_prim and replace all usage of pipe_prim_type with mesa_prim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a prepare step to remove depends on p_defines.h in src/util/* This is done by: replace pipe_prim_type with mesa_prim replace shader_prim with mesa_prim replace PIPE_PRIM_MAX with MESA_PRIM_COUNT replace SHADER_PRIM_ with MESA_PRIM_ replace PIPE_PRIM_ with MESA_PRIM_ This patch only replace code only Signed-off-by: Yonggang Luo Acked-by: Marek Olšák Acked-by: Jesse Natalie Part-of: --- src/amd/common/ac_nir.c | 6 +- src/amd/common/ac_nir_lower_ngg.c | 6 +- src/amd/vulkan/nir/radv_nir_lower_abi.c | 6 +- src/amd/vulkan/radv_pipeline_graphics.c | 20 +- src/amd/vulkan/radv_shader.c | 6 +- src/amd/vulkan/radv_shader.h | 2 +- src/amd/vulkan/radv_shader_info.c | 16 +- src/broadcom/common/v3d_util.c | 26 +- src/broadcom/common/v3d_util.h | 2 +- src/broadcom/vulkan/v3dv_meta_clear.c | 4 +- src/broadcom/vulkan/v3dv_meta_copy.c | 4 +- src/broadcom/vulkan/v3dv_pipeline.c | 80 +++--- src/broadcom/vulkan/v3dv_private.h | 2 +- src/broadcom/vulkan/v3dvx_cmd_buffer.c | 8 +- src/broadcom/vulkan/v3dvx_pipeline.c | 2 +- src/compiler/glsl/glsl_parser_extras.cpp | 8 +- src/compiler/glsl/linker.cpp | 20 +- src/compiler/nir/nir.h | 2 +- src/compiler/nir/nir_lower_gs_intrinsics.c | 10 +- src/compiler/nir/nir_passthrough_gs.c | 128 ++++----- src/compiler/nir/nir_print.c | 2 +- src/compiler/shader_enums.c | 6 +- src/compiler/shader_enums.h | 42 +-- src/compiler/spirv/spirv_to_nir.c | 18 +- src/freedreno/vulkan/tu_pipeline.cc | 10 +- src/gallium/auxiliary/draw/draw_context.c | 2 +- src/gallium/auxiliary/draw/draw_context.h | 2 +- .../auxiliary/draw/draw_decompose_tmp.h | 30 +-- src/gallium/auxiliary/draw/draw_gs_tmp.h | 6 +- src/gallium/auxiliary/draw/draw_llvm.c | 2 +- src/gallium/auxiliary/draw/draw_pipe.c | 4 +- .../auxiliary/draw/draw_pipe_validate.c | 8 +- src/gallium/auxiliary/draw/draw_pipe_vbuf.c | 6 +- .../auxiliary/draw/draw_prim_assembler.c | 18 +- .../auxiliary/draw/draw_prim_assembler_tmp.h | 4 +- src/gallium/auxiliary/draw/draw_private.h | 4 +- src/gallium/auxiliary/draw/draw_pt.c | 8 +- src/gallium/auxiliary/draw/draw_pt.h | 8 +- src/gallium/auxiliary/draw/draw_pt_emit.c | 2 +- .../auxiliary/draw/draw_pt_fetch_shade_emit.c | 2 +- .../draw/draw_pt_fetch_shade_pipeline.c | 8 +- .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 18 +- src/gallium/auxiliary/draw/draw_pt_util.c | 30 +-- src/gallium/auxiliary/draw/draw_pt_vsplit.c | 4 +- .../auxiliary/draw/draw_pt_vsplit_tmp.h | 4 +- src/gallium/auxiliary/draw/draw_so_emit_tmp.h | 10 +- src/gallium/auxiliary/draw/draw_split_tmp.h | 36 +-- src/gallium/auxiliary/draw/draw_tess.c | 12 +- src/gallium/auxiliary/draw/draw_tess.h | 4 +- src/gallium/auxiliary/draw/draw_vbuf.h | 2 +- src/gallium/auxiliary/hud/hud_context.c | 12 +- src/gallium/auxiliary/indices/u_indices.c | 124 ++++----- src/gallium/auxiliary/indices/u_indices.h | 24 +- .../auxiliary/indices/u_indices_gen.py | 28 +- .../auxiliary/indices/u_indices_priv.h | 2 +- src/gallium/auxiliary/indices/u_primconvert.c | 6 +- .../auxiliary/indices/u_unfilled_gen.py | 16 +- .../auxiliary/indices/u_unfilled_indices.c | 40 +-- src/gallium/auxiliary/postprocess/pp_run.c | 2 +- .../auxiliary/tessellator/p_tessellator.cpp | 14 +- .../auxiliary/tessellator/p_tessellator.h | 2 +- .../auxiliary/tgsi/tgsi_point_sprite.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_strings.c | 4 +- src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 +- src/gallium/auxiliary/tgsi/tgsi_text.c | 2 +- src/gallium/auxiliary/util/u_blitter.c | 6 +- src/gallium/auxiliary/util/u_draw.h | 8 +- src/gallium/auxiliary/util/u_dump_defines.c | 30 +-- src/gallium/auxiliary/util/u_prim.c | 32 +-- src/gallium/auxiliary/util/u_prim.h | 244 +++++++++--------- src/gallium/auxiliary/util/u_prim_restart.c | 2 +- src/gallium/auxiliary/util/u_screen.c | 2 +- src/gallium/auxiliary/util/u_simple_shaders.c | 4 +- src/gallium/auxiliary/util/u_split_draw.c | 12 +- src/gallium/auxiliary/util/u_split_prim.h | 22 +- src/gallium/auxiliary/util/u_tests.c | 6 +- src/gallium/auxiliary/util/u_vbuf.c | 10 +- src/gallium/auxiliary/vl/vl_bicubic_filter.c | 2 +- src/gallium/auxiliary/vl/vl_compositor_gfx.c | 2 +- src/gallium/auxiliary/vl/vl_deint_filter.c | 6 +- src/gallium/auxiliary/vl/vl_idct.c | 4 +- src/gallium/auxiliary/vl/vl_matrix_filter.c | 2 +- src/gallium/auxiliary/vl/vl_mc.c | 6 +- src/gallium/auxiliary/vl/vl_median_filter.c | 2 +- src/gallium/auxiliary/vl/vl_zscan.c | 2 +- src/gallium/drivers/asahi/agx_batch.c | 2 +- src/gallium/drivers/asahi/agx_pipe.c | 14 +- src/gallium/drivers/asahi/agx_state.c | 28 +- src/gallium/drivers/asahi/agx_state.h | 4 +- src/gallium/drivers/asahi/agx_streamout.c | 26 +- src/gallium/drivers/crocus/crocus_context.h | 4 +- src/gallium/drivers/crocus/crocus_draw.c | 44 ++-- src/gallium/drivers/crocus/crocus_program.c | 8 +- src/gallium/drivers/crocus/crocus_screen.h | 2 +- src/gallium/drivers/crocus/crocus_state.c | 44 ++-- src/gallium/drivers/d3d12/d3d12_compiler.cpp | 26 +- src/gallium/drivers/d3d12/d3d12_context.cpp | 10 +- src/gallium/drivers/d3d12/d3d12_context.h | 2 +- src/gallium/drivers/d3d12/d3d12_draw.cpp | 70 ++--- .../drivers/d3d12/d3d12_pipeline_state.cpp | 24 +- .../drivers/d3d12/d3d12_pipeline_state.h | 2 +- src/gallium/drivers/etnaviv/etnaviv_context.c | 2 +- src/gallium/drivers/etnaviv/etnaviv_screen.c | 14 +- .../drivers/etnaviv/etnaviv_translate.h | 16 +- src/gallium/drivers/freedreno/a2xx/fd2_draw.c | 16 +- .../drivers/freedreno/a2xx/fd2_screen.c | 30 +-- src/gallium/drivers/freedreno/a3xx/fd3_draw.c | 4 +- .../drivers/freedreno/a3xx/fd3_screen.c | 16 +- src/gallium/drivers/freedreno/a4xx/fd4_draw.c | 4 +- .../drivers/freedreno/a4xx/fd4_screen.c | 16 +- .../drivers/freedreno/a5xx/fd5_screen.c | 16 +- .../drivers/freedreno/a6xx/fd6_draw.cc | 6 +- .../drivers/freedreno/a6xx/fd6_program.cc | 6 +- .../drivers/freedreno/a6xx/fd6_screen.cc | 32 +-- src/gallium/drivers/freedreno/a6xx/fd6_vsc.cc | 4 +- .../drivers/freedreno/freedreno_blitter.c | 2 +- .../drivers/freedreno/freedreno_draw.c | 4 +- .../drivers/freedreno/freedreno_screen.c | 2 +- .../drivers/freedreno/freedreno_screen.h | 2 +- src/gallium/drivers/i915/i915_prim_vbuf.c | 52 ++-- src/gallium/drivers/iris/iris_context.h | 2 +- src/gallium/drivers/iris/iris_draw.c | 10 +- src/gallium/drivers/iris/iris_state.c | 58 ++--- src/gallium/drivers/lima/lima_draw.c | 16 +- .../drivers/llvmpipe/lp_setup_context.h | 2 +- src/gallium/drivers/llvmpipe/lp_setup_vbuf.c | 42 +-- src/gallium/drivers/nouveau/nouveau_gldefs.h | 20 +- .../drivers/nouveau/nv30/nv30_context.h | 2 +- src/gallium/drivers/nouveau/nv30/nv30_draw.c | 2 +- .../drivers/nouveau/nv30/nv30_screen.c | 2 +- .../drivers/nouveau/nv50/nv50_program.c | 8 +- src/gallium/drivers/nouveau/nv50/nv50_push.c | 2 +- .../drivers/nouveau/nv50/nv50_screen.c | 2 +- src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 32 +-- .../drivers/nouveau/nvc0/nvc0_program.c | 22 +- .../drivers/nouveau/nvc0/nvc0_screen.c | 2 +- src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c | 4 +- .../drivers/nouveau/nvc0/nvc0_vbo_translate.c | 2 +- src/gallium/drivers/panfrost/pan_cmdstream.c | 30 +-- src/gallium/drivers/panfrost/pan_context.c | 2 +- src/gallium/drivers/panfrost/pan_context.h | 2 +- src/gallium/drivers/panfrost/pan_screen.c | 8 +- src/gallium/drivers/panfrost/pan_shader.c | 2 +- src/gallium/drivers/r300/r300_render.c | 18 +- src/gallium/drivers/r600/evergreen_state.c | 8 +- src/gallium/drivers/r600/r600_pipe.h | 8 +- src/gallium/drivers/r600/r600_pipe_common.h | 2 +- src/gallium/drivers/r600/r600_state_common.c | 78 +++--- src/gallium/drivers/r600/sfn/sfn_nir.cpp | 6 +- src/gallium/drivers/r600/sfn/sfn_nir.h | 6 +- .../r600/sfn/sfn_nir_lower_tess_io.cpp | 22 +- .../drivers/radeonsi/gfx10_shader_ngg.c | 2 +- src/gallium/drivers/radeonsi/si_pipe.h | 22 +- src/gallium/drivers/radeonsi/si_shader.h | 2 +- src/gallium/drivers/radeonsi/si_shader_info.c | 2 +- .../drivers/radeonsi/si_state_draw.cpp | 80 +++--- .../drivers/radeonsi/si_state_shaders.cpp | 34 +-- .../drivers/radeonsi/si_state_viewport.c | 2 +- src/gallium/drivers/softpipe/sp_clear.c | 2 +- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 52 ++-- src/gallium/drivers/softpipe/sp_setup.c | 8 +- src/gallium/drivers/svga/svga_context.h | 10 +- src/gallium/drivers/svga/svga_draw.c | 2 +- src/gallium/drivers/svga/svga_draw.h | 2 +- src/gallium/drivers/svga/svga_draw_arrays.c | 20 +- src/gallium/drivers/svga/svga_draw_elements.c | 12 +- src/gallium/drivers/svga/svga_draw_private.h | 64 ++--- src/gallium/drivers/svga/svga_pipe_draw.c | 22 +- .../drivers/svga/svga_resource_buffer.h | 2 +- src/gallium/drivers/svga/svga_shader.h | 10 +- .../drivers/svga/svga_state_framebuffer.c | 2 +- src/gallium/drivers/svga/svga_state_fs.c | 6 +- .../drivers/svga/svga_state_need_swtnl.c | 8 +- src/gallium/drivers/svga/svga_state_rss.c | 2 +- .../drivers/svga/svga_state_tgsi_transform.c | 2 +- src/gallium/drivers/svga/svga_swtnl_backend.c | 2 +- src/gallium/drivers/svga/svga_swtnl_private.h | 2 +- src/gallium/drivers/svga/svga_swtnl_state.c | 8 +- src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 130 +++++----- src/gallium/drivers/v3d/v3d_context.c | 2 +- src/gallium/drivers/v3d/v3d_program.c | 10 +- src/gallium/drivers/v3d/v3d_screen.c | 22 +- src/gallium/drivers/v3d/v3dx_draw.c | 10 +- src/gallium/drivers/v3d/v3dx_emit.c | 2 +- src/gallium/drivers/vc4/vc4_draw.c | 6 +- src/gallium/drivers/vc4/vc4_program.c | 8 +- src/gallium/drivers/vc4/vc4_screen.c | 14 +- src/gallium/drivers/virgl/virgl_encode.c | 2 +- src/gallium/drivers/virgl/virgl_screen.c | 6 +- .../drivers/zink/nir_to_spirv/nir_to_spirv.c | 62 ++--- src/gallium/drivers/zink/zink_compiler.c | 16 +- src/gallium/drivers/zink/zink_context.c | 2 +- src/gallium/drivers/zink/zink_draw.cpp | 34 +-- src/gallium/drivers/zink/zink_pipeline.c | 4 +- src/gallium/drivers/zink/zink_program.c | 116 ++++----- src/gallium/drivers/zink/zink_program.h | 38 +-- .../drivers/zink/zink_program_state.hpp | 4 +- src/gallium/drivers/zink/zink_screen.c | 32 +-- src/gallium/drivers/zink/zink_types.h | 6 +- src/gallium/frontends/d3d10umd/Draw.cpp | 10 +- .../frontends/d3d10umd/InputAssembly.cpp | 24 +- src/gallium/frontends/d3d10umd/ShaderTGSI.c | 16 +- src/gallium/frontends/d3d10umd/State.h | 2 +- src/gallium/frontends/lavapipe/lvp_conv.h | 22 +- src/gallium/frontends/lavapipe/lvp_execute.c | 4 +- src/gallium/frontends/nine/device9.c | 2 +- src/gallium/frontends/nine/nine_pipe.h | 14 +- src/gallium/frontends/xa/xa_renderer.c | 4 +- src/gallium/include/pipe/p_defines.h | 22 -- src/gallium/include/pipe/p_state.h | 6 +- src/gallium/tests/trivial/quad-tex.c | 2 +- src/gallium/tests/trivial/tri.c | 2 +- src/gallium/tests/unit/u_prim_verts_test.c | 26 +- src/intel/compiler/brw_compile_clip.c | 6 +- src/intel/compiler/brw_vec4_gs_visitor.cpp | 32 +-- src/intel/vulkan/genX_pipeline.c | 10 +- src/mesa/main/shader_types.h | 4 +- src/mesa/main/shaderobj.c | 4 +- src/mesa/state_tracker/st_cb_drawtex.c | 2 +- src/mesa/state_tracker/st_cb_rasterpos.c | 2 +- src/mesa/state_tracker/st_context.c | 2 +- src/mesa/state_tracker/st_draw.c | 12 +- src/mesa/state_tracker/st_draw_hw_select.c | 10 +- src/mesa/state_tracker/st_pbo.c | 8 +- src/mesa/vbo/vbo_save_api.c | 6 +- src/microsoft/compiler/dxil_enums.c | 18 +- src/microsoft/vulkan/dzn_nir.c | 4 +- src/nouveau/codegen/nv50_ir.cpp | 4 +- src/nouveau/codegen/nv50_ir_driver.h | 4 +- src/nouveau/codegen/nv50_ir_from_nir.cpp | 2 +- src/nouveau/codegen/nv50_ir_from_tgsi.cpp | 4 +- src/nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 2 +- 232 files changed, 1755 insertions(+), 1775 deletions(-) diff --git a/src/amd/common/ac_nir.c b/src/amd/common/ac_nir.c index fe1cd324195..8768a9b5b0a 100644 --- a/src/amd/common/ac_nir.c +++ b/src/amd/common/ac_nir.c @@ -1050,13 +1050,13 @@ ac_nir_lower_legacy_gs(nir_shader *nir, unsigned num_vertices_per_primitive = 0; switch (nir->info.gs.output_primitive) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: num_vertices_per_primitive = 1; break; - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: num_vertices_per_primitive = 2; break; - case SHADER_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: num_vertices_per_primitive = 3; break; default: diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c index fdde4c82813..fba611dcb4b 100644 --- a/src/amd/common/ac_nir_lower_ngg.c +++ b/src/amd/common/ac_nir_lower_ngg.c @@ -3403,11 +3403,11 @@ ac_nir_lower_ngg_gs(nir_shader *shader, const ac_nir_lower_ngg_options *options) if (!state.output_compile_time_known) state.current_clear_primflag_idx_var = nir_local_variable_create(impl, glsl_uint_type(), "current_clear_primflag_idx"); - if (shader->info.gs.output_primitive == SHADER_PRIM_POINTS) + if (shader->info.gs.output_primitive == MESA_PRIM_POINTS) state.num_vertices_per_primitive = 1; - else if (shader->info.gs.output_primitive == SHADER_PRIM_LINE_STRIP) + else if (shader->info.gs.output_primitive == MESA_PRIM_LINE_STRIP) state.num_vertices_per_primitive = 2; - else if (shader->info.gs.output_primitive == SHADER_PRIM_TRIANGLE_STRIP) + else if (shader->info.gs.output_primitive == MESA_PRIM_TRIANGLE_STRIP) state.num_vertices_per_primitive = 3; else unreachable("Invalid GS output primitive."); diff --git a/src/amd/vulkan/nir/radv_nir_lower_abi.c b/src/amd/vulkan/nir/radv_nir_lower_abi.c index b22e8613c50..d669ae29ed6 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_abi.c +++ b/src/amd/vulkan/nir/radv_nir_lower_abi.c @@ -428,13 +428,13 @@ lower_abi_instr(nir_builder *b, nir_instr *instr, void *state) } else { assert(stage == MESA_SHADER_GEOMETRY); switch (s->info->gs.output_prim) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: num_vertices = 1; break; - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: num_vertices = 2; break; - case SHADER_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: num_vertices = 3; break; default: diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index 52a623203b4..de5f056f0d9 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -392,17 +392,17 @@ static uint32_t si_conv_gl_prim_to_gs_out(unsigned gl_prim) { switch (gl_prim) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return V_028A6C_POINTLIST; - case SHADER_PRIM_LINES: - case SHADER_PRIM_LINE_STRIP: - case SHADER_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_LINES_ADJACENCY: return V_028A6C_LINESTRIP; - case SHADER_PRIM_TRIANGLES: - case SHADER_PRIM_TRIANGLE_STRIP_ADJACENCY: - case SHADER_PRIM_TRIANGLE_STRIP: - case SHADER_PRIM_QUADS: + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_QUADS: return V_028A6C_TRISTRIP; default: assert(0); @@ -1321,9 +1321,9 @@ radv_remove_point_size(const struct radv_pipeline_key *pipeline_key, nir_shader if (consumer->info.stage == MESA_SHADER_FRAGMENT && ((producer->info.stage == MESA_SHADER_TESS_EVAL && producer->info.tess.point_mode) || (producer->info.stage == MESA_SHADER_GEOMETRY && - producer->info.gs.output_primitive == SHADER_PRIM_POINTS) || + producer->info.gs.output_primitive == MESA_PRIM_POINTS) || (producer->info.stage == MESA_SHADER_MESH && - producer->info.mesh.primitive_type == SHADER_PRIM_POINTS))) + producer->info.mesh.primitive_type == MESA_PRIM_POINTS))) return; nir_variable *var = diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 8dacbae139b..2e5d9dc8443 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -886,12 +886,12 @@ void radv_lower_ngg(struct radv_device *device, struct radv_pipeline_stage *ngg_ } else if (nir->info.stage == MESA_SHADER_GEOMETRY) { num_vertices_per_prim = nir->info.gs.vertices_in; } else if (nir->info.stage == MESA_SHADER_MESH) { - if (nir->info.mesh.primitive_type == SHADER_PRIM_POINTS) + if (nir->info.mesh.primitive_type == MESA_PRIM_POINTS) num_vertices_per_prim = 1; - else if (nir->info.mesh.primitive_type == SHADER_PRIM_LINES) + else if (nir->info.mesh.primitive_type == MESA_PRIM_LINES) num_vertices_per_prim = 2; else - assert(nir->info.mesh.primitive_type == SHADER_PRIM_TRIANGLES); + assert(nir->info.mesh.primitive_type == MESA_PRIM_TRIANGLES); } else { unreachable("NGG needs to be VS, TES or GS."); } diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 597970ea684..b5da8be2e29 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -405,7 +405,7 @@ struct radv_shader_info { bool tes_reads_tess_factors : 1; } tcs; struct { - enum shader_prim output_prim; + enum mesa_prim output_prim; bool needs_ms_scratch_ring; bool has_task; /* If mesh shader is used together with a task shader. */ } ms; diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index 6c0cf9b3330..c41654ab688 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -1010,8 +1010,8 @@ radv_get_legacy_gs_info(const struct radv_device *device, struct radv_pipeline_s struct radv_legacy_gs_info *out = &gs_stage->info.gs_ring_info; const unsigned gs_num_invocations = MAX2(gs_info->gs.invocations, 1); - const bool uses_adjacency = gs_info->gs.input_prim == SHADER_PRIM_LINES_ADJACENCY || - gs_info->gs.input_prim == SHADER_PRIM_TRIANGLES_ADJACENCY; + const bool uses_adjacency = gs_info->gs.input_prim == MESA_PRIM_LINES_ADJACENCY || + gs_info->gs.input_prim == MESA_PRIM_TRIANGLES_ADJACENCY; /* All these are in dwords: */ /* We can't allow using the whole LDS, because GS waves compete with @@ -1150,13 +1150,13 @@ radv_get_pre_rast_input_topology(const struct radv_pipeline_stage *es_stage, if (es_stage->stage == MESA_SHADER_TESS_EVAL) { if (es_stage->nir->info.tess.point_mode) - return SHADER_PRIM_POINTS; + return MESA_PRIM_POINTS; if (es_stage->nir->info.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES) - return SHADER_PRIM_LINES; - return SHADER_PRIM_TRIANGLES; + return MESA_PRIM_LINES; + return MESA_PRIM_TRIANGLES; } - return SHADER_PRIM_TRIANGLES; + return MESA_PRIM_TRIANGLES; } static void @@ -1173,8 +1173,8 @@ gfx10_get_ngg_info(const struct radv_device *device, struct radv_pipeline_stage const unsigned gs_num_invocations = gs_stage ? MAX2(gs_info->gs.invocations, 1) : 1; const unsigned input_prim = radv_get_pre_rast_input_topology(es_stage, gs_stage); - const bool uses_adjacency = input_prim == SHADER_PRIM_LINES_ADJACENCY || - input_prim == SHADER_PRIM_TRIANGLES_ADJACENCY; + const bool uses_adjacency = input_prim == MESA_PRIM_LINES_ADJACENCY || + input_prim == MESA_PRIM_TRIANGLES_ADJACENCY; /* All these are in dwords: */ /* We can't allow using the whole LDS, because GS waves compete with diff --git a/src/broadcom/common/v3d_util.c b/src/broadcom/common/v3d_util.c index b36bff71326..57872a923d3 100644 --- a/src/broadcom/common/v3d_util.c +++ b/src/broadcom/common/v3d_util.c @@ -148,23 +148,23 @@ v3d_translate_pipe_swizzle(enum pipe_swizzle swizzle) * draw packets. */ uint32_t -v3d_hw_prim_type(enum pipe_prim_type prim_type) +v3d_hw_prim_type(enum mesa_prim prim_type) { switch (prim_type) { - case PIPE_PRIM_POINTS: - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_LOOP: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_POINTS: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: return prim_type; - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: - return 8 + (prim_type - PIPE_PRIM_LINES_ADJACENCY); + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: + return 8 + (prim_type - MESA_PRIM_LINES_ADJACENCY); default: unreachable("Unsupported primitive type"); diff --git a/src/broadcom/common/v3d_util.h b/src/broadcom/common/v3d_util.h index 2392f866415..eb802b77f67 100644 --- a/src/broadcom/common/v3d_util.h +++ b/src/broadcom/common/v3d_util.h @@ -44,6 +44,6 @@ uint32_t v3d_translate_pipe_swizzle(enum pipe_swizzle swizzle); uint32_t -v3d_hw_prim_type(enum pipe_prim_type prim_type); +v3d_hw_prim_type(enum mesa_prim prim_type); #endif diff --git a/src/broadcom/vulkan/v3dv_meta_clear.c b/src/broadcom/vulkan/v3dv_meta_clear.c index 54464011c01..3c7bd374529 100644 --- a/src/broadcom/vulkan/v3dv_meta_clear.c +++ b/src/broadcom/vulkan/v3dv_meta_clear.c @@ -352,8 +352,8 @@ get_clear_rect_gs(uint32_t push_constant_layer_base) nir->info.inputs_read = 1ull << VARYING_SLOT_POS; nir->info.outputs_written = (1ull << VARYING_SLOT_POS) | (1ull << VARYING_SLOT_LAYER); - nir->info.gs.input_primitive = SHADER_PRIM_TRIANGLES; - nir->info.gs.output_primitive = SHADER_PRIM_TRIANGLE_STRIP; + nir->info.gs.input_primitive = MESA_PRIM_TRIANGLES; + nir->info.gs.output_primitive = MESA_PRIM_TRIANGLE_STRIP; nir->info.gs.vertices_in = 3; nir->info.gs.vertices_out = 3; nir->info.gs.invocations = 1; diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c b/src/broadcom/vulkan/v3dv_meta_copy.c index dd02e16fc4e..247ae94a1fc 100644 --- a/src/broadcom/vulkan/v3dv_meta_copy.c +++ b/src/broadcom/vulkan/v3dv_meta_copy.c @@ -1861,8 +1861,8 @@ get_texel_buffer_copy_gs() nir->info.inputs_read = 1ull << VARYING_SLOT_POS; nir->info.outputs_written = (1ull << VARYING_SLOT_POS) | (1ull << VARYING_SLOT_LAYER); - nir->info.gs.input_primitive = SHADER_PRIM_TRIANGLES; - nir->info.gs.output_primitive = SHADER_PRIM_TRIANGLE_STRIP; + nir->info.gs.input_primitive = MESA_PRIM_TRIANGLES; + nir->info.gs.output_primitive = MESA_PRIM_TRIANGLE_STRIP; nir->info.gs.vertices_in = 3; nir->info.gs.vertices_out = 3; nir->info.gs.invocations = 1; diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index 1952d6a16b5..d574ff04854 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -1043,17 +1043,17 @@ pipeline_populate_v3d_key(struct v3d_key *key, /* FIXME: anv maps to hw primitive type. Perhaps eventually we would do the * same. For not using prim_mode that is the one already used on v3d */ -static const enum pipe_prim_type vk_to_pipe_prim_type[] = { - [VK_PRIMITIVE_TOPOLOGY_POINT_LIST] = PIPE_PRIM_POINTS, - [VK_PRIMITIVE_TOPOLOGY_LINE_LIST] = PIPE_PRIM_LINES, - [VK_PRIMITIVE_TOPOLOGY_LINE_STRIP] = PIPE_PRIM_LINE_STRIP, - [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST] = PIPE_PRIM_TRIANGLES, - [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP] = PIPE_PRIM_TRIANGLE_STRIP, - [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN] = PIPE_PRIM_TRIANGLE_FAN, - [VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY] = PIPE_PRIM_LINES_ADJACENCY, - [VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY] = PIPE_PRIM_LINE_STRIP_ADJACENCY, - [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY] = PIPE_PRIM_TRIANGLES_ADJACENCY, - [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY] = PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY, +static const enum mesa_prim vk_to_mesa_prim[] = { + [VK_PRIMITIVE_TOPOLOGY_POINT_LIST] = MESA_PRIM_POINTS, + [VK_PRIMITIVE_TOPOLOGY_LINE_LIST] = MESA_PRIM_LINES, + [VK_PRIMITIVE_TOPOLOGY_LINE_STRIP] = MESA_PRIM_LINE_STRIP, + [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST] = MESA_PRIM_TRIANGLES, + [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP] = MESA_PRIM_TRIANGLE_STRIP, + [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN] = MESA_PRIM_TRIANGLE_FAN, + [VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY] = MESA_PRIM_LINES_ADJACENCY, + [VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY] = MESA_PRIM_LINE_STRIP_ADJACENCY, + [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY] = MESA_PRIM_TRIANGLES_ADJACENCY, + [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY] = MESA_PRIM_TRIANGLE_STRIP_ADJACENCY, }; static const enum pipe_logicop vk_to_pipe_logicop[] = { @@ -1093,11 +1093,11 @@ pipeline_populate_v3d_fs_key(struct v3d_fs_key *key, const VkPipelineInputAssemblyStateCreateInfo *ia_info = pCreateInfo->pInputAssemblyState; - uint8_t topology = vk_to_pipe_prim_type[ia_info->topology]; + uint8_t topology = vk_to_mesa_prim[ia_info->topology]; - key->is_points = (topology == PIPE_PRIM_POINTS); - key->is_lines = (topology >= PIPE_PRIM_LINES && - topology <= PIPE_PRIM_LINE_STRIP); + key->is_points = (topology == MESA_PRIM_POINTS); + key->is_lines = (topology >= MESA_PRIM_LINES && + topology <= MESA_PRIM_LINE_STRIP); key->has_gs = has_geometry_shader; const VkPipelineColorBlendStateCreateInfo *cb_info = @@ -1264,11 +1264,11 @@ pipeline_populate_v3d_vs_key(struct v3d_vs_key *key, */ const VkPipelineInputAssemblyStateCreateInfo *ia_info = pCreateInfo->pInputAssemblyState; - uint8_t topology = vk_to_pipe_prim_type[ia_info->topology]; + uint8_t topology = vk_to_mesa_prim[ia_info->topology]; /* FIXME: PRIM_POINTS is not enough, in gallium the full check is - * PIPE_PRIM_POINTS && v3d->rasterizer->base.point_size_per_vertex */ - key->per_vertex_point_size = (topology == PIPE_PRIM_POINTS); + * MESA_PRIM_POINTS && v3d->rasterizer->base.point_size_per_vertex */ + key->per_vertex_point_size = (topology == MESA_PRIM_POINTS); key->is_coord = broadcom_shader_stage_is_binning(p_stage->stage); @@ -1928,7 +1928,7 @@ pipeline_populate_graphics_key(struct v3dv_pipeline *pipeline, const VkPipelineInputAssemblyStateCreateInfo *ia_info = pCreateInfo->pInputAssemblyState; - key->topology = vk_to_pipe_prim_type[ia_info->topology]; + key->topology = vk_to_mesa_prim[ia_info->topology]; const VkPipelineColorBlendStateCreateInfo *cb_info = raster_enabled ? pCreateInfo->pColorBlendState : NULL; @@ -2127,19 +2127,19 @@ write_creation_feedback(struct v3dv_pipeline *pipeline, } } -static enum shader_prim +static enum mesa_prim multiview_gs_input_primitive_from_pipeline(struct v3dv_pipeline *pipeline) { switch (pipeline->topology) { - case PIPE_PRIM_POINTS: - return SHADER_PRIM_POINTS; - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_STRIP: - return SHADER_PRIM_LINES; - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: - return SHADER_PRIM_TRIANGLES; + case MESA_PRIM_POINTS: + return MESA_PRIM_POINTS; + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_STRIP: + return MESA_PRIM_LINES; + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: + return MESA_PRIM_TRIANGLES; default: /* Since we don't allow GS with multiview, we can only see non-adjacency * primitives. @@ -2148,19 +2148,19 @@ multiview_gs_input_primitive_from_pipeline(struct v3dv_pipeline *pipeline) } } -static enum shader_prim +static enum mesa_prim multiview_gs_output_primitive_from_pipeline(struct v3dv_pipeline *pipeline) { switch (pipeline->topology) { - case PIPE_PRIM_POINTS: - return SHADER_PRIM_POINTS; - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_STRIP: - return SHADER_PRIM_LINE_STRIP; - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: - return SHADER_PRIM_TRIANGLE_STRIP; + case MESA_PRIM_POINTS: + return MESA_PRIM_POINTS; + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_STRIP: + return MESA_PRIM_LINE_STRIP; + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: + return MESA_PRIM_TRIANGLE_STRIP; default: /* Since we don't allow GS with multiview, we can only see non-adjacency * primitives. @@ -2906,7 +2906,7 @@ pipeline_init(struct v3dv_pipeline *pipeline, const VkPipelineInputAssemblyStateCreateInfo *ia_info = pCreateInfo->pInputAssemblyState; - pipeline->topology = vk_to_pipe_prim_type[ia_info->topology]; + pipeline->topology = vk_to_mesa_prim[ia_info->topology]; /* If rasterization is not enabled, various CreateInfo structs must be * ignored. diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index 359de317a71..b70cde0c7ba 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -2279,7 +2279,7 @@ struct v3dv_pipeline { } va[MAX_VERTEX_ATTRIBS]; uint32_t va_count; - enum pipe_prim_type topology; + enum mesa_prim topology; struct v3dv_pipeline_shared_data *shared_data; diff --git a/src/broadcom/vulkan/v3dvx_cmd_buffer.c b/src/broadcom/vulkan/v3dvx_cmd_buffer.c index 0c23a33b501..f500c5810f4 100644 --- a/src/broadcom/vulkan/v3dvx_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dvx_cmd_buffer.c @@ -1842,14 +1842,14 @@ emit_gs_shader_state_record(struct v3dv_job *job, } static uint8_t -v3d_gs_output_primitive(enum shader_prim prim_type) +v3d_gs_output_primitive(enum mesa_prim prim_type) { switch (prim_type) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return GEOMETRY_SHADER_POINTS; - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return GEOMETRY_SHADER_LINE_STRIP; - case SHADER_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return GEOMETRY_SHADER_TRI_STRIP; default: unreachable("Unsupported primitive type"); diff --git a/src/broadcom/vulkan/v3dvx_pipeline.c b/src/broadcom/vulkan/v3dvx_pipeline.c index 25ecbbb92d1..5d32d414ed8 100644 --- a/src/broadcom/vulkan/v3dvx_pipeline.c +++ b/src/broadcom/vulkan/v3dvx_pipeline.c @@ -384,7 +384,7 @@ pack_shader_state_record(struct v3dv_pipeline *pipeline) if (!pipeline->has_gs) { shader.point_size_in_shaded_vertex_data = - pipeline->topology == PIPE_PRIM_POINTS; + pipeline->topology == MESA_PRIM_POINTS; } else { struct v3d_gs_prog_data *prog_data_gs = pipeline->shared_data->variants[BROADCOM_SHADER_GEOMETRY]->prog_data.gs; diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 37b5554dffe..77e7f18827f 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1881,15 +1881,15 @@ set_shader_inout_layout(struct gl_shader *shader, } if (state->gs_input_prim_type_specified) { - shader->info.Geom.InputType = (enum shader_prim)state->in_qualifier->prim_type; + shader->info.Geom.InputType = (enum mesa_prim)state->in_qualifier->prim_type; } else { - shader->info.Geom.InputType = SHADER_PRIM_UNKNOWN; + shader->info.Geom.InputType = MESA_PRIM_UNKNOWN; } if (state->out_qualifier->flags.q.prim_type) { - shader->info.Geom.OutputType = (enum shader_prim)state->out_qualifier->prim_type; + shader->info.Geom.OutputType = (enum mesa_prim)state->out_qualifier->prim_type; } else { - shader->info.Geom.OutputType = SHADER_PRIM_UNKNOWN; + shader->info.Geom.OutputType = MESA_PRIM_UNKNOWN; } shader->info.Geom.Invocations = 0; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index c1807d4f6af..924c20b168f 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2060,8 +2060,8 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, int vertices_out = -1; gl_prog->info.gs.invocations = 0; - gl_prog->info.gs.input_primitive = SHADER_PRIM_UNKNOWN; - gl_prog->info.gs.output_primitive = SHADER_PRIM_UNKNOWN; + gl_prog->info.gs.input_primitive = MESA_PRIM_UNKNOWN; + gl_prog->info.gs.output_primitive = MESA_PRIM_UNKNOWN; /* From the GLSL 1.50 spec, page 46: * @@ -2076,26 +2076,26 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, for (unsigned i = 0; i < num_shaders; i++) { struct gl_shader *shader = shader_list[i]; - if (shader->info.Geom.InputType != SHADER_PRIM_UNKNOWN) { - if (gl_prog->info.gs.input_primitive != SHADER_PRIM_UNKNOWN && + if (shader->info.Geom.InputType != MESA_PRIM_UNKNOWN) { + if (gl_prog->info.gs.input_primitive != MESA_PRIM_UNKNOWN && gl_prog->info.gs.input_primitive != shader->info.Geom.InputType) { linker_error(prog, "geometry shader defined with conflicting " "input types\n"); return; } - gl_prog->info.gs.input_primitive = (enum shader_prim)shader->info.Geom.InputType; + gl_prog->info.gs.input_primitive = (enum mesa_prim)shader->info.Geom.InputType; } - if (shader->info.Geom.OutputType != SHADER_PRIM_UNKNOWN) { - if (gl_prog->info.gs.output_primitive != SHADER_PRIM_UNKNOWN && + if (shader->info.Geom.OutputType != MESA_PRIM_UNKNOWN) { + if (gl_prog->info.gs.output_primitive != MESA_PRIM_UNKNOWN && gl_prog->info.gs.output_primitive != shader->info.Geom.OutputType) { linker_error(prog, "geometry shader defined with conflicting " "output types\n"); return; } - gl_prog->info.gs.output_primitive = (enum shader_prim)shader->info.Geom.OutputType; + gl_prog->info.gs.output_primitive = (enum mesa_prim)shader->info.Geom.OutputType; } if (shader->info.Geom.VerticesOut != -1) { @@ -2127,13 +2127,13 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, * since we already know we're in the right type of shader program * for doing it. */ - if (gl_prog->info.gs.input_primitive == SHADER_PRIM_UNKNOWN) { + if (gl_prog->info.gs.input_primitive == MESA_PRIM_UNKNOWN) { linker_error(prog, "geometry shader didn't declare primitive input type\n"); return; } - if (gl_prog->info.gs.output_primitive == SHADER_PRIM_UNKNOWN) { + if (gl_prog->info.gs.output_primitive == MESA_PRIM_UNKNOWN) { linker_error(prog, "geometry shader didn't declare primitive output type\n"); return; diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index c1ec8d49dda..07b0f71957b 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -5242,7 +5242,7 @@ nir_shader * nir_create_passthrough_tcs(const nir_shader_compiler_options *optio const nir_shader *vs, uint8_t patch_vertices); nir_shader * nir_create_passthrough_gs(const nir_shader_compiler_options *options, const nir_shader *prev_stage, - enum shader_prim primitive_type, + enum mesa_prim primitive_type, bool emulate_edgeflags, bool force_line_strip_out); diff --git a/src/compiler/nir/nir_lower_gs_intrinsics.c b/src/compiler/nir/nir_lower_gs_intrinsics.c index 84b8ddda2fb..1308447e89b 100644 --- a/src/compiler/nir/nir_lower_gs_intrinsics.c +++ b/src/compiler/nir/nir_lower_gs_intrinsics.c @@ -150,14 +150,14 @@ overwrite_incomplete_primitives(struct state *state, unsigned stream) assert(state->count_vtx_per_prim); nir_builder *b = state->builder; - enum shader_prim outprim = b->shader->info.gs.output_primitive; + enum mesa_prim outprim = b->shader->info.gs.output_primitive; unsigned outprim_min_vertices; - if (outprim == SHADER_PRIM_POINTS) + if (outprim == MESA_PRIM_POINTS) outprim_min_vertices = 1; - else if (outprim == SHADER_PRIM_LINE_STRIP) + else if (outprim == MESA_PRIM_LINE_STRIP) outprim_min_vertices = 2; - else if (outprim == SHADER_PRIM_TRIANGLE_STRIP) + else if (outprim == MESA_PRIM_TRIANGLE_STRIP) outprim_min_vertices = 3; else unreachable("Invalid GS output primitive type."); @@ -373,7 +373,7 @@ nir_lower_gs_intrinsics(nir_shader *shader, nir_lower_gs_intrinsics_flags option overwrite_incomplete || (options & nir_lower_gs_intrinsics_count_vertices_per_primitive); - bool is_points = shader->info.gs.output_primitive == SHADER_PRIM_POINTS; + bool is_points = shader->info.gs.output_primitive == MESA_PRIM_POINTS; /* points are always complete primitives with a single vertex, so these are * not needed when primitive is points. */ diff --git a/src/compiler/nir/nir_passthrough_gs.c b/src/compiler/nir/nir_passthrough_gs.c index f24ac7124fb..06a14f0f2cd 100644 --- a/src/compiler/nir/nir_passthrough_gs.c +++ b/src/compiler/nir/nir_passthrough_gs.c @@ -27,96 +27,96 @@ #include "util/u_memory.h" static unsigned int -gs_in_prim_for_topology(enum shader_prim prim) +gs_in_prim_for_topology(enum mesa_prim prim) { switch (prim) { - case SHADER_PRIM_QUADS: - return SHADER_PRIM_LINES_ADJACENCY; + case MESA_PRIM_QUADS: + return MESA_PRIM_LINES_ADJACENCY; default: return prim; } } -static enum shader_prim -gs_out_prim_for_topology(enum shader_prim prim) +static enum mesa_prim +gs_out_prim_for_topology(enum mesa_prim prim) { switch (prim) { - case SHADER_PRIM_POINTS: - return SHADER_PRIM_POINTS; - case SHADER_PRIM_LINES: - case SHADER_PRIM_LINE_LOOP: - case SHADER_PRIM_LINES_ADJACENCY: - case SHADER_PRIM_LINE_STRIP_ADJACENCY: - case SHADER_PRIM_LINE_STRIP: - return SHADER_PRIM_LINE_STRIP; - case SHADER_PRIM_TRIANGLES: - case SHADER_PRIM_TRIANGLE_STRIP: - case SHADER_PRIM_TRIANGLE_FAN: - case SHADER_PRIM_TRIANGLES_ADJACENCY: - case SHADER_PRIM_TRIANGLE_STRIP_ADJACENCY: - case SHADER_PRIM_POLYGON: - return SHADER_PRIM_TRIANGLE_STRIP; - case SHADER_PRIM_QUADS: - case SHADER_PRIM_QUAD_STRIP: - case SHADER_PRIM_PATCHES: + case MESA_PRIM_POINTS: + return MESA_PRIM_POINTS; + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINE_STRIP: + return MESA_PRIM_LINE_STRIP; + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_POLYGON: + return MESA_PRIM_TRIANGLE_STRIP; + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: + case MESA_PRIM_PATCHES: default: - return SHADER_PRIM_QUADS; + return MESA_PRIM_QUADS; } } static unsigned int -vertices_for_prim(enum shader_prim prim) +vertices_for_prim(enum mesa_prim prim) { switch (prim) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return 1; - case SHADER_PRIM_LINES: - case SHADER_PRIM_LINE_LOOP: - case SHADER_PRIM_LINES_ADJACENCY: - case SHADER_PRIM_LINE_STRIP_ADJACENCY: - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINE_STRIP: return 2; - case SHADER_PRIM_TRIANGLES: - case SHADER_PRIM_TRIANGLE_STRIP: - case SHADER_PRIM_TRIANGLE_FAN: - case SHADER_PRIM_TRIANGLES_ADJACENCY: - case SHADER_PRIM_TRIANGLE_STRIP_ADJACENCY: - case SHADER_PRIM_POLYGON: + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_POLYGON: return 3; - case SHADER_PRIM_QUADS: - case SHADER_PRIM_QUAD_STRIP: + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: return 4; - case SHADER_PRIM_PATCHES: + case MESA_PRIM_PATCHES: default: unreachable("unsupported primitive for gs input"); } } static unsigned int -array_size_for_prim(enum shader_prim prim) +array_size_for_prim(enum mesa_prim prim) { switch (prim) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return 1; - case SHADER_PRIM_LINES: - case SHADER_PRIM_LINE_LOOP: - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_STRIP: return 2; - case SHADER_PRIM_LINES_ADJACENCY: - case SHADER_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: return 4; - case SHADER_PRIM_TRIANGLES: - case SHADER_PRIM_TRIANGLE_STRIP: - case SHADER_PRIM_TRIANGLE_FAN: - case SHADER_PRIM_POLYGON: + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: + case MESA_PRIM_POLYGON: return 3; - case SHADER_PRIM_TRIANGLES_ADJACENCY: - case SHADER_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: return 6; - case SHADER_PRIM_QUADS: - case SHADER_PRIM_QUAD_STRIP: + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: return 4; - case SHADER_PRIM_PATCHES: + case MESA_PRIM_PATCHES: default: unreachable("unsupported primitive for gs input"); } @@ -149,14 +149,14 @@ copy_vars(nir_builder *b, nir_deref_instr *dst, nir_deref_instr *src) nir_shader * nir_create_passthrough_gs(const nir_shader_compiler_options *options, const nir_shader *prev_stage, - enum shader_prim primitive_type, + enum mesa_prim primitive_type, bool emulate_edgeflags, bool force_line_strip_out) { unsigned int vertices_out = vertices_for_prim(primitive_type); emulate_edgeflags = emulate_edgeflags && (prev_stage->info.outputs_written & VARYING_BIT_EDGE); bool needs_closing = (force_line_strip_out || emulate_edgeflags) && vertices_out >= 3; - enum shader_prim original_our_prim = gs_out_prim_for_topology(primitive_type); + enum mesa_prim original_our_prim = gs_out_prim_for_topology(primitive_type); nir_builder b = nir_builder_init_simple_shader(MESA_SHADER_GEOMETRY, options, "gs passthrough"); @@ -164,7 +164,7 @@ nir_create_passthrough_gs(const nir_shader_compiler_options *options, nir_shader *nir = b.shader; nir->info.gs.input_primitive = gs_in_prim_for_topology(primitive_type); nir->info.gs.output_primitive = (force_line_strip_out || emulate_edgeflags) ? - SHADER_PRIM_LINE_STRIP : original_our_prim; + MESA_PRIM_LINE_STRIP : original_our_prim; nir->info.gs.vertices_in = vertices_out; nir->info.gs.vertices_out = needs_closing ? vertices_out + 1 : vertices_out; nir->info.gs.invocations = 1; @@ -176,7 +176,7 @@ nir_create_passthrough_gs(const nir_shader_compiler_options *options, nir->xfb_info = mem_dup(prev_stage->xfb_info, sizeof(nir_xfb_info)); } - bool handle_flat = nir->info.gs.output_primitive == SHADER_PRIM_LINE_STRIP && + bool handle_flat = nir->info.gs.output_primitive == MESA_PRIM_LINE_STRIP && nir->info.gs.output_primitive != original_our_prim; nir_variable *in_vars[VARYING_SLOT_MAX * 4]; nir_variable *out_vars[VARYING_SLOT_MAX * 4]; @@ -231,13 +231,13 @@ nir_create_passthrough_gs(const nir_shader_compiler_options *options, unsigned int end_vert = vertices_out; unsigned int vert_step = 1; switch (primitive_type) { - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: start_vert = 1; end_vert += 1; break; - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: end_vert = 5; vert_step = 2; break; diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index f0a79d07f5c..68a46ed747d 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -1810,7 +1810,7 @@ destroy_print_state(print_state *state) static const char * primitive_name(unsigned primitive) { -#define PRIM(X) case SHADER_PRIM_ ## X : return #X +#define PRIM(X) case MESA_PRIM_ ## X : return #X switch (primitive) { PRIM(POINTS); PRIM(LINES); diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c index 112196cfeb6..55e8cbd1788 100644 --- a/src/compiler/shader_enums.c +++ b/src/compiler/shader_enums.c @@ -435,11 +435,11 @@ unsigned num_mesh_vertices_per_primitive(unsigned prim) { switch (prim) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return 1; - case SHADER_PRIM_LINES: + case MESA_PRIM_LINES: return 2; - case SHADER_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return 3; default: unreachable("invalid mesh shader primitive type"); diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 1a3d8541c51..eddd773022c 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -1150,27 +1150,29 @@ enum tess_primitive_mode TESS_PRIMITIVE_ISOLINES, }; -/* these also map directly to GL and gallium prim types. */ -enum PACKED shader_prim +/** + * Mesa primitive types for both GL and Vulkan: + */ +enum PACKED mesa_prim { - SHADER_PRIM_POINTS, - SHADER_PRIM_LINES, - SHADER_PRIM_LINE_LOOP, - SHADER_PRIM_LINE_STRIP, - SHADER_PRIM_TRIANGLES, - SHADER_PRIM_TRIANGLE_STRIP, - SHADER_PRIM_TRIANGLE_FAN, - SHADER_PRIM_QUADS, - SHADER_PRIM_QUAD_STRIP, - SHADER_PRIM_POLYGON, - SHADER_PRIM_LINES_ADJACENCY, - SHADER_PRIM_LINE_STRIP_ADJACENCY, - SHADER_PRIM_TRIANGLES_ADJACENCY, - SHADER_PRIM_TRIANGLE_STRIP_ADJACENCY, - SHADER_PRIM_PATCHES, - SHADER_PRIM_MAX = SHADER_PRIM_PATCHES, - SHADER_PRIM_COUNT = SHADER_PRIM_MAX +1, - SHADER_PRIM_UNKNOWN = (SHADER_PRIM_MAX * 2), + MESA_PRIM_POINTS, + MESA_PRIM_LINES, + MESA_PRIM_LINE_LOOP, + MESA_PRIM_LINE_STRIP, + MESA_PRIM_TRIANGLES, + MESA_PRIM_TRIANGLE_STRIP, + MESA_PRIM_TRIANGLE_FAN, + MESA_PRIM_QUADS, + MESA_PRIM_QUAD_STRIP, + MESA_PRIM_POLYGON, + MESA_PRIM_LINES_ADJACENCY, + MESA_PRIM_LINE_STRIP_ADJACENCY, + MESA_PRIM_TRIANGLES_ADJACENCY, + MESA_PRIM_TRIANGLE_STRIP_ADJACENCY, + MESA_PRIM_PATCHES, + MESA_PRIM_MAX = MESA_PRIM_PATCHES, + MESA_PRIM_COUNT = MESA_PRIM_MAX +1, + MESA_PRIM_UNKNOWN = (MESA_PRIM_MAX * 2), }; /** diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index a754b8c99a9..b672b11e708 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -4506,30 +4506,30 @@ tess_primitive_mode_from_spv_execution_mode(struct vtn_builder *b, } } -static enum shader_prim +static enum mesa_prim primitive_from_spv_execution_mode(struct vtn_builder *b, SpvExecutionMode mode) { switch (mode) { case SpvExecutionModeInputPoints: case SpvExecutionModeOutputPoints: - return SHADER_PRIM_POINTS; + return MESA_PRIM_POINTS; case SpvExecutionModeInputLines: case SpvExecutionModeOutputLinesNV: - return SHADER_PRIM_LINES; + return MESA_PRIM_LINES; case SpvExecutionModeInputLinesAdjacency: - return SHADER_PRIM_LINES_ADJACENCY; + return MESA_PRIM_LINES_ADJACENCY; case SpvExecutionModeTriangles: case SpvExecutionModeOutputTrianglesNV: - return SHADER_PRIM_TRIANGLES; + return MESA_PRIM_TRIANGLES; case SpvExecutionModeInputTrianglesAdjacency: - return SHADER_PRIM_TRIANGLES_ADJACENCY; + return MESA_PRIM_TRIANGLES_ADJACENCY; case SpvExecutionModeQuads: - return SHADER_PRIM_QUADS; + return MESA_PRIM_QUADS; case SpvExecutionModeOutputLineStrip: - return SHADER_PRIM_LINE_STRIP; + return MESA_PRIM_LINE_STRIP; case SpvExecutionModeOutputTriangleStrip: - return SHADER_PRIM_TRIANGLE_STRIP; + return MESA_PRIM_TRIANGLE_STRIP; default: vtn_fail("Invalid primitive type: %s (%u)", spirv_executionmode_to_string(mode), mode); diff --git a/src/freedreno/vulkan/tu_pipeline.cc b/src/freedreno/vulkan/tu_pipeline.cc index 51efd3efad0..07dfe0e9b16 100644 --- a/src/freedreno/vulkan/tu_pipeline.cc +++ b/src/freedreno/vulkan/tu_pipeline.cc @@ -1005,13 +1005,13 @@ tu6_emit_link_map(struct tu_cs *cs, } static enum a6xx_tess_output -primitive_to_tess(enum shader_prim primitive) { +primitive_to_tess(enum mesa_prim primitive) { switch (primitive) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return TESS_POINTS; - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return TESS_LINES; - case SHADER_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return TESS_CW_TRIS; default: unreachable(""); @@ -1440,7 +1440,7 @@ tu6_emit_vpc(struct tu_cs *cs, tu6_emit_link_map(cs, vs, gs, SB6_GS_SHADER); } vertices_out = gs->gs.vertices_out - 1; - enum a6xx_tess_output output = primitive_to_tess((enum shader_prim) gs->gs.output_primitive); + enum a6xx_tess_output output = primitive_to_tess((enum mesa_prim) gs->gs.output_primitive); invocations = gs->gs.invocations - 1; /* Size of per-primitive alloction in ldlw memory in vec4s. */ vec4_size = gs->gs.vertices_in * diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 69935740409..6e9717bbe02 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -1301,7 +1301,7 @@ draw_will_inject_frontface(const struct draw_context *draw) unsigned reduced_prim = u_reduced_prim(draw->pt.prim); const struct pipe_rasterizer_state *rast = draw->rasterizer; - if (reduced_prim != PIPE_PRIM_TRIANGLES) { + if (reduced_prim != MESA_PRIM_TRIANGLES) { return FALSE; } diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index c5a76e7ad87..002675395c7 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -367,7 +367,7 @@ draw_collect_primitives_generated(struct draw_context *draw, boolean draw_need_pipeline(const struct draw_context *draw, const struct pipe_rasterizer_state *rasterizer, - enum pipe_prim_type prim); + enum mesa_prim prim); int draw_get_shader_param(enum pipe_shader_type shader, enum pipe_shader_cap param); diff --git a/src/gallium/auxiliary/draw/draw_decompose_tmp.h b/src/gallium/auxiliary/draw/draw_decompose_tmp.h index 344c90ae980..c5e5e011779 100644 --- a/src/gallium/auxiliary/draw/draw_decompose_tmp.h +++ b/src/gallium/auxiliary/draw/draw_decompose_tmp.h @@ -60,14 +60,14 @@ FUNC(FUNC_VARS) } switch (prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: for (i = 0; i < count; i++) { idx[0] = GET_ELT(i); POINT(idx[0]); } break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: flags = DRAW_PIPE_RESET_STIPPLE; for (i = 0; i + 1 < count; i += 2) { idx[0] = GET_ELT(i); @@ -76,8 +76,8 @@ FUNC(FUNC_VARS) } break; - case PIPE_PRIM_LINE_LOOP: - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_STRIP: if (count >= 2) { flags = (prim_flags & DRAW_SPLIT_BEFORE) ? 0 : DRAW_PIPE_RESET_STIPPLE; idx[1] = GET_ELT(0); @@ -89,12 +89,12 @@ FUNC(FUNC_VARS) LINE(flags, idx[0], idx[1]); } /* close the loop */ - if (prim == PIPE_PRIM_LINE_LOOP && !prim_flags) + if (prim == MESA_PRIM_LINE_LOOP && !prim_flags) LINE(flags, idx[1], idx[2]); } break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: flags = DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL; for (i = 0; i + 2 < count; i += 3) { idx[0] = GET_ELT(i); @@ -104,7 +104,7 @@ FUNC(FUNC_VARS) } break; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: if (count >= 3) { flags = DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL; idx[1] = GET_ELT(0); @@ -137,7 +137,7 @@ FUNC(FUNC_VARS) } break; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: if (count >= 3) { flags = DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL; idx[0] = GET_ELT(0); @@ -163,7 +163,7 @@ FUNC(FUNC_VARS) } break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: if (last_vertex_last) { for (i = 0; i + 3 < count; i += 4) { idx[0] = GET_ELT(i); @@ -216,7 +216,7 @@ FUNC(FUNC_VARS) } break; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: if (count >= 4) { idx[2] = GET_ELT(0); idx[3] = GET_ELT(1); @@ -276,7 +276,7 @@ FUNC(FUNC_VARS) } break; - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: if (count >= 3) { ushort edge_next, edge_finish; @@ -320,7 +320,7 @@ FUNC(FUNC_VARS) } break; - case PIPE_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: flags = DRAW_PIPE_RESET_STIPPLE; for (i = 0; i + 3 < count; i += 4) { idx[0] = GET_ELT(i); @@ -331,7 +331,7 @@ FUNC(FUNC_VARS) } break; - case PIPE_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: if (count >= 4) { flags = (prim_flags & DRAW_SPLIT_BEFORE) ? 0 : DRAW_PIPE_RESET_STIPPLE; idx[1] = GET_ELT(0); @@ -348,7 +348,7 @@ FUNC(FUNC_VARS) } break; - case PIPE_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: flags = DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL; for (i = 0; i + 5 < count; i += 6) { idx[0] = GET_ELT(i); @@ -361,7 +361,7 @@ FUNC(FUNC_VARS) } break; - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: if (count >= 6) { flags = DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL; idx[0] = GET_ELT(1); diff --git a/src/gallium/auxiliary/draw/draw_gs_tmp.h b/src/gallium/auxiliary/draw/draw_gs_tmp.h index 50a784bf920..9f27bf9d1c1 100644 --- a/src/gallium/auxiliary/draw/draw_gs_tmp.h +++ b/src/gallium/auxiliary/draw/draw_gs_tmp.h @@ -13,9 +13,9 @@ const boolean last_vertex_last = !gs->draw->rasterizer->flatshade_first; \ do { \ switch (prim) { \ - case PIPE_PRIM_QUADS: \ - case PIPE_PRIM_QUAD_STRIP: \ - case PIPE_PRIM_POLYGON: \ + case MESA_PRIM_QUADS: \ + case MESA_PRIM_QUAD_STRIP: \ + case MESA_PRIM_POLYGON: \ assert(!"unexpected primitive type in GS"); \ return; \ default: \ diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index d395b23154d..bd05de202ae 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -3665,7 +3665,7 @@ draw_tes_llvm_generate(struct draw_llvm *llvm, LLVMValueRef idx = LLVMBuildAdd(builder, lp_loop.counter, lp_build_const_int32(gallivm, j), ""); LLVMValueRef tc_val; if (i == 2) { - if (variant->shader->base.prim_mode == PIPE_PRIM_TRIANGLES) { + if (variant->shader->base.prim_mode == MESA_PRIM_TRIANGLES) { tc_val = lp_build_const_float(gallivm, 1.0); tc_val = LLVMBuildFSub(builder, tc_val, lp_build_pointer_get2(builder, flt_type, tess_coord[0], idx), ""); tc_val = LLVMBuildFSub(builder, tc_val, lp_build_pointer_get2(builder, flt_type, tess_coord[1], idx), ""); diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index 2a7f4224516..bbbae8461d3 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -206,7 +206,7 @@ do_triangle(struct draw_context *draw, #define FUNC pipe_run_elts #define FUNC_VARS \ struct draw_context *draw, \ - enum pipe_prim_type prim, \ + enum mesa_prim prim, \ unsigned prim_flags, \ struct vertex_header *vertices, \ unsigned stride, \ @@ -304,7 +304,7 @@ draw_pipeline_run(struct draw_context *draw, #define FUNC pipe_run_linear #define FUNC_VARS \ struct draw_context *draw, \ - enum pipe_prim_type prim, \ + enum mesa_prim prim, \ unsigned prim_flags, \ struct vertex_header *vertices, \ unsigned stride, \ diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c index e78bacd958e..32f7b635418 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_validate.c +++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c @@ -49,7 +49,7 @@ boolean draw_need_pipeline(const struct draw_context *draw, const struct pipe_rasterizer_state *rasterizer, - enum pipe_prim_type prim) + enum mesa_prim prim) { unsigned reduced_prim = u_reduced_prim(prim); @@ -63,7 +63,7 @@ draw_need_pipeline(const struct draw_context *draw, * and triggering the pipeline, because we have to trigger the * pipeline *anyway* if unfilled mode is active. */ - if (reduced_prim == PIPE_PRIM_LINES) { + if (reduced_prim == MESA_PRIM_LINES) { /* line stipple */ if (rasterizer->line_stipple_enable && draw->pipeline.line_stipple) return TRUE; @@ -78,7 +78,7 @@ draw_need_pipeline(const struct draw_context *draw, if (draw_current_shader_num_written_culldistances(draw)) return TRUE; - } else if (reduced_prim == PIPE_PRIM_POINTS) { + } else if (reduced_prim == MESA_PRIM_POINTS) { /* large points */ if (rasterizer->point_size > draw->pipeline.wide_point_threshold) return TRUE; @@ -98,7 +98,7 @@ draw_need_pipeline(const struct draw_context *draw, if (draw_current_shader_num_written_culldistances(draw)) return TRUE; - } else if (reduced_prim == PIPE_PRIM_TRIANGLES) { + } else if (reduced_prim == MESA_PRIM_TRIANGLES) { /* polygon stipple */ if (rasterizer->poly_stipple_enable && draw->pipeline.pstipple) return TRUE; diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c index ea180fb13f2..c6a5bc3c3bb 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c +++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c @@ -270,7 +270,7 @@ vbuf_first_tri(struct draw_stage *stage, struct prim_header *prim) struct vbuf_stage *vbuf = vbuf_stage(stage); vbuf_flush_vertices(vbuf); - vbuf_start_prim(vbuf, PIPE_PRIM_TRIANGLES); + vbuf_start_prim(vbuf, MESA_PRIM_TRIANGLES); stage->tri = vbuf_tri; stage->tri(stage, prim); } @@ -282,7 +282,7 @@ vbuf_first_line(struct draw_stage *stage, struct prim_header *prim) struct vbuf_stage *vbuf = vbuf_stage(stage); vbuf_flush_vertices(vbuf); - vbuf_start_prim(vbuf, PIPE_PRIM_LINES); + vbuf_start_prim(vbuf, MESA_PRIM_LINES); stage->line = vbuf_line; stage->line(stage, prim); } @@ -294,7 +294,7 @@ vbuf_first_point(struct draw_stage *stage, struct prim_header *prim) struct vbuf_stage *vbuf = vbuf_stage(stage); vbuf_flush_vertices(vbuf); - vbuf_start_prim(vbuf, PIPE_PRIM_POINTS); + vbuf_start_prim(vbuf, MESA_PRIM_POINTS); stage->point = vbuf_point; stage->point(stage, prim); } diff --git a/src/gallium/auxiliary/draw/draw_prim_assembler.c b/src/gallium/auxiliary/draw/draw_prim_assembler.c index 8444b78c710..7db6e8557e2 100644 --- a/src/gallium/auxiliary/draw/draw_prim_assembler.c +++ b/src/gallium/auxiliary/draw/draw_prim_assembler.c @@ -82,10 +82,10 @@ draw_prim_assembler_is_required(const struct draw_context *draw, if (draw_current_shader_uses_viewport_index(draw)) return TRUE; switch (prim_info->prim) { - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: return TRUE; default: return needs_primid(draw); @@ -255,8 +255,8 @@ draw_prim_assembler_prepare_outputs(struct draw_assembler *ia) /* * Primitive assembler breaks up adjacency primitives and assembles * the base primitives they represent, e.g. vertices forming - * PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY - * become vertices forming PIPE_PRIM_TRIANGLES + * MESA_PRIM_TRIANGLE_STRIP_ADJACENCY + * become vertices forming MESA_PRIM_TRIANGLES * This is needed because specification says that the adjacency * primitives are only visible in the geometry shader so we need * to get rid of them so that the rest of the pipeline can @@ -271,9 +271,9 @@ draw_prim_assembler_run(struct draw_context *draw, { struct draw_assembler *asmblr = draw->ia; unsigned start, i; - unsigned assembled_prim = (input_prims->prim == PIPE_PRIM_QUADS || - input_prims->prim == PIPE_PRIM_QUAD_STRIP) ? - PIPE_PRIM_QUADS : u_reduced_prim(input_prims->prim); + unsigned assembled_prim = (input_prims->prim == MESA_PRIM_QUADS || + input_prims->prim == MESA_PRIM_QUAD_STRIP) ? + MESA_PRIM_QUADS : u_reduced_prim(input_prims->prim); unsigned max_primitives = u_decomposed_prims_for_vertices( input_prims->prim, input_prims->count); unsigned max_verts = u_vertices_per_prim(assembled_prim) * max_primitives; diff --git a/src/gallium/auxiliary/draw/draw_prim_assembler_tmp.h b/src/gallium/auxiliary/draw/draw_prim_assembler_tmp.h index 8f68050906c..4974a1232aa 100644 --- a/src/gallium/auxiliary/draw/draw_prim_assembler_tmp.h +++ b/src/gallium/auxiliary/draw/draw_prim_assembler_tmp.h @@ -7,11 +7,11 @@ #define FUNC_ENTER \ /* declare more local vars */ \ - const enum pipe_prim_type prim = input_prims->prim; \ + const enum mesa_prim prim = input_prims->prim; \ const unsigned prim_flags = input_prims->flags; \ const boolean last_vertex_last = !asmblr->draw->rasterizer->flatshade_first; \ switch (prim) { \ - case PIPE_PRIM_POLYGON: \ + case MESA_PRIM_POLYGON: \ assert(!"unexpected primitive type in prim assembler"); \ return; \ default: \ diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index af34147bebc..2357637f727 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -164,7 +164,7 @@ struct draw_context struct { /* Current active frontend */ struct draw_pt_front_end *frontend; - enum pipe_prim_type prim; + enum mesa_prim prim; unsigned opt; /**< bitmask of PT_x flags */ unsigned eltSize; /* saved eltSize for flushing */ unsigned viewid; /* saved viewid for flushing */ @@ -441,7 +441,7 @@ struct draw_prim_info { const ushort *elts; unsigned count; - enum pipe_prim_type prim; + enum mesa_prim prim; unsigned flags; unsigned *primitive_lengths; unsigned primitive_count; diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 3d5d5f08882..285832ecec6 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -56,12 +56,12 @@ DEBUG_GET_ONCE_BOOL_OPTION(draw_no_fse, "DRAW_NO_FSE", FALSE) */ static boolean draw_pt_arrays(struct draw_context *draw, - enum pipe_prim_type prim, + enum mesa_prim prim, bool index_bias_varies, const struct pipe_draw_start_count_bias *draw_info, unsigned num_draws) { - enum pipe_prim_type out_prim = prim; + enum mesa_prim out_prim = prim; if (draw->gs.geometry_shader) out_prim = draw->gs.geometry_shader->output_primitive; @@ -137,7 +137,7 @@ draw_pt_arrays(struct draw_context *draw, */ unsigned first, incr; - if (prim == PIPE_PRIM_PATCHES) { + if (prim == MESA_PRIM_PATCHES) { first = draw->pt.vertices_per_patch; incr = draw->pt.vertices_per_patch; } else { @@ -243,7 +243,7 @@ draw_pt_destroy(struct draw_context *draw) * Debug- print the first 'count' vertices. */ static void -draw_print_arrays(struct draw_context *draw, enum pipe_prim_type prim, +draw_print_arrays(struct draw_context *draw, enum mesa_prim prim, int start, uint count, int index_bias) { debug_printf("Draw arrays(prim = %u, start = %u, count = %u)\n", diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 2b7092b2e10..a6c21522a4b 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -65,7 +65,7 @@ struct draw_vertex_info; */ struct draw_pt_front_end { void (*prepare)(struct draw_pt_front_end *, - enum pipe_prim_type prim, + enum mesa_prim prim, struct draw_pt_middle_end *, unsigned opt); @@ -89,7 +89,7 @@ struct draw_pt_front_end { */ struct draw_pt_middle_end { void (*prepare)(struct draw_pt_middle_end *, - enum pipe_prim_type prim, + enum mesa_prim prim, unsigned opt, unsigned *max_vertices); @@ -161,7 +161,7 @@ struct pt_emit; void draw_pt_emit_prepare(struct pt_emit *emit, - enum pipe_prim_type prim, + enum mesa_prim prim, unsigned *max_vertices); void @@ -263,7 +263,7 @@ draw_pt_post_vs_destroy(struct pt_post_vs *pvs); * Utils: */ void -draw_pt_split_prim(enum pipe_prim_type prim, unsigned *first, unsigned *incr); +draw_pt_split_prim(enum mesa_prim prim, unsigned *first, unsigned *incr); unsigned draw_pt_trim_count(unsigned count, unsigned first, unsigned incr); diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c index 4027d68a802..ebf6d5e2613 100644 --- a/src/gallium/auxiliary/draw/draw_pt_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_emit.c @@ -51,7 +51,7 @@ struct pt_emit { void draw_pt_emit_prepare(struct pt_emit *emit, - enum pipe_prim_type prim, + enum mesa_prim prim, unsigned *max_vertices) { struct draw_context *draw = emit->draw; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c index 69461e0a3a5..9f20b8a640c 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c @@ -67,7 +67,7 @@ struct fetch_shade_emit { static void fse_prepare(struct draw_pt_middle_end *middle, - enum pipe_prim_type prim, + enum mesa_prim prim, unsigned opt, unsigned *max_vertices) { diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 3b3921b39cb..3e494361cd3 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -68,7 +68,7 @@ fetch_pipeline_middle_end(struct draw_pt_middle_end *middle) */ static void fetch_pipeline_prepare(struct draw_pt_middle_end *middle, - enum pipe_prim_type prim, + enum mesa_prim prim, unsigned opt, unsigned *max_vertices) { @@ -83,8 +83,8 @@ fetch_pipeline_prepare(struct draw_pt_middle_end *middle, unsigned nr = MAX2(vs->info.num_inputs, nr_vs_outputs); unsigned point_line_clip = draw->rasterizer->fill_front == PIPE_POLYGON_MODE_POINT || draw->rasterizer->fill_front == PIPE_POLYGON_MODE_LINE || - gs_out_prim == PIPE_PRIM_POINTS || - gs_out_prim == PIPE_PRIM_LINE_STRIP; + gs_out_prim == MESA_PRIM_POINTS || + gs_out_prim == MESA_PRIM_LINE_STRIP; if (gs) { nr = MAX2(nr, gs->info.num_outputs + 1); @@ -372,7 +372,7 @@ static inline unsigned prim_type(unsigned prim, unsigned flags) { if (flags & DRAW_LINE_LOOP_AS_STRIP) - return PIPE_PRIM_LINE_STRIP; + return MESA_PRIM_LINE_STRIP; else return prim; } diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index df49268cab5..3672755d12e 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -53,7 +53,7 @@ struct llvm_middle_end { unsigned vertex_data_offset; unsigned vertex_size; - enum pipe_prim_type input_prim; + enum mesa_prim input_prim; unsigned opt; struct draw_llvm *llvm; @@ -275,7 +275,7 @@ llvm_middle_end_prepare_tes(struct llvm_middle_end *fpme) */ static void llvm_middle_end_prepare(struct draw_pt_middle_end *middle, - enum pipe_prim_type in_prim, + enum mesa_prim in_prim, unsigned opt, unsigned *max_vertices) { @@ -286,13 +286,13 @@ llvm_middle_end_prepare(struct draw_pt_middle_end *middle, struct draw_geometry_shader *gs = draw->gs.geometry_shader; struct draw_tess_ctrl_shader *tcs = draw->tcs.tess_ctrl_shader; struct draw_tess_eval_shader *tes = draw->tes.tess_eval_shader; - const enum pipe_prim_type out_prim = + const enum mesa_prim out_prim = gs ? gs->output_primitive : tes ? get_tes_output_prim(tes) : u_assembled_prim(in_prim); unsigned point_line_clip = draw->rasterizer->fill_front == PIPE_POLYGON_MODE_POINT || draw->rasterizer->fill_front == PIPE_POLYGON_MODE_LINE || - out_prim == PIPE_PRIM_POINTS || - u_reduced_prim(out_prim) == PIPE_PRIM_LINES; + out_prim == MESA_PRIM_POINTS || + u_reduced_prim(out_prim) == MESA_PRIM_LINES; fpme->input_prim = in_prim; fpme->opt = opt; @@ -585,7 +585,7 @@ llvm_pipeline_generic(struct draw_pt_middle_end *middle, if (draw->collect_statistics) { draw->statistics.ia_vertices += prim_info->count; - if (prim_info->prim == PIPE_PRIM_PATCHES) + if (prim_info->prim == MESA_PRIM_PATCHES) draw->statistics.ia_primitives += prim_info->count / draw->pt.vertices_per_patch; else @@ -775,11 +775,11 @@ llvm_pipeline_generic(struct draw_pt_middle_end *middle, } -static inline enum pipe_prim_type -prim_type(enum pipe_prim_type prim, unsigned flags) +static inline enum mesa_prim +prim_type(enum mesa_prim prim, unsigned flags) { if (flags & DRAW_LINE_LOOP_AS_STRIP) - return PIPE_PRIM_LINE_STRIP; + return MESA_PRIM_LINE_STRIP; else return prim; } diff --git a/src/gallium/auxiliary/draw/draw_pt_util.c b/src/gallium/auxiliary/draw/draw_pt_util.c index ca241a2ff0a..dc9146779c0 100644 --- a/src/gallium/auxiliary/draw/draw_pt_util.c +++ b/src/gallium/auxiliary/draw/draw_pt_util.c @@ -37,53 +37,53 @@ void -draw_pt_split_prim(enum pipe_prim_type prim, unsigned *first, unsigned *incr) +draw_pt_split_prim(enum mesa_prim prim, unsigned *first, unsigned *incr) { switch (prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: *first = 1; *incr = 1; break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: *first = 2; *incr = 2; break; - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_LOOP: *first = 2; *incr = 1; break; - case PIPE_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: *first = 4; *incr = 4; break; - case PIPE_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: *first = 4; *incr = 1; break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: *first = 3; *incr = 3; break; - case PIPE_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: *first = 6; *incr = 6; break; - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: - case PIPE_PRIM_POLYGON: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: + case MESA_PRIM_POLYGON: *first = 3; *incr = 1; break; - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: *first = 6; *incr = 2; break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: *first = 4; *incr = 4; break; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: *first = 4; *incr = 2; break; diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit.c b/src/gallium/auxiliary/draw/draw_pt_vsplit.c index 86548b817c0..d921a4c22b3 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vsplit.c +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit.c @@ -38,7 +38,7 @@ struct vsplit_frontend { struct draw_pt_front_end base; struct draw_context *draw; - enum pipe_prim_type prim; + enum mesa_prim prim; struct draw_pt_middle_end *middle; @@ -201,7 +201,7 @@ vsplit_add_cache_uint(struct vsplit_frontend *vsplit, const uint *elts, static void vsplit_prepare(struct draw_pt_front_end *frontend, - enum pipe_prim_type in_prim, + enum mesa_prim in_prim, struct draw_pt_middle_end *middle, unsigned opt) { diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h index 53fa510917d..f0cf8850bcd 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h @@ -205,7 +205,7 @@ CONCAT2(vsplit_segment_fan_, ELT_TYPE)(struct vsplit_frontend *vsplit, #define LOCAL_VARS \ struct vsplit_frontend *vsplit = (struct vsplit_frontend *) frontend; \ - const enum pipe_prim_type prim = vsplit->prim; \ + const enum mesa_prim prim = vsplit->prim; \ const unsigned max_count_simple = vsplit->segment_size; \ const unsigned max_count_loop = vsplit->segment_size - 1; \ const unsigned max_count_fan = vsplit->segment_size; @@ -274,7 +274,7 @@ vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags, #define LOCAL_VARS \ struct vsplit_frontend *vsplit = (struct vsplit_frontend *) frontend; \ - const enum pipe_prim_type prim = vsplit->prim; \ + const enum mesa_prim prim = vsplit->prim; \ const unsigned max_count_simple = vsplit->max_vertices; \ const unsigned max_count_loop = vsplit->segment_size - 1; \ const unsigned max_count_fan = vsplit->segment_size; diff --git a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h index 101c7eea7c2..4fb341af146 100644 --- a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h +++ b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h @@ -7,16 +7,16 @@ #define FUNC_ENTER \ /* declare more local vars */ \ - const enum pipe_prim_type prim = input_prims->prim; \ + const enum mesa_prim prim = input_prims->prim; \ const unsigned prim_flags = input_prims->flags; \ const boolean quads_flatshade_last = FALSE; \ const boolean last_vertex_last = !so->draw->rasterizer->flatshade_first; \ do { \ switch (prim) { \ - case PIPE_PRIM_LINES_ADJACENCY: \ - case PIPE_PRIM_LINE_STRIP_ADJACENCY: \ - case PIPE_PRIM_TRIANGLES_ADJACENCY: \ - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: \ + case MESA_PRIM_LINES_ADJACENCY: \ + case MESA_PRIM_LINE_STRIP_ADJACENCY: \ + case MESA_PRIM_TRIANGLES_ADJACENCY: \ + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: \ assert(!"unexpected primitive type in stream output"); \ return; \ default: \ diff --git a/src/gallium/auxiliary/draw/draw_split_tmp.h b/src/gallium/auxiliary/draw/draw_split_tmp.h index 3f9b01d27a6..a405e8bb49b 100644 --- a/src/gallium/auxiliary/draw/draw_split_tmp.h +++ b/src/gallium/auxiliary/draw/draw_split_tmp.h @@ -40,7 +40,7 @@ FUNC(FUNC_VARS) max_count_loop, max_count_fan); } - if (prim == PIPE_PRIM_PATCHES) { + if (prim == MESA_PRIM_PATCHES) { first = vsplit->draw->pt.vertices_per_patch; incr = vsplit->draw->pt.vertices_per_patch; } else @@ -78,22 +78,22 @@ FUNC(FUNC_VARS) * That is, remaining is implicitly trimmed. */ switch (prim) { - case PIPE_PRIM_PATCHES: - case PIPE_PRIM_POINTS: - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_QUADS: - case PIPE_PRIM_QUAD_STRIP: - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_PATCHES: + case MESA_PRIM_POINTS: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: seg_max = draw_pt_trim_count(MIN2(max_count_simple, count), first, incr); - if (prim == PIPE_PRIM_TRIANGLE_STRIP || - prim == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY) { + if (prim == MESA_PRIM_TRIANGLE_STRIP || + prim == MESA_PRIM_TRIANGLE_STRIP_ADJACENCY) { /* make sure we flush even number of triangles at a time */ if (seg_max < count && !(((seg_max - first) / incr) & 1)) seg_max -= incr; @@ -116,7 +116,7 @@ FUNC(FUNC_VARS) } while (seg_start < count); break; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: seg_max = draw_pt_trim_count(MIN2(max_count_loop, count), first, incr); @@ -137,8 +137,8 @@ FUNC(FUNC_VARS) } while (seg_start < count); break; - case PIPE_PRIM_TRIANGLE_FAN: - case PIPE_PRIM_POLYGON: + case MESA_PRIM_TRIANGLE_FAN: + case MESA_PRIM_POLYGON: seg_max = draw_pt_trim_count(MIN2(max_count_fan, count), first, incr); diff --git a/src/gallium/auxiliary/draw/draw_tess.c b/src/gallium/auxiliary/draw/draw_tess.c index d79721a7dbb..84085fae706 100644 --- a/src/gallium/auxiliary/draw/draw_tess.c +++ b/src/gallium/auxiliary/draw/draw_tess.c @@ -181,7 +181,7 @@ int draw_tess_ctrl_shader_run(struct draw_tess_ctrl_shader *shader, output_prims->start = 0; output_prims->elts = NULL; output_prims->count = 0; - output_prims->prim = PIPE_PRIM_PATCHES; + output_prims->prim = MESA_PRIM_PATCHES; output_prims->flags = 0; output_prims->primitive_lengths = NULL; output_prims->primitive_count = 0; @@ -641,12 +641,12 @@ void draw_tes_set_current_variant(struct draw_tess_eval_shader *shader, } #endif -enum pipe_prim_type get_tes_output_prim(struct draw_tess_eval_shader *shader) +enum mesa_prim get_tes_output_prim(struct draw_tess_eval_shader *shader) { if (shader->point_mode) - return PIPE_PRIM_POINTS; - else if (shader->prim_mode == PIPE_PRIM_LINES) - return PIPE_PRIM_LINES; + return MESA_PRIM_POINTS; + else if (shader->prim_mode == MESA_PRIM_LINES) + return MESA_PRIM_LINES; else - return PIPE_PRIM_TRIANGLES; + return MESA_PRIM_TRIANGLES; } diff --git a/src/gallium/auxiliary/draw/draw_tess.h b/src/gallium/auxiliary/draw/draw_tess.h index 9ec0f15d75c..f76f57da960 100644 --- a/src/gallium/auxiliary/draw/draw_tess.h +++ b/src/gallium/auxiliary/draw/draw_tess.h @@ -79,7 +79,7 @@ struct draw_tess_eval_shader { struct pipe_shader_state state; struct tgsi_shader_info info; - enum pipe_prim_type prim_mode; + enum mesa_prim prim_mode; unsigned spacing; unsigned vertex_order_cw; unsigned point_mode; @@ -101,7 +101,7 @@ struct draw_tess_eval_shader { #endif }; -enum pipe_prim_type get_tes_output_prim(struct draw_tess_eval_shader *shader); +enum mesa_prim get_tes_output_prim(struct draw_tess_eval_shader *shader); int draw_tess_ctrl_shader_run(struct draw_tess_ctrl_shader *shader, const void *constants[PIPE_MAX_CONSTANT_BUFFERS], diff --git a/src/gallium/auxiliary/draw/draw_vbuf.h b/src/gallium/auxiliary/draw/draw_vbuf.h index 1f13ce7f377..c9e0faac47b 100644 --- a/src/gallium/auxiliary/draw/draw_vbuf.h +++ b/src/gallium/auxiliary/draw/draw_vbuf.h @@ -97,7 +97,7 @@ struct vbuf_render { * the discretion of the driver, for the benefit of the passthrough * path. */ - void (*set_primitive)(struct vbuf_render *, enum pipe_prim_type prim); + void (*set_primitive)(struct vbuf_render *, enum mesa_prim prim); /** * Notify the renderer of the current view index. diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index f5b11c42509..bc313530b31 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -333,7 +333,7 @@ hud_draw_graph_line_strip(struct hud_context *hud, const struct hud_graph *gr, assert(gr->index <= gr->num_vertices); - hud_draw_colored_prims(hud, PIPE_PRIM_LINE_STRIP, + hud_draw_colored_prims(hud, MESA_PRIM_LINE_STRIP, gr->vertices, gr->index, gr->color[0], gr->color[1], gr->color[2], 1, xoffset + (gr->pane->max_num_vertices - gr->index - 1) * 2 - 1, @@ -342,7 +342,7 @@ hud_draw_graph_line_strip(struct hud_context *hud, const struct hud_graph *gr, if (gr->num_vertices <= gr->index) return; - hud_draw_colored_prims(hud, PIPE_PRIM_LINE_STRIP, + hud_draw_colored_prims(hud, MESA_PRIM_LINE_STRIP, gr->vertices + gr->index*2, gr->num_vertices - gr->index, gr->color[0], gr->color[1], gr->color[2], 1, @@ -457,7 +457,7 @@ hud_pane_draw_colored_objects(struct hud_context *hud, unsigned x = pane->x1 + 2; unsigned y = pane->y2 + 2 + i*hud->font.glyph_height; - hud_draw_colored_quad(hud, PIPE_PRIM_QUADS, x + 1, y + 1, x + 12, y + 13, + hud_draw_colored_quad(hud, MESA_PRIM_QUADS, x + 1, y + 1, x + 12, y + 13, gr->color[0], gr->color[1], gr->color[2], 1); i++; } @@ -604,7 +604,7 @@ hud_draw_results(struct hud_context *hud, struct pipe_resource *tex) pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, false, &hud->constbuf); cso_set_vertex_buffers(cso, 0, 1, 0, false, &hud->bg.vbuf); - cso_draw_arrays(cso, PIPE_PRIM_QUADS, 0, hud->bg.num_vertices); + cso_draw_arrays(cso, MESA_PRIM_QUADS, 0, hud->bg.num_vertices); } pipe_resource_reference(&hud->bg.vbuf.buffer.resource, NULL); @@ -613,7 +613,7 @@ hud_draw_results(struct hud_context *hud, struct pipe_resource *tex) cso_set_vertex_shader_handle(cso, hud->vs_text); cso_set_vertex_buffers(cso, 0, 1, 0, false, &hud->text.vbuf); cso_set_fragment_shader_handle(hud->cso, hud->fs_text); - cso_draw_arrays(cso, PIPE_PRIM_QUADS, 0, hud->text.num_vertices); + cso_draw_arrays(cso, MESA_PRIM_QUADS, 0, hud->text.num_vertices); } pipe_resource_reference(&hud->text.vbuf.buffer.resource, NULL); @@ -637,7 +637,7 @@ hud_draw_results(struct hud_context *hud, struct pipe_resource *tex) cso_set_vertex_shader_handle(cso, hud->vs_color); cso_set_vertex_buffers(cso, 0, 1, 0, false, &hud->whitelines.vbuf); cso_set_fragment_shader_handle(hud->cso, hud->fs_color); - cso_draw_arrays(cso, PIPE_PRIM_LINES, 0, hud->whitelines.num_vertices); + cso_draw_arrays(cso, MESA_PRIM_LINES, 0, hud->whitelines.num_vertices); } pipe_resource_reference(&hud->whitelines.vbuf.buffer.resource, NULL); diff --git a/src/gallium/auxiliary/indices/u_indices.c b/src/gallium/auxiliary/indices/u_indices.c index e43072351fd..16d7c88d734 100644 --- a/src/gallium/auxiliary/indices/u_indices.c +++ b/src/gallium/auxiliary/indices/u_indices.c @@ -39,78 +39,78 @@ static void translate_byte_to_ushort( const void *in, } } -enum pipe_prim_type -u_index_prim_type_convert(unsigned hw_mask, enum pipe_prim_type prim, bool pv_matches) +enum mesa_prim +u_index_prim_type_convert(unsigned hw_mask, enum mesa_prim prim, bool pv_matches) { if ((hw_mask & (1<primitive_restart = info->primitive_restart; new_info->restart_index = info->restart_index; if (info->index_size) { - enum pipe_prim_type mode = new_info->mode = u_index_prim_type_convert(pc->cfg.primtypes_mask, info->mode, true); + enum mesa_prim mode = new_info->mode = u_index_prim_type_convert(pc->cfg.primtypes_mask, info->mode, true); unsigned index_size = info->index_size; unsigned offset = draw.start * info->index_size; @@ -208,7 +208,7 @@ primconvert_init_draw(struct primconvert_context *pc, assert(new_info->index_size == index_size); } else { - enum pipe_prim_type mode = 0; + enum mesa_prim mode = 0; unsigned index_size; u_index_generator(pc->cfg.primtypes_mask, @@ -263,7 +263,7 @@ primconvert_init_draw(struct primconvert_context *pc, else { gen_func(draw.start, new_draw->count, dst); } - new_info->was_line_loop = info->mode == PIPE_PRIM_LINE_LOOP; + new_info->was_line_loop = info->mode == MESA_PRIM_LINE_LOOP; if (src_transfer) pipe_buffer_unmap(pc->pipe, src_transfer); diff --git a/src/gallium/auxiliary/indices/u_unfilled_gen.py b/src/gallium/auxiliary/indices/u_unfilled_gen.py index aa6849b5396..37ecbbb4067 100644 --- a/src/gallium/auxiliary/indices/u_unfilled_gen.py +++ b/src/gallium/auxiliary/indices/u_unfilled_gen.py @@ -42,14 +42,14 @@ PRIMS=('tris', 'trisadj', 'tristripadj') -LONGPRIMS=('PIPE_PRIM_TRIANGLES', - 'PIPE_PRIM_TRIANGLE_FAN', - 'PIPE_PRIM_TRIANGLE_STRIP', - 'PIPE_PRIM_QUADS', - 'PIPE_PRIM_QUAD_STRIP', - 'PIPE_PRIM_POLYGON', - 'PIPE_PRIM_TRIANGLES_ADJACENCY', - 'PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY') +LONGPRIMS=('MESA_PRIM_TRIANGLES', + 'MESA_PRIM_TRIANGLE_FAN', + 'MESA_PRIM_TRIANGLE_STRIP', + 'MESA_PRIM_QUADS', + 'MESA_PRIM_QUAD_STRIP', + 'MESA_PRIM_POLYGON', + 'MESA_PRIM_TRIANGLES_ADJACENCY', + 'MESA_PRIM_TRIANGLE_STRIP_ADJACENCY') longprim = dict(zip(PRIMS, LONGPRIMS)) intype_idx = dict(ubyte='IN_UBYTE', ushort='IN_USHORT', uint='IN_UINT') diff --git a/src/gallium/auxiliary/indices/u_unfilled_indices.c b/src/gallium/auxiliary/indices/u_unfilled_indices.c index c568afc56be..1b451865bd4 100644 --- a/src/gallium/auxiliary/indices/u_unfilled_indices.c +++ b/src/gallium/auxiliary/indices/u_unfilled_indices.c @@ -71,31 +71,31 @@ static void generate_linear_uint( unsigned start, /** * Given a primitive type and number of vertices, return the number of vertices * needed to draw the primitive with fill mode = PIPE_POLYGON_MODE_LINE using - * separate lines (PIPE_PRIM_LINES). + * separate lines (MESA_PRIM_LINES). */ static unsigned -nr_lines(enum pipe_prim_type prim, unsigned nr) +nr_lines(enum mesa_prim prim, unsigned nr) { switch (prim) { - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return (nr / 3) * 6; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return (nr - 2) * 6; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: return (nr - 2) * 6; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: return (nr / 4) * 8; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: return (nr - 2) / 2 * 8; - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: return 2 * nr; /* a line (two verts) for each polygon edge */ /* Note: these cases can't really be handled since drawing lines instead * of triangles would also require changing the GS. But if there's no GS, * this should work. */ - case PIPE_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: return (nr / 6) * 6; - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: return ((nr - 4) / 2) * 6; default: assert(0); @@ -105,11 +105,11 @@ nr_lines(enum pipe_prim_type prim, unsigned nr) enum indices_mode -u_unfilled_translator(enum pipe_prim_type prim, +u_unfilled_translator(enum mesa_prim prim, unsigned in_index_size, unsigned nr, unsigned unfilled_mode, - enum pipe_prim_type *out_prim, + enum mesa_prim *out_prim, unsigned *out_index_size, unsigned *out_nr, u_translate_func *out_translate) @@ -117,7 +117,7 @@ u_unfilled_translator(enum pipe_prim_type prim, unsigned in_idx; unsigned out_idx; - assert(u_reduced_prim(prim) == PIPE_PRIM_TRIANGLES); + assert(u_reduced_prim(prim) == MESA_PRIM_TRIANGLES); u_unfilled_init(); @@ -126,7 +126,7 @@ u_unfilled_translator(enum pipe_prim_type prim, out_idx = out_size_idx(*out_index_size); if (unfilled_mode == PIPE_POLYGON_MODE_POINT) { - *out_prim = PIPE_PRIM_POINTS; + *out_prim = MESA_PRIM_POINTS; *out_nr = nr; switch (in_index_size) { @@ -148,7 +148,7 @@ u_unfilled_translator(enum pipe_prim_type prim, } else { assert(unfilled_mode == PIPE_POLYGON_MODE_LINE); - *out_prim = PIPE_PRIM_LINES; + *out_prim = MESA_PRIM_LINES; *out_translate = translate_line[in_idx][out_idx][prim]; *out_nr = nr_lines( prim, nr ); return U_TRANSLATE_NORMAL; @@ -165,18 +165,18 @@ u_unfilled_translator(enum pipe_prim_type prim, * 'draw' module. */ enum indices_mode -u_unfilled_generator(enum pipe_prim_type prim, +u_unfilled_generator(enum mesa_prim prim, unsigned start, unsigned nr, unsigned unfilled_mode, - enum pipe_prim_type *out_prim, + enum mesa_prim *out_prim, unsigned *out_index_size, unsigned *out_nr, u_generate_func *out_generate) { unsigned out_idx; - assert(u_reduced_prim(prim) == PIPE_PRIM_TRIANGLES); + assert(u_reduced_prim(prim) == MESA_PRIM_TRIANGLES); u_unfilled_init(); @@ -189,13 +189,13 @@ u_unfilled_generator(enum pipe_prim_type prim, else *out_generate = generate_linear_ushort; - *out_prim = PIPE_PRIM_POINTS; + *out_prim = MESA_PRIM_POINTS; *out_nr = nr; return U_GENERATE_LINEAR; } else { assert(unfilled_mode == PIPE_POLYGON_MODE_LINE); - *out_prim = PIPE_PRIM_LINES; + *out_prim = MESA_PRIM_LINES; *out_generate = generate_line[out_idx][prim]; *out_nr = nr_lines( prim, nr ); diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c index c38a343e9df..31e069da2ca 100644 --- a/src/gallium/auxiliary/postprocess/pp_run.c +++ b/src/gallium/auxiliary/postprocess/pp_run.c @@ -294,7 +294,7 @@ void pp_filter_draw(struct pp_program *p) { util_draw_vertex_buffer(p->pipe, p->cso, p->vbuf, 0, 0, - PIPE_PRIM_QUADS, 4, 2); + MESA_PRIM_QUADS, 4, 2); } /** Set the framebuffer as active. */ diff --git a/src/gallium/auxiliary/tessellator/p_tessellator.cpp b/src/gallium/auxiliary/tessellator/p_tessellator.cpp index a1ffa1e936d..064a22e6481 100644 --- a/src/gallium/auxiliary/tessellator/p_tessellator.cpp +++ b/src/gallium/auxiliary/tessellator/p_tessellator.cpp @@ -39,13 +39,13 @@ namespace pipe_tessellator_wrap { private: typedef CHWTessellator SUPER; - enum pipe_prim_type prim_mode; + enum mesa_prim prim_mode; alignas(32) float domain_points_u[MAX_POINT_COUNT]; alignas(32) float domain_points_v[MAX_POINT_COUNT]; uint32_t num_domain_points; public: - void Init(enum pipe_prim_type tes_prim_mode, + void Init(enum mesa_prim tes_prim_mode, enum pipe_tess_spacing ts_spacing, bool tes_vertex_order_cw, bool tes_point_mode) { @@ -58,7 +58,7 @@ namespace pipe_tessellator_wrap PIPE_TESSELLATOR_OUTPUT_PRIMITIVE out_prim; if (tes_point_mode) out_prim = PIPE_TESSELLATOR_OUTPUT_POINT; - else if (tes_prim_mode == PIPE_PRIM_LINES) + else if (tes_prim_mode == MESA_PRIM_LINES) out_prim = PIPE_TESSELLATOR_OUTPUT_LINE; else if (tes_vertex_order_cw) out_prim = PIPE_TESSELLATOR_OUTPUT_TRIANGLE_CW; @@ -77,7 +77,7 @@ namespace pipe_tessellator_wrap { switch (prim_mode) { - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: SUPER::TessellateQuadDomain( tess_factors->outer_tf[0], tess_factors->outer_tf[1], @@ -87,7 +87,7 @@ namespace pipe_tessellator_wrap tess_factors->inner_tf[1]); break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: SUPER::TessellateTriDomain( tess_factors->outer_tf[0], tess_factors->outer_tf[1], @@ -95,7 +95,7 @@ namespace pipe_tessellator_wrap tess_factors->inner_tf[0]); break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: SUPER::TessellateIsoLineDomain( tess_factors->outer_tf[0], tess_factors->outer_tf[1]); @@ -126,7 +126,7 @@ namespace pipe_tessellator_wrap /* allocate tessellator */ struct pipe_tessellator * -p_tess_init(enum pipe_prim_type tes_prim_mode, +p_tess_init(enum mesa_prim tes_prim_mode, enum pipe_tess_spacing spacing, bool tes_vertex_order_cw, bool tes_point_mode) { diff --git a/src/gallium/auxiliary/tessellator/p_tessellator.h b/src/gallium/auxiliary/tessellator/p_tessellator.h index 47abc2e4ace..ecdc4d38c6b 100644 --- a/src/gallium/auxiliary/tessellator/p_tessellator.h +++ b/src/gallium/auxiliary/tessellator/p_tessellator.h @@ -51,7 +51,7 @@ struct pipe_tessellator_data }; /// Allocate and initialize a new tessellation context -struct pipe_tessellator *p_tess_init(enum pipe_prim_type tes_prim_mode, +struct pipe_tessellator *p_tess_init(enum mesa_prim tes_prim_mode, enum pipe_tess_spacing spacing, bool tes_vertex_order_cw, bool tes_point_mode); /// Destroy & de-allocate tessellation context diff --git a/src/gallium/auxiliary/tgsi/tgsi_point_sprite.c b/src/gallium/auxiliary/tgsi/tgsi_point_sprite.c index eb17a1be07d..bfd4ab35fd7 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_point_sprite.c +++ b/src/gallium/auxiliary/tgsi/tgsi_point_sprite.c @@ -503,7 +503,7 @@ psprite_property(struct tgsi_transform_context *ctx, { switch (prop->Property.PropertyName) { case TGSI_PROPERTY_GS_OUTPUT_PRIM: - prop->u[0].Data = PIPE_PRIM_TRIANGLE_STRIP; + prop->u[0].Data = MESA_PRIM_TRIANGLE_STRIP; break; case TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES: prop->u[0].Data *= 4; diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index 223d8c577f5..2403a4da5df 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -196,7 +196,7 @@ const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] = const char *tgsi_invariant_name = "INVARIANT"; -const char *tgsi_primitive_names[PIPE_PRIM_MAX] = +const char *tgsi_primitive_names[MESA_PRIM_COUNT] = { "POINTS", "LINES", @@ -252,7 +252,7 @@ tgsi_strings_check(void) STATIC_ASSERT(ARRAY_SIZE(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT); STATIC_ASSERT(ARRAY_SIZE(tgsi_texture_names) == TGSI_TEXTURE_COUNT); STATIC_ASSERT(ARRAY_SIZE(tgsi_property_names) == TGSI_PROPERTY_COUNT); - STATIC_ASSERT(ARRAY_SIZE(tgsi_primitive_names) == PIPE_PRIM_MAX); + STATIC_ASSERT(ARRAY_SIZE(tgsi_primitive_names) == MESA_PRIM_COUNT); STATIC_ASSERT(ARRAY_SIZE(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT); STATIC_ASSERT(ARRAY_SIZE(tgsi_return_type_names) == TGSI_RETURN_TYPE_COUNT); (void) tgsi_processor_type_names; diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h b/src/gallium/auxiliary/tgsi/tgsi_strings.h index 0ae5b827071..f494319c0e1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h @@ -54,7 +54,7 @@ extern const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT]; extern const char *tgsi_invariant_name; -extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; +extern const char *tgsi_primitive_names[MESA_PRIM_COUNT]; extern const char *tgsi_fs_coord_origin_names[2]; diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 29e3372781b..0b005976989 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -1658,7 +1658,7 @@ parse_primitive( const char **pcur, uint *primitive ) { uint i; - for (i = 0; i < PIPE_PRIM_MAX; i++) { + for (i = 0; i < MESA_PRIM_COUNT; i++) { const char *cur = *pcur; if (str_match_nocase_whole( &cur, tgsi_primitive_names[i])) { diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index a67c910d00a..458834f0e1e 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -1421,10 +1421,10 @@ static void blitter_draw(struct blitter_context_priv *ctx, */ static uint8_t indices[6] = { 0, 1, 2, 0, 3, 2 }; util_draw_elements_instanced(pipe, indices, 1, 0, - PIPE_PRIM_TRIANGLES, 0, 6, + MESA_PRIM_TRIANGLES, 0, 6, 0, num_instances); } else { - util_draw_arrays_instanced(pipe, PIPE_PRIM_TRIANGLE_FAN, 0, 4, + util_draw_arrays_instanced(pipe, MESA_PRIM_TRIANGLE_FAN, 0, 4, 0, num_instances); } pipe_resource_reference(&vb.buffer.resource, NULL); @@ -2648,7 +2648,7 @@ void util_blitter_clear_buffer(struct blitter_context *blitter, so_target = pipe->create_stream_output_target(pipe, dst, offset, size); pipe->set_stream_output_targets(pipe, 1, &so_target, offsets); - util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 4); + util_draw_arrays(pipe, MESA_PRIM_POINTS, 0, size / 4); out: util_blitter_restore_vertex_states(blitter); diff --git a/src/gallium/auxiliary/util/u_draw.h b/src/gallium/auxiliary/util/u_draw.h index 7924061aed5..b5a623e0c72 100644 --- a/src/gallium/auxiliary/util/u_draw.h +++ b/src/gallium/auxiliary/util/u_draw.h @@ -50,7 +50,7 @@ util_draw_init_info(struct pipe_draw_info *info) static inline void util_draw_arrays(struct pipe_context *pipe, - enum pipe_prim_type mode, + enum mesa_prim mode, uint start, uint count) { @@ -73,7 +73,7 @@ static inline void util_draw_elements(struct pipe_context *pipe, void *indices, unsigned index_size, - int index_bias, enum pipe_prim_type mode, + int index_bias, enum mesa_prim mode, uint start, uint count) { @@ -95,7 +95,7 @@ util_draw_elements(struct pipe_context *pipe, static inline void util_draw_arrays_instanced(struct pipe_context *pipe, - enum pipe_prim_type mode, + enum mesa_prim mode, uint start, uint count, uint start_instance, @@ -124,7 +124,7 @@ util_draw_elements_instanced(struct pipe_context *pipe, void *indices, unsigned index_size, int index_bias, - enum pipe_prim_type mode, + enum mesa_prim mode, uint start, uint count, uint start_instance, diff --git a/src/gallium/auxiliary/util/u_dump_defines.c b/src/gallium/auxiliary/util/u_dump_defines.c index a9dac512af9..08e1ed6656f 100644 --- a/src/gallium/auxiliary/util/u_dump_defines.c +++ b/src/gallium/auxiliary/util/u_dump_defines.c @@ -455,21 +455,21 @@ DEFINE_UTIL_STR_CONTINUOUS(query_value_type) static const char * util_prim_mode_names[] = { - "PIPE_PRIM_POINTS", - "PIPE_PRIM_LINES", - "PIPE_PRIM_LINE_LOOP", - "PIPE_PRIM_LINE_STRIP", - "PIPE_PRIM_TRIANGLES", - "PIPE_PRIM_TRIANGLE_STRIP", - "PIPE_PRIM_TRIANGLE_FAN", - "PIPE_PRIM_QUADS", - "PIPE_PRIM_QUAD_STRIP", - "PIPE_PRIM_POLYGON", - "PIPE_PRIM_LINES_ADJACENCY", - "PIPE_PRIM_LINE_STRIP_ADJACENCY", - "PIPE_PRIM_TRIANGLES_ADJACENCY", - "PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY", - "PIPE_PRIM_PATCHES", + "MESA_PRIM_POINTS", + "MESA_PRIM_LINES", + "MESA_PRIM_LINE_LOOP", + "MESA_PRIM_LINE_STRIP", + "MESA_PRIM_TRIANGLES", + "MESA_PRIM_TRIANGLE_STRIP", + "MESA_PRIM_TRIANGLE_FAN", + "MESA_PRIM_QUADS", + "MESA_PRIM_QUAD_STRIP", + "MESA_PRIM_POLYGON", + "MESA_PRIM_LINES_ADJACENCY", + "MESA_PRIM_LINE_STRIP_ADJACENCY", + "MESA_PRIM_TRIANGLES_ADJACENCY", + "MESA_PRIM_TRIANGLE_STRIP_ADJACENCY", + "MESA_PRIM_PATCHES", }; static const char * diff --git a/src/gallium/auxiliary/util/u_prim.c b/src/gallium/auxiliary/util/u_prim.c index a84d0e71e7c..0b0eec568f4 100644 --- a/src/gallium/auxiliary/util/u_prim.c +++ b/src/gallium/auxiliary/util/u_prim.c @@ -26,11 +26,11 @@ /** Return string name of given primitive type */ const char * -u_prim_name(enum pipe_prim_type prim) +u_prim_name(enum mesa_prim prim) { #if defined(__GNUC__) /* Check that the enum is packed: */ - STATIC_ASSERT(sizeof(enum pipe_prim_type) == 1); + STATIC_ASSERT(sizeof(enum mesa_prim) == 1); #endif /* Draw merging in u_threaded_context requires that sizeof(mode) == 1. */ @@ -41,20 +41,20 @@ u_prim_name(enum pipe_prim_type prim) STATIC_ASSERT(sizeof(dvs_info.mode) == 1); static const struct debug_named_value names[] = { - DEBUG_NAMED_VALUE(PIPE_PRIM_POINTS), - DEBUG_NAMED_VALUE(PIPE_PRIM_LINES), - DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_LOOP), - DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_STRIP), - DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLES), - DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_STRIP), - DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_FAN), - DEBUG_NAMED_VALUE(PIPE_PRIM_QUADS), - DEBUG_NAMED_VALUE(PIPE_PRIM_QUAD_STRIP), - DEBUG_NAMED_VALUE(PIPE_PRIM_POLYGON), - DEBUG_NAMED_VALUE(PIPE_PRIM_LINES_ADJACENCY), - DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_STRIP_ADJACENCY), - DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLES_ADJACENCY), - DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY), + DEBUG_NAMED_VALUE(MESA_PRIM_POINTS), + DEBUG_NAMED_VALUE(MESA_PRIM_LINES), + DEBUG_NAMED_VALUE(MESA_PRIM_LINE_LOOP), + DEBUG_NAMED_VALUE(MESA_PRIM_LINE_STRIP), + DEBUG_NAMED_VALUE(MESA_PRIM_TRIANGLES), + DEBUG_NAMED_VALUE(MESA_PRIM_TRIANGLE_STRIP), + DEBUG_NAMED_VALUE(MESA_PRIM_TRIANGLE_FAN), + DEBUG_NAMED_VALUE(MESA_PRIM_QUADS), + DEBUG_NAMED_VALUE(MESA_PRIM_QUAD_STRIP), + DEBUG_NAMED_VALUE(MESA_PRIM_POLYGON), + DEBUG_NAMED_VALUE(MESA_PRIM_LINES_ADJACENCY), + DEBUG_NAMED_VALUE(MESA_PRIM_LINE_STRIP_ADJACENCY), + DEBUG_NAMED_VALUE(MESA_PRIM_TRIANGLES_ADJACENCY), + DEBUG_NAMED_VALUE(MESA_PRIM_TRIANGLE_STRIP_ADJACENCY), DEBUG_NAMED_VALUE_END }; return debug_dump_enum(names, prim); diff --git a/src/gallium/auxiliary/util/u_prim.h b/src/gallium/auxiliary/util/u_prim.h index 4c7214b730c..ec3c34d913e 100644 --- a/src/gallium/auxiliary/util/u_prim.h +++ b/src/gallium/auxiliary/util/u_prim.h @@ -48,61 +48,61 @@ struct u_prim_vertex_count { * Decompose a primitive that is a loop, a strip, or a fan. Return the * original primitive if it is already decomposed. */ -static inline enum pipe_prim_type -u_decomposed_prim(enum pipe_prim_type prim) +static inline enum mesa_prim +u_decomposed_prim(enum mesa_prim prim) { switch (prim) { - case PIPE_PRIM_LINE_LOOP: - case PIPE_PRIM_LINE_STRIP: - return PIPE_PRIM_LINES; - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: - return PIPE_PRIM_TRIANGLES; - case PIPE_PRIM_QUAD_STRIP: - return PIPE_PRIM_QUADS; - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - return PIPE_PRIM_LINES_ADJACENCY; - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: - return PIPE_PRIM_TRIANGLES_ADJACENCY; + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_STRIP: + return MESA_PRIM_LINES; + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: + return MESA_PRIM_TRIANGLES; + case MESA_PRIM_QUAD_STRIP: + return MESA_PRIM_QUADS; + case MESA_PRIM_LINE_STRIP_ADJACENCY: + return MESA_PRIM_LINES_ADJACENCY; + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: + return MESA_PRIM_TRIANGLES_ADJACENCY; default: return prim; } } /** - * Reduce a primitive to one of PIPE_PRIM_POINTS, PIPE_PRIM_LINES, and - * PIPE_PRIM_TRIANGLES. + * Reduce a primitive to one of MESA_PRIM_POINTS, MESA_PRIM_LINES, and + * MESA_PRIM_TRIANGLES. */ -static inline enum pipe_prim_type -u_reduced_prim(enum pipe_prim_type prim) +static inline enum mesa_prim +u_reduced_prim(enum mesa_prim prim) { switch (prim) { - case PIPE_PRIM_POINTS: - return PIPE_PRIM_POINTS; - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_LOOP: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - return PIPE_PRIM_LINES; + case MESA_PRIM_POINTS: + return MESA_PRIM_POINTS; + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + return MESA_PRIM_LINES; default: - return PIPE_PRIM_TRIANGLES; + return MESA_PRIM_TRIANGLES; } } /** * Re-assemble a primitive to remove its adjacency. */ -static inline enum pipe_prim_type -u_assembled_prim(enum pipe_prim_type prim) +static inline enum mesa_prim +u_assembled_prim(enum mesa_prim prim) { switch (prim) { - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - return PIPE_PRIM_LINES; - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: - return PIPE_PRIM_TRIANGLES; + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + return MESA_PRIM_LINES; + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: + return MESA_PRIM_TRIANGLES; default: return prim; } @@ -116,26 +116,26 @@ u_assembled_prim(enum pipe_prim_type prim) * expected because of the use of a table. */ static inline const struct u_prim_vertex_count * -u_prim_vertex_count(enum pipe_prim_type prim) +u_prim_vertex_count(enum mesa_prim prim) { - static const struct u_prim_vertex_count prim_table[PIPE_PRIM_MAX] = { - { 1, 1 }, /* PIPE_PRIM_POINTS */ - { 2, 2 }, /* PIPE_PRIM_LINES */ - { 2, 1 }, /* PIPE_PRIM_LINE_LOOP */ - { 2, 1 }, /* PIPE_PRIM_LINE_STRIP */ - { 3, 3 }, /* PIPE_PRIM_TRIANGLES */ - { 3, 1 }, /* PIPE_PRIM_TRIANGLE_STRIP */ - { 3, 1 }, /* PIPE_PRIM_TRIANGLE_FAN */ - { 4, 4 }, /* PIPE_PRIM_QUADS */ - { 4, 2 }, /* PIPE_PRIM_QUAD_STRIP */ - { 3, 1 }, /* PIPE_PRIM_POLYGON */ - { 4, 4 }, /* PIPE_PRIM_LINES_ADJACENCY */ - { 4, 1 }, /* PIPE_PRIM_LINE_STRIP_ADJACENCY */ - { 6, 6 }, /* PIPE_PRIM_TRIANGLES_ADJACENCY */ - { 6, 2 }, /* PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY */ + static const struct u_prim_vertex_count prim_table[MESA_PRIM_COUNT] = { + { 1, 1 }, /* MESA_PRIM_POINTS */ + { 2, 2 }, /* MESA_PRIM_LINES */ + { 2, 1 }, /* MESA_PRIM_LINE_LOOP */ + { 2, 1 }, /* MESA_PRIM_LINE_STRIP */ + { 3, 3 }, /* MESA_PRIM_TRIANGLES */ + { 3, 1 }, /* MESA_PRIM_TRIANGLE_STRIP */ + { 3, 1 }, /* MESA_PRIM_TRIANGLE_FAN */ + { 4, 4 }, /* MESA_PRIM_QUADS */ + { 4, 2 }, /* MESA_PRIM_QUAD_STRIP */ + { 3, 1 }, /* MESA_PRIM_POLYGON */ + { 4, 4 }, /* MESA_PRIM_LINES_ADJACENCY */ + { 4, 1 }, /* MESA_PRIM_LINE_STRIP_ADJACENCY */ + { 6, 6 }, /* MESA_PRIM_TRIANGLES_ADJACENCY */ + { 6, 2 }, /* MESA_PRIM_TRIANGLE_STRIP_ADJACENCY */ }; - return (likely(prim < PIPE_PRIM_MAX)) ? &prim_table[prim] : NULL; + return (likely(prim < MESA_PRIM_COUNT)) ? &prim_table[prim] : NULL; } /** @@ -143,7 +143,7 @@ u_prim_vertex_count(enum pipe_prim_type prim) * For polygons, return the number of triangles. */ static inline unsigned -u_prims_for_vertices(enum pipe_prim_type prim, unsigned num) +u_prims_for_vertices(enum mesa_prim prim, unsigned num) { const struct u_prim_vertex_count *info = u_prim_vertex_count(prim); @@ -157,7 +157,7 @@ u_prims_for_vertices(enum pipe_prim_type prim, unsigned num) } static inline boolean -u_validate_pipe_prim(enum pipe_prim_type pipe_prim, unsigned nr) +u_validate_pipe_prim(enum mesa_prim pipe_prim, unsigned nr) { const struct u_prim_vertex_count *count = u_prim_vertex_count(pipe_prim); @@ -166,7 +166,7 @@ u_validate_pipe_prim(enum pipe_prim_type pipe_prim, unsigned nr) static inline boolean -u_trim_pipe_prim(enum pipe_prim_type pipe_prim, unsigned *nr) +u_trim_pipe_prim(enum mesa_prim pipe_prim, unsigned *nr) { const struct u_prim_vertex_count *count = u_prim_vertex_count(pipe_prim); @@ -182,28 +182,28 @@ u_trim_pipe_prim(enum pipe_prim_type pipe_prim, unsigned *nr) } static inline unsigned -u_vertices_per_prim(enum pipe_prim_type primitive) +u_vertices_per_prim(enum mesa_prim primitive) { switch(primitive) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: return 1; - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_LOOP: - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_STRIP: return 2; - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: return 3; - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: return 4; - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: return 6; - case PIPE_PRIM_QUADS: - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: /* these won't be seen from geometry shaders but prim assembly might for prim id. */ return 4; @@ -211,7 +211,7 @@ u_vertices_per_prim(enum pipe_prim_type primitive) /* following primitives should never be used * with geometry shaders abd their size is * undefined */ - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: default: debug_printf("Unrecognized geometry shader primitive"); return 3; @@ -228,41 +228,41 @@ u_vertices_per_prim(enum pipe_prim_type primitive) * primitives for a set of vertices. */ static inline unsigned -u_decomposed_prims_for_vertices(enum pipe_prim_type primitive, int vertices) +u_decomposed_prims_for_vertices(enum mesa_prim primitive, int vertices) { switch (primitive) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: return vertices; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: return vertices / 2; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: return (vertices >= 2) ? vertices : 0; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return (vertices >= 2) ? vertices - 1 : 0; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return vertices / 3; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return (vertices >= 3) ? vertices - 2 : 0; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: return (vertices >= 3) ? vertices - 2 : 0; - case PIPE_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: return vertices / 4; - case PIPE_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: return (vertices >= 4) ? vertices - 3 : 0; - case PIPE_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: return vertices / 6; - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: return (vertices >= 6) ? 1 + (vertices - 6) / 2 : 0; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: return vertices / 4; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: return (vertices >= 4) ? (vertices - 2) / 2 : 0; /* Polygons can't be decomposed * because the number of their vertices isn't known so * for them and whatever else we don't recognize just * return 1 if the number of vertices is greater than * or equal to 3 and zero otherwise */ - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: default: debug_printf("Invalid decomposition primitive!\n"); return (vertices >= 3) ? 1 : 0; @@ -275,63 +275,63 @@ u_decomposed_prims_for_vertices(enum pipe_prim_type primitive, int vertices) * triangle fans. */ static inline unsigned -u_reduced_prims_for_vertices(enum pipe_prim_type primitive, int vertices) +u_reduced_prims_for_vertices(enum mesa_prim primitive, int vertices) { switch (primitive) { - case PIPE_PRIM_QUADS: - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: return u_decomposed_prims_for_vertices(primitive, vertices) * 2; - case PIPE_PRIM_POLYGON: - primitive = PIPE_PRIM_TRIANGLE_FAN; + case MESA_PRIM_POLYGON: + primitive = MESA_PRIM_TRIANGLE_FAN; FALLTHROUGH; default: return u_decomposed_prims_for_vertices(primitive, vertices); } } -static inline enum pipe_prim_type -u_base_prim_type(enum pipe_prim_type prim_type) +static inline enum mesa_prim +u_base_prim_type(enum mesa_prim prim_type) { switch(prim_type) { - case PIPE_PRIM_POINTS: - return PIPE_PRIM_POINTS; - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_LOOP: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - return PIPE_PRIM_LINES; - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: - return PIPE_PRIM_TRIANGLES; - case PIPE_PRIM_QUADS: - case PIPE_PRIM_QUAD_STRIP: - return PIPE_PRIM_QUADS; + case MESA_PRIM_POINTS: + return MESA_PRIM_POINTS; + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + return MESA_PRIM_LINES; + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: + return MESA_PRIM_TRIANGLES; + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: + return MESA_PRIM_QUADS; default: return prim_type; } } -static inline enum pipe_prim_type +static inline enum mesa_prim u_tess_prim_from_shader(enum tess_primitive_mode shader_mode) { switch (shader_mode) { case TESS_PRIMITIVE_TRIANGLES: - return PIPE_PRIM_TRIANGLES; + return MESA_PRIM_TRIANGLES; case TESS_PRIMITIVE_QUADS: - return PIPE_PRIM_QUADS; + return MESA_PRIM_QUADS; case TESS_PRIMITIVE_ISOLINES: - return PIPE_PRIM_LINES; + return MESA_PRIM_LINES; default: - return PIPE_PRIM_POINTS; + return MESA_PRIM_POINTS; } } static inline unsigned -u_vertices_for_prims(enum pipe_prim_type prim_type, int count) +u_vertices_for_prims(enum mesa_prim prim_type, int count) { if (count <= 0) return 0; @@ -340,7 +340,7 @@ u_vertices_for_prims(enum pipe_prim_type prim_type, int count) * if we are using basic primitives (so no loops, strips, fans, etc). */ assert(prim_type == u_base_prim_type(prim_type) && - prim_type != PIPE_PRIM_PATCHES && prim_type != PIPE_PRIM_POLYGON); + prim_type != MESA_PRIM_PATCHES && prim_type != MESA_PRIM_POLYGON); const struct u_prim_vertex_count *info = u_prim_vertex_count(prim_type); assert(info); @@ -354,7 +354,7 @@ u_vertices_for_prims(enum pipe_prim_type prim_type, int count) */ static inline unsigned -u_stream_outputs_for_vertices(enum pipe_prim_type primitive, unsigned nr) +u_stream_outputs_for_vertices(enum mesa_prim primitive, unsigned nr) { /* Extraneous vertices don't contribute to stream outputs */ u_trim_pipe_prim(primitive, &nr); @@ -363,14 +363,14 @@ u_stream_outputs_for_vertices(enum pipe_prim_type primitive, unsigned nr) * vertices. In this case, we just have an output for each vertex (after * trimming) */ - if (primitive == PIPE_PRIM_POLYGON) + if (primitive == MESA_PRIM_POLYGON) return nr; /* Normally, consider how many primitives are actually generated */ unsigned prims = u_decomposed_prims_for_vertices(primitive, nr); /* One output per vertex after decomposition */ - enum pipe_prim_type base = u_base_prim_type(primitive); + enum mesa_prim base = u_base_prim_type(primitive); /* The GL 4.6 compatibility spec says * @@ -381,15 +381,15 @@ u_stream_outputs_for_vertices(enum pipe_prim_type primitive, unsigned nr) * Further, quads and polygons are always provided as TRIANGLES. So * tessellate quads into triangles. */ - if (base == PIPE_PRIM_QUADS) { - base = PIPE_PRIM_TRIANGLES; + if (base == MESA_PRIM_QUADS) { + base = MESA_PRIM_TRIANGLES; prims *= 2; } return u_vertices_for_prims(base, prims); } -const char *u_prim_name(enum pipe_prim_type pipe_prim); +const char *u_prim_name(enum mesa_prim pipe_prim); #ifdef __cplusplus diff --git a/src/gallium/auxiliary/util/u_prim_restart.c b/src/gallium/auxiliary/util/u_prim_restart.c index 82fca678885..13b1b29bee4 100644 --- a/src/gallium/auxiliary/util/u_prim_restart.c +++ b/src/gallium/auxiliary/util/u_prim_restart.c @@ -105,7 +105,7 @@ struct range_info { * \return true for success, false if out of memory */ static boolean -add_range(enum pipe_prim_type mode, struct range_info *info, unsigned start, unsigned count, unsigned index_bias) +add_range(enum mesa_prim mode, struct range_info *info, unsigned start, unsigned count, unsigned index_bias) { /* degenerate primitive: ignore */ if (!u_trim_pipe_prim(mode, (unsigned*)&count)) diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index 348aaa8c9d0..407ddd7b3c5 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -105,7 +105,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen, case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART: case PIPE_CAP_SUPPORTED_PRIM_MODES: - return BITFIELD_MASK(PIPE_PRIM_MAX); + return BITFIELD_MASK(MESA_PRIM_COUNT); case PIPE_CAP_MIN_TEXEL_OFFSET: /* GL 3.x minimum value. */ diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index 4e53f2c687f..119e1021614 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -930,8 +930,8 @@ util_make_geometry_passthrough_shader(struct pipe_context *pipe, if (!ureg) return NULL; - ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, PIPE_PRIM_POINTS); - ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, PIPE_PRIM_POINTS); + ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, MESA_PRIM_POINTS); + ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, MESA_PRIM_POINTS); ureg_property(ureg, TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES, 1); ureg_property(ureg, TGSI_PROPERTY_GS_INVOCATIONS, 1); imm = ureg_DECL_immediate_uint(ureg, zero, 4); diff --git a/src/gallium/auxiliary/util/u_split_draw.c b/src/gallium/auxiliary/util/u_split_draw.c index 39989aad00e..1ed2d1e99e4 100644 --- a/src/gallium/auxiliary/util/u_split_draw.c +++ b/src/gallium/auxiliary/util/u_split_draw.c @@ -33,27 +33,27 @@ u_split_draw(const struct pipe_draw_info *info, uint32_t max_verts, } switch (info->mode) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: *count = *step = max_verts; break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: *count = *step = max_verts - (max_verts % 2); break; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: *count = max_verts; *step = max_verts - 1; break; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: *count = max_verts; *step = max_verts - 1; debug_warn_once("unhandled line loop " "looping behavior with " ">max vert count\n"); break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: *count = *step = max_verts - (max_verts % 3); break; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: *count = max_verts; *step = max_verts - 2; break; diff --git a/src/gallium/auxiliary/util/u_split_prim.h b/src/gallium/auxiliary/util/u_split_prim.h index 5afb7d9a920..bc5dc87b99d 100644 --- a/src/gallium/auxiliary/util/u_split_prim.h +++ b/src/gallium/auxiliary/util/u_split_prim.h @@ -27,8 +27,8 @@ static inline void util_split_prim_init(struct util_split_prim *s, unsigned mode, unsigned start, unsigned count) { - if (mode == PIPE_PRIM_LINE_LOOP) { - s->mode = PIPE_PRIM_LINE_STRIP; + if (mode == MESA_PRIM_LINE_LOOP) { + s->mode = MESA_PRIM_LINE_STRIP; s->close_first = 1; } else { s->mode = mode; @@ -63,13 +63,13 @@ util_split_prim_next(struct util_split_prim *s, unsigned max_verts) } switch (s->mode) { - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: max_verts &= ~1; break; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: repeat = 1; break; - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: max_verts--; s->emit(s->priv, s->p_start, max_verts); s->edge(s->priv, FALSE); @@ -78,28 +78,28 @@ util_split_prim_next(struct util_split_prim *s, unsigned max_verts) s->repeat_first = TRUE; s->edgeflag_off = TRUE; return FALSE; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: max_verts = max_verts - (max_verts % 3); break; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: /* to ensure winding stays correct, always split * on an even number of generated triangles */ max_verts = max_verts & ~1; repeat = 2; break; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: s->repeat_first = TRUE; repeat = 1; break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: max_verts &= ~3; break; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: max_verts &= ~1; repeat = 2; break; - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: break; default: /* TODO: implement adjacency primitives */ diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c index bec15df2aab..6f13718b924 100644 --- a/src/gallium/auxiliary/util/u_tests.c +++ b/src/gallium/auxiliary/util/u_tests.c @@ -194,7 +194,7 @@ util_draw_fullscreen_quad(struct cso_context *cso) 1, -1, 0, 1, 1, 0, 0, 0 }; util_set_interleaved_vertex_elements(cso, 2); - util_draw_user_vertex_buffer(cso, vertices, PIPE_PRIM_QUADS, 4, 2); + util_draw_user_vertex_buffer(cso, vertices, MESA_PRIM_QUADS, 4, 2); } static void @@ -208,7 +208,7 @@ util_draw_fullscreen_quad_fill(struct cso_context *cso, 1, -1, 0, 1, r, g, b, a, }; util_set_interleaved_vertex_elements(cso, 2); - util_draw_user_vertex_buffer(cso, vertices, PIPE_PRIM_QUADS, 4, 2); + util_draw_user_vertex_buffer(cso, vertices, MESA_PRIM_QUADS, 4, 2); } /** @@ -349,7 +349,7 @@ tgsi_vs_window_space_position(struct pipe_context *ctx) 256, 0, 0, 0, 1, 0, 0, 1, }; util_set_interleaved_vertex_elements(cso, 2); - util_draw_user_vertex_buffer(cso, vertices, PIPE_PRIM_QUADS, 4, 2); + util_draw_user_vertex_buffer(cso, vertices, MESA_PRIM_QUADS, 4, 2); } /* Probe pixels. */ diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c index 7b8f95560e2..bb30d811b25 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -321,13 +321,13 @@ void u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps, screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX)) { caps->rewrite_restart_index = screen->get_param(screen, PIPE_CAP_EMULATE_NONFIXED_PRIMITIVE_RESTART); caps->supported_restart_modes = screen->get_param(screen, PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART); - caps->supported_restart_modes |= BITFIELD_BIT(PIPE_PRIM_PATCHES); - if (caps->supported_restart_modes != BITFIELD_MASK(PIPE_PRIM_MAX)) + caps->supported_restart_modes |= BITFIELD_BIT(MESA_PRIM_PATCHES); + if (caps->supported_restart_modes != BITFIELD_MASK(MESA_PRIM_COUNT)) caps->fallback_always = true; caps->fallback_always |= caps->rewrite_restart_index; } caps->supported_prim_modes = screen->get_param(screen, PIPE_CAP_SUPPORTED_PRIM_MODES); - if (caps->supported_prim_modes != BITFIELD_MASK(PIPE_PRIM_MAX)) + if (caps->supported_prim_modes != BITFIELD_MASK(MESA_PRIM_COUNT)) caps->fallback_always = true; if (!screen->is_format_supported(screen, PIPE_FORMAT_R8_UINT, PIPE_BUFFER, 0, 0, PIPE_BIND_INDEX_BUFFER)) @@ -356,8 +356,8 @@ u_vbuf_create(struct pipe_context *pipe, struct u_vbuf_caps *caps) mgr->pipe = pipe; if (caps->rewrite_ubyte_ibs || caps->rewrite_restart_index || /* require all but patches */ - ((caps->supported_prim_modes & caps->supported_restart_modes & BITFIELD_MASK(PIPE_PRIM_MAX))) != - BITFIELD_MASK(PIPE_PRIM_MAX)) { + ((caps->supported_prim_modes & caps->supported_restart_modes & BITFIELD_MASK(MESA_PRIM_COUNT))) != + BITFIELD_MASK(MESA_PRIM_COUNT)) { struct primconvert_config cfg; cfg.fixed_prim_restart = caps->rewrite_restart_index; cfg.primtypes_mask = caps->supported_prim_modes; diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c index bc434841383..f092fcaeff3 100644 --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c @@ -463,5 +463,5 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter, filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, false, &filter->quad); filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves); - util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4); + util_draw_arrays(filter->pipe, MESA_PRIM_QUADS, 0, 4); } diff --git a/src/gallium/auxiliary/vl/vl_compositor_gfx.c b/src/gallium/auxiliary/vl/vl_compositor_gfx.c index 24f5625b478..eb33f7b0ca8 100644 --- a/src/gallium/auxiliary/vl/vl_compositor_gfx.c +++ b/src/gallium/auxiliary/vl/vl_compositor_gfx.c @@ -667,7 +667,7 @@ draw_layers(struct vl_compositor *c, struct vl_compositor_state *s, struct u_rec c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0, num_sampler_views, 0, false, samplers); - util_draw_arrays(c->pipe, PIPE_PRIM_QUADS, vb_index * 4, 4); + util_draw_arrays(c->pipe, MESA_PRIM_QUADS, vb_index * 4, 4); vb_index++; if (dirty) { diff --git a/src/gallium/auxiliary/vl/vl_deint_filter.c b/src/gallium/auxiliary/vl/vl_deint_filter.c index f0c860ff2cd..91ffa839614 100644 --- a/src/gallium/auxiliary/vl/vl_deint_filter.c +++ b/src/gallium/auxiliary/vl/vl_deint_filter.c @@ -508,16 +508,16 @@ vl_deint_filter_render(struct vl_deint_filter *filter, filter->pipe->bind_fs_state(filter->pipe, field ? filter->fs_copy_bottom : filter->fs_copy_top); filter->pipe->set_framebuffer_state(filter->pipe, &fb_state); filter->pipe->set_viewport_states(filter->pipe, 0, 1, &viewport); - util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4); + util_draw_arrays(filter->pipe, MESA_PRIM_QUADS, 0, 4); /* blit or interpolate other field */ fb_state.cbufs[0] = dst_surf; filter->pipe->set_framebuffer_state(filter->pipe, &fb_state); if (i > 0 && filter->skip_chroma) { - util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4); + util_draw_arrays(filter->pipe, MESA_PRIM_QUADS, 0, 4); } else { filter->pipe->bind_fs_state(filter->pipe, field ? filter->fs_deint_top : filter->fs_deint_bottom); - util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4); + util_draw_arrays(filter->pipe, MESA_PRIM_QUADS, 0, 4); } if (++j >= util_format_get_nr_components(dst_surf->format)) { diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index a499e929b80..5de94e94b80 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -842,14 +842,14 @@ vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_ idct->pipe->set_viewport_states(idct->pipe, 0, 1, &buffer->viewport_mismatch); idct->pipe->bind_vs_state(idct->pipe, idct->vs_mismatch); idct->pipe->bind_fs_state(idct->pipe, idct->fs_mismatch); - util_draw_arrays_instanced(idct->pipe, PIPE_PRIM_POINTS, 0, 1, 0, num_instances); + util_draw_arrays_instanced(idct->pipe, MESA_PRIM_POINTS, 0, 1, 0, num_instances); /* first stage */ idct->pipe->set_framebuffer_state(idct->pipe, &buffer->fb_state); idct->pipe->set_viewport_states(idct->pipe, 0, 1, &buffer->viewport); idct->pipe->bind_vs_state(idct->pipe, idct->vs); idct->pipe->bind_fs_state(idct->pipe, idct->fs); - util_draw_arrays_instanced(idct->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances); + util_draw_arrays_instanced(idct->pipe, MESA_PRIM_QUADS, 0, 4, 0, num_instances); } void diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c index 5530444347c..4ef1be7f6e1 100644 --- a/src/gallium/auxiliary/vl/vl_matrix_filter.c +++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c @@ -309,5 +309,5 @@ vl_matrix_filter_render(struct vl_matrix_filter *filter, filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, false, &filter->quad); filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves); - util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4); + util_draw_arrays(filter->pipe, MESA_PRIM_QUADS, 0, 4); } diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c index 5963286c735..7e0f6dda92b 100644 --- a/src/gallium/auxiliary/vl/vl_mc.c +++ b/src/gallium/auxiliary/vl/vl_mc.c @@ -625,7 +625,7 @@ vl_mc_render_ref(struct vl_mc *renderer, struct vl_mc_buffer *buffer, struct pip renderer->pipe->bind_sampler_states(renderer->pipe, PIPE_SHADER_FRAGMENT, 0, 1, &renderer->sampler_ref); - util_draw_arrays_instanced(renderer->pipe, PIPE_PRIM_QUADS, 0, 4, 0, + util_draw_arrays_instanced(renderer->pipe, MESA_PRIM_QUADS, 0, 4, 0, renderer->buffer_width / VL_MACROBLOCK_WIDTH * renderer->buffer_height / VL_MACROBLOCK_HEIGHT); @@ -647,11 +647,11 @@ vl_mc_render_ycbcr(struct vl_mc *renderer, struct vl_mc_buffer *buffer, unsigned renderer->pipe->bind_vs_state(renderer->pipe, renderer->vs_ycbcr); renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ycbcr); - util_draw_arrays_instanced(renderer->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances); + util_draw_arrays_instanced(renderer->pipe, MESA_PRIM_QUADS, 0, 4, 0, num_instances); if (buffer->surface_cleared) { renderer->pipe->bind_blend_state(renderer->pipe, renderer->blend_sub[mask]); renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ycbcr_sub); - util_draw_arrays_instanced(renderer->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances); + util_draw_arrays_instanced(renderer->pipe, MESA_PRIM_QUADS, 0, 4, 0, num_instances); } } diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c index 38c9597fb72..a3aad7b5a8d 100644 --- a/src/gallium/auxiliary/vl/vl_median_filter.c +++ b/src/gallium/auxiliary/vl/vl_median_filter.c @@ -428,5 +428,5 @@ vl_median_filter_render(struct vl_median_filter *filter, filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, false, &filter->quad); filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves); - util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4); + util_draw_arrays(filter->pipe, MESA_PRIM_QUADS, 0, 4); } diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c index 3093ad1fe7d..59bc36b0bec 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.c +++ b/src/gallium/auxiliary/vl/vl_zscan.c @@ -610,5 +610,5 @@ vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned 0, 3, 0, false, &buffer->src); zscan->pipe->bind_vs_state(zscan->pipe, zscan->vs); zscan->pipe->bind_fs_state(zscan->pipe, zscan->fs); - util_draw_arrays_instanced(zscan->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances); + util_draw_arrays_instanced(zscan->pipe, MESA_PRIM_QUADS, 0, 4, 0, num_instances); } diff --git a/src/gallium/drivers/asahi/agx_batch.c b/src/gallium/drivers/asahi/agx_batch.c index 4a4065bec85..0cea6b35e0f 100644 --- a/src/gallium/drivers/asahi/agx_batch.c +++ b/src/gallium/drivers/asahi/agx_batch.c @@ -120,7 +120,7 @@ agx_batch_init(struct agx_context *ctx, batch->initialized = false; /* We need to emit prim state at the start. Max collides with all. */ - batch->reduced_prim = PIPE_PRIM_MAX; + batch->reduced_prim = MESA_PRIM_COUNT; if (!batch->syncobj) { int ret = drmSyncobjCreate(dev->fd, 0, &batch->syncobj); diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 20ade96c572..8e903963285 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -1617,13 +1617,13 @@ agx_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_SUPPORTED_PRIM_MODES: case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART: - return BITFIELD_BIT(PIPE_PRIM_POINTS) | BITFIELD_BIT(PIPE_PRIM_LINES) | - BITFIELD_BIT(PIPE_PRIM_LINE_STRIP) | - BITFIELD_BIT(PIPE_PRIM_LINE_LOOP) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLES) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLE_STRIP) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLE_FAN) | - BITFIELD_BIT(PIPE_PRIM_QUADS) | BITFIELD_BIT(PIPE_PRIM_QUAD_STRIP); + return BITFIELD_BIT(MESA_PRIM_POINTS) | BITFIELD_BIT(MESA_PRIM_LINES) | + BITFIELD_BIT(MESA_PRIM_LINE_STRIP) | + BITFIELD_BIT(MESA_PRIM_LINE_LOOP) | + BITFIELD_BIT(MESA_PRIM_TRIANGLES) | + BITFIELD_BIT(MESA_PRIM_TRIANGLE_STRIP) | + BITFIELD_BIT(MESA_PRIM_TRIANGLE_FAN) | + BITFIELD_BIT(MESA_PRIM_QUADS) | BITFIELD_BIT(MESA_PRIM_QUAD_STRIP); case PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE: return 1; diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 201a49dc030..711bccfa224 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -1666,7 +1666,7 @@ agx_update_fs(struct agx_batch *batch) .clip_plane_enable = ctx->rast->base.clip_plane_enable, }; - if (batch->reduced_prim == PIPE_PRIM_POINTS) + if (batch->reduced_prim == MESA_PRIM_POINTS) key.sprite_coord_enable = ctx->rast->base.sprite_coord_enable; for (unsigned i = 0; i < key.nr_cbufs; ++i) { @@ -2420,26 +2420,26 @@ agx_encode_state(struct agx_batch *batch, uint8_t *out, bool is_lines, } static enum agx_primitive -agx_primitive_for_pipe(enum pipe_prim_type mode) +agx_primitive_for_pipe(enum mesa_prim mode) { switch (mode) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: return AGX_PRIMITIVE_POINTS; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: return AGX_PRIMITIVE_LINES; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return AGX_PRIMITIVE_LINE_STRIP; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: return AGX_PRIMITIVE_LINE_LOOP; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return AGX_PRIMITIVE_TRIANGLES; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return AGX_PRIMITIVE_TRIANGLE_STRIP; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: return AGX_PRIMITIVE_TRIANGLE_FAN; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: return AGX_PRIMITIVE_QUADS; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: return AGX_PRIMITIVE_QUAD_STRIP; default: unreachable("todo: other primitive types"); @@ -2601,7 +2601,7 @@ agx_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info, agx_batch_init_state(batch); /* Dirty track the reduced prim: lines vs points vs triangles */ - enum pipe_prim_type reduced_prim = u_reduced_prim(info->mode); + enum mesa_prim reduced_prim = u_reduced_prim(info->mode); if (reduced_prim != batch->reduced_prim) ctx->dirty |= AGX_DIRTY_PRIM; batch->reduced_prim = reduced_prim; @@ -2650,8 +2650,8 @@ agx_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info, AGX_INDEX_LIST_START_LENGTH + AGX_INDEX_LIST_BUFFER_SIZE_LENGTH); uint8_t *out = agx_encode_state(batch, batch->encoder_current, - reduced_prim == PIPE_PRIM_LINES, - reduced_prim == PIPE_PRIM_POINTS); + reduced_prim == MESA_PRIM_LINES, + reduced_prim == MESA_PRIM_POINTS); enum agx_primitive prim = agx_primitive_for_pipe(info->mode); if (idx_size) { diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h index 727e1077f12..2db4ae8da35 100644 --- a/src/gallium/drivers/asahi/agx_state.h +++ b/src/gallium/drivers/asahi/agx_state.h @@ -56,7 +56,7 @@ struct agx_xfb_key { uint8_t index_size; /* The primitive mode for unrolling the vertex ID */ - enum pipe_prim_type mode; + enum mesa_prim mode; /* Use first vertex as the provoking vertex for flat shading */ bool flatshade_first; @@ -219,7 +219,7 @@ struct agx_batch { unsigned clear_stencil; /* Whether we're drawing points, lines, or triangles */ - enum pipe_prim_type reduced_prim; + enum mesa_prim reduced_prim; /* Current varyings linkage structures */ uint32_t varyings; diff --git a/src/gallium/drivers/asahi/agx_streamout.c b/src/gallium/drivers/asahi/agx_streamout.c index 190211ca7ee..87110841e3c 100644 --- a/src/gallium/drivers/asahi/agx_streamout.c +++ b/src/gallium/drivers/asahi/agx_streamout.c @@ -128,7 +128,7 @@ agx_draw_vbo_from_xfb(struct pipe_context *pctx, } static uint32_t -xfb_prims_for_vertices(enum pipe_prim_type mode, unsigned verts) +xfb_prims_for_vertices(enum mesa_prim mode, unsigned verts) { uint32_t prims = u_decomposed_prims_for_vertices(mode, verts); @@ -136,7 +136,7 @@ xfb_prims_for_vertices(enum pipe_prim_type mode, unsigned verts) * supposed to be tessellated into primitives and piglit * (ext_transform_feedback-tessellation quads) checks this. */ - if (u_decomposed_prim(mode) == PIPE_PRIM_QUADS) + if (u_decomposed_prim(mode) == MESA_PRIM_QUADS) prims *= 2; return prims; @@ -170,7 +170,7 @@ agx_launch_so(struct pipe_context *pctx, const struct pipe_draw_info *info, /* Ignore provoking vertex for modes that don't depend on the provoking * vertex, to reduce shader variants. */ - if (info->mode != PIPE_PRIM_TRIANGLE_STRIP) + if (info->mode != MESA_PRIM_TRIANGLE_STRIP) ctx->streamout.key.flatshade_first = false; /* Determine how many vertices are XFB there will be */ @@ -189,7 +189,7 @@ agx_launch_so(struct pipe_context *pctx, const struct pipe_draw_info *info, pctx, util_blitter_get_discard_rasterizer_state(ctx->blitter)); /* Dispatch a grid of points, this is compute-like */ - util_draw_arrays_instanced(pctx, PIPE_PRIM_POINTS, 0, num_outputs, 0, + util_draw_arrays_instanced(pctx, MESA_PRIM_POINTS, 0, num_outputs, 0, info->instance_count); pctx->bind_rasterizer_state(pctx, saved_rast); @@ -289,7 +289,7 @@ primitive_fits(nir_builder *b, struct agx_xfb_key *key) */ uint32_t verts_per_prim = u_vertices_per_prim(key->mode); - if (u_decomposed_prim(key->mode) == PIPE_PRIM_QUADS) + if (u_decomposed_prim(key->mode) == MESA_PRIM_QUADS) verts_per_prim = 6; /* Get the ID for this invocation */ @@ -449,8 +449,8 @@ lower_xfb_intrinsics(struct nir_builder *b, nir_instr *instr, void *data) nir_ssa_def *id = nir_load_vertex_id(b); /* Tessellate by primitive mode */ - if (key->mode == PIPE_PRIM_LINE_STRIP || - key->mode == PIPE_PRIM_LINE_LOOP) { + if (key->mode == MESA_PRIM_LINE_STRIP || + key->mode == MESA_PRIM_LINE_LOOP) { /* The last vertex is special for a loop. Check if that's we're dealing * with. */ @@ -463,10 +463,10 @@ lower_xfb_intrinsics(struct nir_builder *b, nir_instr *instr, void *data) id = nir_iadd(b, nir_ushr_imm(b, id, 1), nir_iand_imm(b, id, 1)); /* (0, 1), (1, 2), (2, 0) */ - if (key->mode == PIPE_PRIM_LINE_LOOP) { + if (key->mode == MESA_PRIM_LINE_LOOP) { id = nir_bcsel(b, last_vertex, nir_imm_int(b, 0), id); } - } else if (key->mode == PIPE_PRIM_TRIANGLE_STRIP) { + } else if (key->mode == MESA_PRIM_TRIANGLE_STRIP) { /* Order depends on the provoking vertex. * * First: (0, 1, 2), (1, 3, 2), (2, 3, 4). @@ -486,19 +486,19 @@ lower_xfb_intrinsics(struct nir_builder *b, nir_instr *instr, void *data) /* Pull the (maybe swapped) vertex from the corresponding primitive */ id = nir_iadd(b, prim, off); - } else if (key->mode == PIPE_PRIM_TRIANGLE_FAN) { + } else if (key->mode == MESA_PRIM_TRIANGLE_FAN) { /* (0, 1, 2), (0, 2, 3) */ nir_ssa_def *prim = nir_udiv_imm(b, id, 3); nir_ssa_def *rem = nir_umod_imm(b, id, 3); id = nir_bcsel(b, nir_ieq_imm(b, rem, 0), nir_imm_int(b, 0), nir_iadd(b, prim, rem)); - } else if (key->mode == PIPE_PRIM_QUADS || - key->mode == PIPE_PRIM_QUAD_STRIP) { + } else if (key->mode == MESA_PRIM_QUADS || + key->mode == MESA_PRIM_QUAD_STRIP) { /* Quads: [(0, 1, 3), (3, 1, 2)], [(4, 5, 7), (7, 5, 6)] * Quad strips: [(0, 1, 3), (0, 2, 3)], [(2, 3, 5), (2, 4, 5)] */ - bool strips = key->mode == PIPE_PRIM_QUAD_STRIP; + bool strips = key->mode == MESA_PRIM_QUAD_STRIP; nir_ssa_def *prim = nir_udiv_imm(b, id, 6); nir_ssa_def *rem = nir_umod_imm(b, id, 6); diff --git a/src/gallium/drivers/crocus/crocus_context.h b/src/gallium/drivers/crocus/crocus_context.h index ddfddd6ac31..071c6fe4508 100644 --- a/src/gallium/drivers/crocus/crocus_context.h +++ b/src/gallium/drivers/crocus/crocus_context.h @@ -584,8 +584,8 @@ struct crocus_context { bool primitive_restart; unsigned cut_index; - enum pipe_prim_type reduced_prim_mode:8; - enum pipe_prim_type prim_mode:8; + enum mesa_prim reduced_prim_mode:8; + enum mesa_prim prim_mode:8; bool prim_is_points_or_lines; uint8_t vertices_per_patch; uint8_t patch_vertices; diff --git a/src/gallium/drivers/crocus/crocus_draw.c b/src/gallium/drivers/crocus/crocus_draw.c index b576ba8284e..23e14a881cc 100644 --- a/src/gallium/drivers/crocus/crocus_draw.c +++ b/src/gallium/drivers/crocus/crocus_draw.c @@ -45,15 +45,15 @@ #include "util/u_prim.h" static bool -prim_is_points_or_lines(enum pipe_prim_type mode) +prim_is_points_or_lines(enum mesa_prim mode) { /* We don't need to worry about adjacency - it can only be used with * geometry shaders, and we don't care about this info when GS is on. */ - return mode == PIPE_PRIM_POINTS || - mode == PIPE_PRIM_LINES || - mode == PIPE_PRIM_LINE_LOOP || - mode == PIPE_PRIM_LINE_STRIP; + return mode == MESA_PRIM_POINTS || + mode == MESA_PRIM_LINES || + mode == MESA_PRIM_LINE_LOOP || + mode == MESA_PRIM_LINE_STRIP; } static bool @@ -89,15 +89,15 @@ can_cut_index_handle_prim(struct crocus_context *ice, return false; switch (draw->mode) { - case PIPE_PRIM_POINTS: - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_POINTS: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: return true; default: break; @@ -118,28 +118,28 @@ crocus_update_draw_info(struct crocus_context *ice, const struct pipe_draw_start_count_bias *draw) { struct crocus_screen *screen = (struct crocus_screen *)ice->ctx.screen; - enum pipe_prim_type mode = info->mode; + enum mesa_prim mode = info->mode; if (screen->devinfo.ver < 6) { /* Slight optimization to avoid the GS program when not needed: */ struct pipe_rasterizer_state *rs_state = crocus_get_rast_state(ice); - if (mode == PIPE_PRIM_QUAD_STRIP && !rs_state->flatshade && + if (mode == MESA_PRIM_QUAD_STRIP && !rs_state->flatshade && rs_state->fill_front == PIPE_POLYGON_MODE_FILL && rs_state->fill_back == PIPE_POLYGON_MODE_FILL) - mode = PIPE_PRIM_TRIANGLE_STRIP; - if (mode == PIPE_PRIM_QUADS && + mode = MESA_PRIM_TRIANGLE_STRIP; + if (mode == MESA_PRIM_QUADS && draw->count == 4 && !rs_state->flatshade && rs_state->fill_front == PIPE_POLYGON_MODE_FILL && rs_state->fill_back == PIPE_POLYGON_MODE_FILL) - mode = PIPE_PRIM_TRIANGLE_FAN; + mode = MESA_PRIM_TRIANGLE_FAN; } if (ice->state.prim_mode != mode) { ice->state.prim_mode = mode; - enum pipe_prim_type reduced = u_reduced_prim(mode); + enum mesa_prim reduced = u_reduced_prim(mode); if (ice->state.reduced_prim_mode != reduced) { if (screen->devinfo.ver < 6) ice->state.dirty |= CROCUS_DIRTY_GEN4_CLIP_PROG | CROCUS_DIRTY_GEN4_SF_PROG; @@ -165,7 +165,7 @@ crocus_update_draw_info(struct crocus_context *ice, } } - if (info->mode == PIPE_PRIM_PATCHES && + if (info->mode == MESA_PRIM_PATCHES && ice->state.vertices_per_patch != ice->state.patch_vertices) { ice->state.vertices_per_patch = ice->state.patch_vertices; @@ -396,7 +396,7 @@ crocus_draw_vbo(struct pipe_context *ctx, * trifans/tristrips. */ if (screen->devinfo.ver < 6) { - if (info->mode == PIPE_PRIM_QUADS || info->mode == PIPE_PRIM_QUAD_STRIP) { + if (info->mode == MESA_PRIM_QUADS || info->mode == MESA_PRIM_QUAD_STRIP) { bool trim = u_trim_pipe_prim(info->mode, (unsigned *)&draws[0].count); if (!trim) return; diff --git a/src/gallium/drivers/crocus/crocus_program.c b/src/gallium/drivers/crocus/crocus_program.c index a2d67052fc3..d9cea484fdd 100644 --- a/src/gallium/drivers/crocus/crocus_program.c +++ b/src/gallium/drivers/crocus/crocus_program.c @@ -2076,7 +2076,7 @@ crocus_update_compiled_clip(struct crocus_context *ice) else key.clip_mode = BRW_CLIP_MODE_NORMAL; - if (key.primitive == PIPE_PRIM_TRIANGLES) { + if (key.primitive == MESA_PRIM_TRIANGLES) { if (rs_state->cull_face == PIPE_FACE_FRONT_AND_BACK) key.clip_mode = BRW_CLIP_MODE_REJECT_ALL; else { @@ -2211,17 +2211,17 @@ crocus_update_compiled_sf(struct crocus_context *ice) key.attrs = ice->shaders.last_vue_map->slots_valid; switch (ice->state.reduced_prim_mode) { - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: default: if (key.attrs & BITFIELD64_BIT(VARYING_SLOT_EDGE)) key.primitive = BRW_SF_PRIM_UNFILLED_TRIS; else key.primitive = BRW_SF_PRIM_TRIANGLES; break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: key.primitive = BRW_SF_PRIM_LINES; break; - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: key.primitive = BRW_SF_PRIM_POINTS; break; } diff --git a/src/gallium/drivers/crocus/crocus_screen.h b/src/gallium/drivers/crocus/crocus_screen.h index f817bfa75a4..d60abcb3f34 100644 --- a/src/gallium/drivers/crocus/crocus_screen.h +++ b/src/gallium/drivers/crocus/crocus_screen.h @@ -156,7 +156,7 @@ struct crocus_vtable { bool (*calculate_urb_fence)(struct crocus_batch *batch, unsigned csize, unsigned vsize, unsigned sfsize); void (*batch_reset_dirty)(struct crocus_batch *batch); - unsigned (*translate_prim_type)(enum pipe_prim_type prim, uint8_t verts_per_patch); + unsigned (*translate_prim_type)(enum mesa_prim prim, uint8_t verts_per_patch); void (*update_so_strides)(struct crocus_context *ice, uint16_t *strides); diff --git a/src/gallium/drivers/crocus/crocus_state.c b/src/gallium/drivers/crocus/crocus_state.c index 28fa9e3fd65..7daf7c7fa76 100644 --- a/src/gallium/drivers/crocus/crocus_state.c +++ b/src/gallium/drivers/crocus/crocus_state.c @@ -185,31 +185,31 @@ UNUSED static void pipe_asserts() } static unsigned -translate_prim_type(enum pipe_prim_type prim, uint8_t verts_per_patch) +translate_prim_type(enum mesa_prim prim, uint8_t verts_per_patch) { static const unsigned map[] = { - [PIPE_PRIM_POINTS] = _3DPRIM_POINTLIST, - [PIPE_PRIM_LINES] = _3DPRIM_LINELIST, - [PIPE_PRIM_LINE_LOOP] = _3DPRIM_LINELOOP, - [PIPE_PRIM_LINE_STRIP] = _3DPRIM_LINESTRIP, - [PIPE_PRIM_TRIANGLES] = _3DPRIM_TRILIST, - [PIPE_PRIM_TRIANGLE_STRIP] = _3DPRIM_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = _3DPRIM_TRIFAN, - [PIPE_PRIM_QUADS] = _3DPRIM_QUADLIST, - [PIPE_PRIM_QUAD_STRIP] = _3DPRIM_QUADSTRIP, - [PIPE_PRIM_POLYGON] = _3DPRIM_POLYGON, + [MESA_PRIM_POINTS] = _3DPRIM_POINTLIST, + [MESA_PRIM_LINES] = _3DPRIM_LINELIST, + [MESA_PRIM_LINE_LOOP] = _3DPRIM_LINELOOP, + [MESA_PRIM_LINE_STRIP] = _3DPRIM_LINESTRIP, + [MESA_PRIM_TRIANGLES] = _3DPRIM_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = _3DPRIM_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = _3DPRIM_TRIFAN, + [MESA_PRIM_QUADS] = _3DPRIM_QUADLIST, + [MESA_PRIM_QUAD_STRIP] = _3DPRIM_QUADSTRIP, + [MESA_PRIM_POLYGON] = _3DPRIM_POLYGON, #if GFX_VER >= 6 - [PIPE_PRIM_LINES_ADJACENCY] = _3DPRIM_LINELIST_ADJ, - [PIPE_PRIM_LINE_STRIP_ADJACENCY] = _3DPRIM_LINESTRIP_ADJ, - [PIPE_PRIM_TRIANGLES_ADJACENCY] = _3DPRIM_TRILIST_ADJ, - [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = _3DPRIM_TRISTRIP_ADJ, + [MESA_PRIM_LINES_ADJACENCY] = _3DPRIM_LINELIST_ADJ, + [MESA_PRIM_LINE_STRIP_ADJACENCY] = _3DPRIM_LINESTRIP_ADJ, + [MESA_PRIM_TRIANGLES_ADJACENCY] = _3DPRIM_TRILIST_ADJ, + [MESA_PRIM_TRIANGLE_STRIP_ADJACENCY] = _3DPRIM_TRISTRIP_ADJ, #endif #if GFX_VER >= 7 - [PIPE_PRIM_PATCHES] = _3DPRIM_PATCHLIST_1 - 1, + [MESA_PRIM_PATCHES] = _3DPRIM_PATCHLIST_1 - 1, #endif }; - return map[prim] + (prim == PIPE_PRIM_PATCHES ? verts_per_patch : 0); + return map[prim] + (prim == MESA_PRIM_PATCHES ? verts_per_patch : 0); } static unsigned @@ -4456,7 +4456,7 @@ crocus_is_drawing_points(const struct crocus_context *ice) (void *) ice->shaders.prog[MESA_SHADER_TESS_EVAL]->prog_data; return tes_data->output_topology == BRW_TESS_OUTPUT_TOPOLOGY_POINT; } else { - return ice->state.prim_mode == PIPE_PRIM_POINTS; + return ice->state.prim_mode == MESA_PRIM_POINTS; } } #endif @@ -4815,9 +4815,9 @@ crocus_populate_fs_key(const struct crocus_context *ice, uint32_t line_aa = BRW_NEVER; if (rast->cso.line_smooth) { int reduced_prim = ice->state.reduced_prim_mode; - if (reduced_prim == PIPE_PRIM_LINES) + if (reduced_prim == MESA_PRIM_LINES) line_aa = BRW_ALWAYS; - else if (reduced_prim == PIPE_PRIM_TRIANGLES) { + else if (reduced_prim == MESA_PRIM_TRIANGLES) { if (rast->cso.fill_front == PIPE_POLYGON_MODE_LINE) { line_aa = BRW_SOMETIMES; @@ -9306,8 +9306,8 @@ genX(crocus_init_state)(struct crocus_context *ice) ice->state.sample_mask = 0xff; ice->state.num_viewports = 1; - ice->state.prim_mode = PIPE_PRIM_MAX; - ice->state.reduced_prim_mode = PIPE_PRIM_MAX; + ice->state.prim_mode = MESA_PRIM_COUNT; + ice->state.reduced_prim_mode = MESA_PRIM_COUNT; ice->state.genx = calloc(1, sizeof(struct crocus_genx_state)); ice->draw.derived_params.drawid = -1; diff --git a/src/gallium/drivers/d3d12/d3d12_compiler.cpp b/src/gallium/drivers/d3d12/d3d12_compiler.cpp index 52c18390476..befe646eb9c 100644 --- a/src/gallium/drivers/d3d12/d3d12_compiler.cpp +++ b/src/gallium/drivers/d3d12/d3d12_compiler.cpp @@ -346,11 +346,11 @@ manual_depth_range(struct d3d12_context *ctx) } static bool -needs_edge_flag_fix(enum pipe_prim_type mode) +needs_edge_flag_fix(enum mesa_prim mode) { - return (mode == PIPE_PRIM_QUADS || - mode == PIPE_PRIM_QUAD_STRIP || - mode == PIPE_PRIM_POLYGON); + return (mode == MESA_PRIM_QUADS || + mode == MESA_PRIM_QUAD_STRIP || + mode == MESA_PRIM_POLYGON); } static unsigned @@ -361,8 +361,8 @@ fill_mode_lowered(struct d3d12_context *ctx, const struct pipe_draw_info *dinfo) if ((ctx->gfx_stages[PIPE_SHADER_GEOMETRY] != NULL && !ctx->gfx_stages[PIPE_SHADER_GEOMETRY]->is_variant) || ctx->gfx_pipeline_state.rast == NULL || - (dinfo->mode != PIPE_PRIM_TRIANGLES && - dinfo->mode != PIPE_PRIM_TRIANGLE_STRIP)) + (dinfo->mode != MESA_PRIM_TRIANGLES && + dinfo->mode != MESA_PRIM_TRIANGLE_STRIP)) return PIPE_POLYGON_MODE_FILL; /* D3D12 supports line mode (wireframe) but doesn't support edge flags */ @@ -408,7 +408,7 @@ needs_point_sprite_lowering(struct d3d12_context *ctx, const struct pipe_draw_in !has_stream_out_for_streams(ctx))); } else { /* No user GS; check if we are drawing wide points */ - return ((dinfo->mode == PIPE_PRIM_POINTS || + return ((dinfo->mode == MESA_PRIM_POINTS || fill_mode_lowered(ctx, dinfo) == PIPE_POLYGON_MODE_POINT) && (ctx->gfx_pipeline_state.rast->base.point_size > 1.0 || ctx->gfx_pipeline_state.rast->base.offset_point || @@ -443,17 +443,17 @@ get_provoking_vertex(struct d3d12_selection_context *sel_ctx, bool *alternate, c struct d3d12_shader_selector *last_vertex_stage = gs && !gs->is_variant ? gs : vs; /* Make sure GL prims match Gallium prims */ - STATIC_ASSERT(GL_POINTS == PIPE_PRIM_POINTS); - STATIC_ASSERT(GL_LINES == PIPE_PRIM_LINES); - STATIC_ASSERT(GL_LINE_STRIP == PIPE_PRIM_LINE_STRIP); + STATIC_ASSERT(GL_POINTS == MESA_PRIM_POINTS); + STATIC_ASSERT(GL_LINES == MESA_PRIM_LINES); + STATIC_ASSERT(GL_LINE_STRIP == MESA_PRIM_LINE_STRIP); - enum pipe_prim_type mode; + enum mesa_prim mode; switch (last_vertex_stage->stage) { case PIPE_SHADER_GEOMETRY: - mode = (enum pipe_prim_type)last_vertex_stage->current->nir->info.gs.output_primitive; + mode = (enum mesa_prim)last_vertex_stage->current->nir->info.gs.output_primitive; break; case PIPE_SHADER_VERTEX: - mode = (enum pipe_prim_type)dinfo->mode; + mode = (enum mesa_prim)dinfo->mode; break; default: unreachable("Tesselation shaders are not supported"); diff --git a/src/gallium/drivers/d3d12/d3d12_context.cpp b/src/gallium/drivers/d3d12/d3d12_context.cpp index 27aad18ae31..0bd94e0f8c2 100644 --- a/src/gallium/drivers/d3d12/d3d12_context.cpp +++ b/src/gallium/drivers/d3d12/d3d12_context.cpp @@ -2497,11 +2497,11 @@ d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) 0, false); struct primconvert_config cfg = {}; - cfg.primtypes_mask = 1 << PIPE_PRIM_POINTS | - 1 << PIPE_PRIM_LINES | - 1 << PIPE_PRIM_LINE_STRIP | - 1 << PIPE_PRIM_TRIANGLES | - 1 << PIPE_PRIM_TRIANGLE_STRIP; + cfg.primtypes_mask = 1 << MESA_PRIM_POINTS | + 1 << MESA_PRIM_LINES | + 1 << MESA_PRIM_LINE_STRIP | + 1 << MESA_PRIM_TRIANGLES | + 1 << MESA_PRIM_TRIANGLE_STRIP; cfg.restart_primtypes_mask = cfg.primtypes_mask; cfg.fixed_prim_restart = true; ctx->primconvert = util_primconvert_create_config(&ctx->base, &cfg); diff --git a/src/gallium/drivers/d3d12/d3d12_context.h b/src/gallium/drivers/d3d12/d3d12_context.h index 148ba6ddfc7..89ff68477de 100644 --- a/src/gallium/drivers/d3d12/d3d12_context.h +++ b/src/gallium/drivers/d3d12/d3d12_context.h @@ -196,7 +196,7 @@ struct d3d12_context { unsigned num_vbs; float flip_y; bool need_zero_one_depth_range; - enum pipe_prim_type initial_api_prim; + enum mesa_prim initial_api_prim; struct pipe_viewport_state viewport_states[PIPE_MAX_VIEWPORTS]; D3D12_VIEWPORT viewports[PIPE_MAX_VIEWPORTS]; unsigned num_viewports; diff --git a/src/gallium/drivers/d3d12/d3d12_draw.cpp b/src/gallium/drivers/d3d12/d3d12_draw.cpp index 6e0f5bdc8c7..2ae97dc3e05 100644 --- a/src/gallium/drivers/d3d12/d3d12_draw.cpp +++ b/src/gallium/drivers/d3d12/d3d12_draw.cpp @@ -621,46 +621,46 @@ validate_stream_output_targets(struct d3d12_context *ctx) } static D3D_PRIMITIVE_TOPOLOGY -topology(enum pipe_prim_type prim_type, uint8_t patch_vertices) +topology(enum mesa_prim prim_type, uint8_t patch_vertices) { switch (prim_type) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: return D3D_PRIMITIVE_TOPOLOGY_POINTLIST; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: return D3D_PRIMITIVE_TOPOLOGY_LINELIST; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; - case PIPE_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: return D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ; - case PIPE_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ; - case PIPE_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ; - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ; - case PIPE_PRIM_PATCHES: + case MESA_PRIM_PATCHES: return (D3D_PRIMITIVE_TOPOLOGY)(D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + patch_vertices - 1); - case PIPE_PRIM_QUADS: - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; /* HACK: this is just wrong! */ default: - debug_printf("pipe_prim_type: %s\n", u_prim_name(prim_type)); - unreachable("unexpected enum pipe_prim_type"); + debug_printf("mesa_prim: %s\n", u_prim_name(prim_type)); + unreachable("unexpected enum mesa_prim"); } } @@ -717,19 +717,19 @@ transition_surface_subresources_state(struct d3d12_context *ctx, } static bool -prim_supported(enum pipe_prim_type prim_type) +prim_supported(enum mesa_prim prim_type) { switch (prim_type) { - case PIPE_PRIM_POINTS: - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: - case PIPE_PRIM_PATCHES: + case MESA_PRIM_POINTS: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_PATCHES: return true; default: @@ -901,17 +901,17 @@ d3d12_draw_vbo(struct pipe_context *pctx, enum d3d12_surface_conversion_mode conversion_modes[PIPE_MAX_COLOR_BUFS] = {}; struct pipe_draw_indirect_info patched_indirect = {}; - if (!prim_supported((enum pipe_prim_type)dinfo->mode) || + if (!prim_supported((enum mesa_prim)dinfo->mode) || dinfo->index_size == 1 || (dinfo->primitive_restart && dinfo->restart_index != 0xffff && dinfo->restart_index != 0xffffffff)) { if (!dinfo->primitive_restart && !indirect && - !u_trim_pipe_prim((enum pipe_prim_type)dinfo->mode, (unsigned *)&draws[0].count)) + !u_trim_pipe_prim((enum mesa_prim)dinfo->mode, (unsigned *)&draws[0].count)) return; - ctx->initial_api_prim = (enum pipe_prim_type)dinfo->mode; + ctx->initial_api_prim = (enum mesa_prim)dinfo->mode; util_primconvert_save_rasterizer_state(ctx->primconvert, &ctx->gfx_pipeline_state.rast->base); util_primconvert_draw_vbo(ctx->primconvert, dinfo, drawid_offset, indirect, draws, num_draws); return; @@ -946,7 +946,7 @@ d3d12_draw_vbo(struct pipe_context *pctx, struct d3d12_rasterizer_state *rast = ctx->gfx_pipeline_state.rast; if (rast->twoface_back) { - enum pipe_prim_type saved_mode = ctx->initial_api_prim; + enum mesa_prim saved_mode = ctx->initial_api_prim; twoface_emulation(ctx, rast, dinfo, indirect, &draws[0]); ctx->initial_api_prim = saved_mode; } @@ -956,13 +956,13 @@ d3d12_draw_vbo(struct pipe_context *pctx, D3D12_SHADER_DIRTY_SAMPLERS; /* this should *really* be fixed at a higher level than here! */ - enum pipe_prim_type reduced_prim = u_reduced_prim((enum pipe_prim_type)dinfo->mode); - if (reduced_prim == PIPE_PRIM_TRIANGLES && + enum mesa_prim reduced_prim = u_reduced_prim((enum mesa_prim)dinfo->mode); + if (reduced_prim == MESA_PRIM_TRIANGLES && ctx->gfx_pipeline_state.rast->base.cull_face == PIPE_FACE_FRONT_AND_BACK) return; if (ctx->gfx_pipeline_state.prim_type != dinfo->mode) { - ctx->gfx_pipeline_state.prim_type = (enum pipe_prim_type)dinfo->mode; + ctx->gfx_pipeline_state.prim_type = (enum mesa_prim)dinfo->mode; ctx->state_dirty |= D3D12_DIRTY_PRIM_MODE; } @@ -977,7 +977,7 @@ d3d12_draw_vbo(struct pipe_context *pctx, } /* Reset to an invalid value after it's been used */ - ctx->initial_api_prim = PIPE_PRIM_MAX; + ctx->initial_api_prim = MESA_PRIM_COUNT; /* Copy the stream output info from the current vertex/geometry shader */ if (ctx->state_dirty & D3D12_DIRTY_SHADER) { @@ -1111,7 +1111,7 @@ d3d12_draw_vbo(struct pipe_context *pctx, } if (ctx->cmdlist_dirty & D3D12_DIRTY_PRIM_MODE) - ctx->cmdlist->IASetPrimitiveTopology(topology((enum pipe_prim_type)dinfo->mode, ctx->patch_vertices)); + ctx->cmdlist->IASetPrimitiveTopology(topology((enum mesa_prim)dinfo->mode, ctx->patch_vertices)); for (unsigned i = 0; i < ctx->num_vbs; ++i) { if (ctx->vbs[i].buffer.resource) { diff --git a/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp b/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp index 2663abee864..ea7ad5a5b7c 100644 --- a/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp +++ b/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp @@ -156,11 +156,11 @@ fill_so_declaration(const struct pipe_stream_output_info *info, } static bool -depth_bias(struct d3d12_rasterizer_state *state, enum pipe_prim_type reduced_prim) +depth_bias(struct d3d12_rasterizer_state *state, enum mesa_prim reduced_prim) { /* glPolygonOffset is supposed to be only enabled when rendering polygons. * In d3d12 case, all polygons (and quads) are lowered to triangles */ - if (reduced_prim != PIPE_PRIM_TRIANGLES) + if (reduced_prim != MESA_PRIM_TRIANGLES) return false; unsigned fill_mode = state->base.cull_face == PIPE_FACE_FRONT ? state->base.fill_back @@ -182,24 +182,24 @@ depth_bias(struct d3d12_rasterizer_state *state, enum pipe_prim_type reduced_pri } static D3D12_PRIMITIVE_TOPOLOGY_TYPE -topology_type(enum pipe_prim_type reduced_prim) +topology_type(enum mesa_prim reduced_prim) { switch (reduced_prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; - case PIPE_PRIM_PATCHES: + case MESA_PRIM_PATCHES: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH; default: - debug_printf("pipe_prim_type: %s\n", u_prim_name(reduced_prim)); - unreachable("unexpected enum pipe_prim_type"); + debug_printf("mesa_prim: %s\n", u_prim_name(reduced_prim)); + unreachable("unexpected enum mesa_prim"); } } @@ -229,8 +229,8 @@ create_gfx_pipeline_state(struct d3d12_context *ctx) { struct d3d12_screen *screen = d3d12_screen(ctx->base.screen); struct d3d12_gfx_pipeline_state *state = &ctx->gfx_pipeline_state; - enum pipe_prim_type reduced_prim = state->prim_type == PIPE_PRIM_PATCHES ? - PIPE_PRIM_PATCHES : u_reduced_prim(state->prim_type); + enum mesa_prim reduced_prim = state->prim_type == MESA_PRIM_PATCHES ? + MESA_PRIM_PATCHES : u_reduced_prim(state->prim_type); D3D12_SO_DECLARATION_ENTRY entries[PIPE_MAX_SO_OUTPUTS] = {}; UINT strides[PIPE_MAX_SO_OUTPUTS] = { 0 }; UINT num_entries = 0, num_strides = 0; @@ -293,7 +293,7 @@ create_gfx_pipeline_state(struct d3d12_context *ctx) D3D12_RASTERIZER_DESC& rast = (D3D12_RASTERIZER_DESC&)pso_desc.RasterizerState; rast = state->rast->desc; - if (reduced_prim != PIPE_PRIM_TRIANGLES) + if (reduced_prim != MESA_PRIM_TRIANGLES) rast.CullMode = D3D12_CULL_MODE_NONE; if (depth_bias(state->rast, reduced_prim)) { diff --git a/src/gallium/drivers/d3d12/d3d12_pipeline_state.h b/src/gallium/drivers/d3d12/d3d12_pipeline_state.h index 5fb15b54da3..14d9d60b6cb 100644 --- a/src/gallium/drivers/d3d12/d3d12_pipeline_state.h +++ b/src/gallium/drivers/d3d12/d3d12_pipeline_state.h @@ -80,7 +80,7 @@ struct d3d12_gfx_pipeline_state { DXGI_FORMAT rtv_formats[8]; DXGI_FORMAT dsv_format; D3D12_INDEX_BUFFER_STRIP_CUT_VALUE ib_strip_cut_value; - enum pipe_prim_type prim_type; + enum mesa_prim prim_type; }; struct d3d12_compute_pipeline_state { diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c index 84a64c4e187..f9d718a9f14 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_context.c +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c @@ -245,7 +245,7 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info, return; /* Nothing to do */ if (unlikely(ctx->rasterizer->cull_face == PIPE_FACE_FRONT_AND_BACK && - u_decomposed_prim(info->mode) == PIPE_PRIM_TRIANGLES)) + u_decomposed_prim(info->mode) == MESA_PRIM_TRIANGLES)) return; int prims = u_decomposed_prims_for_vertices(info->mode, draws[0].count); diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index e991349993f..8751db71dcb 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -269,21 +269,21 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_SUPPORTED_PRIM_MODES: case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART: { /* Generate the bitmask of supported draw primitives. */ - uint32_t modes = 1 << PIPE_PRIM_POINTS | - 1 << PIPE_PRIM_LINES | - 1 << PIPE_PRIM_LINE_STRIP | - 1 << PIPE_PRIM_TRIANGLES | - 1 << PIPE_PRIM_TRIANGLE_FAN; + uint32_t modes = 1 << MESA_PRIM_POINTS | + 1 << MESA_PRIM_LINES | + 1 << MESA_PRIM_LINE_STRIP | + 1 << MESA_PRIM_TRIANGLES | + 1 << MESA_PRIM_TRIANGLE_FAN; /* TODO: The bug relates only to indexed draws, but here we signal * that there is no support for triangle strips at all. This should * be refined. */ if (VIV_FEATURE(screen, chipMinorFeatures2, BUG_FIXES8)) - modes |= 1 << PIPE_PRIM_TRIANGLE_STRIP; + modes |= 1 << MESA_PRIM_TRIANGLE_STRIP; if (VIV_FEATURE(screen, chipMinorFeatures2, LINE_LOOP)) - modes |= 1 << PIPE_PRIM_LINE_LOOP; + modes |= 1 << MESA_PRIM_LINE_LOOP; return modes; } diff --git a/src/gallium/drivers/etnaviv/etnaviv_translate.h b/src/gallium/drivers/etnaviv/etnaviv_translate.h index eb81001c99b..e208b5e4ed8 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_translate.h +++ b/src/gallium/drivers/etnaviv/etnaviv_translate.h @@ -427,21 +427,21 @@ static inline uint32_t translate_draw_mode(unsigned mode) { switch (mode) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: return PRIMITIVE_TYPE_POINTS; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: return PRIMITIVE_TYPE_LINES; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: return PRIMITIVE_TYPE_LINE_LOOP; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return PRIMITIVE_TYPE_LINE_STRIP; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return PRIMITIVE_TYPE_TRIANGLES; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return PRIMITIVE_TYPE_TRIANGLE_STRIP; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: return PRIMITIVE_TYPE_TRIANGLE_FAN; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: return PRIMITIVE_TYPE_QUADS; default: DBG("Unhandled draw mode primitive %i", mode); diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c index b19899de7d8..10edf724702 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c @@ -141,7 +141,7 @@ draw_impl(struct fd_context *ctx, const struct pipe_draw_info *info, } enum pc_di_vis_cull_mode vismode = USE_VISIBILITY; - if (binning || info->mode == PIPE_PRIM_POINTS) + if (binning || info->mode == MESA_PRIM_POINTS) vismode = IGNORE_VISIBILITY; fd_draw_emit(ctx->batch, ring, ctx->screen->primtypes[info->mode], @@ -169,7 +169,7 @@ fd2_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *pinfo, if (!ctx->prog.fs || !ctx->prog.vs) return false; - if (pinfo->mode != PIPE_PRIM_MAX && !indirect && !pinfo->primitive_restart && + if (pinfo->mode != MESA_PRIM_COUNT && !indirect && !pinfo->primitive_restart && !u_trim_pipe_prim(pinfo->mode, (unsigned *)&pdraw->count)) return false; @@ -190,14 +190,14 @@ fd2_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *pinfo, */ if (pdraw->count > 32766) { /* clang-format off */ - static const uint16_t step_tbl[PIPE_PRIM_MAX] = { - [0 ... PIPE_PRIM_MAX - 1] = 32766, - [PIPE_PRIM_LINE_STRIP] = 32765, - [PIPE_PRIM_TRIANGLE_STRIP] = 32764, + static const uint16_t step_tbl[MESA_PRIM_COUNT] = { + [0 ... MESA_PRIM_COUNT - 1] = 32766, + [MESA_PRIM_LINE_STRIP] = 32765, + [MESA_PRIM_TRIANGLE_STRIP] = 32764, /* needs more work */ - [PIPE_PRIM_TRIANGLE_FAN] = 0, - [PIPE_PRIM_LINE_LOOP] = 0, + [MESA_PRIM_TRIANGLE_FAN] = 0, + [MESA_PRIM_LINE_LOOP] = 0, }; /* clang-format on */ diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c index a761c6420b7..353a3498f37 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c @@ -94,23 +94,23 @@ fd2_screen_is_format_supported(struct pipe_screen *pscreen, } /* clang-format off */ -static const enum pc_di_primtype a22x_primtypes[PIPE_PRIM_MAX] = { - [PIPE_PRIM_POINTS] = DI_PT_POINTLIST_PSIZE, - [PIPE_PRIM_LINES] = DI_PT_LINELIST, - [PIPE_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, - [PIPE_PRIM_LINE_LOOP] = DI_PT_LINELOOP, - [PIPE_PRIM_TRIANGLES] = DI_PT_TRILIST, - [PIPE_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, +static const enum pc_di_primtype a22x_primtypes[MESA_PRIM_COUNT] = { + [MESA_PRIM_POINTS] = DI_PT_POINTLIST_PSIZE, + [MESA_PRIM_LINES] = DI_PT_LINELIST, + [MESA_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, + [MESA_PRIM_LINE_LOOP] = DI_PT_LINELOOP, + [MESA_PRIM_TRIANGLES] = DI_PT_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, }; -static const enum pc_di_primtype a20x_primtypes[PIPE_PRIM_MAX] = { - [PIPE_PRIM_POINTS] = DI_PT_POINTLIST_PSIZE, - [PIPE_PRIM_LINES] = DI_PT_LINELIST, - [PIPE_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, - [PIPE_PRIM_TRIANGLES] = DI_PT_TRILIST, - [PIPE_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, +static const enum pc_di_primtype a20x_primtypes[MESA_PRIM_COUNT] = { + [MESA_PRIM_POINTS] = DI_PT_POINTLIST_PSIZE, + [MESA_PRIM_LINES] = DI_PT_LINELIST, + [MESA_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, + [MESA_PRIM_TRIANGLES] = DI_PT_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, }; /* clang-format on */ diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c index 12e564208e3..3428cbf836b 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c @@ -86,7 +86,7 @@ draw_impl(struct fd_context *ctx, struct fd_ringbuffer *ring, /* points + psize -> spritelist: */ if (ctx->rasterizer->point_size_per_vertex && - fd3_emit_get_vp(emit)->writes_psize && (info->mode == PIPE_PRIM_POINTS)) + fd3_emit_get_vp(emit)->writes_psize && (info->mode == MESA_PRIM_POINTS)) primtype = DI_PT_POINTLIST_PSIZE; fd_draw_emit(ctx->batch, ring, primtype, @@ -117,7 +117,7 @@ fd3_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info, .sprite_coord_mode = ctx->rasterizer->sprite_coord_mode, }; - if (info->mode != PIPE_PRIM_MAX && !indirect && !info->primitive_restart && + if (info->mode != MESA_PRIM_COUNT && !indirect && !info->primitive_restart && !u_trim_pipe_prim(info->mode, (unsigned *)&draw->count)) return false; diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c index 8f6f641442c..8d9224ace85 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c @@ -96,14 +96,14 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen, /* clang-format off */ static const enum pc_di_primtype primtypes[] = { - [PIPE_PRIM_POINTS] = DI_PT_POINTLIST, - [PIPE_PRIM_LINES] = DI_PT_LINELIST, - [PIPE_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, - [PIPE_PRIM_LINE_LOOP] = DI_PT_LINELOOP, - [PIPE_PRIM_TRIANGLES] = DI_PT_TRILIST, - [PIPE_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, - [PIPE_PRIM_MAX] = DI_PT_RECTLIST, /* internal clear blits */ + [MESA_PRIM_POINTS] = DI_PT_POINTLIST, + [MESA_PRIM_LINES] = DI_PT_LINELIST, + [MESA_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, + [MESA_PRIM_LINE_LOOP] = DI_PT_LINELOOP, + [MESA_PRIM_TRIANGLES] = DI_PT_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, + [MESA_PRIM_COUNT] = DI_PT_RECTLIST, /* internal clear blits */ }; /* clang-format on */ diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c index 6d49340d449..86a23c67ea8 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c @@ -63,7 +63,7 @@ draw_impl(struct fd_context *ctx, struct fd_ringbuffer *ring, /* points + psize -> spritelist: */ if (ctx->rasterizer->point_size_per_vertex && - fd4_emit_get_vp(emit)->writes_psize && (info->mode == PIPE_PRIM_POINTS)) + fd4_emit_get_vp(emit)->writes_psize && (info->mode == MESA_PRIM_POINTS)) primtype = DI_PT_POINTLIST_PSIZE; fd4_draw_emit(ctx->batch, ring, primtype, @@ -114,7 +114,7 @@ fd4_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info, sizeof(emit.key.key.fsampler_swizzles)); } - if (info->mode != PIPE_PRIM_MAX && !indirect && !info->primitive_restart && + if (info->mode != MESA_PRIM_COUNT && !indirect && !info->primitive_restart && !u_trim_pipe_prim(info->mode, (unsigned *)&draw->count)) return false; diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c index ae8b75a9e9e..19eabd36389 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c @@ -100,14 +100,14 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen, /* clang-format off */ static const enum pc_di_primtype primtypes[] = { - [PIPE_PRIM_POINTS] = DI_PT_POINTLIST, - [PIPE_PRIM_LINES] = DI_PT_LINELIST, - [PIPE_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, - [PIPE_PRIM_LINE_LOOP] = DI_PT_LINELOOP, - [PIPE_PRIM_TRIANGLES] = DI_PT_TRILIST, - [PIPE_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, - [PIPE_PRIM_MAX] = DI_PT_RECTLIST, /* internal clear blits */ + [MESA_PRIM_POINTS] = DI_PT_POINTLIST, + [MESA_PRIM_LINES] = DI_PT_LINELIST, + [MESA_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, + [MESA_PRIM_LINE_LOOP] = DI_PT_LINELOOP, + [MESA_PRIM_TRIANGLES] = DI_PT_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, + [MESA_PRIM_COUNT] = DI_PT_RECTLIST, /* internal clear blits */ }; /* clang-format on */ diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c index 1faf272f304..4907c2851f0 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c @@ -122,14 +122,14 @@ fd5_screen_is_format_supported(struct pipe_screen *pscreen, /* clang-format off */ static const enum pc_di_primtype primtypes[] = { - [PIPE_PRIM_POINTS] = DI_PT_POINTLIST, - [PIPE_PRIM_LINES] = DI_PT_LINELIST, - [PIPE_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, - [PIPE_PRIM_LINE_LOOP] = DI_PT_LINELOOP, - [PIPE_PRIM_TRIANGLES] = DI_PT_TRILIST, - [PIPE_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, - [PIPE_PRIM_MAX] = DI_PT_RECTLIST, /* internal clear blits */ + [MESA_PRIM_POINTS] = DI_PT_POINTLIST, + [MESA_PRIM_LINES] = DI_PT_LINELIST, + [MESA_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, + [MESA_PRIM_LINE_LOOP] = DI_PT_LINELOOP, + [MESA_PRIM_TRIANGLES] = DI_PT_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, + [MESA_PRIM_COUNT] = DI_PT_RECTLIST, /* internal clear blits */ }; /* clang-format on */ diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc b/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc index 69b95c5273e..75987851895 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc @@ -236,7 +236,7 @@ get_program_state(struct fd_context *ctx, const struct pipe_draw_info *info) key.key.rasterflat = ctx->rasterizer->flatshade; if (PIPELINE == HAS_TESS_GS) { - if (info->mode == PIPE_PRIM_PATCHES) { + if (info->mode == MESA_PRIM_PATCHES) { struct shader_info *gs_info = ir3_get_shader_info((struct ir3_shader_state *)ctx->prog.gs); @@ -316,7 +316,7 @@ draw_vbos(struct fd_context *ctx, const struct pipe_draw_info *info, return; if (PIPELINE == HAS_TESS_GS) { - if ((info->mode == PIPE_PRIM_PATCHES) || ctx->prog.gs) { + if ((info->mode == MESA_PRIM_PATCHES) || ctx->prog.gs) { ctx->gen_dirty |= BIT(FD6_GROUP_PRIMITIVE_PARAMS); } } @@ -389,7 +389,7 @@ draw_vbos(struct fd_context *ctx, const struct pipe_draw_info *info, draw0.source_select = DI_SRC_SEL_AUTO_INDEX; } - if ((PIPELINE == HAS_TESS_GS) && (info->mode == PIPE_PRIM_PATCHES)) { + if ((PIPELINE == HAS_TESS_GS) && (info->mode == MESA_PRIM_PATCHES)) { struct shader_info *ds_info = ir3_get_shader_info((struct ir3_shader_state *)ctx->prog.ds); unsigned tessellation = ir3_tess_mode(ds_info->tess._primitive_mode); diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.cc b/src/gallium/drivers/freedreno/a6xx/fd6_program.cc index d17e84256d6..7ba49ac9d78 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.cc @@ -1078,13 +1078,13 @@ setup_stateobj(struct fd_ringbuffer *ring, struct fd_context *ctx, enum a6xx_tess_output output; switch (gs->gs.output_primitive) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: output = TESS_POINTS; break; - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: output = TESS_LINES; break; - case SHADER_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: output = TESS_CW_TRIS; break; default: diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_screen.cc b/src/gallium/drivers/freedreno/a6xx/fd6_screen.cc index abb7caba748..881aba30a74 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_screen.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_screen.cc @@ -131,22 +131,22 @@ fd6_screen_is_format_supported(struct pipe_screen *pscreen, /* clang-format off */ static const enum pc_di_primtype primtypes[] = { - [PIPE_PRIM_POINTS] = DI_PT_POINTLIST, - [PIPE_PRIM_LINES] = DI_PT_LINELIST, - [PIPE_PRIM_LINE_LOOP] = DI_PT_LINELOOP, - [PIPE_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, - [PIPE_PRIM_TRIANGLES] = DI_PT_TRILIST, - [PIPE_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, - [PIPE_PRIM_QUADS] = DI_PT_NONE, /* unsupported */ - [PIPE_PRIM_QUAD_STRIP] = DI_PT_NONE, /* unsupported */ - [PIPE_PRIM_POLYGON] = DI_PT_NONE, /* unsupported */ - [PIPE_PRIM_LINES_ADJACENCY] = DI_PT_LINE_ADJ, - [PIPE_PRIM_LINE_STRIP_ADJACENCY] = DI_PT_LINESTRIP_ADJ, - [PIPE_PRIM_TRIANGLES_ADJACENCY] = DI_PT_TRI_ADJ, - [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = DI_PT_TRISTRIP_ADJ, - [PIPE_PRIM_PATCHES] = DI_PT_PATCHES0, - [PIPE_PRIM_MAX] = DI_PT_RECTLIST, /* internal clear blits */ + [MESA_PRIM_POINTS] = DI_PT_POINTLIST, + [MESA_PRIM_LINES] = DI_PT_LINELIST, + [MESA_PRIM_LINE_LOOP] = DI_PT_LINELOOP, + [MESA_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, + [MESA_PRIM_TRIANGLES] = DI_PT_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, + [MESA_PRIM_QUADS] = DI_PT_NONE, /* unsupported */ + [MESA_PRIM_QUAD_STRIP] = DI_PT_NONE, /* unsupported */ + [MESA_PRIM_POLYGON] = DI_PT_NONE, /* unsupported */ + [MESA_PRIM_LINES_ADJACENCY] = DI_PT_LINE_ADJ, + [MESA_PRIM_LINE_STRIP_ADJACENCY] = DI_PT_LINESTRIP_ADJ, + [MESA_PRIM_TRIANGLES_ADJACENCY] = DI_PT_TRI_ADJ, + [MESA_PRIM_TRIANGLE_STRIP_ADJACENCY] = DI_PT_TRISTRIP_ADJ, + [MESA_PRIM_PATCHES] = DI_PT_PATCHES0, + [MESA_PRIM_COUNT] = DI_PT_RECTLIST, /* internal clear blits */ }; /* clang-format on */ diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_vsc.cc b/src/gallium/drivers/freedreno/a6xx/fd6_vsc.cc index caa8f8b346e..d9365b0bdde 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_vsc.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_vsc.cc @@ -67,9 +67,9 @@ static unsigned prim_count(const struct pipe_draw_info *info, const struct pipe_draw_start_count_bias *draw) { - /* PIPE_PRIM_MAX used internally for RECTLIST blits on 3d pipe: */ + /* MESA_PRIM_COUNT used internally for RECTLIST blits on 3d pipe: */ unsigned vtx_per_prim = - (info->mode == PIPE_PRIM_MAX) ? 2 : u_vertices_per_prim(info->mode); + (info->mode == MESA_PRIM_COUNT) ? 2 : u_vertices_per_prim(info->mode); return MAX2(1, (draw->count * info->instance_count) / vtx_per_prim); } diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.c b/src/gallium/drivers/freedreno/freedreno_blitter.c index 3e719b4c5a2..781d0a584cb 100644 --- a/src/gallium/drivers/freedreno/freedreno_blitter.c +++ b/src/gallium/drivers/freedreno/freedreno_blitter.c @@ -254,7 +254,7 @@ fd_blitter_clear(struct pipe_context *pctx, unsigned buffers, pctx->bind_tes_state(pctx, NULL); struct pipe_draw_info info = { - .mode = PIPE_PRIM_MAX, /* maps to DI_PT_RECTLIST */ + .mode = MESA_PRIM_COUNT, /* maps to DI_PT_RECTLIST */ .index_bounds_valid = true, .max_index = 1, .instance_count = MAX2(1, pfb->layers), diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index 78488560f16..be469715127 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -277,7 +277,7 @@ update_draw_stats(struct fd_context *ctx, const struct pipe_draw_info *info, * so keep the count accurate for non-patch geometry. */ unsigned prims = 0; - if ((info->mode != PIPE_PRIM_PATCHES) && (info->mode != PIPE_PRIM_MAX)) { + if ((info->mode != MESA_PRIM_PATCHES) && (info->mode != MESA_PRIM_COUNT)) { for (unsigned i = 0; i < num_draws; i++) { prims += u_reduced_prims_for_vertices(info->mode, draws[i].count); } @@ -287,7 +287,7 @@ update_draw_stats(struct fd_context *ctx, const struct pipe_draw_info *info, if (ctx->streamout.num_targets > 0) { /* Clip the prims we're writing to the size of the SO buffers. */ - enum pipe_prim_type tf_prim = u_decomposed_prim(info->mode); + enum mesa_prim tf_prim = u_decomposed_prim(info->mode); unsigned verts_written = u_vertices_for_prims(tf_prim, prims); unsigned remaining_vert_space = ctx->streamout.max_tf_vtx - ctx->streamout.verts_written; diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 6b5b77f647f..61c40f666de 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -1186,7 +1186,7 @@ fd_screen_create(int fd, /* fdN_screen_init() should set this: */ assert(screen->primtypes); screen->primtypes_mask = 0; - for (unsigned i = 0; i <= PIPE_PRIM_MAX; i++) + for (unsigned i = 0; i <= MESA_PRIM_COUNT; i++) if (screen->primtypes[i]) screen->primtypes_mask |= (1 << i); diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h index c8a814ecc5a..0635fc65d1c 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.h +++ b/src/gallium/drivers/freedreno/freedreno_screen.h @@ -160,7 +160,7 @@ struct fd_screen { #define FD6_TESS_BO_SIZE (FD6_TESS_FACTOR_SIZE + FD6_TESS_PARAM_SIZE) struct fd_bo *tess_bo; - /* table with PIPE_PRIM_MAX+1 entries mapping PIPE_PRIM_x to + /* table with MESA_PRIM_COUNT+1 entries mapping MESA_PRIM_x to * DI_PT_x value to use for draw initiator. There are some * slight differences between generation. * diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c index 44e10da8d60..939c43f1ac8 100644 --- a/src/gallium/drivers/i915/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -285,49 +285,49 @@ i915_vbuf_ensure_index_bounds(struct vbuf_render *render, unsigned max_index) static void i915_vbuf_render_set_primitive(struct vbuf_render *render, - enum pipe_prim_type prim) + enum mesa_prim prim) { struct i915_vbuf_render *i915_render = i915_vbuf_render(render); i915_render->prim = prim; switch (prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: i915_render->hwprim = PRIM3D_POINTLIST; i915_render->fallback = 0; break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: i915_render->hwprim = PRIM3D_LINELIST; i915_render->fallback = 0; break; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: i915_render->hwprim = PRIM3D_LINELIST; - i915_render->fallback = PIPE_PRIM_LINE_LOOP; + i915_render->fallback = MESA_PRIM_LINE_LOOP; break; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: i915_render->hwprim = PRIM3D_LINESTRIP; i915_render->fallback = 0; break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: i915_render->hwprim = PRIM3D_TRILIST; i915_render->fallback = 0; break; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: i915_render->hwprim = PRIM3D_TRISTRIP; i915_render->fallback = 0; break; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: i915_render->hwprim = PRIM3D_TRIFAN; i915_render->fallback = 0; break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: i915_render->hwprim = PRIM3D_TRILIST; - i915_render->fallback = PIPE_PRIM_QUADS; + i915_render->fallback = MESA_PRIM_QUADS; break; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: i915_render->hwprim = PRIM3D_TRILIST; - i915_render->fallback = PIPE_PRIM_QUAD_STRIP; + i915_render->fallback = MESA_PRIM_QUAD_STRIP; break; - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: i915_render->hwprim = PRIM3D_POLY; i915_render->fallback = 0; break; @@ -357,21 +357,21 @@ draw_arrays_generate_indices(struct vbuf_render *render, unsigned start, if (i < end) OUT_BATCH(i); break; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: if (nr >= 2) { for (i = start + 1; i < end; i++) OUT_BATCH((i - 1) | (i + 0) << 16); OUT_BATCH((i - 1) | (start) << 16); } break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: for (i = start; i + 3 < end; i += 4) { OUT_BATCH((i + 0) | (i + 1) << 16); OUT_BATCH((i + 3) | (i + 1) << 16); OUT_BATCH((i + 2) | (i + 3) << 16); } break; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: for (i = start; i + 3 < end; i += 2) { OUT_BATCH((i + 0) | (i + 1) << 16); OUT_BATCH((i + 3) | (i + 2) << 16); @@ -389,14 +389,14 @@ draw_arrays_calc_nr_indices(uint32_t nr, unsigned type) switch (type) { case 0: return nr; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: if (nr >= 2) return nr * 2; else return 0; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: return (nr / 4) * 6; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: return ((nr - 2) / 2) * 6; default: assert(0); @@ -514,21 +514,21 @@ draw_generate_indices(struct vbuf_render *render, const ushort *indices, OUT_BATCH((o + indices[i])); } break; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: if (nr_indices >= 2) { for (i = 1; i < nr_indices; i++) OUT_BATCH((o + indices[i - 1]) | (o + indices[i]) << 16); OUT_BATCH((o + indices[i - 1]) | (o + indices[0]) << 16); } break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: for (i = 0; i + 3 < nr_indices; i += 4) { OUT_BATCH((o + indices[i + 0]) | (o + indices[i + 1]) << 16); OUT_BATCH((o + indices[i + 3]) | (o + indices[i + 1]) << 16); OUT_BATCH((o + indices[i + 2]) | (o + indices[i + 3]) << 16); } break; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: for (i = 0; i + 3 < nr_indices; i += 2) { OUT_BATCH((o + indices[i + 0]) | (o + indices[i + 1]) << 16); OUT_BATCH((o + indices[i + 3]) | (o + indices[i + 2]) << 16); @@ -547,14 +547,14 @@ draw_calc_nr_indices(uint32_t nr_indices, unsigned type) switch (type) { case 0: return nr_indices; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: if (nr_indices >= 2) return nr_indices * 2; else return 0; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: return (nr_indices / 4) * 6; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: return ((nr_indices - 2) / 2) * 6; default: assert(0); diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 9471081bb6c..1c850def2ff 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -776,7 +776,7 @@ struct iris_context { uint8_t patch_vertices; bool primitive_restart; unsigned cut_index; - enum pipe_prim_type prim_mode:8; + enum mesa_prim prim_mode:8; bool prim_is_points_or_lines; uint8_t vertices_per_patch; diff --git a/src/gallium/drivers/iris/iris_draw.c b/src/gallium/drivers/iris/iris_draw.c index de4e834b993..dacbdbf3226 100644 --- a/src/gallium/drivers/iris/iris_draw.c +++ b/src/gallium/drivers/iris/iris_draw.c @@ -48,10 +48,10 @@ prim_is_points_or_lines(const struct pipe_draw_info *draw) /* We don't need to worry about adjacency - it can only be used with * geometry shaders, and we don't care about this info when GS is on. */ - return draw->mode == PIPE_PRIM_POINTS || - draw->mode == PIPE_PRIM_LINES || - draw->mode == PIPE_PRIM_LINE_LOOP || - draw->mode == PIPE_PRIM_LINE_STRIP; + return draw->mode == MESA_PRIM_POINTS || + draw->mode == MESA_PRIM_LINES || + draw->mode == MESA_PRIM_LINE_LOOP || + draw->mode == MESA_PRIM_LINE_STRIP; } /** @@ -82,7 +82,7 @@ iris_update_draw_info(struct iris_context *ice, } } - if (info->mode == PIPE_PRIM_PATCHES && + if (info->mode == MESA_PRIM_PATCHES && ice->state.vertices_per_patch != ice->state.patch_vertices) { ice->state.vertices_per_patch = ice->state.patch_vertices; ice->state.dirty |= IRIS_DIRTY_VF_TOPOLOGY; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 1b08973008f..bf2803a456a 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -184,27 +184,27 @@ UNUSED static void pipe_asserts() } static unsigned -translate_prim_type(enum pipe_prim_type prim, uint8_t verts_per_patch) +translate_prim_type(enum mesa_prim prim, uint8_t verts_per_patch) { static const unsigned map[] = { - [PIPE_PRIM_POINTS] = _3DPRIM_POINTLIST, - [PIPE_PRIM_LINES] = _3DPRIM_LINELIST, - [PIPE_PRIM_LINE_LOOP] = _3DPRIM_LINELOOP, - [PIPE_PRIM_LINE_STRIP] = _3DPRIM_LINESTRIP, - [PIPE_PRIM_TRIANGLES] = _3DPRIM_TRILIST, - [PIPE_PRIM_TRIANGLE_STRIP] = _3DPRIM_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = _3DPRIM_TRIFAN, - [PIPE_PRIM_QUADS] = _3DPRIM_QUADLIST, - [PIPE_PRIM_QUAD_STRIP] = _3DPRIM_QUADSTRIP, - [PIPE_PRIM_POLYGON] = _3DPRIM_POLYGON, - [PIPE_PRIM_LINES_ADJACENCY] = _3DPRIM_LINELIST_ADJ, - [PIPE_PRIM_LINE_STRIP_ADJACENCY] = _3DPRIM_LINESTRIP_ADJ, - [PIPE_PRIM_TRIANGLES_ADJACENCY] = _3DPRIM_TRILIST_ADJ, - [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = _3DPRIM_TRISTRIP_ADJ, - [PIPE_PRIM_PATCHES] = _3DPRIM_PATCHLIST_1 - 1, + [MESA_PRIM_POINTS] = _3DPRIM_POINTLIST, + [MESA_PRIM_LINES] = _3DPRIM_LINELIST, + [MESA_PRIM_LINE_LOOP] = _3DPRIM_LINELOOP, + [MESA_PRIM_LINE_STRIP] = _3DPRIM_LINESTRIP, + [MESA_PRIM_TRIANGLES] = _3DPRIM_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = _3DPRIM_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = _3DPRIM_TRIFAN, + [MESA_PRIM_QUADS] = _3DPRIM_QUADLIST, + [MESA_PRIM_QUAD_STRIP] = _3DPRIM_QUADSTRIP, + [MESA_PRIM_POLYGON] = _3DPRIM_POLYGON, + [MESA_PRIM_LINES_ADJACENCY] = _3DPRIM_LINELIST_ADJ, + [MESA_PRIM_LINE_STRIP_ADJACENCY] = _3DPRIM_LINESTRIP_ADJ, + [MESA_PRIM_TRIANGLES_ADJACENCY] = _3DPRIM_TRILIST_ADJ, + [MESA_PRIM_TRIANGLE_STRIP_ADJACENCY] = _3DPRIM_TRISTRIP_ADJ, + [MESA_PRIM_PATCHES] = _3DPRIM_PATCHLIST_1 - 1, }; - return map[prim] + (prim == PIPE_PRIM_PATCHES ? verts_per_patch : 0); + return map[prim] + (prim == MESA_PRIM_PATCHES ? verts_per_patch : 0); } static unsigned @@ -4520,7 +4520,7 @@ iris_is_drawing_points(const struct iris_context *ice) (void *) ice->shaders.prog[MESA_SHADER_TESS_EVAL]->prog_data; return tes_data->output_topology == BRW_TESS_OUTPUT_TOPOLOGY_POINT; } else { - return ice->state.prim_mode == PIPE_PRIM_POINTS; + return ice->state.prim_mode == MESA_PRIM_POINTS; } } @@ -7353,15 +7353,15 @@ flush_vbos(struct iris_context *ice, struct iris_batch *batch) } static bool -point_or_line_list(enum pipe_prim_type prim_type) +point_or_line_list(enum mesa_prim prim_type) { switch (prim_type) { - case PIPE_PRIM_POINTS: - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_POINTS: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINE_LOOP: return true; default: return false; @@ -8767,7 +8767,7 @@ gfx9_toggle_preemption(struct iris_context *ice, * "WA: Disable mid-draw preemption when draw-call is a linestrip_adj * and GS is enabled." */ - if (draw->mode == PIPE_PRIM_LINE_STRIP_ADJACENCY && + if (draw->mode == MESA_PRIM_LINE_STRIP_ADJACENCY && ice->shaders.prog[MESA_SHADER_GEOMETRY]) object_preemption = false; @@ -8780,7 +8780,7 @@ gfx9_toggle_preemption(struct iris_context *ice, * * WA: Disable mid-draw preemption when draw-call has a tri-fan." */ - if (draw->mode == PIPE_PRIM_TRIANGLE_FAN) + if (draw->mode == MESA_PRIM_TRIANGLE_FAN) object_preemption = false; /* WaDisableMidObjectPreemptionForLineLoop @@ -8790,7 +8790,7 @@ gfx9_toggle_preemption(struct iris_context *ice, * WA: Disable mid-draw preemption when the draw uses a lineloop * topology." */ - if (draw->mode == PIPE_PRIM_LINE_LOOP) + if (draw->mode == MESA_PRIM_LINE_LOOP) object_preemption = false; /* WA#0798 @@ -9036,7 +9036,7 @@ genX(init_state)(struct iris_context *ice) ice->state.sample_mask = 0xffff; ice->state.num_viewports = 1; - ice->state.prim_mode = PIPE_PRIM_MAX; + ice->state.prim_mode = MESA_PRIM_COUNT; ice->state.genx = calloc(1, sizeof(struct iris_genx_state)); ice->draw.derived_params.drawid = -1; diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c index 771757d084c..ff8cbbdfaa0 100644 --- a/src/gallium/drivers/lima/lima_draw.c +++ b/src/gallium/drivers/lima/lima_draw.c @@ -94,7 +94,7 @@ lima_extend_viewport(struct lima_context *ctx, const struct pipe_draw_info *info ctx->ext_viewport.bottom = ctx->viewport.bottom; ctx->ext_viewport.top = ctx->viewport.top; - if (info->mode != PIPE_PRIM_LINES) + if (info->mode != MESA_PRIM_LINES) return; if (!ctx->rasterizer) @@ -363,11 +363,11 @@ lima_pack_plbu_cmd(struct lima_context *ctx, const struct pipe_draw_info *info, } /* Specify point size with PLBU command if shader doesn't write */ - if (info->mode == PIPE_PRIM_POINTS && ctx->vs->state.point_size_idx == -1) + if (info->mode == MESA_PRIM_POINTS && ctx->vs->state.point_size_idx == -1) force_point_size = true; /* Specify line width with PLBU command for lines */ - if (info->mode > PIPE_PRIM_POINTS && info->mode < PIPE_PRIM_TRIANGLES) + if (info->mode > MESA_PRIM_POINTS && info->mode < MESA_PRIM_TRIANGLES) force_point_size = true; PLBU_CMD_PRIMITIVE_SETUP(force_point_size, cull, info->index_size); @@ -392,10 +392,10 @@ lima_pack_plbu_cmd(struct lima_context *ctx, const struct pipe_draw_info *info, PLBU_CMD_DEPTH_RANGE_NEAR(fui(ctx->viewport.near)); PLBU_CMD_DEPTH_RANGE_FAR(fui(ctx->viewport.far)); - if ((info->mode == PIPE_PRIM_POINTS && ctx->vs->state.point_size_idx == -1) || - ((info->mode >= PIPE_PRIM_LINES) && (info->mode < PIPE_PRIM_TRIANGLES))) + if ((info->mode == MESA_PRIM_POINTS && ctx->vs->state.point_size_idx == -1) || + ((info->mode >= MESA_PRIM_LINES) && (info->mode < MESA_PRIM_TRIANGLES))) { - uint32_t v = info->mode == PIPE_PRIM_POINTS ? + uint32_t v = info->mode == MESA_PRIM_POINTS ? fui(ctx->rasterizer->base.point_size) : fui(ctx->rasterizer->base.line_width); PLBU_CMD_LOW_PRIM_SIZE(v); } @@ -674,9 +674,9 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in } /* need more investigation */ - if (info->mode == PIPE_PRIM_POINTS) + if (info->mode == MESA_PRIM_POINTS) render->multi_sample = 0x00000000; - else if (info->mode < PIPE_PRIM_TRIANGLES) + else if (info->mode < MESA_PRIM_TRIANGLES) render->multi_sample = 0x00000400; else render->multi_sample = 0x00000800; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 6bf8202865e..5a0985e816b 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -77,7 +77,7 @@ struct lp_setup_context struct pipe_context *pipe; struct vertex_info *vertex_info; uint view_index; - enum pipe_prim_type prim; + enum mesa_prim prim; uint vertex_size; uint nr_vertices; uint sprite_coord_enable, sprite_coord_origin; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c index 5342052daa0..7afa2ae693f 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c @@ -125,7 +125,7 @@ lp_setup_unmap_vertices(struct vbuf_render *vbr, static void -lp_setup_set_primitive(struct vbuf_render *vbr, enum pipe_prim_type prim) +lp_setup_set_primitive(struct vbuf_render *vbr, enum mesa_prim prim) { lp_setup_context(vbr)->prim = prim; } @@ -186,14 +186,14 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) setup->setup.variant->key.uses_constant_interp; switch (setup->prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: for (i = 0; i < nr; i++) { setup->point(setup, get_vert(vertex_buffer, indices[i-0], stride)); } break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: for (i = 1; i < nr; i += 2) { setup->line(setup, get_vert(vertex_buffer, indices[i-1], stride), @@ -201,7 +201,7 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: for (i = 1; i < nr; i ++) { setup->line(setup, get_vert(vertex_buffer, indices[i-1], stride), @@ -209,7 +209,7 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: for (i = 1; i < nr; i ++) { setup->line(setup, get_vert(vertex_buffer, indices[i-1], stride), @@ -222,7 +222,7 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: if (nr % 6 == 0 && !uses_constant_interp) { for (i = 5; i < nr; i += 6) { rect(setup, @@ -243,7 +243,7 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: if (flatshade_first) { for (i = 2; i < nr; i += 1) { /* emit first triangle vertex as first triangle vertex */ @@ -264,7 +264,7 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: if (flatshade_first) { for (i = 2; i < nr; i += 1) { /* emit first non-spoke vertex as first vertex */ @@ -284,7 +284,7 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: /* GL quads don't follow provoking vertex convention */ if (flatshade_first) { /* emit last quad vertex as first triangle vertex */ @@ -315,7 +315,7 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: /* GL quad strips don't follow provoking vertex convention */ if (flatshade_first) { /* emit last quad vertex as first triangle vertex */ @@ -344,7 +344,7 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: /* Almost same as tri fan but the _first_ vertex specifies the flat * shading color. */ @@ -394,14 +394,14 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) setup->setup.variant->key.uses_constant_interp; switch (setup->prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: for (i = 0; i < nr; i++) { setup->point(setup, get_vert(vertex_buffer, i-0, stride)); } break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: for (i = 1; i < nr; i += 2) { setup->line(setup, get_vert(vertex_buffer, i-1, stride), @@ -409,7 +409,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: for (i = 1; i < nr; i ++) { setup->line(setup, get_vert(vertex_buffer, i-1, stride), @@ -417,7 +417,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: for (i = 1; i < nr; i ++) { setup->line(setup, get_vert(vertex_buffer, i-1, stride), @@ -430,7 +430,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: if (nr % 6 == 0 && !uses_constant_interp) { for (i = 5; i < nr; i += 6) { rect(setup, @@ -456,7 +456,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: if (flatshade_first) { if (!uses_constant_interp) { int j; @@ -508,7 +508,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: if (nr == 4 && !uses_constant_interp) { rect(setup, get_vert(vertex_buffer, 0, stride), @@ -536,7 +536,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: /* GL quads don't follow provoking vertex convention */ if (flatshade_first) { /* emit last quad vertex as first triangle vertex */ @@ -577,7 +577,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: /* GL quad strips don't follow provoking vertex convention */ if (flatshade_first) { /* emit last quad vertex as first triangle vertex */ @@ -606,7 +606,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: /* Almost same as tri fan but the _first_ vertex specifies the flat * shading color. */ diff --git a/src/gallium/drivers/nouveau/nouveau_gldefs.h b/src/gallium/drivers/nouveau/nouveau_gldefs.h index 1538c7b6e57..68c0c0ab6ff 100644 --- a/src/gallium/drivers/nouveau/nouveau_gldefs.h +++ b/src/gallium/drivers/nouveau/nouveau_gldefs.h @@ -168,25 +168,25 @@ nvgl_stencil_op(unsigned op) static inline unsigned nvgl_primitive(unsigned prim) { switch (prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: return 0x0001; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: return 0x0002; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: return 0x0003; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return 0x0004; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return 0x0005; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return 0x0006; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: return 0x0007; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: return 0x0008; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: return 0x0009; - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: return 0x000a; default: return 0; diff --git a/src/gallium/drivers/nouveau/nv30/nv30_context.h b/src/gallium/drivers/nouveau/nv30/nv30_context.h index 1f5b476789a..2531cf6e25a 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_context.h +++ b/src/gallium/drivers/nouveau/nv30/nv30_context.h @@ -216,7 +216,7 @@ nv30_state_release(struct nv30_context *nv30); #ifdef NV30_3D_VERTEX_BEGIN_END #define NV30_PRIM_GL_CASE(n) \ - case PIPE_PRIM_##n: return NV30_3D_VERTEX_BEGIN_END_##n + case MESA_PRIM_##n: return NV30_3D_VERTEX_BEGIN_END_##n static inline unsigned nv30_prim_gl(unsigned prim) diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c b/src/gallium/drivers/nouveau/nv30/nv30_draw.c index 0aafb506cb4..e76ae93e2e0 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c @@ -112,7 +112,7 @@ nv30_render_unmap_vertices(struct vbuf_render *render, } static void -nv30_render_set_primitive(struct vbuf_render *render, enum pipe_prim_type prim) +nv30_render_set_primitive(struct vbuf_render *render, enum mesa_prim prim) { struct nv30_render *r = nv30_render(render); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index f8d108845ec..5e9ed925cdb 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -110,7 +110,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return eng3d->oclass == NV35_3D_CLASS || eng3d->oclass >= NV40_3D_CLASS; case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART: case PIPE_CAP_SUPPORTED_PRIM_MODES: - return BITFIELD_MASK(PIPE_PRIM_MAX); + return BITFIELD_MASK(MESA_PRIM_COUNT); /* nv4x capabilities */ case PIPE_CAP_BLEND_EQUATION_SEPARATE: case PIPE_CAP_NPOT_TEXTURES: diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c index 0d42e4831bb..7f3f182b82c 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c @@ -427,15 +427,15 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset, } else if (prog->type == PIPE_SHADER_GEOMETRY) { switch (info_out.prop.gp.outputPrim) { - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: prog->gp.prim_type = NV50_3D_GP_OUTPUT_PRIMITIVE_TYPE_LINE_STRIP; break; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: prog->gp.prim_type = NV50_3D_GP_OUTPUT_PRIMITIVE_TYPE_TRIANGLE_STRIP; break; - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: default: - assert(info_out.prop.gp.outputPrim == PIPE_PRIM_POINTS); + assert(info_out.prop.gp.outputPrim == MESA_PRIM_POINTS); prog->gp.prim_type = NV50_3D_GP_OUTPUT_PRIMITIVE_TYPE_POINTS; break; } diff --git a/src/gallium/drivers/nouveau/nv50/nv50_push.c b/src/gallium/drivers/nouveau/nv50/nv50_push.c index 87104e4f644..7d315f74bc8 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_push.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_push.c @@ -209,7 +209,7 @@ emit_vertices_seq(struct push_context *ctx, unsigned start, unsigned count) #define NV50_PRIM_GL_CASE(n) \ - case PIPE_PRIM_##n: return NV50_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n + case MESA_PRIM_##n: return NV50_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n static inline unsigned nv50_prim_gl(unsigned prim) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index 1fa34a85ca6..7a1c637ab68 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -191,7 +191,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART: case PIPE_CAP_SUPPORTED_PRIM_MODES: - return BITFIELD_MASK(PIPE_PRIM_MAX); + return BITFIELD_MASK(MESA_PRIM_COUNT); /* supported caps */ case PIPE_CAP_TEXTURE_MIRROR_CLAMP: diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c index 24070085634..682ed61fa60 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c @@ -418,7 +418,7 @@ nv50_vertex_arrays_validate(struct nv50_context *nv50) } #define NV50_PRIM_GL_CASE(n) \ - case PIPE_PRIM_##n: return NV50_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n + case MESA_PRIM_##n: return NV50_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n static inline unsigned nv50_prim_gl(unsigned prim) @@ -445,22 +445,22 @@ nv50_prim_gl(unsigned prim) } /* For pre-nva0 transform feedback. */ -static const uint8_t nv50_pipe_prim_to_prim_size[PIPE_PRIM_MAX + 1] = +static const uint8_t nv50_pipe_prim_to_prim_size[MESA_PRIM_COUNT + 1] = { - [PIPE_PRIM_POINTS] = 1, - [PIPE_PRIM_LINES] = 2, - [PIPE_PRIM_LINE_LOOP] = 2, - [PIPE_PRIM_LINE_STRIP] = 2, - [PIPE_PRIM_TRIANGLES] = 3, - [PIPE_PRIM_TRIANGLE_STRIP] = 3, - [PIPE_PRIM_TRIANGLE_FAN] = 3, - [PIPE_PRIM_QUADS] = 3, - [PIPE_PRIM_QUAD_STRIP] = 3, - [PIPE_PRIM_POLYGON] = 3, - [PIPE_PRIM_LINES_ADJACENCY] = 2, - [PIPE_PRIM_LINE_STRIP_ADJACENCY] = 2, - [PIPE_PRIM_TRIANGLES_ADJACENCY] = 3, - [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = 3 + [MESA_PRIM_POINTS] = 1, + [MESA_PRIM_LINES] = 2, + [MESA_PRIM_LINE_LOOP] = 2, + [MESA_PRIM_LINE_STRIP] = 2, + [MESA_PRIM_TRIANGLES] = 3, + [MESA_PRIM_TRIANGLE_STRIP] = 3, + [MESA_PRIM_TRIANGLE_FAN] = 3, + [MESA_PRIM_QUADS] = 3, + [MESA_PRIM_QUAD_STRIP] = 3, + [MESA_PRIM_POLYGON] = 3, + [MESA_PRIM_LINES_ADJACENCY] = 2, + [MESA_PRIM_LINE_STRIP_ADJACENCY] = 2, + [MESA_PRIM_TRIANGLES_ADJACENCY] = 3, + [MESA_PRIM_TRIANGLE_STRIP_ADJACENCY] = 3 }; static void diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c index d3b6b9fdcb3..3c035989697 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c @@ -290,18 +290,18 @@ nvc0_vp_gen_header(struct nvc0_program *vp, struct nv50_ir_prog_info_out *info) static void nvc0_tp_get_tess_mode(struct nvc0_program *tp, struct nv50_ir_prog_info_out *info) { - if (info->prop.tp.outputPrim == PIPE_PRIM_MAX) { + if (info->prop.tp.outputPrim == MESA_PRIM_COUNT) { tp->tp.tess_mode = ~0; return; } switch (info->prop.tp.domain) { - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: tp->tp.tess_mode = NVC0_3D_TESS_MODE_PRIM_ISOLINES; break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: tp->tp.tess_mode = NVC0_3D_TESS_MODE_PRIM_TRIANGLES; break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: tp->tp.tess_mode = NVC0_3D_TESS_MODE_PRIM_QUADS; break; default: @@ -312,16 +312,16 @@ nvc0_tp_get_tess_mode(struct nvc0_program *tp, struct nv50_ir_prog_info_out *inf /* It seems like lines want the "CW" bit to indicate they're connected, and * spit out errors in dmesg when the "CONNECTED" bit is set. */ - if (info->prop.tp.outputPrim != PIPE_PRIM_POINTS) { - if (info->prop.tp.domain == PIPE_PRIM_LINES) + if (info->prop.tp.outputPrim != MESA_PRIM_POINTS) { + if (info->prop.tp.domain == MESA_PRIM_LINES) tp->tp.tess_mode |= NVC0_3D_TESS_MODE_CW; else tp->tp.tess_mode |= NVC0_3D_TESS_MODE_CONNECTED; } /* Winding only matters for triangles/quads, not lines. */ - if (info->prop.tp.domain != PIPE_PRIM_LINES && - info->prop.tp.outputPrim != PIPE_PRIM_POINTS && + if (info->prop.tp.domain != MESA_PRIM_LINES && + info->prop.tp.outputPrim != MESA_PRIM_POINTS && info->prop.tp.winding > 0) tp->tp.tess_mode |= NVC0_3D_TESS_MODE_CW; @@ -395,15 +395,15 @@ nvc0_gp_gen_header(struct nvc0_program *gp, struct nv50_ir_prog_info_out *info) gp->hdr[2] = MIN2(info->prop.gp.instanceCount, 32) << 24; switch (info->prop.gp.outputPrim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: gp->hdr[3] = 0x01000000; gp->hdr[0] |= 0xf0000000; break; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: gp->hdr[3] = 0x06000000; gp->hdr[0] |= 0x10000000; break; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: gp->hdr[3] = 0x07000000; gp->hdr[0] |= 0x10000000; break; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index a5d8aa6388d..2270c207e4c 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -209,7 +209,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART: case PIPE_CAP_SUPPORTED_PRIM_MODES: - return BITFIELD_MASK(PIPE_PRIM_MAX); + return BITFIELD_MASK(MESA_PRIM_COUNT); /* supported caps */ case PIPE_CAP_TEXTURE_MIRROR_CLAMP: diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c index 75c5080fa77..c9717020953 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c @@ -531,7 +531,7 @@ nvc0_vertex_arrays_validate(struct nvc0_context *nvc0) } #define NVC0_PRIM_GL_CASE(n) \ - case PIPE_PRIM_##n: return NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n + case MESA_PRIM_##n: return NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n static inline unsigned nvc0_prim_gl(unsigned prim) @@ -973,7 +973,7 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info, } } - if (info->mode == PIPE_PRIM_PATCHES && + if (info->mode == MESA_PRIM_PATCHES && nvc0->state.patch_vertices != nvc0->patch_vertices) { nvc0->state.patch_vertices = nvc0->patch_vertices; PUSH_SPACE(push, 1); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c index c7ae3fb3f9b..a0af5781abb 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c @@ -449,7 +449,7 @@ disp_vertices_seq(struct push_context *ctx, unsigned start, unsigned count) #define NVC0_PRIM_GL_CASE(n) \ - case PIPE_PRIM_##n: return NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n + case MESA_PRIM_##n: return NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n static inline unsigned nvc0_prim_gl(unsigned prim) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 1d5a0819fba..0f887926139 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -2695,11 +2695,11 @@ emit_fragment_job(struct panfrost_batch *batch, const struct pan_fb_info *pfb) } #define DEFINE_CASE(c) \ - case PIPE_PRIM_##c: \ + case MESA_PRIM_##c: \ return MALI_DRAW_MODE_##c; static uint8_t -pan_draw_mode(enum pipe_prim_type mode) +pan_draw_mode(enum mesa_prim mode) { switch (mode) { DEFINE_CASE(POINTS); @@ -2991,8 +2991,8 @@ panfrost_emit_primitive(struct panfrost_context *ctx, UNUSED struct pipe_rasterizer_state *rast = &ctx->rasterizer->base; bool lines = - (info->mode == PIPE_PRIM_LINES || info->mode == PIPE_PRIM_LINE_LOOP || - info->mode == PIPE_PRIM_LINE_STRIP); + (info->mode == MESA_PRIM_LINES || info->mode == MESA_PRIM_LINE_LOOP || + info->mode == MESA_PRIM_LINE_STRIP); pan_pack(out, PRIMITIVE, cfg) { cfg.draw_mode = pan_draw_mode(info->mode); @@ -3118,12 +3118,12 @@ panfrost_emit_shader(struct panfrost_batch *batch, static void panfrost_emit_draw(void *out, struct panfrost_batch *batch, bool fs_required, - enum pipe_prim_type prim, mali_ptr pos, mali_ptr fs_vary, + enum mesa_prim prim, mali_ptr pos, mali_ptr fs_vary, mali_ptr varyings) { struct panfrost_context *ctx = batch->ctx; struct pipe_rasterizer_state *rast = &ctx->rasterizer->base; - bool polygon = (prim == PIPE_PRIM_TRIANGLES); + bool polygon = (prim == MESA_PRIM_TRIANGLES); pan_pack(out, DRAW, cfg) { /* @@ -3261,7 +3261,7 @@ panfrost_emit_draw(void *out, struct panfrost_batch *batch, bool fs_required, * be set to 0 and the provoking vertex is selected with the * PRIMITIVE.first_provoking_vertex field. */ - if (prim == PIPE_PRIM_LINES) { + if (prim == MESA_PRIM_LINES) { /* The logic is inverted across arches. */ cfg.flat_shading_vertex = rast->flatshade_first ^ (PAN_ARCH <= 5); } @@ -3324,7 +3324,7 @@ panfrost_emit_malloc_vertex(struct panfrost_batch *batch, pan_size(SCISSOR)); panfrost_emit_primitive_size( - ctx, info->mode == PIPE_PRIM_POINTS, 0, + ctx, info->mode == MESA_PRIM_POINTS, 0, pan_section_ptr(job, MALLOC_VERTEX_JOB, PRIMITIVE_SIZE)); pan_section_pack(job, MALLOC_VERTEX_JOB, INDICES, cfg) { @@ -3339,7 +3339,7 @@ panfrost_emit_malloc_vertex(struct panfrost_batch *batch, mali_ptr vs_ptr = batch->rsd[PIPE_SHADER_VERTEX]; /* IDVS/triangle vertex shader */ - if (vs_ptr && info->mode != PIPE_PRIM_POINTS) + if (vs_ptr && info->mode != MESA_PRIM_POINTS) vs_ptr += pan_size(SHADER_PROGRAM); panfrost_emit_shader(batch, &cfg, PIPE_SHADER_VERTEX, vs_ptr, @@ -3381,7 +3381,7 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch, pan_section_ptr(job, TILER_JOB, PRIMITIVE)); void *prim_size = pan_section_ptr(job, TILER_JOB, PRIMITIVE_SIZE); - enum pipe_prim_type prim = u_reduced_prim(info->mode); + enum mesa_prim prim = u_reduced_prim(info->mode); #if PAN_ARCH >= 6 pan_section_pack(job, TILER_JOB, TILER, cfg) { @@ -3395,7 +3395,7 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch, panfrost_emit_draw(pan_section_ptr(job, TILER_JOB, DRAW), batch, true, prim, pos, fs_vary, varyings); - panfrost_emit_primitive_size(ctx, prim == PIPE_PRIM_POINTS, psiz, prim_size); + panfrost_emit_primitive_size(ctx, prim == MESA_PRIM_POINTS, psiz, prim_size); } #endif @@ -3518,8 +3518,8 @@ panfrost_direct_draw(struct panfrost_batch *batch, * framebuffers, because all dirty flags are set there. */ if ((ctx->dirty & PAN_DIRTY_RASTERIZER) || - ((ctx->active_prim == PIPE_PRIM_POINTS) ^ - (info->mode == PIPE_PRIM_POINTS))) { + ((ctx->active_prim == MESA_PRIM_POINTS) ^ + (info->mode == MESA_PRIM_POINTS))) { ctx->active_prim = info->mode; panfrost_update_shader_variant(ctx, PIPE_SHADER_FRAGMENT); @@ -3617,7 +3617,7 @@ panfrost_direct_draw(struct panfrost_batch *batch, panfrost_emit_varying_descriptor( batch, ctx->padded_count * ctx->instance_count, &vs_vary, &fs_vary, - &varyings, NULL, &pos, &psiz, info->mode == PIPE_PRIM_POINTS); + &varyings, NULL, &pos, &psiz, info->mode == MESA_PRIM_POINTS); mali_ptr attribs, attrib_bufs; attribs = panfrost_emit_vertex_data(batch, &attrib_bufs); @@ -3729,7 +3729,7 @@ panfrost_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info, if (unlikely(batch->scoreboard.job_index > 10000)) batch = panfrost_get_fresh_batch_for_fbo(ctx, "Too many draws"); - bool points = (info->mode == PIPE_PRIM_POINTS); + bool points = (info->mode == MESA_PRIM_POINTS); if (unlikely(!panfrost_compatible_batch_state(batch, points))) { batch = panfrost_get_fresh_batch_for_fbo(ctx, "State change"); diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 11dbd1b4c4c..79f8749d6b2 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -92,7 +92,7 @@ panfrost_writes_point_size(struct panfrost_context *ctx) struct panfrost_compiled_shader *vs = ctx->prog[PIPE_SHADER_VERTEX]; assert(vs != NULL); - return vs->info.vs.writes_point_size && ctx->active_prim == PIPE_PRIM_POINTS; + return vs->info.vs.writes_point_size && ctx->active_prim == MESA_PRIM_POINTS; } /* The entire frame is in memory -- send it off to the kernel! */ diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index db95af9f8cb..844088c4846 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -168,7 +168,7 @@ struct panfrost_context { unsigned offset_start; unsigned base_vertex; unsigned base_instance; - enum pipe_prim_type active_prim; + enum mesa_prim active_prim; /* If instancing is enabled, vertex count padded for instance; if * it is disabled, just equal to plain vertex count */ diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 822eede136c..25e5ca9dc90 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -340,11 +340,11 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART: { /* Mali supports GLES and QUADS. Midgard and v6 Bifrost * support more */ - uint32_t modes = BITFIELD_MASK(PIPE_PRIM_QUADS + 1); + uint32_t modes = BITFIELD_MASK(MESA_PRIM_QUADS + 1); if (dev->arch <= 6) { - modes |= BITFIELD_BIT(PIPE_PRIM_QUAD_STRIP); - modes |= BITFIELD_BIT(PIPE_PRIM_POLYGON); + modes |= BITFIELD_BIT(MESA_PRIM_QUAD_STRIP); + modes |= BITFIELD_BIT(MESA_PRIM_POLYGON); } if (dev->arch >= 9) { @@ -352,7 +352,7 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param) * don't seem to work correctly. Disable to fix * arb-provoking-vertex-render. */ - modes &= ~BITFIELD_BIT(PIPE_PRIM_QUADS); + modes &= ~BITFIELD_BIT(MESA_PRIM_QUADS); } return modes; diff --git a/src/gallium/drivers/panfrost/pan_shader.c b/src/gallium/drivers/panfrost/pan_shader.c index 4212e8a7838..33c864ee130 100644 --- a/src/gallium/drivers/panfrost/pan_shader.c +++ b/src/gallium/drivers/panfrost/pan_shader.c @@ -218,7 +218,7 @@ panfrost_build_key(struct panfrost_context *ctx, } /* Point sprite lowering needed on Bifrost and newer */ - if (dev->arch >= 6 && rast && ctx->active_prim == PIPE_PRIM_POINTS) { + if (dev->arch >= 6 && rast && ctx->active_prim == MESA_PRIM_POINTS) { key->fs.sprite_coord_enable = rast->sprite_coord_enable; } diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index bf9a0952199..9b8d943d4ee 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -96,12 +96,12 @@ static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300, if (rs->rs.flatshade_first) { switch (mode) { - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: color_control |= R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_SECOND; break; - case PIPE_PRIM_QUADS: - case PIPE_PRIM_QUAD_STRIP: - case PIPE_PRIM_POLYGON: + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: + case MESA_PRIM_POLYGON: color_control |= R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST; break; default: @@ -454,7 +454,7 @@ static void r300_emit_draw_elements(struct r300_context *r300, * in the command stream. This will increase start by 3 and make it * even. We can then proceed without a fallback. */ if (indexSize == 2 && (start & 1) && - mode == PIPE_PRIM_TRIANGLES) { + mode == MESA_PRIM_TRIANGLES) { BEGIN_CS(4); OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 2); OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (3 << 16) | @@ -617,7 +617,7 @@ static void r300_draw_elements(struct r300_context *r300, PIPE_MAP_READ | PIPE_MAP_UNSYNCHRONIZED); - if (info->mode == PIPE_PRIM_TRIANGLES) { + if (info->mode == MESA_PRIM_TRIANGLES) { memcpy(indices3, ptr + start, 6); } else { /* Copy the mapped index buffer directly to the upload buffer. @@ -802,7 +802,7 @@ static void r300_draw_vbo(struct pipe_context* pipe, } if (r300->sprite_coord_enable != 0) - if ((info.mode == PIPE_PRIM_POINTS) != r300->is_point) { + if ((info.mode == MESA_PRIM_POINTS) != r300->is_point) { r300->is_point = !r300->is_point; r300_mark_atom_dirty(r300, &r300->rs_block_state); } @@ -889,7 +889,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe, } if (r300->sprite_coord_enable != 0) - if ((info->mode == PIPE_PRIM_POINTS) != r300->is_point) { + if ((info->mode == MESA_PRIM_POINTS) != r300->is_point) { r300->is_point = !r300->is_point; r300_mark_atom_dirty(r300, &r300->rs_block_state); } @@ -1002,7 +1002,7 @@ static void r300_render_release_vertices(struct vbuf_render* render) } static void r300_render_set_primitive(struct vbuf_render* render, - enum pipe_prim_type prim) + enum mesa_prim prim) { struct r300_render* r300render = r300_render(render); diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index fd1f34e51aa..b6034bad8ef 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -2682,13 +2682,13 @@ static void evergreen_emit_shader_stages(struct r600_context *rctx, struct r600_ bool tes_vertex_order_cw = info->properties[TGSI_PROPERTY_TES_VERTEX_ORDER_CW]; bool tes_point_mode = info->properties[TGSI_PROPERTY_TES_POINT_MODE]; switch (tes_prim_mode) { - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: type = V_028B6C_TESS_ISOLINE; break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: type = V_028B6C_TESS_TRIANGLE; break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: type = V_028B6C_TESS_QUAD; break; default: @@ -2713,7 +2713,7 @@ static void evergreen_emit_shader_stages(struct r600_context *rctx, struct r600_ if (tes_point_mode) topology = V_028B6C_OUTPUT_POINT; - else if (tes_prim_mode == PIPE_PRIM_LINES) + else if (tes_prim_mode == MESA_PRIM_LINES) topology = V_028B6C_OUTPUT_LINE; else if (tes_vertex_order_cw) /* XXX follow radeonsi and invert */ diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 8004fc86436..de79c4ce9ae 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -357,7 +357,7 @@ struct r600_pipe_shader_selector { enum pipe_shader_ir ir_type; /* geometry shader properties */ - enum pipe_prim_type gs_output_prim; + enum mesa_prim gs_output_prim; unsigned gs_max_out_vertices; unsigned gs_num_invocations; @@ -590,9 +590,9 @@ struct r600_context { struct list_head texture_buffers; /* Last draw state (-1 = unset). */ - enum pipe_prim_type last_primitive_type; /* Last primitive type used in draw_vbo. */ - enum pipe_prim_type current_rast_prim; /* primitive type after TES, GS */ - enum pipe_prim_type last_rast_prim; + enum mesa_prim last_primitive_type; /* Last primitive type used in draw_vbo. */ + enum mesa_prim current_rast_prim; /* primitive type after TES, GS */ + enum mesa_prim last_rast_prim; unsigned last_start_instance; void *sb_context; diff --git a/src/gallium/drivers/r600/r600_pipe_common.h b/src/gallium/drivers/r600/r600_pipe_common.h index 46ee83d3b28..c0ca5570b33 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.h +++ b/src/gallium/drivers/r600/r600_pipe_common.h @@ -63,7 +63,7 @@ struct u_log_context; #define R600_CONTEXT_PRIVATE_FLAG (1u << 4) /* special primitive types */ -#define R600_PRIM_RECTANGLE_LIST PIPE_PRIM_MAX +#define R600_PRIM_RECTANGLE_LIST MESA_PRIM_COUNT #define R600_NOT_QUERY 0xffffffff diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 748166a1f49..81ee75e3351 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -136,21 +136,21 @@ static void r600_texture_barrier(struct pipe_context *ctx, unsigned flags) static unsigned r600_conv_pipe_prim(unsigned prim) { static const unsigned prim_conv[] = { - [PIPE_PRIM_POINTS] = V_008958_DI_PT_POINTLIST, - [PIPE_PRIM_LINES] = V_008958_DI_PT_LINELIST, - [PIPE_PRIM_LINE_LOOP] = V_008958_DI_PT_LINELOOP, - [PIPE_PRIM_LINE_STRIP] = V_008958_DI_PT_LINESTRIP, - [PIPE_PRIM_TRIANGLES] = V_008958_DI_PT_TRILIST, - [PIPE_PRIM_TRIANGLE_STRIP] = V_008958_DI_PT_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = V_008958_DI_PT_TRIFAN, - [PIPE_PRIM_QUADS] = V_008958_DI_PT_QUADLIST, - [PIPE_PRIM_QUAD_STRIP] = V_008958_DI_PT_QUADSTRIP, - [PIPE_PRIM_POLYGON] = V_008958_DI_PT_POLYGON, - [PIPE_PRIM_LINES_ADJACENCY] = V_008958_DI_PT_LINELIST_ADJ, - [PIPE_PRIM_LINE_STRIP_ADJACENCY] = V_008958_DI_PT_LINESTRIP_ADJ, - [PIPE_PRIM_TRIANGLES_ADJACENCY] = V_008958_DI_PT_TRILIST_ADJ, - [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = V_008958_DI_PT_TRISTRIP_ADJ, - [PIPE_PRIM_PATCHES] = V_008958_DI_PT_PATCH, + [MESA_PRIM_POINTS] = V_008958_DI_PT_POINTLIST, + [MESA_PRIM_LINES] = V_008958_DI_PT_LINELIST, + [MESA_PRIM_LINE_LOOP] = V_008958_DI_PT_LINELOOP, + [MESA_PRIM_LINE_STRIP] = V_008958_DI_PT_LINESTRIP, + [MESA_PRIM_TRIANGLES] = V_008958_DI_PT_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = V_008958_DI_PT_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = V_008958_DI_PT_TRIFAN, + [MESA_PRIM_QUADS] = V_008958_DI_PT_QUADLIST, + [MESA_PRIM_QUAD_STRIP] = V_008958_DI_PT_QUADSTRIP, + [MESA_PRIM_POLYGON] = V_008958_DI_PT_POLYGON, + [MESA_PRIM_LINES_ADJACENCY] = V_008958_DI_PT_LINELIST_ADJ, + [MESA_PRIM_LINE_STRIP_ADJACENCY] = V_008958_DI_PT_LINESTRIP_ADJ, + [MESA_PRIM_TRIANGLES_ADJACENCY] = V_008958_DI_PT_TRILIST_ADJ, + [MESA_PRIM_TRIANGLE_STRIP_ADJACENCY] = V_008958_DI_PT_TRISTRIP_ADJ, + [MESA_PRIM_PATCHES] = V_008958_DI_PT_PATCH, [R600_PRIM_RECTANGLE_LIST] = V_008958_DI_PT_RECTLIST }; assert(prim < ARRAY_SIZE(prim_conv)); @@ -160,21 +160,21 @@ static unsigned r600_conv_pipe_prim(unsigned prim) unsigned r600_conv_prim_to_gs_out(unsigned mode) { static const int prim_conv[] = { - [PIPE_PRIM_POINTS] = V_028A6C_OUTPRIM_TYPE_POINTLIST, - [PIPE_PRIM_LINES] = V_028A6C_OUTPRIM_TYPE_LINESTRIP, - [PIPE_PRIM_LINE_LOOP] = V_028A6C_OUTPRIM_TYPE_LINESTRIP, - [PIPE_PRIM_LINE_STRIP] = V_028A6C_OUTPRIM_TYPE_LINESTRIP, - [PIPE_PRIM_TRIANGLES] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, - [PIPE_PRIM_TRIANGLE_STRIP] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, - [PIPE_PRIM_QUADS] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, - [PIPE_PRIM_QUAD_STRIP] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, - [PIPE_PRIM_POLYGON] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, - [PIPE_PRIM_LINES_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_LINESTRIP, - [PIPE_PRIM_LINE_STRIP_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_LINESTRIP, - [PIPE_PRIM_TRIANGLES_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, - [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, - [PIPE_PRIM_PATCHES] = V_028A6C_OUTPRIM_TYPE_POINTLIST, + [MESA_PRIM_POINTS] = V_028A6C_OUTPRIM_TYPE_POINTLIST, + [MESA_PRIM_LINES] = V_028A6C_OUTPRIM_TYPE_LINESTRIP, + [MESA_PRIM_LINE_LOOP] = V_028A6C_OUTPRIM_TYPE_LINESTRIP, + [MESA_PRIM_LINE_STRIP] = V_028A6C_OUTPRIM_TYPE_LINESTRIP, + [MESA_PRIM_TRIANGLES] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, + [MESA_PRIM_TRIANGLE_STRIP] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, + [MESA_PRIM_QUADS] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, + [MESA_PRIM_QUAD_STRIP] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, + [MESA_PRIM_POLYGON] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, + [MESA_PRIM_LINES_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_LINESTRIP, + [MESA_PRIM_LINE_STRIP_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_LINESTRIP, + [MESA_PRIM_TRIANGLES_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, + [MESA_PRIM_TRIANGLE_STRIP_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_TRISTRIP, + [MESA_PRIM_PATCHES] = V_028A6C_OUTPRIM_TYPE_POINTLIST, [R600_PRIM_RECTANGLE_LIST] = V_028A6C_OUTPRIM_TYPE_TRISTRIP }; assert(mode < ARRAY_SIZE(prim_conv)); @@ -908,7 +908,7 @@ r600_shader_precompile_key(const struct pipe_context *ctx, case PIPE_SHADER_TESS_CTRL: /* Prim mode comes from the TES, but we need some valid value. */ - key->tcs.prim_mode = PIPE_PRIM_TRIANGLES; + key->tcs.prim_mode = MESA_PRIM_TRIANGLES; break; case PIPE_SHADER_COMPUTE: @@ -2123,14 +2123,14 @@ void r600_emit_clip_misc_state(struct r600_context *rctx, struct r600_atom *atom static inline void r600_emit_rasterizer_prim_state(struct r600_context *rctx) { struct radeon_cmdbuf *cs = &rctx->b.gfx.cs; - enum pipe_prim_type rast_prim = rctx->current_rast_prim; + enum mesa_prim rast_prim = rctx->current_rast_prim; /* Skip this if not rendering lines. */ - if (rast_prim != PIPE_PRIM_LINES && - rast_prim != PIPE_PRIM_LINE_LOOP && - rast_prim != PIPE_PRIM_LINE_STRIP && - rast_prim != PIPE_PRIM_LINES_ADJACENCY && - rast_prim != PIPE_PRIM_LINE_STRIP_ADJACENCY) + if (rast_prim != MESA_PRIM_LINES && + rast_prim != MESA_PRIM_LINE_LOOP && + rast_prim != MESA_PRIM_LINE_STRIP && + rast_prim != MESA_PRIM_LINES_ADJACENCY && + rast_prim != MESA_PRIM_LINE_STRIP_ADJACENCY) return; if (rast_prim == rctx->last_rast_prim) @@ -2140,7 +2140,7 @@ static inline void r600_emit_rasterizer_prim_state(struct r600_context *rctx) * reset the stipple pattern at each packet (line strips, line loops). */ radeon_set_context_reg(cs, R_028A0C_PA_SC_LINE_STIPPLE, - S_028A0C_AUTO_RESET_CNTL(rast_prim == PIPE_PRIM_LINES ? 1 : 2) | + S_028A0C_AUTO_RESET_CNTL(rast_prim == MESA_PRIM_LINES ? 1 : 2) | (rctx->rasterizer ? rctx->rasterizer->pa_sc_line_stipple : 0)); rctx->last_rast_prim = rast_prim; } @@ -2215,7 +2215,7 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info */ bool gs_tri_strip_adj_fix = !rctx->tes_shader && - info->mode == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY && + info->mode == MESA_PRIM_TRIANGLE_STRIP_ADJACENCY && !info->primitive_restart; if (gs_tri_strip_adj_fix != rctx->gs_tri_strip_adj_fix) rctx->gs_tri_strip_adj_fix = gs_tri_strip_adj_fix; diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.cpp b/src/gallium/drivers/r600/sfn/sfn_nir.cpp index 742ce61ff4b..63471b3104e 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir.cpp @@ -870,12 +870,12 @@ r600_shader_from_nir(struct r600_context *rctx, (sh->info.stage == MESA_SHADER_VERTEX && key->vs.as_ls)) { auto prim_type = sh->info.stage == MESA_SHADER_TESS_EVAL ? u_tess_prim_from_shader(sh->info.tess._primitive_mode) - : (pipe_prim_type)key->tcs.prim_mode; - NIR_PASS_V(sh, r600_lower_tess_io, static_cast(prim_type)); + : (mesa_prim)key->tcs.prim_mode; + NIR_PASS_V(sh, r600_lower_tess_io, static_cast(prim_type)); } if (sh->info.stage == MESA_SHADER_TESS_CTRL) - NIR_PASS_V(sh, r600_append_tcs_TF_emission, (pipe_prim_type)key->tcs.prim_mode); + NIR_PASS_V(sh, r600_append_tcs_TF_emission, (mesa_prim)key->tcs.prim_mode); if (sh->info.stage == MESA_SHADER_TESS_EVAL) { NIR_PASS_V(sh, diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.h b/src/gallium/drivers/r600/sfn/sfn_nir.h index b20240bcd52..2e379bd9365 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir.h +++ b/src/gallium/drivers/r600/sfn/sfn_nir.h @@ -104,11 +104,11 @@ r600_imm_ivec3(nir_builder *build, int x, int y, int z) } bool -r600_lower_tess_io(nir_shader *shader, enum pipe_prim_type prim_type); +r600_lower_tess_io(nir_shader *shader, enum mesa_prim prim_type); bool -r600_append_tcs_TF_emission(nir_shader *shader, enum pipe_prim_type prim_type); +r600_append_tcs_TF_emission(nir_shader *shader, enum mesa_prim prim_type); bool -r600_lower_tess_coord(nir_shader *sh, enum pipe_prim_type prim_type); +r600_lower_tess_coord(nir_shader *sh, enum mesa_prim prim_type); bool r600_legalize_image_load_store(nir_shader *shader); diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp index 13a793d4ecd..32ef562cd60 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp @@ -333,14 +333,14 @@ emil_tcs_io_offset(nir_builder *b, } inline unsigned -outer_tf_components(pipe_prim_type prim_type) +outer_tf_components(mesa_prim prim_type) { switch (prim_type) { - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: return 2; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return 3; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: return 4; default: return 0; @@ -348,7 +348,7 @@ outer_tf_components(pipe_prim_type prim_type) } static bool -r600_lower_tess_io_impl(nir_builder *b, nir_instr *instr, enum pipe_prim_type prim_type) +r600_lower_tess_io_impl(nir_builder *b, nir_instr *instr, enum mesa_prim prim_type) { static nir_ssa_def *load_in_param_base = nullptr; static nir_ssa_def *load_out_param_base = nullptr; @@ -476,7 +476,7 @@ r600_lower_tess_io_impl(nir_builder *b, nir_instr *instr, enum pipe_prim_type pr } bool -r600_lower_tess_io(nir_shader *shader, enum pipe_prim_type prim_type) +r600_lower_tess_io(nir_shader *shader, enum mesa_prim prim_type) { bool progress = false; nir_foreach_function(function, shader) @@ -513,7 +513,7 @@ r600_emit_tf(nir_builder *b, nir_ssa_def *val) } bool -r600_append_tcs_TF_emission(nir_shader *shader, enum pipe_prim_type prim_type) +r600_append_tcs_TF_emission(nir_shader *shader, enum mesa_prim prim_type) { if (shader->info.stage != MESA_SHADER_TESS_CTRL) return false; @@ -585,7 +585,7 @@ r600_append_tcs_TF_emission(nir_shader *shader, enum pipe_prim_type prim_type) int chanx = 0; int chany = 1; - if (prim_type == PIPE_PRIM_LINES) + if (prim_type == MESA_PRIM_LINES) std::swap(chanx, chany); int inner_base = 12; @@ -657,14 +657,14 @@ r600_lower_tess_coord_filter(const nir_instr *instr, UNUSED const void *_options static nir_ssa_def * r600_lower_tess_coord_impl(nir_builder *b, UNUSED nir_instr *instr, void *_options) { - pipe_prim_type prim_type = *(pipe_prim_type *)_options; + mesa_prim prim_type = *(mesa_prim *)_options; auto tc_xy = nir_load_tess_coord_r600(b); auto tc_x = nir_channel(b, tc_xy, 0); auto tc_y = nir_channel(b, tc_xy, 1); - if (prim_type == PIPE_PRIM_TRIANGLES) + if (prim_type == MESA_PRIM_TRIANGLES) return nir_vec3(b, tc_x, tc_y, @@ -674,7 +674,7 @@ r600_lower_tess_coord_impl(nir_builder *b, UNUSED nir_instr *instr, void *_optio } bool -r600_lower_tess_coord(nir_shader *sh, enum pipe_prim_type prim_type) +r600_lower_tess_coord(nir_shader *sh, enum mesa_prim prim_type) { return nir_shader_lower_instructions(sh, r600_lower_tess_coord_filter, diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c index d56ff5cd304..4d2272ff470 100644 --- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c +++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c @@ -85,7 +85,7 @@ bool gfx10_ngg_calculate_subgroup_info(struct si_shader *shader) const unsigned gs_num_invocations = MAX2(gs_sel->info.base.gs.invocations, 1); const unsigned input_prim = si_get_input_prim(gs_sel, &shader->key); const bool use_adjacency = - input_prim >= PIPE_PRIM_LINES_ADJACENCY && input_prim <= PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY; + input_prim >= MESA_PRIM_LINES_ADJACENCY && input_prim <= MESA_PRIM_TRIANGLE_STRIP_ADJACENCY; const unsigned max_verts_per_prim = u_vertices_per_prim(input_prim); const unsigned min_verts_per_prim = gs_stage == MESA_SHADER_GEOMETRY ? max_verts_per_prim : 1; diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 4fef8f136fb..0b7c748b1c7 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -25,7 +25,7 @@ extern "C" { #define SI_NOT_QUERY 0xffffffff /* special primitive types */ -#define SI_PRIM_RECTANGLE_LIST PIPE_PRIM_MAX +#define SI_PRIM_RECTANGLE_LIST MESA_PRIM_COUNT /* The base vertex and primitive restart can be any number, but we must pick * one which will mean "unknown" for the purpose of state tracking and @@ -1165,7 +1165,7 @@ struct si_context { unsigned current_gs_state; /* only GS and NGG bits */ unsigned last_vs_state; unsigned last_gs_state; - enum pipe_prim_type current_rast_prim; /* primitive type after TES, GS */ + enum mesa_prim current_rast_prim; /* primitive type after TES, GS */ unsigned gs_out_prim; struct si_small_prim_cull_info last_small_prim_cull_info; @@ -1931,14 +1931,14 @@ static inline unsigned si_get_total_colormask(struct si_context *sctx) } #define UTIL_ALL_PRIM_LINE_MODES \ - ((1 << PIPE_PRIM_LINES) | (1 << PIPE_PRIM_LINE_LOOP) | (1 << PIPE_PRIM_LINE_STRIP) | \ - (1 << PIPE_PRIM_LINES_ADJACENCY) | (1 << PIPE_PRIM_LINE_STRIP_ADJACENCY)) + ((1 << MESA_PRIM_LINES) | (1 << MESA_PRIM_LINE_LOOP) | (1 << MESA_PRIM_LINE_STRIP) | \ + (1 << MESA_PRIM_LINES_ADJACENCY) | (1 << MESA_PRIM_LINE_STRIP_ADJACENCY)) #define UTIL_ALL_PRIM_TRIANGLE_MODES \ - ((1 << PIPE_PRIM_TRIANGLES) | (1 << PIPE_PRIM_TRIANGLE_STRIP) | \ - (1 << PIPE_PRIM_TRIANGLE_FAN) | (1 << PIPE_PRIM_QUADS) | (1 << PIPE_PRIM_QUAD_STRIP) | \ - (1 << PIPE_PRIM_POLYGON) | (1 << PIPE_PRIM_TRIANGLES_ADJACENCY) | \ - (1 << PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY)) + ((1 << MESA_PRIM_TRIANGLES) | (1 << MESA_PRIM_TRIANGLE_STRIP) | \ + (1 << MESA_PRIM_TRIANGLE_FAN) | (1 << MESA_PRIM_QUADS) | (1 << MESA_PRIM_QUAD_STRIP) | \ + (1 << MESA_PRIM_POLYGON) | (1 << MESA_PRIM_TRIANGLES_ADJACENCY) | \ + (1 << MESA_PRIM_TRIANGLE_STRIP_ADJACENCY)) static inline bool util_prim_is_lines(unsigned prim) { @@ -1947,7 +1947,7 @@ static inline bool util_prim_is_lines(unsigned prim) static inline bool util_prim_is_points_or_lines(unsigned prim) { - return ((1 << prim) & (UTIL_ALL_PRIM_LINE_MODES | (1 << PIPE_PRIM_POINTS))) != 0; + return ((1 << prim) & (UTIL_ALL_PRIM_LINE_MODES | (1 << MESA_PRIM_POINTS))) != 0; } static inline bool util_rast_prim_is_triangles(unsigned prim) @@ -2134,12 +2134,12 @@ si_update_ngg_prim_state_sgpr(struct si_context *sctx, struct si_shader *hw_vs, * It's expected that hw_vs and ngg are inline constants in draw_vbo after optimizations. */ static inline void -si_set_rasterized_prim(struct si_context *sctx, enum pipe_prim_type rast_prim, +si_set_rasterized_prim(struct si_context *sctx, enum mesa_prim rast_prim, struct si_shader *hw_vs, bool ngg) { if (rast_prim != sctx->current_rast_prim) { bool is_rect = rast_prim == SI_PRIM_RECTANGLE_LIST; - bool is_points = rast_prim == PIPE_PRIM_POINTS; + bool is_points = rast_prim == MESA_PRIM_POINTS; bool is_lines = util_prim_is_lines(rast_prim); bool is_triangles = util_rast_prim_is_triangles(rast_prim); diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 0f9b3dad5de..9a48d58bd06 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -524,7 +524,7 @@ struct si_shader_selector { ubyte cs_images_num_sgprs; ubyte cs_num_images_in_user_sgprs; unsigned ngg_cull_vert_threshold; /* UINT32_MAX = disabled */ - enum pipe_prim_type rast_prim; + enum mesa_prim rast_prim; /* GS parameters. */ bool tess_turns_off_ngg; diff --git a/src/gallium/drivers/radeonsi/si_shader_info.c b/src/gallium/drivers/radeonsi/si_shader_info.c index 204bfaf7d4c..dbb76a0f0e3 100644 --- a/src/gallium/drivers/radeonsi/si_shader_info.c +++ b/src/gallium/drivers/radeonsi/si_shader_info.c @@ -799,7 +799,7 @@ void si_nir_scan_shader(struct si_screen *sscreen, const struct nir_shader *nir, info->gsvs_vertex_size = info->num_outputs * 16; info->max_gsvs_emit_size = info->gsvs_vertex_size * info->base.gs.vertices_out; info->gs_input_verts_per_prim = - u_vertices_per_prim((enum pipe_prim_type)info->base.gs.input_primitive); + u_vertices_per_prim((enum mesa_prim)info->base.gs.input_primitive); } info->clipdist_mask = info->writes_clipvertex ? SI_USER_CLIP_PLANE_MASK : diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp index bd09a8e8547..9c803101b4d 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.cpp +++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp @@ -459,21 +459,21 @@ ALWAYS_INLINE static unsigned si_conv_pipe_prim(unsigned mode) { static const unsigned prim_conv[] = { - [PIPE_PRIM_POINTS] = V_008958_DI_PT_POINTLIST, - [PIPE_PRIM_LINES] = V_008958_DI_PT_LINELIST, - [PIPE_PRIM_LINE_LOOP] = V_008958_DI_PT_LINELOOP, - [PIPE_PRIM_LINE_STRIP] = V_008958_DI_PT_LINESTRIP, - [PIPE_PRIM_TRIANGLES] = V_008958_DI_PT_TRILIST, - [PIPE_PRIM_TRIANGLE_STRIP] = V_008958_DI_PT_TRISTRIP, - [PIPE_PRIM_TRIANGLE_FAN] = V_008958_DI_PT_TRIFAN, - [PIPE_PRIM_QUADS] = V_008958_DI_PT_QUADLIST, - [PIPE_PRIM_QUAD_STRIP] = V_008958_DI_PT_QUADSTRIP, - [PIPE_PRIM_POLYGON] = V_008958_DI_PT_POLYGON, - [PIPE_PRIM_LINES_ADJACENCY] = V_008958_DI_PT_LINELIST_ADJ, - [PIPE_PRIM_LINE_STRIP_ADJACENCY] = V_008958_DI_PT_LINESTRIP_ADJ, - [PIPE_PRIM_TRIANGLES_ADJACENCY] = V_008958_DI_PT_TRILIST_ADJ, - [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = V_008958_DI_PT_TRISTRIP_ADJ, - [PIPE_PRIM_PATCHES] = V_008958_DI_PT_PATCH, + [MESA_PRIM_POINTS] = V_008958_DI_PT_POINTLIST, + [MESA_PRIM_LINES] = V_008958_DI_PT_LINELIST, + [MESA_PRIM_LINE_LOOP] = V_008958_DI_PT_LINELOOP, + [MESA_PRIM_LINE_STRIP] = V_008958_DI_PT_LINESTRIP, + [MESA_PRIM_TRIANGLES] = V_008958_DI_PT_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = V_008958_DI_PT_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = V_008958_DI_PT_TRIFAN, + [MESA_PRIM_QUADS] = V_008958_DI_PT_QUADLIST, + [MESA_PRIM_QUAD_STRIP] = V_008958_DI_PT_QUADSTRIP, + [MESA_PRIM_POLYGON] = V_008958_DI_PT_POLYGON, + [MESA_PRIM_LINES_ADJACENCY] = V_008958_DI_PT_LINELIST_ADJ, + [MESA_PRIM_LINE_STRIP_ADJACENCY] = V_008958_DI_PT_LINESTRIP_ADJ, + [MESA_PRIM_TRIANGLES_ADJACENCY] = V_008958_DI_PT_TRILIST_ADJ, + [MESA_PRIM_TRIANGLE_STRIP_ADJACENCY] = V_008958_DI_PT_TRISTRIP_ADJ, + [MESA_PRIM_PATCHES] = V_008958_DI_PT_PATCH, [SI_PRIM_RECTANGLE_LIST] = V_008958_DI_PT_RECTLIST}; assert(mode < ARRAY_SIZE(prim_conv)); return prim_conv[mode]; @@ -862,13 +862,13 @@ static void si_emit_derived_tess_state(struct si_context *sctx) } } -static unsigned si_num_prims_for_vertices(enum pipe_prim_type prim, +static unsigned si_num_prims_for_vertices(enum mesa_prim prim, unsigned count, unsigned vertices_per_patch) { switch (prim) { - case PIPE_PRIM_PATCHES: + case MESA_PRIM_PATCHES: return count / vertices_per_patch; - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: /* It's a triangle fan with different edge flags. */ return count >= 3 ? count - 2 : 0; case SI_PRIM_RECTANGLE_LIST: @@ -926,13 +926,13 @@ static unsigned si_get_init_multi_vgt_param(struct si_screen *sscreen, union si_ * Polaris supports primitive restart with WD_SWITCH_ON_EOP=0 * for points, line strips, and tri strips. */ - if (sscreen->info.max_se <= 2 || key->u.prim == PIPE_PRIM_POLYGON || - key->u.prim == PIPE_PRIM_LINE_LOOP || key->u.prim == PIPE_PRIM_TRIANGLE_FAN || - key->u.prim == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY || + if (sscreen->info.max_se <= 2 || key->u.prim == MESA_PRIM_POLYGON || + key->u.prim == MESA_PRIM_LINE_LOOP || key->u.prim == MESA_PRIM_TRIANGLE_FAN || + key->u.prim == MESA_PRIM_TRIANGLE_STRIP_ADJACENCY || (key->u.primitive_restart && (sscreen->info.family < CHIP_POLARIS10 || - (key->u.prim != PIPE_PRIM_POINTS && key->u.prim != PIPE_PRIM_LINE_STRIP && - key->u.prim != PIPE_PRIM_TRIANGLE_STRIP))) || + (key->u.prim != MESA_PRIM_POINTS && key->u.prim != MESA_PRIM_LINE_STRIP && + key->u.prim != MESA_PRIM_TRIANGLE_STRIP))) || key->u.count_from_stream_output) wd_switch_on_eop = true; @@ -1032,7 +1032,7 @@ static bool si_is_line_stipple_enabled(struct si_context *sctx) { struct si_state_rasterizer *rs = sctx->queued.named.rasterizer; - return rs->line_stipple_enable && sctx->current_rast_prim != PIPE_PRIM_POINTS && + return rs->line_stipple_enable && sctx->current_rast_prim != MESA_PRIM_POINTS && (rs->polygon_mode_is_lines || util_prim_is_lines(sctx->current_rast_prim)); } @@ -1043,7 +1043,7 @@ enum si_is_draw_vertex_state { template ALWAYS_INLINE static bool num_instanced_prims_less_than(const struct pipe_draw_indirect_info *indirect, - enum pipe_prim_type prim, + enum mesa_prim prim, unsigned min_vertex_count, unsigned instance_count, unsigned num_prims, @@ -1065,7 +1065,7 @@ template ALWAYS_INLINE static unsigned si_get_ia_multi_vgt_param(struct si_context *sctx, const struct pipe_draw_indirect_info *indirect, - enum pipe_prim_type prim, unsigned num_patches, + enum mesa_prim prim, unsigned num_patches, unsigned instance_count, bool primitive_restart, unsigned min_vertex_count) { @@ -1129,9 +1129,9 @@ static void si_emit_rasterizer_prim_state(struct si_context *sctx) /* For lines, reset the stipple pattern at each primitive. Otherwise, * reset the stipple pattern at each packet (line strips, line loops). */ - enum pipe_prim_type rast_prim = sctx->current_rast_prim; - bool reset_per_prim = rast_prim == PIPE_PRIM_LINES || - rast_prim == PIPE_PRIM_LINES_ADJACENCY; + enum mesa_prim rast_prim = sctx->current_rast_prim; + bool reset_per_prim = rast_prim == MESA_PRIM_LINES || + rast_prim == MESA_PRIM_LINES_ADJACENCY; /* 0 = no reset, 1 = reset per prim, 2 = reset per packet */ unsigned value = rs->pa_sc_line_stipple | S_028A0C_AUTO_RESET_CNTL(reset_per_prim ? 1 : 2); @@ -1228,7 +1228,7 @@ template ALWAYS_INLINE static void si_emit_ia_multi_vgt_param(struct si_context *sctx, const struct pipe_draw_indirect_info *indirect, - enum pipe_prim_type prim, unsigned num_patches, + enum mesa_prim prim, unsigned num_patches, unsigned instance_count, bool primitive_restart, unsigned min_vertex_count) { @@ -1322,7 +1322,7 @@ template ALWAYS_INLINE static void si_emit_draw_registers(struct si_context *sctx, const struct pipe_draw_indirect_info *indirect, - enum pipe_prim_type prim, unsigned index_size, + enum mesa_prim prim, unsigned index_size, unsigned instance_count, bool primitive_restart, unsigned restart_index, unsigned min_vertex_count) { @@ -1460,10 +1460,10 @@ static void si_emit_draw_packets(struct si_context *sctx, const struct pipe_draw if (sctx->num_pipeline_stat_queries && sctx->shader.gs.cso == NULL && (instance_count > 1 || indirect) && - (1 << info->mode) & (1 << PIPE_PRIM_LINES_ADJACENCY | - 1 << PIPE_PRIM_LINE_STRIP_ADJACENCY | - 1 << PIPE_PRIM_TRIANGLES_ADJACENCY | - 1 << PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY)) { + (1 << info->mode) & (1 << MESA_PRIM_LINES_ADJACENCY | + 1 << MESA_PRIM_LINE_STRIP_ADJACENCY | + 1 << MESA_PRIM_TRIANGLES_ADJACENCY | + 1 << MESA_PRIM_TRIANGLE_STRIP_ADJACENCY)) { disable_instance_packing = true; } } @@ -2173,12 +2173,12 @@ static void si_draw(struct pipe_context *ctx, if (unlikely(!vs || (!IS_DRAW_VERTEX_STATE && sctx->num_vertex_elements < vs->info.num_vs_inputs) || (IS_DRAW_VERTEX_STATE && vstate->velems.count < vs->info.num_vs_inputs) || - !sctx->shader.ps.cso || (HAS_TESS != (info->mode == PIPE_PRIM_PATCHES)))) { + !sctx->shader.ps.cso || (HAS_TESS != (info->mode == MESA_PRIM_PATCHES)))) { assert(0); return; } - enum pipe_prim_type prim = HAS_TESS ? PIPE_PRIM_PATCHES : (enum pipe_prim_type)info->mode; + enum mesa_prim prim = HAS_TESS ? MESA_PRIM_PATCHES : (enum mesa_prim)info->mode; if (GFX_VERSION <= GFX9 && HAS_GS) { /* Determine whether the GS triangle strip adjacency fix should @@ -2187,7 +2187,7 @@ static void si_draw(struct pipe_context *ctx, * restart occurs after an odd number of triangles. */ bool gs_tri_strip_adj_fix = - !HAS_TESS && prim == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY; + !HAS_TESS && prim == MESA_PRIM_TRIANGLE_STRIP_ADJACENCY; if (gs_tri_strip_adj_fix != sctx->shader.gs.key.ge.mono.u.gs_tri_strip_adj_fix) { sctx->shader.gs.key.ge.mono.u.gs_tri_strip_adj_fix = gs_tri_strip_adj_fix; @@ -2285,10 +2285,10 @@ static void si_draw(struct pipe_context *ctx, * current_rast_prim for this draw_vbo call. */ if (!HAS_GS && !HAS_TESS) { - enum pipe_prim_type rast_prim; + enum mesa_prim rast_prim; if (util_rast_prim_is_triangles(prim)) { - rast_prim = PIPE_PRIM_TRIANGLES; + rast_prim = MESA_PRIM_TRIANGLES; } else { /* Only possibilities, POINTS, LINE*, RECTANGLES */ rast_prim = prim; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp b/src/gallium/drivers/radeonsi/si_state_shaders.cpp index f4b548c8267..a34e57f2b8a 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp +++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp @@ -830,7 +830,7 @@ void gfx9_get_gs_info(struct si_shader_selector *es, struct si_shader_selector * unsigned gs_num_invocations = MAX2(gs->info.base.gs.invocations, 1); unsigned input_prim = gs->info.base.gs.input_primitive; bool uses_adjacency = - input_prim >= PIPE_PRIM_LINES_ADJACENCY && input_prim <= PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY; + input_prim >= MESA_PRIM_LINES_ADJACENCY && input_prim <= MESA_PRIM_TRIANGLE_STRIP_ADJACENCY; /* All these are in dwords: */ /* We can't allow using the whole LDS, because GS waves compete with @@ -1057,7 +1057,7 @@ static void si_shader_gs(struct si_screen *sscreen, struct si_shader *shader) gs_vgpr_comp_cnt = 3; /* VGPR3 contains InvocationID. */ else if (sel->info.uses_primid) gs_vgpr_comp_cnt = 2; /* VGPR2 contains PrimitiveID. */ - else if (input_prim >= PIPE_PRIM_TRIANGLES) + else if (input_prim >= MESA_PRIM_TRIANGLES) gs_vgpr_comp_cnt = 1; /* VGPR1 contains offsets 2, 3 */ else gs_vgpr_comp_cnt = 0; /* VGPR0 contains offsets 0, 1 */ @@ -1256,16 +1256,16 @@ unsigned si_get_input_prim(const struct si_shader_selector *gs, const union si_s if (gs->stage == MESA_SHADER_TESS_EVAL) { if (gs->info.base.tess.point_mode) - return PIPE_PRIM_POINTS; + return MESA_PRIM_POINTS; if (gs->info.base.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES) - return PIPE_PRIM_LINES; - return PIPE_PRIM_TRIANGLES; + return MESA_PRIM_LINES; + return MESA_PRIM_TRIANGLES; } if (key->ge.opt.ngg_culling & SI_NGG_CULL_LINES) - return PIPE_PRIM_LINES; + return MESA_PRIM_LINES; - return PIPE_PRIM_TRIANGLES; /* worst case for all callers */ + return MESA_PRIM_TRIANGLES; /* worst case for all callers */ } static unsigned si_get_vs_out_cntl(const struct si_shader_selector *sel, @@ -1361,7 +1361,7 @@ static void gfx10_shader_ngg(struct si_screen *sscreen, struct si_shader *shader else if ((gs_stage == MESA_SHADER_GEOMETRY && gs_info->uses_primid) || (gs_stage == MESA_SHADER_VERTEX && shader->key.ge.mono.u.vs_export_prim_id)) gs_vgpr_comp_cnt = 2; /* VGPR2 contains PrimitiveID. */ - else if (input_prim >= PIPE_PRIM_TRIANGLES && !gfx10_is_ngg_passthrough(shader)) + else if (input_prim >= MESA_PRIM_TRIANGLES && !gfx10_is_ngg_passthrough(shader)) gs_vgpr_comp_cnt = 1; /* VGPR1 contains offsets 2, 3 */ else gs_vgpr_comp_cnt = 0; /* VGPR0 contains offsets 0, 1 */ @@ -2142,7 +2142,7 @@ static void si_get_vs_key_outputs(struct si_context *sctx, struct si_shader_sele key->ge.mono.u.vs_export_prim_id = vs->stage != MESA_SHADER_GEOMETRY && sctx->shader.ps.cso && sctx->shader.ps.cso->info.uses_primid; key->ge.opt.kill_pointsize = vs->info.writes_psize && - sctx->current_rast_prim != PIPE_PRIM_POINTS && + sctx->current_rast_prim != MESA_PRIM_POINTS && !sctx->queued.named.rasterizer->polygon_mode_is_points; key->ge.opt.remove_streamout = vs->info.enabled_streamout_buffer_mask && !sctx->streamout.enabled_mask; @@ -2346,7 +2346,7 @@ static void si_ps_key_update_primtype_shader_rasterizer_framebuffer(struct si_co sctx->framebuffer.nr_samples <= 1; key->ps.mono.point_smoothing = rs->point_smooth && - sctx->current_rast_prim == PIPE_PRIM_POINTS; + sctx->current_rast_prim == MESA_PRIM_POINTS; } void si_ps_key_update_sample_shading(struct si_context *sctx) @@ -3158,9 +3158,9 @@ static void *si_create_shader_selector(struct pipe_context *ctx, switch (sel->stage) { case MESA_SHADER_GEOMETRY: /* Only possibilities: POINTS, LINE_STRIP, TRIANGLES */ - sel->rast_prim = (enum pipe_prim_type)sel->info.base.gs.output_primitive; + sel->rast_prim = (enum mesa_prim)sel->info.base.gs.output_primitive; if (util_rast_prim_is_triangles(sel->rast_prim)) - sel->rast_prim = PIPE_PRIM_TRIANGLES; + sel->rast_prim = MESA_PRIM_TRIANGLES; /* EN_MAX_VERT_OUT_PER_GS_INSTANCE does not work with tessellation so * we can't split workgroups. Disable ngg if any of the following conditions is true: @@ -3178,13 +3178,13 @@ static void *si_create_shader_selector(struct pipe_context *ctx, case MESA_SHADER_TESS_EVAL: if (sel->stage == MESA_SHADER_TESS_EVAL) { if (sel->info.base.tess.point_mode) - sel->rast_prim = PIPE_PRIM_POINTS; + sel->rast_prim = MESA_PRIM_POINTS; else if (sel->info.base.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES) - sel->rast_prim = PIPE_PRIM_LINE_STRIP; + sel->rast_prim = MESA_PRIM_LINE_STRIP; else - sel->rast_prim = PIPE_PRIM_TRIANGLES; + sel->rast_prim = MESA_PRIM_TRIANGLES; } else { - sel->rast_prim = PIPE_PRIM_TRIANGLES; + sel->rast_prim = MESA_PRIM_TRIANGLES; } break; default:; @@ -3213,7 +3213,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx, sel->ngg_cull_vert_threshold = 128; } else if (sel->stage == MESA_SHADER_TESS_EVAL || sel->stage == MESA_SHADER_GEOMETRY) { - if (sel->rast_prim != PIPE_PRIM_POINTS) + if (sel->rast_prim != MESA_PRIM_POINTS) sel->ngg_cull_vert_threshold = 0; /* always enabled */ } } diff --git a/src/gallium/drivers/radeonsi/si_state_viewport.c b/src/gallium/drivers/radeonsi/si_state_viewport.c index df6592c3d95..88dd30e205a 100644 --- a/src/gallium/drivers/radeonsi/si_state_viewport.c +++ b/src/gallium/drivers/radeonsi/si_state_viewport.c @@ -344,7 +344,7 @@ static void si_emit_guardband(struct si_context *ctx) * conservative about when to discard them entirely. */ float pixels; - if (ctx->current_rast_prim == PIPE_PRIM_POINTS) + if (ctx->current_rast_prim == MESA_PRIM_POINTS) pixels = rs->max_point_size; else pixels = rs->line_width; diff --git a/src/gallium/drivers/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c index 7ad4b0946be..2d6da35906c 100644 --- a/src/gallium/drivers/softpipe/sp_clear.c +++ b/src/gallium/drivers/softpipe/sp_clear.c @@ -65,7 +65,7 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, return; #if 0 - softpipe_update_derived(softpipe, PIPE_PRIM_TRIANGLES); /* not needed?? */ + softpipe_update_derived(softpipe, MESA_PRIM_TRIANGLES); /* not needed?? */ #endif if (buffers & PIPE_CLEAR_COLOR) { diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 12734314bf0..39a4c2e46a6 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -60,7 +60,7 @@ struct softpipe_vbuf_render struct softpipe_context *softpipe; struct setup_context *setup; - enum pipe_prim_type prim; + enum mesa_prim prim; uint vertex_size; uint nr_vertices; uint vertex_buffer_size; @@ -133,7 +133,7 @@ sp_vbuf_unmap_vertices(struct vbuf_render *vbr, static void -sp_vbuf_set_primitive(struct vbuf_render *vbr, enum pipe_prim_type prim) +sp_vbuf_set_primitive(struct vbuf_render *vbr, enum mesa_prim prim) { struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); struct setup_context *setup_ctx = cvbr->setup; @@ -168,14 +168,14 @@ sp_vbuf_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) unsigned i; switch (cvbr->prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: for (i = 0; i < nr; i++) { sp_setup_point( setup, get_vert(vertex_buffer, indices[i-0], stride) ); } break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: for (i = 1; i < nr; i += 2) { sp_setup_line( setup, get_vert(vertex_buffer, indices[i-1], stride), @@ -183,7 +183,7 @@ sp_vbuf_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: for (i = 1; i < nr; i ++) { sp_setup_line( setup, get_vert(vertex_buffer, indices[i-1], stride), @@ -191,7 +191,7 @@ sp_vbuf_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: for (i = 1; i < nr; i ++) { sp_setup_line( setup, get_vert(vertex_buffer, indices[i-1], stride), @@ -204,7 +204,7 @@ sp_vbuf_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: for (i = 2; i < nr; i += 3) { sp_setup_tri( setup, get_vert(vertex_buffer, indices[i-2], stride), @@ -213,7 +213,7 @@ sp_vbuf_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: if (flatshade_first) { for (i = 2; i < nr; i += 1) { /* emit first triangle vertex as first triangle vertex */ @@ -235,7 +235,7 @@ sp_vbuf_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: if (flatshade_first) { for (i = 2; i < nr; i += 1) { /* emit first non-spoke vertex as first vertex */ @@ -256,7 +256,7 @@ sp_vbuf_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: /* GL quads don't follow provoking vertex convention */ if (flatshade_first) { /* emit last quad vertex as first triangle vertex */ @@ -288,7 +288,7 @@ sp_vbuf_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: /* GL quad strips don't follow provoking vertex convention */ if (flatshade_first) { /* emit last quad vertex as first triangle vertex */ @@ -318,7 +318,7 @@ sp_vbuf_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: /* Almost same as tri fan but the _first_ vertex specifies the flat * shading color. */ @@ -365,14 +365,14 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) unsigned i; switch (cvbr->prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: for (i = 0; i < nr; i++) { sp_setup_point( setup, get_vert(vertex_buffer, i-0, stride) ); } break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: for (i = 1; i < nr; i += 2) { sp_setup_line( setup, get_vert(vertex_buffer, i-1, stride), @@ -380,7 +380,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: for (i = 3; i < nr; i += 4) { sp_setup_line( setup, get_vert(vertex_buffer, i-2, stride), @@ -388,7 +388,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: for (i = 1; i < nr; i ++) { sp_setup_line( setup, get_vert(vertex_buffer, i-1, stride), @@ -396,7 +396,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: for (i = 3; i < nr; i++) { sp_setup_line( setup, get_vert(vertex_buffer, i-2, stride), @@ -404,7 +404,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_LOOP: for (i = 1; i < nr; i ++) { sp_setup_line( setup, get_vert(vertex_buffer, i-1, stride), @@ -417,7 +417,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: for (i = 2; i < nr; i += 3) { sp_setup_tri( setup, get_vert(vertex_buffer, i-2, stride), @@ -426,7 +426,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: for (i = 5; i < nr; i += 6) { sp_setup_tri( setup, get_vert(vertex_buffer, i-5, stride), @@ -435,7 +435,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: if (flatshade_first) { for (i = 2; i < nr; i++) { /* emit first triangle vertex as first triangle vertex */ @@ -456,7 +456,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: if (flatshade_first) { for (i = 5; i < nr; i += 2) { /* emit first triangle vertex as first triangle vertex */ @@ -477,7 +477,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: if (flatshade_first) { for (i = 2; i < nr; i += 1) { /* emit first non-spoke vertex as first vertex */ @@ -498,7 +498,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: /* GL quads don't follow provoking vertex convention */ if (flatshade_first) { /* emit last quad vertex as first triangle vertex */ @@ -528,7 +528,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_QUAD_STRIP: /* GL quad strips don't follow provoking vertex convention */ if (flatshade_first) { /* emit last quad vertex as first triangle vertex */ @@ -558,7 +558,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_POLYGON: + case MESA_PRIM_POLYGON: /* Almost same as tri fan but the _first_ vertex specifies the flat * shading color. */ diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index 496e14d914a..712fe23a11f 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -779,7 +779,7 @@ sp_setup_tri(struct setup_context *setup, setup_tri_coefficients( setup ); setup_tri_edges( setup ); - assert(setup->softpipe->reduced_prim == PIPE_PRIM_TRIANGLES); + assert(setup->softpipe->reduced_prim == MESA_PRIM_TRIANGLES); setup->span.y = 0; setup->span.right[0] = 0; @@ -1048,7 +1048,7 @@ sp_setup_line(struct setup_context *setup, assert(dx >= 0); assert(dy >= 0); - assert(setup->softpipe->reduced_prim == PIPE_PRIM_LINES); + assert(setup->softpipe->reduced_prim == MESA_PRIM_LINES); setup->quad[0].input.x0 = setup->quad[0].input.y0 = -1; setup->quad[0].inout.mask = 0x0; @@ -1167,7 +1167,7 @@ sp_setup_point(struct setup_context *setup, setup->softpipe->rasterizer->rasterizer_discard) return; - assert(setup->softpipe->reduced_prim == PIPE_PRIM_POINTS); + assert(setup->softpipe->reduced_prim == MESA_PRIM_POINTS); if (setup->softpipe->layer_slot > 0) { layer = *(unsigned *)v0[setup->softpipe->layer_slot]; @@ -1403,7 +1403,7 @@ sp_setup_prepare(struct setup_context *setup) sp->quad.first->begin( sp->quad.first ); - if (sp->reduced_api_prim == PIPE_PRIM_TRIANGLES && + if (sp->reduced_api_prim == MESA_PRIM_TRIANGLES && sp->rasterizer->fill_front == PIPE_POLYGON_MODE_FILL && sp->rasterizer->fill_back == PIPE_POLYGON_MODE_FILL) { /* we'll do culling */ diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 04d852fe39f..b95776d8b62 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -179,9 +179,9 @@ struct svga_depth_stencil_state { #define SVGA_UNFILLED_LINE 1 #define SVGA_UNFILLED_POINT 2 -#define SVGA_PIPELINE_FLAG_POINTS (1<index_cache[i][j].buffer, NULL); } diff --git a/src/gallium/drivers/svga/svga_draw.h b/src/gallium/drivers/svga/svga_draw.h index 375c721b3eb..18d8e3e2145 100644 --- a/src/gallium/drivers/svga/svga_draw.h +++ b/src/gallium/drivers/svga/svga_draw.h @@ -59,7 +59,7 @@ svga_hwtnl_vertex_buffers(struct svga_hwtnl *hwtnl, enum pipe_error svga_hwtnl_draw_arrays(struct svga_hwtnl *hwtnl, - enum pipe_prim_type prim, unsigned start, unsigned count, + enum mesa_prim prim, unsigned start, unsigned count, unsigned start_instance, unsigned instance_count, ubyte vertices_per_patch); diff --git a/src/gallium/drivers/svga/svga_draw_arrays.c b/src/gallium/drivers/svga/svga_draw_arrays.c index 20127e916fd..b26f7e16776 100644 --- a/src/gallium/drivers/svga/svga_draw_arrays.c +++ b/src/gallium/drivers/svga/svga_draw_arrays.c @@ -90,7 +90,7 @@ compare(unsigned cached_nr, unsigned nr, unsigned type) static enum pipe_error retrieve_or_generate_indices(struct svga_hwtnl *hwtnl, - enum pipe_prim_type prim, + enum mesa_prim prim, unsigned gen_type, unsigned gen_nr, unsigned gen_size, @@ -174,7 +174,7 @@ done: static enum pipe_error simple_draw_arrays(struct svga_hwtnl *hwtnl, - enum pipe_prim_type prim, unsigned start, unsigned count, + enum mesa_prim prim, unsigned start, unsigned count, unsigned start_instance, unsigned instance_count, ubyte vertices_per_patch) { @@ -208,11 +208,11 @@ simple_draw_arrays(struct svga_hwtnl *hwtnl, enum pipe_error svga_hwtnl_draw_arrays(struct svga_hwtnl *hwtnl, - enum pipe_prim_type prim, unsigned start, unsigned count, + enum mesa_prim prim, unsigned start, unsigned count, unsigned start_instance, unsigned instance_count, ubyte vertices_per_patch) { - enum pipe_prim_type gen_prim; + enum mesa_prim gen_prim; unsigned gen_size, gen_nr; enum indices_mode gen_type; u_generate_func gen_func; @@ -242,11 +242,11 @@ svga_hwtnl_draw_arrays(struct svga_hwtnl *hwtnl, * supported by the svga device. Also note, we can only do this * for flat/constant-colored rendering because of provoking vertex. */ - if (prim == PIPE_PRIM_POLYGON) { - prim = PIPE_PRIM_TRIANGLE_FAN; + if (prim == MESA_PRIM_POLYGON) { + prim = MESA_PRIM_TRIANGLE_FAN; } - else if (prim == PIPE_PRIM_QUADS && count == 4) { - prim = PIPE_PRIM_TRIANGLE_FAN; + else if (prim == MESA_PRIM_QUADS && count == 4) { + prim = MESA_PRIM_TRIANGLE_FAN; } } } @@ -261,8 +261,8 @@ svga_hwtnl_draw_arrays(struct svga_hwtnl *hwtnl, &gen_size, &gen_nr, &gen_func); } else { - /* Convert PIPE_PRIM_LINE_LOOP to PIPE_PRIM_LINESTRIP, - * convert PIPE_PRIM_POLYGON to PIPE_PRIM_TRIANGLE_FAN, + /* Convert MESA_PRIM_LINE_LOOP to MESA_PRIM_LINESTRIP, + * convert MESA_PRIM_POLYGON to MESA_PRIM_TRIANGLE_FAN, * etc, if needed (as determined by svga_hw_prims mask). */ gen_type = u_index_generator(svga_hw_prims, diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c index ec7cba7588a..4dea43d1f3d 100644 --- a/src/gallium/drivers/svga/svga_draw_elements.c +++ b/src/gallium/drivers/svga/svga_draw_elements.c @@ -49,8 +49,8 @@ * glDrawElements(GL_QUADS) commands (we can't draw quads natively). * * \param offset offset in bytes to first index to translate in src buffer - * \param orig_prim original primitive type (like PIPE_PRIM_QUADS) - * \param gen_prim new/generated primitive type (like PIPE_PRIM_TRIANGLES) + * \param orig_prim original primitive type (like MESA_PRIM_QUADS) + * \param gen_prim new/generated primitive type (like MESA_PRIM_TRIANGLES) * \param orig_nr number of indexes to translate in source buffer * \param gen_nr number of indexes to write into new/dest buffer * \param index_size bytes per index (2 or 4) @@ -62,7 +62,7 @@ static enum pipe_error translate_indices(struct svga_hwtnl *hwtnl, const struct pipe_draw_info *info, const struct pipe_draw_start_count_bias *draw, - enum pipe_prim_type gen_prim, + enum mesa_prim gen_prim, unsigned orig_nr, unsigned gen_nr, unsigned gen_size, u_translate_func translate, @@ -184,7 +184,7 @@ svga_hwtnl_simple_draw_range_elements(struct svga_hwtnl *hwtnl, struct pipe_resource *index_buffer, unsigned index_size, int index_bias, unsigned min_index, unsigned max_index, - enum pipe_prim_type prim, unsigned start, + enum mesa_prim prim, unsigned start, unsigned count, unsigned start_instance, unsigned instance_count, @@ -220,7 +220,7 @@ svga_hwtnl_draw_range_elements(struct svga_hwtnl *hwtnl, unsigned count) { struct pipe_context *pipe = &hwtnl->svga->pipe; - enum pipe_prim_type gen_prim; + enum mesa_prim gen_prim; unsigned gen_size, gen_nr; enum indices_mode gen_type; u_translate_func gen_func; @@ -244,7 +244,7 @@ svga_hwtnl_draw_range_elements(struct svga_hwtnl *hwtnl, * consider provoking vertex mode for the translation. * So use the same api_pv as the hw_pv. */ - hw_pv = info->mode == PIPE_PRIM_PATCHES ? hwtnl->api_pv : + hw_pv = info->mode == MESA_PRIM_PATCHES ? hwtnl->api_pv : hwtnl->hw_pv; gen_type = u_index_translator(svga_hw_prims, info->mode, diff --git a/src/gallium/drivers/svga/svga_draw_private.h b/src/gallium/drivers/svga/svga_draw_private.h index 475ccc5aae0..3b2d4f24f2a 100644 --- a/src/gallium/drivers/svga/svga_draw_private.h +++ b/src/gallium/drivers/svga/svga_draw_private.h @@ -43,25 +43,25 @@ struct u_upload_mgr; * these types by the index/translation code. */ static const unsigned svga_hw_prims = - ((1 << PIPE_PRIM_POINTS) | - (1 << PIPE_PRIM_LINES) | - (1 << PIPE_PRIM_LINE_STRIP) | - (1 << PIPE_PRIM_TRIANGLES) | - (1 << PIPE_PRIM_TRIANGLE_STRIP) | - (1 << PIPE_PRIM_TRIANGLE_FAN) | - (1 << PIPE_PRIM_LINES_ADJACENCY) | - (1 << PIPE_PRIM_LINE_STRIP_ADJACENCY) | - (1 << PIPE_PRIM_TRIANGLES_ADJACENCY) | - (1 << PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY) | - (1 << PIPE_PRIM_PATCHES)); + ((1 << MESA_PRIM_POINTS) | + (1 << MESA_PRIM_LINES) | + (1 << MESA_PRIM_LINE_STRIP) | + (1 << MESA_PRIM_TRIANGLES) | + (1 << MESA_PRIM_TRIANGLE_STRIP) | + (1 << MESA_PRIM_TRIANGLE_FAN) | + (1 << MESA_PRIM_LINES_ADJACENCY) | + (1 << MESA_PRIM_LINE_STRIP_ADJACENCY) | + (1 << MESA_PRIM_TRIANGLES_ADJACENCY) | + (1 << MESA_PRIM_TRIANGLE_STRIP_ADJACENCY) | + (1 << MESA_PRIM_PATCHES)); /** - * Translate a gallium PIPE_PRIM_x value to an SVGA3D_PRIMITIVE_x value. + * Translate a gallium MESA_PRIM_x value to an SVGA3D_PRIMITIVE_x value. * Also, compute the number of primitives that'll be drawn given a * vertex count. - * Note that this function doesn't have to handle PIPE_PRIM_LINE_LOOP, - * PIPE_PRIM_QUADS, PIPE_PRIM_QUAD_STRIP or PIPE_PRIM_POLYGON. We convert + * Note that this function doesn't have to handle MESA_PRIM_LINE_LOOP, + * MESA_PRIM_QUADS, MESA_PRIM_QUAD_STRIP or MESA_PRIM_POLYGON. We convert * those to other types of primitives with index/translation code. */ static inline SVGA3dPrimitiveType @@ -69,47 +69,47 @@ svga_translate_prim(unsigned mode, unsigned vcount, unsigned *prim_count, ubyte vertices_per_patch) { switch (mode) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: *prim_count = vcount; return SVGA3D_PRIMITIVE_POINTLIST; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: *prim_count = vcount / 2; return SVGA3D_PRIMITIVE_LINELIST; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: *prim_count = vcount - 1; return SVGA3D_PRIMITIVE_LINESTRIP; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: *prim_count = vcount / 3; return SVGA3D_PRIMITIVE_TRIANGLELIST; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: *prim_count = vcount - 2; return SVGA3D_PRIMITIVE_TRIANGLESTRIP; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: *prim_count = vcount - 2; return SVGA3D_PRIMITIVE_TRIANGLEFAN; - case PIPE_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: *prim_count = vcount / 4; return SVGA3D_PRIMITIVE_LINELIST_ADJ; - case PIPE_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: *prim_count = vcount - 3; return SVGA3D_PRIMITIVE_LINESTRIP_ADJ; - case PIPE_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: *prim_count = vcount / 6; return SVGA3D_PRIMITIVE_TRIANGLELIST_ADJ; - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: *prim_count = vcount / 2 - 2 ; return SVGA3D_PRIMITIVE_TRIANGLESTRIP_ADJ; - case PIPE_PRIM_PATCHES: + case MESA_PRIM_PATCHES: *prim_count = vcount / vertices_per_patch ; assert(vertices_per_patch >= 1); assert(vertices_per_patch <= 32); @@ -183,7 +183,7 @@ struct svga_hwtnl { /* Cache the results of running a particular generate func on each * primitive type. */ - struct index_cache index_cache[PIPE_PRIM_MAX][IDX_CACHE_MAX]; + struct index_cache index_cache[MESA_PRIM_COUNT][IDX_CACHE_MAX]; /* Try to build the maximal draw command packet before emitting: */ @@ -198,16 +198,16 @@ struct svga_hwtnl { */ static inline boolean svga_need_unfilled_fallback(const struct svga_hwtnl *hwtnl, - enum pipe_prim_type prim) + enum mesa_prim prim) { - if (u_reduced_prim(prim) != PIPE_PRIM_TRIANGLES) { + if (u_reduced_prim(prim) != MESA_PRIM_TRIANGLES) { /* if we're drawing points or lines, no fallback needed */ return FALSE; } - if ((prim == PIPE_PRIM_QUADS || - prim == PIPE_PRIM_QUAD_STRIP || - prim == PIPE_PRIM_POLYGON) && + if ((prim == MESA_PRIM_QUADS || + prim == MESA_PRIM_QUAD_STRIP || + prim == MESA_PRIM_POLYGON) && hwtnl->api_fillmode == PIPE_POLYGON_MODE_LINE) { /* We can't directly render quads or polygons. They're * converted to triangles. If we let the device draw the triangle @@ -238,7 +238,7 @@ svga_hwtnl_simple_draw_range_elements(struct svga_hwtnl *hwtnl, int index_bias, unsigned min_index, unsigned max_index, - enum pipe_prim_type prim, + enum mesa_prim prim, unsigned start, unsigned count, unsigned start_instance, diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c index ffdd3df05e4..3efb7cef2d3 100644 --- a/src/gallium/drivers/svga/svga_pipe_draw.c +++ b/src/gallium/drivers/svga/svga_pipe_draw.c @@ -59,7 +59,7 @@ retry_draw_range_elements(struct svga_context *svga, static enum pipe_error retry_draw_arrays( struct svga_context *svga, - enum pipe_prim_type prim, unsigned start, unsigned count, + enum mesa_prim prim, unsigned start, unsigned count, unsigned start_instance, unsigned instance_count, ubyte vertices_per_patch) { @@ -88,11 +88,11 @@ retry_draw_auto(struct svga_context *svga, assert(indirect->count_from_stream_output); assert(info->instance_count == 1); /* SO drawing implies core profile and none of these prim types */ - assert(info->mode != PIPE_PRIM_QUADS && - info->mode != PIPE_PRIM_QUAD_STRIP && - info->mode != PIPE_PRIM_POLYGON); + assert(info->mode != MESA_PRIM_QUADS && + info->mode != MESA_PRIM_QUAD_STRIP && + info->mode != MESA_PRIM_POLYGON); - if (info->mode == PIPE_PRIM_LINE_LOOP) { + if (info->mode == MESA_PRIM_LINE_LOOP) { /* XXX need to do a fallback */ assert(!"draw auto fallback not supported yet"); return PIPE_OK; @@ -137,11 +137,11 @@ retry_draw_indirect(struct svga_context *svga, assert(svga_have_sm5(svga)); assert(indirect && indirect->buffer); /* indirect drawing implies core profile and none of these prim types */ - assert(info->mode != PIPE_PRIM_QUADS && - info->mode != PIPE_PRIM_QUAD_STRIP && - info->mode != PIPE_PRIM_POLYGON); + assert(info->mode != MESA_PRIM_QUADS && + info->mode != MESA_PRIM_QUAD_STRIP && + info->mode != MESA_PRIM_POLYGON); - if (info->mode == PIPE_PRIM_LINE_LOOP) { + if (info->mode == MESA_PRIM_LINE_LOOP) { /* need to do a fallback */ util_draw_indirect(&svga->pipe, info, indirect); return PIPE_OK; @@ -232,7 +232,7 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info, return; struct svga_context *svga = svga_context(pipe); - enum pipe_prim_type reduced_prim = u_reduced_prim(info->mode); + enum mesa_prim reduced_prim = u_reduced_prim(info->mode); unsigned count = draws[0].count; enum pipe_error ret = 0; boolean needed_swtnl; @@ -241,7 +241,7 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info, svga->hud.num_draw_calls++; /* for SVGA_QUERY_NUM_DRAW_CALLS */ - if (u_reduced_prim(info->mode) == PIPE_PRIM_TRIANGLES && + if (u_reduced_prim(info->mode) == MESA_PRIM_TRIANGLES && svga->curr.rast->templ.cull_face == PIPE_FACE_FRONT_AND_BACK) goto done; diff --git a/src/gallium/drivers/svga/svga_resource_buffer.h b/src/gallium/drivers/svga/svga_resource_buffer.h index 5652bbcec3e..7a4c1add81a 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.h +++ b/src/gallium/drivers/svga/svga_resource_buffer.h @@ -222,7 +222,7 @@ struct svga_buffer * function from svga_draw_elements.c */ struct { - enum pipe_prim_type orig_prim, new_prim; + enum mesa_prim orig_prim, new_prim; struct pipe_resource *buffer; unsigned index_size; unsigned offset; /**< first index */ diff --git a/src/gallium/drivers/svga/svga_shader.h b/src/gallium/drivers/svga/svga_shader.h index 01fc2578032..34573bb01b0 100644 --- a/src/gallium/drivers/svga/svga_shader.h +++ b/src/gallium/drivers/svga/svga_shader.h @@ -98,7 +98,7 @@ struct svga_compile_key struct { unsigned vertices_per_patch:8; unsigned vertices_out:8; - enum pipe_prim_type prim_mode:8; + enum mesa_prim prim_mode:8; enum pipe_tess_spacing spacing:3; unsigned vertices_order_cw:1; unsigned point_mode:1; @@ -273,7 +273,7 @@ struct svga_tes_variant { struct svga_shader_variant base; - enum pipe_prim_type prim_mode:8; + enum mesa_prim prim_mode:8; enum pipe_tess_spacing spacing:3; unsigned vertices_order_cw:1; unsigned point_mode:1; @@ -334,8 +334,8 @@ struct svga_shader_info } fs; struct { - enum pipe_prim_type in_prim; - enum pipe_prim_type out_prim; + enum mesa_prim in_prim; + enum mesa_prim out_prim; } gs; struct { @@ -344,7 +344,7 @@ struct svga_shader_info } tcs; struct { - enum pipe_prim_type prim_mode; + enum mesa_prim prim_mode; boolean reads_control_point; boolean reads_tess_factor; } tes; diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c index 9c69975508d..55c94dd4a6a 100644 --- a/src/gallium/drivers/svga/svga_state_framebuffer.c +++ b/src/gallium/drivers/svga/svga_state_framebuffer.c @@ -560,7 +560,7 @@ get_viewport_prescale(struct svga_context *svga, * adjustments for VGPU10. But when we draw wide points with * a GS we need an X adjustment in order to be conformant. */ - if (svga->curr.reduced_prim == PIPE_PRIM_POINTS && + if (svga->curr.reduced_prim == MESA_PRIM_POINTS && svga->curr.rast->pointsize > 1.0f) { adjust_x = 0.5; } diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c index 3c09e19171b..fa5ab065615 100644 --- a/src/gallium/drivers/svga/svga_state_fs.c +++ b/src/gallium/drivers/svga/svga_state_fs.c @@ -147,7 +147,7 @@ make_fs_key(const struct svga_context *svga, if (!svga->state.sw.need_swtnl) { /* SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE */ - enum pipe_prim_type prim_mode; + enum mesa_prim prim_mode; struct svga_shader *shader; /* Find the last shader in the vertex pipeline and the output primitive mode @@ -167,11 +167,11 @@ make_fs_key(const struct svga_context *svga, key->fs.light_twoside = svga->curr.rast->templ.light_twoside; key->fs.front_ccw = svga->curr.rast->templ.front_ccw; key->fs.pstipple = (svga->curr.rast->templ.poly_stipple_enable && - prim_mode == PIPE_PRIM_TRIANGLES); + prim_mode == MESA_PRIM_TRIANGLES); if (svga->curr.gs) { key->fs.aa_point = (svga->curr.rast->templ.point_smooth && - shader->info.gs.in_prim == PIPE_PRIM_POINTS && + shader->info.gs.in_prim == MESA_PRIM_POINTS && (svga->curr.rast->pointsize > 1.0 || shader->info.writes_psize)); diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c b/src/gallium/drivers/svga/svga_state_need_swtnl.c index 60eba558000..abb9c3bdbc1 100644 --- a/src/gallium/drivers/svga/svga_state_need_swtnl.c +++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c @@ -80,13 +80,13 @@ update_need_pipeline(struct svga_context *svga, uint64_t dirty) need_pipeline = TRUE; switch (svga->curr.reduced_prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: reason = svga->curr.rast->need_pipeline_points_str; break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: reason = svga->curr.rast->need_pipeline_lines_str; break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: reason = svga->curr.rast->need_pipeline_tris_str; break; default: @@ -104,7 +104,7 @@ update_need_pipeline(struct svga_context *svga, uint64_t dirty) /* SVGA_NEW_FS, SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE */ - if (svga->curr.rast && svga->curr.reduced_prim == PIPE_PRIM_POINTS) { + if (svga->curr.rast && svga->curr.reduced_prim == MESA_PRIM_POINTS) { unsigned sprite_coord_gen = svga->curr.rast->templ.sprite_coord_enable; unsigned generic_inputs = svga->curr.fs ? svga->curr.fs->generic_inputs : 0; diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c index 8cdf60c3417..69fa5c5cf04 100644 --- a/src/gallium/drivers/svga/svga_state_rss.c +++ b/src/gallium/drivers/svga/svga_state_rss.c @@ -483,7 +483,7 @@ emit_rss_vgpu10(struct svga_context *svga, uint64_t dirty) SVGA_NEW_FRAME_BUFFER)) { struct svga_rasterizer_state *rast = svga->curr.rast; - if (svga->curr.reduced_prim == PIPE_PRIM_POINTS && + if (svga->curr.reduced_prim == MESA_PRIM_POINTS && svga->curr.gs && svga->curr.gs->wide_point) { /* If we are drawing a point sprite, we will need to diff --git a/src/gallium/drivers/svga/svga_state_tgsi_transform.c b/src/gallium/drivers/svga/svga_state_tgsi_transform.c index 06084f6191d..dc49f8d833c 100644 --- a/src/gallium/drivers/svga/svga_state_tgsi_transform.c +++ b/src/gallium/drivers/svga/svga_state_tgsi_transform.c @@ -449,7 +449,7 @@ update_tgsi_transform(struct svga_context *svga, uint64_t dirty) transform_dynamic_indexing(svga, &tes->base); } - if (svga->curr.reduced_prim == PIPE_PRIM_POINTS) { + if (svga->curr.reduced_prim == MESA_PRIM_POINTS) { /* If the current prim type is POINTS and the current geometry shader * emits wide points, transform the shader to emulate wide points using * quads. NOTE: we don't do emulation of wide points in GS when diff --git a/src/gallium/drivers/svga/svga_swtnl_backend.c b/src/gallium/drivers/svga/svga_swtnl_backend.c index 3c9a52465b0..a697c855d38 100644 --- a/src/gallium/drivers/svga/svga_swtnl_backend.c +++ b/src/gallium/drivers/svga/svga_swtnl_backend.c @@ -204,7 +204,7 @@ svga_vbuf_render_unmap_vertices(struct vbuf_render *render, static void svga_vbuf_render_set_primitive(struct vbuf_render *render, - enum pipe_prim_type prim) + enum mesa_prim prim) { struct svga_vbuf_render *svga_render = svga_vbuf_render(render); svga_render->prim = prim; diff --git a/src/gallium/drivers/svga/svga_swtnl_private.h b/src/gallium/drivers/svga/svga_swtnl_private.h index 489b3bc0e36..17cf2bc33fd 100644 --- a/src/gallium/drivers/svga/svga_swtnl_private.h +++ b/src/gallium/drivers/svga/svga_swtnl_private.h @@ -45,7 +45,7 @@ struct svga_vbuf_render { SVGA3dElementLayoutId layout_id; /**< current element layout id */ - enum pipe_prim_type prim; + enum mesa_prim prim; struct pipe_resource *vbuf; struct pipe_resource *ibuf; diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c index a02e82d9186..e87d947d90d 100644 --- a/src/gallium/drivers/svga/svga_swtnl_state.c +++ b/src/gallium/drivers/svga/svga_swtnl_state.c @@ -56,17 +56,17 @@ set_draw_viewport(struct svga_context *svga) float adjy = 0.0f; if (svga_have_vgpu10(svga)) { - if (svga->curr.reduced_prim == PIPE_PRIM_TRIANGLES) { + if (svga->curr.reduced_prim == MESA_PRIM_TRIANGLES) { adjy = 0.25; } } else { switch (svga->curr.reduced_prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: adjx = SVGA_POINT_ADJ_X; adjy = SVGA_POINT_ADJ_Y; break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: /* XXX: This is to compensate for the fact that wide lines are * going to be drawn with triangles, but we're not catching all * cases where that will happen. @@ -81,7 +81,7 @@ set_draw_viewport(struct svga_context *svga) adjy = SVGA_LINE_ADJ_Y; } break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: adjx += SVGA_TRIANGLE_ADJ_X; adjy += SVGA_TRIANGLE_ADJ_Y; break; diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c index e4ac54a853c..b7f6f05abf1 100644 --- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c +++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c @@ -407,7 +407,7 @@ struct svga_shader_emitter_v10 /* For tessellation evaluation shaders only */ struct { - enum pipe_prim_type prim_mode; + enum mesa_prim prim_mode; enum pipe_tess_spacing spacing; boolean vertices_order_cw; boolean point_mode; @@ -2946,37 +2946,37 @@ emit_vgpu10_property(struct svga_shader_emitter_v10 *emit, const struct tgsi_full_property *prop) { static const VGPU10_PRIMITIVE primType[] = { - VGPU10_PRIMITIVE_POINT, /* PIPE_PRIM_POINTS */ - VGPU10_PRIMITIVE_LINE, /* PIPE_PRIM_LINES */ - VGPU10_PRIMITIVE_LINE, /* PIPE_PRIM_LINE_LOOP */ - VGPU10_PRIMITIVE_LINE, /* PIPE_PRIM_LINE_STRIP */ - VGPU10_PRIMITIVE_TRIANGLE, /* PIPE_PRIM_TRIANGLES */ - VGPU10_PRIMITIVE_TRIANGLE, /* PIPE_PRIM_TRIANGLE_STRIP */ - VGPU10_PRIMITIVE_TRIANGLE, /* PIPE_PRIM_TRIANGLE_FAN */ - VGPU10_PRIMITIVE_UNDEFINED, /* PIPE_PRIM_QUADS */ - VGPU10_PRIMITIVE_UNDEFINED, /* PIPE_PRIM_QUAD_STRIP */ - VGPU10_PRIMITIVE_UNDEFINED, /* PIPE_PRIM_POLYGON */ - VGPU10_PRIMITIVE_LINE_ADJ, /* PIPE_PRIM_LINES_ADJACENCY */ - VGPU10_PRIMITIVE_LINE_ADJ, /* PIPE_PRIM_LINE_STRIP_ADJACENCY */ - VGPU10_PRIMITIVE_TRIANGLE_ADJ, /* PIPE_PRIM_TRIANGLES_ADJACENCY */ - VGPU10_PRIMITIVE_TRIANGLE_ADJ /* PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY */ + VGPU10_PRIMITIVE_POINT, /* MESA_PRIM_POINTS */ + VGPU10_PRIMITIVE_LINE, /* MESA_PRIM_LINES */ + VGPU10_PRIMITIVE_LINE, /* MESA_PRIM_LINE_LOOP */ + VGPU10_PRIMITIVE_LINE, /* MESA_PRIM_LINE_STRIP */ + VGPU10_PRIMITIVE_TRIANGLE, /* MESA_PRIM_TRIANGLES */ + VGPU10_PRIMITIVE_TRIANGLE, /* MESA_PRIM_TRIANGLE_STRIP */ + VGPU10_PRIMITIVE_TRIANGLE, /* MESA_PRIM_TRIANGLE_FAN */ + VGPU10_PRIMITIVE_UNDEFINED, /* MESA_PRIM_QUADS */ + VGPU10_PRIMITIVE_UNDEFINED, /* MESA_PRIM_QUAD_STRIP */ + VGPU10_PRIMITIVE_UNDEFINED, /* MESA_PRIM_POLYGON */ + VGPU10_PRIMITIVE_LINE_ADJ, /* MESA_PRIM_LINES_ADJACENCY */ + VGPU10_PRIMITIVE_LINE_ADJ, /* MESA_PRIM_LINE_STRIP_ADJACENCY */ + VGPU10_PRIMITIVE_TRIANGLE_ADJ, /* MESA_PRIM_TRIANGLES_ADJACENCY */ + VGPU10_PRIMITIVE_TRIANGLE_ADJ /* MESA_PRIM_TRIANGLE_STRIP_ADJACENCY */ }; static const VGPU10_PRIMITIVE_TOPOLOGY primTopology[] = { - VGPU10_PRIMITIVE_TOPOLOGY_POINTLIST, /* PIPE_PRIM_POINTS */ - VGPU10_PRIMITIVE_TOPOLOGY_LINELIST, /* PIPE_PRIM_LINES */ - VGPU10_PRIMITIVE_TOPOLOGY_LINELIST, /* PIPE_PRIM_LINE_LOOP */ - VGPU10_PRIMITIVE_TOPOLOGY_LINESTRIP, /* PIPE_PRIM_LINE_STRIP */ - VGPU10_PRIMITIVE_TOPOLOGY_TRIANGLELIST, /* PIPE_PRIM_TRIANGLES */ - VGPU10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, /* PIPE_PRIM_TRIANGLE_STRIP */ - VGPU10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, /* PIPE_PRIM_TRIANGLE_FAN */ - VGPU10_PRIMITIVE_TOPOLOGY_UNDEFINED, /* PIPE_PRIM_QUADS */ - VGPU10_PRIMITIVE_TOPOLOGY_UNDEFINED, /* PIPE_PRIM_QUAD_STRIP */ - VGPU10_PRIMITIVE_TOPOLOGY_UNDEFINED, /* PIPE_PRIM_POLYGON */ - VGPU10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, /* PIPE_PRIM_LINES_ADJACENCY */ - VGPU10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, /* PIPE_PRIM_LINE_STRIP_ADJACENCY */ - VGPU10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, /* PIPE_PRIM_TRIANGLES_ADJACENCY */ - VGPU10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ /* PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY */ + VGPU10_PRIMITIVE_TOPOLOGY_POINTLIST, /* MESA_PRIM_POINTS */ + VGPU10_PRIMITIVE_TOPOLOGY_LINELIST, /* MESA_PRIM_LINES */ + VGPU10_PRIMITIVE_TOPOLOGY_LINELIST, /* MESA_PRIM_LINE_LOOP */ + VGPU10_PRIMITIVE_TOPOLOGY_LINESTRIP, /* MESA_PRIM_LINE_STRIP */ + VGPU10_PRIMITIVE_TOPOLOGY_TRIANGLELIST, /* MESA_PRIM_TRIANGLES */ + VGPU10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, /* MESA_PRIM_TRIANGLE_STRIP */ + VGPU10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, /* MESA_PRIM_TRIANGLE_FAN */ + VGPU10_PRIMITIVE_TOPOLOGY_UNDEFINED, /* MESA_PRIM_QUADS */ + VGPU10_PRIMITIVE_TOPOLOGY_UNDEFINED, /* MESA_PRIM_QUAD_STRIP */ + VGPU10_PRIMITIVE_TOPOLOGY_UNDEFINED, /* MESA_PRIM_POLYGON */ + VGPU10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, /* MESA_PRIM_LINES_ADJACENCY */ + VGPU10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, /* MESA_PRIM_LINE_STRIP_ADJACENCY */ + VGPU10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, /* MESA_PRIM_TRIANGLES_ADJACENCY */ + VGPU10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ /* MESA_PRIM_TRIANGLE_STRIP_ADJACENCY */ }; static const unsigned inputArraySize[] = { @@ -3111,18 +3111,18 @@ emit_property_instructions(struct svga_shader_emitter_v10 *emit) */ static void emit_tessellator_domain(struct svga_shader_emitter_v10 *emit, - enum pipe_prim_type prim_mode) + enum mesa_prim prim_mode) { VGPU10OpcodeToken0 opcode0; opcode0.value = 0; opcode0.opcodeType = VGPU10_OPCODE_DCL_TESS_DOMAIN; switch (prim_mode) { - case PIPE_PRIM_QUADS: - case PIPE_PRIM_LINES: + case MESA_PRIM_QUADS: + case MESA_PRIM_LINES: opcode0.tessDomain = VGPU10_TESSELLATOR_DOMAIN_QUAD; break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: opcode0.tessDomain = VGPU10_TESSELLATOR_DOMAIN_TRI; break; default: @@ -3161,7 +3161,7 @@ emit_domain_shader_declarations(struct svga_shader_emitter_v10 *emit) /* Specify a max for swizzles of the domain point according to the * tessellator domain type. */ - emit->tes.swizzle_max = emit->tes.prim_mode == PIPE_PRIM_TRIANGLES ? + emit->tes.swizzle_max = emit->tes.prim_mode == MESA_PRIM_TRIANGLES ? TGSI_SWIZZLE_Z : TGSI_SWIZZLE_Y; } @@ -3324,12 +3324,12 @@ emit_hull_shader_declarations(struct svga_shader_emitter_v10 *emit) if (emit->key.tcs.point_mode) { opcode0.tessOutputPrimitive = VGPU10_TESSELLATOR_OUTPUT_POINT; } - else if (emit->key.tcs.prim_mode == PIPE_PRIM_LINES) { + else if (emit->key.tcs.prim_mode == MESA_PRIM_LINES) { opcode0.tessOutputPrimitive = VGPU10_TESSELLATOR_OUTPUT_LINE; } else { - assert(emit->key.tcs.prim_mode == PIPE_PRIM_QUADS || - emit->key.tcs.prim_mode == PIPE_PRIM_TRIANGLES); + assert(emit->key.tcs.prim_mode == MESA_PRIM_QUADS || + emit->key.tcs.prim_mode == MESA_PRIM_TRIANGLES); if (emit->key.tcs.vertices_order_cw) opcode0.tessOutputPrimitive = VGPU10_TESSELLATOR_OUTPUT_TRIANGLE_CCW; @@ -4379,7 +4379,7 @@ emit_tesslevel_declaration(struct svga_shader_emitter_v10 *emit, assert(emit->version >= 50); assert(name >= VGPU10_NAME_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR || - (emit->key.tcs.prim_mode == PIPE_PRIM_LINES && + (emit->key.tcs.prim_mode == MESA_PRIM_LINES && name == VGPU10_NAME_UNDEFINED)); assert(name <= VGPU10_NAME_FINAL_LINE_DENSITY_TESSFACTOR); @@ -4442,7 +4442,7 @@ emit_tcs_output_declarations(struct svga_shader_emitter_v10 *emit) emit->tcs.inner.out_index = outputIndex; switch (emit->key.tcs.prim_mode) { - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: emit_tesslevel_declaration(emit, outputIndex++, VGPU10_OPCODE_DCL_OUTPUT_SIV, VGPU10_OPERAND_TYPE_OUTPUT, VGPU10_NAME_FINAL_QUAD_U_INSIDE_TESSFACTOR, @@ -4453,13 +4453,13 @@ emit_tcs_output_declarations(struct svga_shader_emitter_v10 *emit) VGPU10_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR, SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR); break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: emit_tesslevel_declaration(emit, outputIndex++, VGPU10_OPCODE_DCL_OUTPUT_SIV, VGPU10_OPERAND_TYPE_OUTPUT, VGPU10_NAME_FINAL_TRI_INSIDE_TESSFACTOR, SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_INSIDE_TESSFACTOR); break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: break; default: debug_printf("Unsupported primitive type"); @@ -4475,7 +4475,7 @@ emit_tcs_output_declarations(struct svga_shader_emitter_v10 *emit) emit->tcs.outer.out_index = outputIndex; switch (emit->key.tcs.prim_mode) { - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: for (int j = 0; j < 4; j++) { emit_tesslevel_declaration(emit, outputIndex++, VGPU10_OPCODE_DCL_OUTPUT_SIV, VGPU10_OPERAND_TYPE_OUTPUT, @@ -4483,7 +4483,7 @@ emit_tcs_output_declarations(struct svga_shader_emitter_v10 *emit) SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR + j); } break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: for (int j = 0; j < 3; j++) { emit_tesslevel_declaration(emit, outputIndex++, VGPU10_OPCODE_DCL_OUTPUT_SIV, VGPU10_OPERAND_TYPE_OUTPUT, @@ -4491,7 +4491,7 @@ emit_tcs_output_declarations(struct svga_shader_emitter_v10 *emit) SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR + j); } break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: for (int j = 0; j < 2; j++) { emit_tesslevel_declaration(emit, outputIndex++, VGPU10_OPCODE_DCL_OUTPUT_SIV, VGPU10_OPERAND_TYPE_OUTPUT, @@ -4552,10 +4552,10 @@ emit_tcs_output_declarations(struct svga_shader_emitter_v10 *emit) if (emit->tcs.control_point_out_index == INVALID_INDEX) { /* use register index after tessellation factors */ switch (emit->key.tcs.prim_mode) { - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: emit->tcs.control_point_out_index = outputIndex + 6; break; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: emit->tcs.control_point_out_index = outputIndex + 4; break; default: @@ -4583,7 +4583,7 @@ emit_tcs_output_declarations(struct svga_shader_emitter_v10 *emit) * we declare it here for patch constant phase only. */ emit->tcs.outer.out_index = outputIndex; - if (emit->key.tcs.prim_mode == PIPE_PRIM_QUADS) { + if (emit->key.tcs.prim_mode == MESA_PRIM_QUADS) { for (int i = 0; i < 4; i++) { emit_tesslevel_declaration(emit, outputIndex++, VGPU10_OPCODE_DCL_OUTPUT_SIV, VGPU10_OPERAND_TYPE_OUTPUT, @@ -4591,7 +4591,7 @@ emit_tcs_output_declarations(struct svga_shader_emitter_v10 *emit) SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR + i); } } - else if (emit->key.tcs.prim_mode == PIPE_PRIM_TRIANGLES) { + else if (emit->key.tcs.prim_mode == MESA_PRIM_TRIANGLES) { for (int i = 0; i < 3; i++) { emit_tesslevel_declaration(emit, outputIndex++, VGPU10_OPCODE_DCL_OUTPUT_SIV, VGPU10_OPERAND_TYPE_OUTPUT, @@ -4606,7 +4606,7 @@ emit_tcs_output_declarations(struct svga_shader_emitter_v10 *emit) * we declare it here */ emit->tcs.inner.out_index = outputIndex; - if (emit->key.tcs.prim_mode == PIPE_PRIM_QUADS) { + if (emit->key.tcs.prim_mode == MESA_PRIM_QUADS) { emit_tesslevel_declaration(emit, outputIndex++, VGPU10_OPCODE_DCL_OUTPUT_SIV, VGPU10_OPERAND_TYPE_OUTPUT, VGPU10_NAME_FINAL_QUAD_U_INSIDE_TESSFACTOR, @@ -4616,7 +4616,7 @@ emit_tcs_output_declarations(struct svga_shader_emitter_v10 *emit) VGPU10_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR, SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR); } - else if (emit->key.tcs.prim_mode == PIPE_PRIM_TRIANGLES) { + else if (emit->key.tcs.prim_mode == MESA_PRIM_TRIANGLES) { emit_tesslevel_declaration(emit, outputIndex++, VGPU10_OPCODE_DCL_OUTPUT_SIV, VGPU10_OPERAND_TYPE_OUTPUT, VGPU10_NAME_FINAL_TRI_INSIDE_TESSFACTOR, @@ -4757,11 +4757,11 @@ emit_system_value_declaration(struct svga_shader_emitter_v10 *emit, unsigned usageMask = 0; - if (emit->tes.prim_mode == PIPE_PRIM_TRIANGLES) { + if (emit->tes.prim_mode == MESA_PRIM_TRIANGLES) { usageMask = VGPU10_OPERAND_4_COMPONENT_MASK_XYZ; } - else if (emit->tes.prim_mode == PIPE_PRIM_LINES || - emit->tes.prim_mode == PIPE_PRIM_QUADS) { + else if (emit->tes.prim_mode == MESA_PRIM_LINES || + emit->tes.prim_mode == MESA_PRIM_QUADS) { usageMask = VGPU10_OPERAND_4_COMPONENT_MASK_XY; } @@ -5273,7 +5273,7 @@ emit_tessfactor_input_declarations(struct svga_shader_emitter_v10 *emit) */ unsigned inputIndex = emit->key.tes.tessfactor_index; - if (emit->tes.prim_mode == PIPE_PRIM_QUADS) { + if (emit->tes.prim_mode == MESA_PRIM_QUADS) { if (emit->key.tes.need_tessouter) { emit->tes.outer.in_index = inputIndex; for (int i = 0; i < 4; i++) { @@ -5300,7 +5300,7 @@ emit_tessfactor_input_declarations(struct svga_shader_emitter_v10 *emit) SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR); } } - else if (emit->tes.prim_mode == PIPE_PRIM_TRIANGLES) { + else if (emit->tes.prim_mode == MESA_PRIM_TRIANGLES) { if (emit->key.tes.need_tessouter) { emit->tes.outer.in_index = inputIndex; for (int i = 0; i < 3; i++) { @@ -5321,7 +5321,7 @@ emit_tessfactor_input_declarations(struct svga_shader_emitter_v10 *emit) SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_INSIDE_TESSFACTOR); } } - else if (emit->tes.prim_mode == PIPE_PRIM_LINES) { + else if (emit->tes.prim_mode == MESA_PRIM_LINES) { if (emit->key.tes.need_tessouter) { emit->tes.outer.in_index = inputIndex; emit_tesslevel_declaration(emit, inputIndex++, @@ -6560,7 +6560,7 @@ store_tesslevels(struct svga_shader_emitter_v10 *emit) * emitting the inner/outer tessellation levels, either from * values provided in tcs or fallback default values which is 1.0 */ - if (emit->key.tcs.prim_mode == PIPE_PRIM_QUADS) { + if (emit->key.tcs.prim_mode == MESA_PRIM_QUADS) { struct tgsi_full_src_register temp_src; if (emit->tcs.inner.tgsi_index != INVALID_INDEX) @@ -6591,7 +6591,7 @@ store_tesslevels(struct svga_shader_emitter_v10 *emit) emit_instruction_op1(emit, VGPU10_OPCODE_MOV, &dst, &src); } } - else if (emit->key.tcs.prim_mode == PIPE_PRIM_TRIANGLES) { + else if (emit->key.tcs.prim_mode == MESA_PRIM_TRIANGLES) { struct tgsi_full_src_register temp_src; if (emit->tcs.inner.tgsi_index != INVALID_INDEX) @@ -6620,7 +6620,7 @@ store_tesslevels(struct svga_shader_emitter_v10 *emit) emit_instruction_op1(emit, VGPU10_OPCODE_MOV, &dst, &src); } } - else if (emit->key.tcs.prim_mode == PIPE_PRIM_LINES) { + else if (emit->key.tcs.prim_mode == MESA_PRIM_LINES) { if (emit->tcs.outer.tgsi_index != INVALID_INDEX) { struct tgsi_full_src_register temp_src = make_src_temp_reg(emit->tcs.outer.temp_index); @@ -11973,19 +11973,19 @@ emit_temp_tessfactor_instructions(struct svga_shader_emitter_v10 *emit) dst = make_dst_temp_reg(emit->tes.inner.temp_index); switch (emit->tes.prim_mode) { - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: src = make_src_scalar_reg(TGSI_FILE_INPUT, emit->tes.inner.in_index + 1, TGSI_SWIZZLE_X); dst = writemask_dst(&dst, TGSI_WRITEMASK_Y); emit_instruction_op1(emit, VGPU10_OPCODE_MOV, &dst, &src); FALLTHROUGH; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: src = make_src_scalar_reg(TGSI_FILE_INPUT, emit->tes.inner.in_index, TGSI_SWIZZLE_X); dst = writemask_dst(&dst, TGSI_WRITEMASK_X); emit_instruction_op1(emit, VGPU10_OPCODE_MOV, &dst, &src); break; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: /** * As per SM5 spec, InsideTessFactor for isolines are unused. * In fact glsl tessInnerLevel for isolines doesn't mean anything but if @@ -12005,19 +12005,19 @@ emit_temp_tessfactor_instructions(struct svga_shader_emitter_v10 *emit) dst = make_dst_temp_reg(emit->tes.outer.temp_index); switch (emit->tes.prim_mode) { - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: src = make_src_scalar_reg(TGSI_FILE_INPUT, emit->tes.outer.in_index + 3, TGSI_SWIZZLE_X); dst = writemask_dst(&dst, TGSI_WRITEMASK_W); emit_instruction_op1(emit, VGPU10_OPCODE_MOV, &dst, &src); FALLTHROUGH; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: src = make_src_scalar_reg(TGSI_FILE_INPUT, emit->tes.outer.in_index + 2, TGSI_SWIZZLE_X); dst = writemask_dst(&dst, TGSI_WRITEMASK_Z); emit_instruction_op1(emit, VGPU10_OPCODE_MOV, &dst, &src); FALLTHROUGH; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: src = make_src_scalar_reg(TGSI_FILE_INPUT, emit->tes.outer.in_index + 1, TGSI_SWIZZLE_X); dst = writemask_dst(&dst, TGSI_WRITEMASK_Y); diff --git a/src/gallium/drivers/v3d/v3d_context.c b/src/gallium/drivers/v3d/v3d_context.c index 5e7e5012fbc..f12e8c92139 100644 --- a/src/gallium/drivers/v3d/v3d_context.c +++ b/src/gallium/drivers/v3d/v3d_context.c @@ -128,7 +128,7 @@ v3d_update_primitive_counters(struct v3d_context *v3d) if (prims_before == prims_after) return; - enum pipe_prim_type prim_type = u_base_prim_type(v3d->prim_mode); + enum mesa_prim prim_type = u_base_prim_type(v3d->prim_mode); uint32_t num_verts = u_vertices_for_prims(prim_type, prims_after - prims_before); for (int i = 0; i < v3d->streamout.num_targets; i++) { diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c index 1896c030f7d..f7712ec08fc 100644 --- a/src/gallium/drivers/v3d/v3d_program.c +++ b/src/gallium/drivers/v3d/v3d_program.c @@ -570,9 +570,9 @@ v3d_update_compiled_fs(struct v3d_context *v3d, uint8_t prim_mode) v3d_setup_shared_key(v3d, &key->base, &v3d->tex[PIPE_SHADER_FRAGMENT]); key->base.shader_state = v3d->prog.bind_fs; key->base.ucp_enables = v3d->rasterizer->base.clip_plane_enable; - key->is_points = (prim_mode == PIPE_PRIM_POINTS); - key->is_lines = (prim_mode >= PIPE_PRIM_LINES && - prim_mode <= PIPE_PRIM_LINE_STRIP); + key->is_points = (prim_mode == MESA_PRIM_POINTS); + key->is_lines = (prim_mode >= MESA_PRIM_LINES && + prim_mode <= MESA_PRIM_LINE_STRIP); key->line_smoothing = (key->is_lines && v3d_line_smoothing_enabled(v3d)); key->has_gs = v3d->prog.bind_gs != NULL; @@ -698,7 +698,7 @@ v3d_update_compiled_gs(struct v3d_context *v3d, uint8_t prim_mode) sizeof(key->used_outputs)); key->per_vertex_point_size = - (prim_mode == PIPE_PRIM_POINTS && + (prim_mode == MESA_PRIM_POINTS && v3d->rasterizer->base.point_size_per_vertex); struct v3d_compiled_shader *gs = @@ -777,7 +777,7 @@ v3d_update_compiled_vs(struct v3d_context *v3d, uint8_t prim_mode) } key->per_vertex_point_size = - (prim_mode == PIPE_PRIM_POINTS && + (prim_mode == MESA_PRIM_POINTS && v3d->rasterizer->base.point_size_per_vertex); nir_shader *s = v3d->prog.bind_vs->base.ir.nir; diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index 239442673be..ad15c7982d0 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -967,17 +967,17 @@ v3d_screen_create(int fd, const struct pipe_screen_config *config, } /* Generate the bitmask of supported draw primitives. */ - screen->prim_types = BITFIELD_BIT(PIPE_PRIM_POINTS) | - BITFIELD_BIT(PIPE_PRIM_LINES) | - BITFIELD_BIT(PIPE_PRIM_LINE_LOOP) | - BITFIELD_BIT(PIPE_PRIM_LINE_STRIP) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLES) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLE_STRIP) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLE_FAN) | - BITFIELD_BIT(PIPE_PRIM_LINES_ADJACENCY) | - BITFIELD_BIT(PIPE_PRIM_LINE_STRIP_ADJACENCY) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLES_ADJACENCY) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY); + screen->prim_types = BITFIELD_BIT(MESA_PRIM_POINTS) | + BITFIELD_BIT(MESA_PRIM_LINES) | + BITFIELD_BIT(MESA_PRIM_LINE_LOOP) | + BITFIELD_BIT(MESA_PRIM_LINE_STRIP) | + BITFIELD_BIT(MESA_PRIM_TRIANGLES) | + BITFIELD_BIT(MESA_PRIM_TRIANGLE_STRIP) | + BITFIELD_BIT(MESA_PRIM_TRIANGLE_FAN) | + BITFIELD_BIT(MESA_PRIM_LINES_ADJACENCY) | + BITFIELD_BIT(MESA_PRIM_LINE_STRIP_ADJACENCY) | + BITFIELD_BIT(MESA_PRIM_TRIANGLES_ADJACENCY) | + BITFIELD_BIT(MESA_PRIM_TRIANGLE_STRIP_ADJACENCY); return pscreen; diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c index a180dffed94..93e99eb383e 100644 --- a/src/gallium/drivers/v3d/v3dx_draw.c +++ b/src/gallium/drivers/v3d/v3dx_draw.c @@ -394,14 +394,14 @@ v3d_emit_gs_state_record(struct v3d_job *job, } static uint8_t -v3d_gs_output_primitive(enum shader_prim prim_type) +v3d_gs_output_primitive(enum mesa_prim prim_type) { switch (prim_type) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return GEOMETRY_SHADER_POINTS; - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return GEOMETRY_SHADER_LINE_STRIP; - case SHADER_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return GEOMETRY_SHADER_TRI_STRIP; default: unreachable("Unsupported primitive type"); @@ -600,7 +600,7 @@ v3d_emit_gl_shader_state(struct v3d_context *v3d, shader.enable_clipping = true; /* V3D_DIRTY_PRIM_MODE | V3D_DIRTY_RASTERIZER */ shader.point_size_in_shaded_vertex_data = - (info->mode == PIPE_PRIM_POINTS && + (info->mode == MESA_PRIM_POINTS && v3d->rasterizer->base.point_size_per_vertex); /* Must be set if the shader modifies Z, discards, or modifies diff --git a/src/gallium/drivers/v3d/v3dx_emit.c b/src/gallium/drivers/v3d/v3dx_emit.c index e25b2609a43..becd196b108 100644 --- a/src/gallium/drivers/v3d/v3dx_emit.c +++ b/src/gallium/drivers/v3d/v3dx_emit.c @@ -736,7 +736,7 @@ v3dX(emit_state)(struct pipe_context *pctx) V3D_DIRTY_PRIM_MODE)) { struct v3d_streamout_stateobj *so = &v3d->streamout; if (so->num_targets) { - bool psiz_per_vertex = (v3d->prim_mode == PIPE_PRIM_POINTS && + bool psiz_per_vertex = (v3d->prim_mode == MESA_PRIM_POINTS && v3d->rasterizer->base.point_size_per_vertex); struct v3d_uncompiled_shader *tf_shader = get_tf_shader(v3d); diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c index 08c0c71cc31..437b327144c 100644 --- a/src/gallium/drivers/vc4/vc4_draw.c +++ b/src/gallium/drivers/vc4/vc4_draw.c @@ -158,7 +158,7 @@ vc4_emit_gl_shader_state(struct vc4_context *vc4, /* VC4_DIRTY_PRIM_MODE | VC4_DIRTY_RASTERIZER */ rec.point_size_included_in_shaded_vertex_data = - (info->mode == PIPE_PRIM_POINTS && + (info->mode == MESA_PRIM_POINTS && vc4->rasterizer->base.point_size_per_vertex); /* VC4_DIRTY_COMPILED_FS */ @@ -294,11 +294,11 @@ vc4_draw_workaround_line_loop_2(struct pipe_context *pctx, const struct pipe_dra const struct pipe_draw_indirect_info *indirect, const struct pipe_draw_start_count_bias *draw) { - if (draw->count != 2 || info->mode != PIPE_PRIM_LINE_LOOP) + if (draw->count != 2 || info->mode != MESA_PRIM_LINE_LOOP) return false; struct pipe_draw_info local_info = *info; - local_info.mode = PIPE_PRIM_LINES; + local_info.mode = MESA_PRIM_LINES; /* Draw twice. The vertex order will be wrong on the second prim, but * that's probably not worth rewriting an index buffer over. diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 1a2b0441b66..c3df853c9c6 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2780,9 +2780,9 @@ vc4_update_compiled_fs(struct vc4_context *vc4, uint8_t prim_mode) memset(key, 0, sizeof(*key)); vc4_setup_shared_key(vc4, &key->base, &vc4->fragtex); key->base.shader_state = vc4->prog.bind_fs; - key->is_points = (prim_mode == PIPE_PRIM_POINTS); - key->is_lines = (prim_mode >= PIPE_PRIM_LINES && - prim_mode <= PIPE_PRIM_LINE_STRIP); + key->is_points = (prim_mode == MESA_PRIM_POINTS); + key->is_lines = (prim_mode >= MESA_PRIM_LINES && + prim_mode <= MESA_PRIM_LINE_STRIP); key->blend = vc4->blend->rt[0]; if (vc4->blend->logicop_enable) { key->logicop_func = vc4->blend->logicop_func; @@ -2855,7 +2855,7 @@ vc4_update_compiled_vs(struct vc4_context *vc4, uint8_t prim_mode) key->attr_formats[i] = vc4->vtx->pipe[i].src_format; key->per_vertex_point_size = - (prim_mode == PIPE_PRIM_POINTS && + (prim_mode == MESA_PRIM_POINTS && vc4->rasterizer->base.point_size_per_vertex); struct vc4_compiled_shader *vs = diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c index 4a0e34956fe..f279a4c6933 100644 --- a/src/gallium/drivers/vc4/vc4_screen.c +++ b/src/gallium/drivers/vc4/vc4_screen.c @@ -612,13 +612,13 @@ vc4_screen_create(int fd, const struct pipe_screen_config *config, } /* Generate the bitmask of supported draw primitives. */ - screen->prim_types = BITFIELD_BIT(PIPE_PRIM_POINTS) | - BITFIELD_BIT(PIPE_PRIM_LINES) | - BITFIELD_BIT(PIPE_PRIM_LINE_LOOP) | - BITFIELD_BIT(PIPE_PRIM_LINE_STRIP) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLES) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLE_STRIP) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLE_FAN); + screen->prim_types = BITFIELD_BIT(MESA_PRIM_POINTS) | + BITFIELD_BIT(MESA_PRIM_LINES) | + BITFIELD_BIT(MESA_PRIM_LINE_LOOP) | + BITFIELD_BIT(MESA_PRIM_LINE_STRIP) | + BITFIELD_BIT(MESA_PRIM_TRIANGLES) | + BITFIELD_BIT(MESA_PRIM_TRIANGLE_STRIP) | + BITFIELD_BIT(MESA_PRIM_TRIANGLE_FAN); return pscreen; diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index 585a95463cf..518bca5050c 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -786,7 +786,7 @@ int virgl_encoder_draw_vbo(struct virgl_context *ctx, const struct pipe_draw_start_count_bias *draw) { uint32_t length = VIRGL_DRAW_VBO_SIZE; - if (info->mode == PIPE_PRIM_PATCHES || drawid_offset > 0) + if (info->mode == MESA_PRIM_PATCHES || drawid_offset > 0) length = VIRGL_DRAW_VBO_SIZE_TESS; if (indirect && indirect->buffer) length = VIRGL_DRAW_VBO_SIZE_INDIRECT; diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index cc2b7eb054b..aa495edbc6f 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -132,9 +132,9 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS: return 16*4; case PIPE_CAP_SUPPORTED_PRIM_MODES: - return BITFIELD_MASK(PIPE_PRIM_MAX) & - ~BITFIELD_BIT(PIPE_PRIM_QUADS) & - ~BITFIELD_BIT(PIPE_PRIM_QUAD_STRIP); + return BITFIELD_MASK(MESA_PRIM_COUNT) & + ~BITFIELD_BIT(MESA_PRIM_QUADS) & + ~BITFIELD_BIT(MESA_PRIM_QUAD_STRIP); case PIPE_CAP_PRIMITIVE_RESTART: case PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX: return vscreen->caps.caps.v1.bset.primitive_restart; diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index 14f771da207..b3d05b95128 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -4529,31 +4529,31 @@ emit_cf_list(struct ntv_context *ctx, struct exec_list *list) } static SpvExecutionMode -get_input_prim_type_mode(enum shader_prim type) +get_input_prim_type_mode(enum mesa_prim type) { switch (type) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return SpvExecutionModeInputPoints; - case SHADER_PRIM_LINES: - case SHADER_PRIM_LINE_LOOP: - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_STRIP: return SpvExecutionModeInputLines; - case SHADER_PRIM_TRIANGLE_STRIP: - case SHADER_PRIM_TRIANGLES: - case SHADER_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_FAN: return SpvExecutionModeTriangles; - case SHADER_PRIM_QUADS: - case SHADER_PRIM_QUAD_STRIP: + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: return SpvExecutionModeQuads; break; - case SHADER_PRIM_POLYGON: + case MESA_PRIM_POLYGON: unreachable("handle polygons in gs"); break; - case SHADER_PRIM_LINES_ADJACENCY: - case SHADER_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: return SpvExecutionModeInputLinesAdjacency; - case SHADER_PRIM_TRIANGLES_ADJACENCY: - case SHADER_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: return SpvExecutionModeInputTrianglesAdjacency; break; default: @@ -4565,34 +4565,34 @@ get_input_prim_type_mode(enum shader_prim type) return 0; } static SpvExecutionMode -get_output_prim_type_mode(enum shader_prim type) +get_output_prim_type_mode(enum mesa_prim type) { switch (type) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return SpvExecutionModeOutputPoints; - case SHADER_PRIM_LINES: - case SHADER_PRIM_LINE_LOOP: - unreachable("SHADER_PRIM_LINES/LINE_LOOP passed as gs output"); + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + unreachable("MESA_PRIM_LINES/LINE_LOOP passed as gs output"); break; - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return SpvExecutionModeOutputLineStrip; - case SHADER_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return SpvExecutionModeOutputTriangleStrip; - case SHADER_PRIM_TRIANGLES: - case SHADER_PRIM_TRIANGLE_FAN: //FIXME: not sure if right for output + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_FAN: //FIXME: not sure if right for output return SpvExecutionModeTriangles; - case SHADER_PRIM_QUADS: - case SHADER_PRIM_QUAD_STRIP: + case MESA_PRIM_QUADS: + case MESA_PRIM_QUAD_STRIP: return SpvExecutionModeQuads; - case SHADER_PRIM_POLYGON: + case MESA_PRIM_POLYGON: unreachable("handle polygons in gs"); break; - case SHADER_PRIM_LINES_ADJACENCY: - case SHADER_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: unreachable("handle line adjacency in gs"); break; - case SHADER_PRIM_TRIANGLES_ADJACENCY: - case SHADER_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: unreachable("handle triangle adjacency in gs"); break; default: diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 7a7c480d803..a4384a1bbc8 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -382,7 +382,7 @@ lower_gl_point_gs(nir_shader *shader) struct lower_gl_point_state state; nir_builder b; - shader->info.gs.output_primitive = SHADER_PRIM_TRIANGLE_STRIP; + shader->info.gs.output_primitive = MESA_PRIM_TRIANGLE_STRIP; shader->info.gs.vertices_out *= 4; // Gets the gl_Position in and out @@ -618,14 +618,14 @@ lower_pv_mode_gs_instr(nir_builder *b, nir_instr *instr, void *data) } static unsigned int -lower_pv_mode_vertices_for_prim(enum shader_prim prim) +lower_pv_mode_vertices_for_prim(enum mesa_prim prim) { switch (prim) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return 1; - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return 2; - case SHADER_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return 3; default: unreachable("unsupported primitive for gs output"); @@ -1127,7 +1127,7 @@ lower_line_smooth_gs(nir_shader *shader) nir_store_var(&b, state.pos_counter, nir_imm_int(&b, 0), 1); shader->info.gs.vertices_out = 8 * shader->info.gs.vertices_out; - shader->info.gs.output_primitive = SHADER_PRIM_TRIANGLE_STRIP; + shader->info.gs.output_primitive = MESA_PRIM_TRIANGLE_STRIP; return nir_shader_instructions_pass(shader, lower_line_smooth_gs_instr, nir_metadata_dominance, &state); @@ -1225,8 +1225,8 @@ zink_create_quads_emulation_gs(const nir_shader_compiler_options *options, "filled quad gs"); nir_shader *nir = b.shader; - nir->info.gs.input_primitive = SHADER_PRIM_LINES_ADJACENCY; - nir->info.gs.output_primitive = SHADER_PRIM_TRIANGLE_STRIP; + nir->info.gs.input_primitive = MESA_PRIM_LINES_ADJACENCY; + nir->info.gs.output_primitive = MESA_PRIM_TRIANGLE_STRIP; nir->info.gs.vertices_in = 4; nir->info.gs.vertices_out = 6; nir->info.gs.invocations = 1; diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 5cd93fba037..5a011a3450e 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -4804,7 +4804,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) ctx->compute_pipeline_state.dirty = true; ctx->fb_changed = ctx->rp_changed = true; ctx->sample_mask_changed = true; - ctx->gfx_pipeline_state.gfx_prim_mode = PIPE_PRIM_MAX; + ctx->gfx_pipeline_state.gfx_prim_mode = MESA_PRIM_COUNT; zink_init_draw_functions(ctx, screen); zink_init_grid_functions(ctx); diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index 7be952a5a6b..71721b32599 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -267,7 +267,7 @@ draw(struct zink_context *ctx, template static bool -update_gfx_pipeline(struct zink_context *ctx, struct zink_batch_state *bs, enum pipe_prim_type mode) +update_gfx_pipeline(struct zink_context *ctx, struct zink_batch_state *bs, enum mesa_prim mode) { VkPipeline prev_pipeline = ctx->gfx_pipeline_state.pipeline; const struct zink_screen *screen = zink_screen(ctx->base.screen); @@ -307,30 +307,30 @@ update_gfx_pipeline(struct zink_context *ctx, struct zink_batch_state *bs, enum return pipeline_changed; } -static enum pipe_prim_type +static enum mesa_prim zink_prim_type(const struct zink_context *ctx, const struct pipe_draw_info *dinfo) { - if (ctx->gfx_pipeline_state.shader_rast_prim != PIPE_PRIM_MAX) + if (ctx->gfx_pipeline_state.shader_rast_prim != MESA_PRIM_COUNT) return ctx->gfx_pipeline_state.shader_rast_prim; - return u_reduced_prim((enum pipe_prim_type)dinfo->mode); + return u_reduced_prim((enum mesa_prim)dinfo->mode); } -static enum pipe_prim_type +static enum mesa_prim zink_rast_prim(const struct zink_context *ctx, const struct pipe_draw_info *dinfo) { - enum pipe_prim_type prim_type = zink_prim_type(ctx, dinfo); - assert(prim_type != PIPE_PRIM_MAX); + enum mesa_prim prim_type = zink_prim_type(ctx, dinfo); + assert(prim_type != MESA_PRIM_COUNT); - if (prim_type == PIPE_PRIM_TRIANGLES && + if (prim_type == MESA_PRIM_TRIANGLES && ctx->rast_state->base.fill_front != PIPE_POLYGON_MODE_FILL) { switch(ctx->rast_state->base.fill_front) { case PIPE_POLYGON_MODE_POINT: - return PIPE_PRIM_POINTS; + return MESA_PRIM_POINTS; case PIPE_POLYGON_MODE_LINE: - return PIPE_PRIM_LINES; + return MESA_PRIM_LINES; default: unreachable("unexpected polygon mode"); } @@ -368,7 +368,7 @@ zink_draw(struct pipe_context *pctx, bool reads_drawid = ctx->shader_reads_drawid; bool reads_basevertex = ctx->shader_reads_basevertex; unsigned work_count = ctx->batch.work_count; - enum pipe_prim_type mode = (enum pipe_prim_type)dinfo->mode; + enum mesa_prim mode = (enum mesa_prim)dinfo->mode; if (ctx->memory_barrier && !ctx->blitting) zink_flush_memory_barrier(ctx, false); @@ -482,16 +482,16 @@ zink_draw(struct pipe_context *pctx, bool rast_state_changed = ctx->rast_state_changed; if (mode_changed || ctx->gfx_pipeline_state.modules_changed || rast_state_changed) { - enum pipe_prim_type rast_prim = zink_rast_prim(ctx, dinfo); + enum mesa_prim rast_prim = zink_rast_prim(ctx, dinfo); if (rast_prim != ctx->gfx_pipeline_state.rast_prim) { bool points_changed = - (ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_POINTS) != - (rast_prim == PIPE_PRIM_POINTS); + (ctx->gfx_pipeline_state.rast_prim == MESA_PRIM_POINTS) != + (rast_prim == MESA_PRIM_POINTS); prim_changed = ctx->gfx_pipeline_state.rast_prim != rast_prim; static bool rect_warned = false; - if (DYNAMIC_STATE >= ZINK_DYNAMIC_STATE3 && rast_prim == PIPE_PRIM_LINES && !rect_warned && + if (DYNAMIC_STATE >= ZINK_DYNAMIC_STATE3 && rast_prim == MESA_PRIM_LINES && !rect_warned && (VkLineRasterizationModeEXT)rast_state->hw_state.line_mode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT) { if (screen->info.line_rast_feats.rectangularLines) rect_warned = true; @@ -676,7 +676,7 @@ zink_draw(struct pipe_context *pctx, if (BATCH_CHANGED || /* only re-emit on non-batch change when actually drawing lines */ - ((ctx->line_width_changed || rast_prim_changed) && ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_LINES)) { + ((ctx->line_width_changed || rast_prim_changed) && ctx->gfx_pipeline_state.rast_prim == MESA_PRIM_LINES)) { VKCTX(CmdSetLineWidth)(batch->state->cmdbuf, rast_state->line_width); ctx->line_width_changed = false; } @@ -685,7 +685,7 @@ zink_draw(struct pipe_context *pctx, ctx->gfx_pipeline_state.modules_changed || rast_state_changed) { bool depth_bias = - zink_prim_type(ctx, dinfo) == PIPE_PRIM_TRIANGLES && + zink_prim_type(ctx, dinfo) == MESA_PRIM_TRIANGLES && rast_state->offset_fill; if (depth_bias) { diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c index 05c9ce59677..12c52853f03 100644 --- a/src/gallium/drivers/zink/zink_pipeline.c +++ b/src/gallium/drivers/zink/zink_pipeline.c @@ -272,7 +272,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen, if (screen->info.have_EXT_color_write_enable) dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT; - assert(state->rast_prim != PIPE_PRIM_MAX); + assert(state->rast_prim != MESA_PRIM_COUNT); VkPipelineRasterizationLineStateCreateInfoEXT rast_line_state; if (screen->info.have_EXT_line_rasterization && @@ -282,7 +282,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen, rast_line_state.stippledLineEnable = VK_FALSE; rast_line_state.lineRasterizationMode = VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT; - if (state->rast_prim == PIPE_PRIM_LINES) { + if (state->rast_prim == MESA_PRIM_LINES) { const char *features[4][2] = { [VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT] = {"",""}, [VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT] = {"rectangularLines", "stippledRectangularLines"}, diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index c74058d0a59..2c37dc62c90 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -1665,33 +1665,33 @@ bind_gfx_stage(struct zink_context *ctx, gl_shader_stage stage, struct zink_shad } } -static enum pipe_prim_type +static enum mesa_prim gs_output_to_reduced_prim_type(struct shader_info *info) { switch (info->gs.output_primitive) { - case SHADER_PRIM_POINTS: - return PIPE_PRIM_POINTS; + case MESA_PRIM_POINTS: + return MESA_PRIM_POINTS; - case SHADER_PRIM_LINES: - case SHADER_PRIM_LINE_LOOP: - case SHADER_PRIM_LINE_STRIP: - case SHADER_PRIM_LINES_ADJACENCY: - case SHADER_PRIM_LINE_STRIP_ADJACENCY: - return PIPE_PRIM_LINES; + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + return MESA_PRIM_LINES; - case SHADER_PRIM_TRIANGLES: - case SHADER_PRIM_TRIANGLE_STRIP: - case SHADER_PRIM_TRIANGLE_FAN: - case SHADER_PRIM_TRIANGLES_ADJACENCY: - case SHADER_PRIM_TRIANGLE_STRIP_ADJACENCY: - return PIPE_PRIM_TRIANGLES; + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: + return MESA_PRIM_TRIANGLES; default: unreachable("unexpected output primitive type"); } } -static enum pipe_prim_type +static enum mesa_prim update_rast_prim(struct zink_shader *shader) { struct shader_info *info = &shader->info; @@ -1699,20 +1699,20 @@ update_rast_prim(struct zink_shader *shader) return gs_output_to_reduced_prim_type(info); else if (info->stage == MESA_SHADER_TESS_EVAL) { if (info->tess.point_mode) - return PIPE_PRIM_POINTS; + return MESA_PRIM_POINTS; else { switch (info->tess._primitive_mode) { case TESS_PRIMITIVE_ISOLINES: - return PIPE_PRIM_LINES; + return MESA_PRIM_LINES; case TESS_PRIMITIVE_TRIANGLES: case TESS_PRIMITIVE_QUADS: - return PIPE_PRIM_TRIANGLES; + return MESA_PRIM_TRIANGLES; default: - return PIPE_PRIM_MAX; + return MESA_PRIM_COUNT; } } } - return PIPE_PRIM_MAX; + return MESA_PRIM_COUNT; } static void @@ -1746,7 +1746,7 @@ bind_last_vertex_stage(struct zink_context *ctx, gl_shader_stage stage, struct z /* update rast_prim */ ctx->gfx_pipeline_state.shader_rast_prim = ctx->last_vertex_stage ? update_rast_prim(ctx->last_vertex_stage) : - PIPE_PRIM_MAX; + MESA_PRIM_COUNT; if (old != current) { if (!zink_screen(ctx->base.screen)->optimal_keys) { @@ -2283,58 +2283,58 @@ static bool has_edge_flags(struct zink_context *ctx) { switch(ctx->gfx_pipeline_state.gfx_prim_mode) { - case PIPE_PRIM_POINTS: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_LOOP: - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: - case PIPE_PRIM_QUAD_STRIP: - case PIPE_PRIM_PATCHES: + case MESA_PRIM_POINTS: + case MESA_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINES: + case MESA_PRIM_LINE_LOOP: + case MESA_PRIM_LINES_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_QUAD_STRIP: + case MESA_PRIM_PATCHES: return false; - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_TRIANGLES_ADJACENCY: - case PIPE_PRIM_QUADS: - case PIPE_PRIM_POLYGON: - case PIPE_PRIM_MAX: + case MESA_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_QUADS: + case MESA_PRIM_POLYGON: + case MESA_PRIM_COUNT: default: break; } - return ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_LINES && + return ctx->gfx_pipeline_state.rast_prim == MESA_PRIM_LINES && ctx->gfx_stages[MESA_SHADER_VERTEX]->has_edgeflags; } static enum zink_rast_prim -zink_rast_prim_for_pipe(enum pipe_prim_type prim) +zink_rast_prim_for_pipe(enum mesa_prim prim) { switch (prim) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: return ZINK_PRIM_POINTS; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: return ZINK_PRIM_LINES; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: default: return ZINK_PRIM_TRIANGLES; } } -static enum pipe_prim_type +static enum mesa_prim zink_tess_prim_type(struct zink_shader *tess) { if (tess->info.tess.point_mode) - return PIPE_PRIM_POINTS; + return MESA_PRIM_POINTS; else { switch (tess->info.tess._primitive_mode) { case TESS_PRIMITIVE_ISOLINES: - return PIPE_PRIM_LINES; + return MESA_PRIM_LINES; case TESS_PRIMITIVE_TRIANGLES: case TESS_PRIMITIVE_QUADS: - return PIPE_PRIM_TRIANGLES; + return MESA_PRIM_TRIANGLES; default: - return PIPE_PRIM_MAX; + return MESA_PRIM_COUNT; } } } @@ -2347,13 +2347,13 @@ zink_add_inline_uniform(nir_shader *shader, int offset) } static unsigned -encode_lower_pv_mode(enum pipe_prim_type prim_type) +encode_lower_pv_mode(enum mesa_prim prim_type) { switch (prim_type) { - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_QUAD_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_QUAD_STRIP: return ZINK_PVE_PRIMITIVE_TRISTRIP; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: return ZINK_PVE_PRIMITIVE_FAN; default: return ZINK_PVE_PRIMITIVE_SIMPLE; @@ -2367,12 +2367,12 @@ zink_set_primitive_emulation_keys(struct zink_context *ctx) bool lower_line_stipple = false, lower_line_smooth = false; unsigned lower_pv_mode = 0; if (!screen->optimal_keys) { - lower_line_stipple = ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_LINES && + lower_line_stipple = ctx->gfx_pipeline_state.rast_prim == MESA_PRIM_LINES && screen->driver_workarounds.no_linestipple && ctx->rast_state->base.line_stipple_enable && !ctx->num_so_targets; - bool lower_point_smooth = ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_POINTS && + bool lower_point_smooth = ctx->gfx_pipeline_state.rast_prim == MESA_PRIM_POINTS && screen->driconf.emulate_point_smooth && ctx->rast_state->base.point_smooth; if (zink_get_fs_key(ctx)->lower_line_stipple != lower_line_stipple) { @@ -2382,7 +2382,7 @@ zink_set_primitive_emulation_keys(struct zink_context *ctx) zink_set_gs_key(ctx)->lower_line_stipple = lower_line_stipple; } - lower_line_smooth = ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_LINES && + lower_line_smooth = ctx->gfx_pipeline_state.rast_prim == MESA_PRIM_LINES && screen->driver_workarounds.no_linesmooth && ctx->rast_state->base.line_smooth && !ctx->num_so_targets; @@ -2409,10 +2409,10 @@ zink_set_primitive_emulation_keys(struct zink_context *ctx) bool lower_edge_flags = has_edge_flags(ctx); - bool lower_quad_prim = ctx->gfx_pipeline_state.gfx_prim_mode == PIPE_PRIM_QUADS; + bool lower_quad_prim = ctx->gfx_pipeline_state.gfx_prim_mode == MESA_PRIM_QUADS; bool lower_filled_quad = lower_quad_prim && - ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_TRIANGLES; + ctx->gfx_pipeline_state.rast_prim == MESA_PRIM_TRIANGLES; if (lower_line_stipple || lower_line_smooth || lower_edge_flags || lower_quad_prim || @@ -2437,7 +2437,7 @@ zink_set_primitive_emulation_keys(struct zink_context *ctx) &screen->nir_options, prev_stage); } else { - enum pipe_prim_type prim = ctx->gfx_pipeline_state.gfx_prim_mode; + enum mesa_prim prim = ctx->gfx_pipeline_state.gfx_prim_mode; if (prev_vertex_stage == MESA_SHADER_TESS_EVAL) prim = zink_tess_prim_type(ctx->gfx_stages[MESA_SHADER_TESS_EVAL]); nir = nir_create_passthrough_gs( diff --git a/src/gallium/drivers/zink/zink_program.h b/src/gallium/drivers/zink/zink_program.h index bf78d194bca..b8142cce066 100644 --- a/src/gallium/drivers/zink/zink_program.h +++ b/src/gallium/drivers/zink/zink_program.h @@ -60,47 +60,47 @@ zink_desc_type_from_vktype(VkDescriptorType type) } static inline VkPrimitiveTopology -zink_primitive_topology(enum pipe_prim_type mode) +zink_primitive_topology(enum mesa_prim mode) { switch (mode) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: return VK_PRIMITIVE_TOPOLOGY_POINT_LIST; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: return VK_PRIMITIVE_TOPOLOGY_LINE_LIST; - case PIPE_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP; - case PIPE_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; - case PIPE_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; - case PIPE_PRIM_TRIANGLE_FAN: + case MESA_PRIM_TRIANGLE_FAN: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN; - case PIPE_PRIM_LINE_STRIP_ADJACENCY: + case MESA_PRIM_LINE_STRIP_ADJACENCY: return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY; - case PIPE_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: return VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY; - case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY; - case PIPE_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY; - case PIPE_PRIM_PATCHES: + case MESA_PRIM_PATCHES: return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST; - case PIPE_PRIM_QUADS: + case MESA_PRIM_QUADS: return VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY; default: - unreachable("unexpected enum pipe_prim_type"); + unreachable("unexpected enum mesa_prim"); } } @@ -135,14 +135,14 @@ void zink_gfx_program_compile_queue(struct zink_context *ctx, struct zink_gfx_pipeline_cache_entry *pc_entry); static inline unsigned -get_primtype_idx(enum pipe_prim_type mode) +get_primtype_idx(enum mesa_prim mode) { - if (mode == PIPE_PRIM_PATCHES) + if (mode == MESA_PRIM_PATCHES) return 3; switch (u_reduced_prim(mode)) { - case PIPE_PRIM_POINTS: + case MESA_PRIM_POINTS: return 0; - case PIPE_PRIM_LINES: + case MESA_PRIM_LINES: return 1; default: return 2; @@ -354,7 +354,7 @@ static inline void zink_set_fs_point_coord_key(struct zink_context *ctx) { const struct zink_fs_key_base *fs = zink_get_fs_base_key(ctx); - bool disable = ctx->gfx_pipeline_state.rast_prim != PIPE_PRIM_POINTS; + bool disable = ctx->gfx_pipeline_state.rast_prim != MESA_PRIM_POINTS; uint8_t coord_replace_bits = disable ? 0 : ctx->rast_state->base.sprite_coord_enable; bool point_coord_yinvert = disable ? false : !!ctx->rast_state->base.sprite_coord_mode; if (fs->coord_replace_bits != coord_replace_bits || fs->point_coord_yinvert != point_coord_yinvert) { diff --git a/src/gallium/drivers/zink/zink_program_state.hpp b/src/gallium/drivers/zink/zink_program_state.hpp index 77e5f11a406..18fd3fe3ca3 100644 --- a/src/gallium/drivers/zink/zink_program_state.hpp +++ b/src/gallium/drivers/zink/zink_program_state.hpp @@ -53,7 +53,7 @@ hash_gfx_pipeline_state(const void *key) template static unsigned -get_pipeline_idx(enum pipe_prim_type mode, VkPrimitiveTopology vkmode) +get_pipeline_idx(enum mesa_prim mode, VkPrimitiveTopology vkmode) { /* VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY specifies that the topology state in * VkPipelineInputAssemblyStateCreateInfo only specifies the topology class, @@ -98,7 +98,7 @@ VkPipeline zink_get_gfx_pipeline(struct zink_context *ctx, struct zink_gfx_program *prog, struct zink_gfx_pipeline_state *state, - enum pipe_prim_type mode) + enum mesa_prim mode) { struct zink_screen *screen = zink_screen(ctx->base.screen); bool uses_dynamic_stride = state->uses_dynamic_stride; diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 7d269398765..9d31cbd5342 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -513,30 +513,30 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_EMULATE_NONFIXED_PRIMITIVE_RESTART: return 1; case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART: { - uint32_t modes = BITFIELD_BIT(PIPE_PRIM_LINE_STRIP) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLE_STRIP) | - BITFIELD_BIT(PIPE_PRIM_LINE_STRIP_ADJACENCY) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY); + uint32_t modes = BITFIELD_BIT(MESA_PRIM_LINE_STRIP) | + BITFIELD_BIT(MESA_PRIM_TRIANGLE_STRIP) | + BITFIELD_BIT(MESA_PRIM_LINE_STRIP_ADJACENCY) | + BITFIELD_BIT(MESA_PRIM_TRIANGLE_STRIP_ADJACENCY); if (screen->have_triangle_fans) - modes |= BITFIELD_BIT(PIPE_PRIM_TRIANGLE_FAN); + modes |= BITFIELD_BIT(MESA_PRIM_TRIANGLE_FAN); if (screen->info.have_EXT_primitive_topology_list_restart) { - modes |= BITFIELD_BIT(PIPE_PRIM_POINTS) | - BITFIELD_BIT(PIPE_PRIM_LINES) | - BITFIELD_BIT(PIPE_PRIM_LINES_ADJACENCY) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLES) | - BITFIELD_BIT(PIPE_PRIM_TRIANGLES_ADJACENCY); + modes |= BITFIELD_BIT(MESA_PRIM_POINTS) | + BITFIELD_BIT(MESA_PRIM_LINES) | + BITFIELD_BIT(MESA_PRIM_LINES_ADJACENCY) | + BITFIELD_BIT(MESA_PRIM_TRIANGLES) | + BITFIELD_BIT(MESA_PRIM_TRIANGLES_ADJACENCY); if (screen->info.list_restart_feats.primitiveTopologyPatchListRestart) - modes |= BITFIELD_BIT(PIPE_PRIM_PATCHES); + modes |= BITFIELD_BIT(MESA_PRIM_PATCHES); } return modes; } case PIPE_CAP_SUPPORTED_PRIM_MODES: { - uint32_t modes = BITFIELD_MASK(PIPE_PRIM_MAX); - modes &= ~BITFIELD_BIT(PIPE_PRIM_QUAD_STRIP); - modes &= ~BITFIELD_BIT(PIPE_PRIM_POLYGON); - modes &= ~BITFIELD_BIT(PIPE_PRIM_LINE_LOOP); + uint32_t modes = BITFIELD_MASK(MESA_PRIM_COUNT); + modes &= ~BITFIELD_BIT(MESA_PRIM_QUAD_STRIP); + modes &= ~BITFIELD_BIT(MESA_PRIM_POLYGON); + modes &= ~BITFIELD_BIT(MESA_PRIM_LINE_LOOP); if (!screen->have_triangle_fans) - modes &= ~BITFIELD_BIT(PIPE_PRIM_TRIANGLE_FAN); + modes &= ~BITFIELD_BIT(MESA_PRIM_TRIANGLE_FAN); return modes; } diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 25b131b3118..5d38097821a 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -794,7 +794,7 @@ struct zink_shader { union { struct { struct zink_shader *generated_tcs; // a generated shader that this shader "owns"; only valid in the tes stage - struct zink_shader *generated_gs[PIPE_PRIM_MAX][ZINK_PRIM_MAX]; // generated shaders that this shader "owns" + struct zink_shader *generated_gs[MESA_PRIM_COUNT][ZINK_PRIM_MAX]; // generated shaders that this shader "owns" struct zink_shader *parent; // for a generated gs this points to the shader that "owns" it bool is_generated; // if this is a driver-created shader (e.g., tcs) @@ -874,7 +874,7 @@ struct zink_gfx_pipeline_state { struct zink_vertex_elements_hw_state *element_state; struct zink_zs_swizzle_key *shadow; bool sample_locations_enabled; - enum pipe_prim_type shader_rast_prim, rast_prim; /* reduced type or max for unknown */ + enum mesa_prim shader_rast_prim, rast_prim; /* reduced type or max for unknown */ union { struct { struct zink_shader_key key[5]; @@ -890,7 +890,7 @@ struct zink_gfx_pipeline_state { VkFormat rendering_formats[PIPE_MAX_COLOR_BUFS]; VkPipelineRenderingCreateInfo rendering_info; VkPipeline pipeline; - enum pipe_prim_type gfx_prim_mode; //pending mode + enum mesa_prim gfx_prim_mode; //pending mode }; struct zink_compute_pipeline_state { diff --git a/src/gallium/frontends/d3d10umd/Draw.cpp b/src/gallium/frontends/d3d10umd/Draw.cpp index 5036f76593c..bf1b0427508 100644 --- a/src/gallium/frontends/d3d10umd/Draw.cpp +++ b/src/gallium/frontends/d3d10umd/Draw.cpp @@ -133,7 +133,7 @@ Draw(D3D10DDI_HDEVICE hDevice, // IN ResolveState(pDevice); - assert(pDevice->primitive < PIPE_PRIM_MAX); + assert(pDevice->primitive < MESA_PRIM_COUNT); util_draw_arrays(pDevice->pipe, pDevice->primitive, StartVertexLocation, @@ -167,7 +167,7 @@ DrawIndexed(D3D10DDI_HDEVICE hDevice, // IN unsigned index_size = pDevice->index_size; unsigned ib_offset = pDevice->ib_offset; - assert(pDevice->primitive < PIPE_PRIM_MAX); + assert(pDevice->primitive < MESA_PRIM_COUNT); /* XXX I don't think draw still needs this? */ if (!pDevice->index_buffer) { @@ -225,7 +225,7 @@ DrawInstanced(D3D10DDI_HDEVICE hDevice, // IN ResolveState(pDevice); - assert(pDevice->primitive < PIPE_PRIM_MAX); + assert(pDevice->primitive < MESA_PRIM_COUNT); util_draw_arrays_instanced(pDevice->pipe, pDevice->primitive, StartVertexLocation, @@ -264,7 +264,7 @@ DrawIndexedInstanced(D3D10DDI_HDEVICE hDevice, // IN unsigned index_size = pDevice->index_size; unsigned ib_offset = pDevice->ib_offset; - assert(pDevice->primitive < PIPE_PRIM_MAX); + assert(pDevice->primitive < MESA_PRIM_COUNT); if (!InstanceCount) { return; @@ -330,7 +330,7 @@ DrawAuto(D3D10DDI_HDEVICE hDevice) // IN return; } - assert(pDevice->primitive < PIPE_PRIM_MAX); + assert(pDevice->primitive < MESA_PRIM_COUNT); ResolveState(pDevice); diff --git a/src/gallium/frontends/d3d10umd/InputAssembly.cpp b/src/gallium/frontends/d3d10umd/InputAssembly.cpp index 0acc09d9752..4ce9e03a8d5 100644 --- a/src/gallium/frontends/d3d10umd/InputAssembly.cpp +++ b/src/gallium/frontends/d3d10umd/InputAssembly.cpp @@ -59,42 +59,42 @@ IaSetTopology(D3D10DDI_HDEVICE hDevice, // IN Device *pDevice = CastDevice(hDevice); - enum pipe_prim_type primitive; + enum mesa_prim primitive; switch (PrimitiveTopology) { case D3D10_DDI_PRIMITIVE_TOPOLOGY_UNDEFINED: /* Apps might set topology to UNDEFINED when cleaning up on exit. */ - primitive = PIPE_PRIM_MAX; + primitive = MESA_PRIM_COUNT; break; case D3D10_DDI_PRIMITIVE_TOPOLOGY_POINTLIST: - primitive = PIPE_PRIM_POINTS; + primitive = MESA_PRIM_POINTS; break; case D3D10_DDI_PRIMITIVE_TOPOLOGY_LINELIST: - primitive = PIPE_PRIM_LINES; + primitive = MESA_PRIM_LINES; break; case D3D10_DDI_PRIMITIVE_TOPOLOGY_LINESTRIP: - primitive = PIPE_PRIM_LINE_STRIP; + primitive = MESA_PRIM_LINE_STRIP; break; case D3D10_DDI_PRIMITIVE_TOPOLOGY_TRIANGLELIST: - primitive = PIPE_PRIM_TRIANGLES; + primitive = MESA_PRIM_TRIANGLES; break; case D3D10_DDI_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: - primitive = PIPE_PRIM_TRIANGLE_STRIP; + primitive = MESA_PRIM_TRIANGLE_STRIP; break; case D3D10_DDI_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: - primitive = PIPE_PRIM_LINES_ADJACENCY; + primitive = MESA_PRIM_LINES_ADJACENCY; break; case D3D10_DDI_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: - primitive = PIPE_PRIM_LINE_STRIP_ADJACENCY; + primitive = MESA_PRIM_LINE_STRIP_ADJACENCY; break; case D3D10_DDI_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: - primitive = PIPE_PRIM_TRIANGLES_ADJACENCY; + primitive = MESA_PRIM_TRIANGLES_ADJACENCY; break; case D3D10_DDI_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: - primitive = PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY; + primitive = MESA_PRIM_TRIANGLE_STRIP_ADJACENCY; break; default: assert(0); - primitive = PIPE_PRIM_MAX; + primitive = MESA_PRIM_COUNT; break; } diff --git a/src/gallium/frontends/d3d10umd/ShaderTGSI.c b/src/gallium/frontends/d3d10umd/ShaderTGSI.c index 8494536a0f7..f4ff4b99856 100644 --- a/src/gallium/frontends/d3d10umd/ShaderTGSI.c +++ b/src/gallium/frontends/d3d10umd/ShaderTGSI.c @@ -1873,19 +1873,19 @@ Shader_tgsi_translate(const unsigned *code, case D3D10_SB_PRIMITIVE_TOPOLOGY_POINTLIST: ureg_property(sx.ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, - PIPE_PRIM_POINTS); + MESA_PRIM_POINTS); break; case D3D10_SB_PRIMITIVE_TOPOLOGY_LINESTRIP: ureg_property(sx.ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, - PIPE_PRIM_LINE_STRIP); + MESA_PRIM_LINE_STRIP); break; case D3D10_SB_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: ureg_property(sx.ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, - PIPE_PRIM_TRIANGLE_STRIP); + MESA_PRIM_TRIANGLE_STRIP); break; default: @@ -1903,35 +1903,35 @@ Shader_tgsi_translate(const unsigned *code, declare_vertices_in(&sx, 1); ureg_property(sx.ureg, TGSI_PROPERTY_GS_INPUT_PRIM, - PIPE_PRIM_POINTS); + MESA_PRIM_POINTS); break; case D3D10_SB_PRIMITIVE_LINE: declare_vertices_in(&sx, 2); ureg_property(sx.ureg, TGSI_PROPERTY_GS_INPUT_PRIM, - PIPE_PRIM_LINES); + MESA_PRIM_LINES); break; case D3D10_SB_PRIMITIVE_TRIANGLE: declare_vertices_in(&sx, 3); ureg_property(sx.ureg, TGSI_PROPERTY_GS_INPUT_PRIM, - PIPE_PRIM_TRIANGLES); + MESA_PRIM_TRIANGLES); break; case D3D10_SB_PRIMITIVE_LINE_ADJ: declare_vertices_in(&sx, 4); ureg_property(sx.ureg, TGSI_PROPERTY_GS_INPUT_PRIM, - PIPE_PRIM_LINES_ADJACENCY); + MESA_PRIM_LINES_ADJACENCY); break; case D3D10_SB_PRIMITIVE_TRIANGLE_ADJ: declare_vertices_in(&sx, 6); ureg_property(sx.ureg, TGSI_PROPERTY_GS_INPUT_PRIM, - PIPE_PRIM_TRIANGLES_ADJACENCY); + MESA_PRIM_TRIANGLES_ADJACENCY); break; default: diff --git a/src/gallium/frontends/d3d10umd/State.h b/src/gallium/frontends/d3d10umd/State.h index 3e45cb79743..fb90073db3c 100644 --- a/src/gallium/frontends/d3d10umd/State.h +++ b/src/gallium/frontends/d3d10umd/State.h @@ -79,7 +79,7 @@ struct Device void *empty_fs; void *empty_vs; - enum pipe_prim_type primitive; + enum mesa_prim primitive; struct pipe_stream_output_target *so_targets[PIPE_MAX_SO_BUFFERS]; struct pipe_stream_output_target *draw_so_target; diff --git a/src/gallium/frontends/lavapipe/lvp_conv.h b/src/gallium/frontends/lavapipe/lvp_conv.h index a1496385dae..47d2a18a78b 100644 --- a/src/gallium/frontends/lavapipe/lvp_conv.h +++ b/src/gallium/frontends/lavapipe/lvp_conv.h @@ -64,27 +64,27 @@ static inline unsigned vk_conv_topology(VkPrimitiveTopology topology) { switch (topology) { case VK_PRIMITIVE_TOPOLOGY_POINT_LIST: - return PIPE_PRIM_POINTS; + return MESA_PRIM_POINTS; case VK_PRIMITIVE_TOPOLOGY_LINE_LIST: - return PIPE_PRIM_LINES; + return MESA_PRIM_LINES; case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP: - return PIPE_PRIM_LINE_STRIP; + return MESA_PRIM_LINE_STRIP; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST: - return PIPE_PRIM_TRIANGLES; + return MESA_PRIM_TRIANGLES; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP: - return PIPE_PRIM_TRIANGLE_STRIP; + return MESA_PRIM_TRIANGLE_STRIP; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN: - return PIPE_PRIM_TRIANGLE_FAN; + return MESA_PRIM_TRIANGLE_FAN; case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY: - return PIPE_PRIM_LINES_ADJACENCY; + return MESA_PRIM_LINES_ADJACENCY; case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY: - return PIPE_PRIM_LINE_STRIP_ADJACENCY; + return MESA_PRIM_LINE_STRIP_ADJACENCY; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY: - return PIPE_PRIM_TRIANGLES_ADJACENCY; + return MESA_PRIM_TRIANGLES_ADJACENCY; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY: - return PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY; + return MESA_PRIM_TRIANGLE_STRIP_ADJACENCY; case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST: - return PIPE_PRIM_PATCHES; + return MESA_PRIM_PATCHES; default: assert(0); return 0; diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index 52296404c20..84f93c6234d 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -483,7 +483,7 @@ static void emit_state(struct rendering_state *state) bool ms = state->rs_state.multisample; if (state->disable_multisample && (state->gs_output_lines == GS_OUTPUT_LINES || - (!state->shaders[MESA_SHADER_GEOMETRY] && u_reduced_prim(state->info.mode) == PIPE_PRIM_LINES))) + (!state->shaders[MESA_SHADER_GEOMETRY] && u_reduced_prim(state->info.mode) == MESA_PRIM_LINES))) state->rs_state.multisample = false; assert(offsetof(struct pipe_rasterizer_state, offset_clamp) - offsetof(struct pipe_rasterizer_state, offset_units) == sizeof(float) * 2); if (state->depth_bias.enabled) { @@ -717,7 +717,7 @@ handle_graphics_stages(struct rendering_state *state, VkShaderStageFlagBits shad state->inlines_dirty[MESA_SHADER_GEOMETRY] = state->shaders[MESA_SHADER_GEOMETRY]->inlines.can_inline; if (!state->shaders[MESA_SHADER_GEOMETRY]->inlines.can_inline) state->pctx->bind_gs_state(state->pctx, state->shaders[MESA_SHADER_GEOMETRY]->shader_cso); - state->gs_output_lines = state->shaders[MESA_SHADER_GEOMETRY]->pipeline_nir->nir->info.gs.output_primitive == SHADER_PRIM_LINES ? GS_OUTPUT_LINES : GS_OUTPUT_NOT_LINES; + state->gs_output_lines = state->shaders[MESA_SHADER_GEOMETRY]->pipeline_nir->nir->info.gs.output_primitive == MESA_PRIM_LINES ? GS_OUTPUT_LINES : GS_OUTPUT_NOT_LINES; break; case VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT: state->inlines_dirty[MESA_SHADER_TESS_CTRL] = state->shaders[MESA_SHADER_TESS_CTRL]->inlines.can_inline; diff --git a/src/gallium/frontends/nine/device9.c b/src/gallium/frontends/nine/device9.c index 5e913843025..b8e2b99f4ad 100644 --- a/src/gallium/frontends/nine/device9.c +++ b/src/gallium/frontends/nine/device9.c @@ -3320,7 +3320,7 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This, return D3DERR_DRIVERINTERNALERROR; } - draw.mode = PIPE_PRIM_POINTS; + draw.mode = MESA_PRIM_POINTS; sc.count = VertexCount; draw.start_instance = 0; draw.primitive_restart = FALSE; diff --git a/src/gallium/frontends/nine/nine_pipe.h b/src/gallium/frontends/nine/nine_pipe.h index 00401362473..5c5ad2a5cdd 100644 --- a/src/gallium/frontends/nine/nine_pipe.h +++ b/src/gallium/frontends/nine/nine_pipe.h @@ -598,15 +598,15 @@ static inline unsigned d3dprimitivetype_to_pipe_prim(D3DPRIMITIVETYPE prim) { switch (prim) { - case D3DPT_POINTLIST: return PIPE_PRIM_POINTS; - case D3DPT_LINELIST: return PIPE_PRIM_LINES; - case D3DPT_LINESTRIP: return PIPE_PRIM_LINE_STRIP; - case D3DPT_TRIANGLELIST: return PIPE_PRIM_TRIANGLES; - case D3DPT_TRIANGLESTRIP: return PIPE_PRIM_TRIANGLE_STRIP; - case D3DPT_TRIANGLEFAN: return PIPE_PRIM_TRIANGLE_FAN; + case D3DPT_POINTLIST: return MESA_PRIM_POINTS; + case D3DPT_LINELIST: return MESA_PRIM_LINES; + case D3DPT_LINESTRIP: return MESA_PRIM_LINE_STRIP; + case D3DPT_TRIANGLELIST: return MESA_PRIM_TRIANGLES; + case D3DPT_TRIANGLESTRIP: return MESA_PRIM_TRIANGLE_STRIP; + case D3DPT_TRIANGLEFAN: return MESA_PRIM_TRIANGLE_FAN; default: assert(0); - return PIPE_PRIM_POINTS; + return MESA_PRIM_POINTS; } } diff --git a/src/gallium/frontends/xa/xa_renderer.c b/src/gallium/frontends/xa/xa_renderer.c index 5f818fd74c4..fd6654bab75 100644 --- a/src/gallium/frontends/xa/xa_renderer.c +++ b/src/gallium/frontends/xa/xa_renderer.c @@ -93,7 +93,7 @@ renderer_draw(struct xa_context *r) memcpy(velems.velems, r->velems, sizeof(r->velems[0]) * velems.count); cso_set_vertex_elements(r->cso, &velems); - util_draw_user_vertex_buffer(r->cso, r->buffer, PIPE_PRIM_QUADS, + util_draw_user_vertex_buffer(r->cso, r->buffer, MESA_PRIM_QUADS, num_verts, /* verts */ r->attrs_per_vertex); /* attribs/vert */ r->buffer_size = 0; @@ -529,7 +529,7 @@ renderer_draw_yuv(struct xa_context *r, memcpy(velems.velems, r->velems, sizeof(r->velems[0]) * velems.count); cso_set_vertex_elements(r->cso, &velems); - util_draw_user_vertex_buffer(r->cso, r->buffer, PIPE_PRIM_QUADS, + util_draw_user_vertex_buffer(r->cso, r->buffer, MESA_PRIM_QUADS, 4, /* verts */ num_attribs); /* attribs/vert */ r->buffer_size = 0; diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index aaa9f279991..6527f160aec 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -558,28 +558,6 @@ enum pipe_resource_usage { PIPE_USAGE_STAGING, /* fast CPU access */ }; -/** - * Primitive types: - */ -enum PACKED pipe_prim_type { - PIPE_PRIM_POINTS, - PIPE_PRIM_LINES, - PIPE_PRIM_LINE_LOOP, - PIPE_PRIM_LINE_STRIP, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLE_STRIP, - PIPE_PRIM_TRIANGLE_FAN, - PIPE_PRIM_QUADS, - PIPE_PRIM_QUAD_STRIP, - PIPE_PRIM_POLYGON, - PIPE_PRIM_LINES_ADJACENCY, - PIPE_PRIM_LINE_STRIP_ADJACENCY, - PIPE_PRIM_TRIANGLES_ADJACENCY, - PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY, - PIPE_PRIM_PATCHES, - PIPE_PRIM_MAX, -}; - /** * Tessellator spacing types */ diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 3c6ed1aee77..3a7d82c5d82 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -854,7 +854,7 @@ struct pipe_draw_start_count_bias { struct pipe_draw_vertex_state_info { #if defined(__GNUC__) /* sizeof(mode) == 1 because it's a packed enum. */ - enum pipe_prim_type mode; /**< the mode of the primitive */ + enum mesa_prim mode; /**< the mode of the primitive */ #else /* sizeof(mode) == 1 is required by draw merging in u_threaded_context. */ uint8_t mode; /**< the mode of the primitive */ @@ -869,7 +869,7 @@ struct pipe_draw_info { #if defined(__GNUC__) /* sizeof(mode) == 1 because it's a packed enum. */ - enum pipe_prim_type mode; /**< the mode of the primitive */ + enum mesa_prim mode; /**< the mode of the primitive */ #else /* sizeof(mode) == 1 is required by draw merging in u_threaded_context. */ uint8_t mode; /**< the mode of the primitive */ @@ -884,7 +884,7 @@ struct pipe_draw_info bool take_index_buffer_ownership:1; /**< callee inherits caller's refcount (no need to reference indexbuf, but still needs to unreference it) */ bool index_bias_varies:1; /**< true if index_bias varies between draws */ - bool was_line_loop:1; /**< true if pipe_prim_type was LINE_LOOP before translation */ + bool was_line_loop:1; /**< true if mesa_prim was LINE_LOOP before translation */ uint8_t _pad:1; unsigned start_instance; /**< first instance id */ diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c index 5a54d00ec25..d0ebcb66698 100644 --- a/src/gallium/tests/trivial/quad-tex.c +++ b/src/gallium/tests/trivial/quad-tex.c @@ -336,7 +336,7 @@ static void draw(struct program *p) util_draw_vertex_buffer(p->pipe, p->cso, p->vbuf, 0, 0, - PIPE_PRIM_QUADS, + MESA_PRIM_QUADS, 4, /* verts */ 2); /* attribs/vert */ diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c index 0bc09a983a2..a936433fbe1 100644 --- a/src/gallium/tests/trivial/tri.c +++ b/src/gallium/tests/trivial/tri.c @@ -268,7 +268,7 @@ static void draw(struct program *p) util_draw_vertex_buffer(p->pipe, p->cso, p->vbuf, 0, 0, - PIPE_PRIM_TRIANGLES, + MESA_PRIM_TRIANGLES, 3, /* verts */ 2); /* attribs/vert */ diff --git a/src/gallium/tests/unit/u_prim_verts_test.c b/src/gallium/tests/unit/u_prim_verts_test.c index 94b64f75eec..3b64d4112d1 100644 --- a/src/gallium/tests/unit/u_prim_verts_test.c +++ b/src/gallium/tests/unit/u_prim_verts_test.c @@ -4,27 +4,27 @@ #include "util/u_prim.h" struct test_info { - enum pipe_prim_type prim_type; + enum mesa_prim prim_type; uint32_t count; uint32_t expected; }; struct test_info tests[] = { - { PIPE_PRIM_POINTS, 0, 0 }, - { PIPE_PRIM_POINTS, 1, 1 }, - { PIPE_PRIM_POINTS, 2, 2 }, + { MESA_PRIM_POINTS, 0, 0 }, + { MESA_PRIM_POINTS, 1, 1 }, + { MESA_PRIM_POINTS, 2, 2 }, - { PIPE_PRIM_LINES, 0, 0 }, - { PIPE_PRIM_LINES, 1, 2 }, - { PIPE_PRIM_LINES, 2, 4 }, + { MESA_PRIM_LINES, 0, 0 }, + { MESA_PRIM_LINES, 1, 2 }, + { MESA_PRIM_LINES, 2, 4 }, - { PIPE_PRIM_TRIANGLES, 0, 0 }, - { PIPE_PRIM_TRIANGLES, 1, 3 }, - { PIPE_PRIM_TRIANGLES, 2, 6 }, + { MESA_PRIM_TRIANGLES, 0, 0 }, + { MESA_PRIM_TRIANGLES, 1, 3 }, + { MESA_PRIM_TRIANGLES, 2, 6 }, - { PIPE_PRIM_QUADS, 0, 0 }, - { PIPE_PRIM_QUADS, 1, 4 }, - { PIPE_PRIM_QUADS, 2, 8 }, + { MESA_PRIM_QUADS, 0, 0 }, + { MESA_PRIM_QUADS, 1, 4 }, + { MESA_PRIM_QUADS, 2, 8 }, }; int diff --git a/src/intel/compiler/brw_compile_clip.c b/src/intel/compiler/brw_compile_clip.c index 60422389218..3ee26de00e4 100644 --- a/src/intel/compiler/brw_compile_clip.c +++ b/src/intel/compiler/brw_compile_clip.c @@ -63,16 +63,16 @@ brw_compile_clip(const struct brw_compiler *compiler, * do all three: */ switch (key->primitive) { - case SHADER_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: if (key->do_unfilled) brw_emit_unfilled_clip( &c ); else brw_emit_tri_clip( &c ); break; - case SHADER_PRIM_LINES: + case MESA_PRIM_LINES: brw_emit_line_clip( &c ); break; - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: brw_emit_point_clip( &c ); break; default: diff --git a/src/intel/compiler/brw_vec4_gs_visitor.cpp b/src/intel/compiler/brw_vec4_gs_visitor.cpp index abaa784d6b9..322e011c472 100644 --- a/src/intel/compiler/brw_vec4_gs_visitor.cpp +++ b/src/intel/compiler/brw_vec4_gs_visitor.cpp @@ -561,21 +561,21 @@ vec4_gs_visitor::gs_end_primitive() emit(OR(dst_reg(this->control_data_bits), this->control_data_bits, mask)); } -static const GLuint gl_prim_to_hw_prim[SHADER_PRIM_TRIANGLE_STRIP_ADJACENCY+1] = { - [SHADER_PRIM_POINTS] =_3DPRIM_POINTLIST, - [SHADER_PRIM_LINES] = _3DPRIM_LINELIST, - [SHADER_PRIM_LINE_LOOP] = _3DPRIM_LINELOOP, - [SHADER_PRIM_LINE_STRIP] = _3DPRIM_LINESTRIP, - [SHADER_PRIM_TRIANGLES] = _3DPRIM_TRILIST, - [SHADER_PRIM_TRIANGLE_STRIP] = _3DPRIM_TRISTRIP, - [SHADER_PRIM_TRIANGLE_FAN] = _3DPRIM_TRIFAN, - [SHADER_PRIM_QUADS] = _3DPRIM_QUADLIST, - [SHADER_PRIM_QUAD_STRIP] = _3DPRIM_QUADSTRIP, - [SHADER_PRIM_POLYGON] = _3DPRIM_POLYGON, - [SHADER_PRIM_LINES_ADJACENCY] = _3DPRIM_LINELIST_ADJ, - [SHADER_PRIM_LINE_STRIP_ADJACENCY] = _3DPRIM_LINESTRIP_ADJ, - [SHADER_PRIM_TRIANGLES_ADJACENCY] = _3DPRIM_TRILIST_ADJ, - [SHADER_PRIM_TRIANGLE_STRIP_ADJACENCY] = _3DPRIM_TRISTRIP_ADJ, +static const GLuint gl_prim_to_hw_prim[MESA_PRIM_TRIANGLE_STRIP_ADJACENCY+1] = { + [MESA_PRIM_POINTS] =_3DPRIM_POINTLIST, + [MESA_PRIM_LINES] = _3DPRIM_LINELIST, + [MESA_PRIM_LINE_LOOP] = _3DPRIM_LINELOOP, + [MESA_PRIM_LINE_STRIP] = _3DPRIM_LINESTRIP, + [MESA_PRIM_TRIANGLES] = _3DPRIM_TRILIST, + [MESA_PRIM_TRIANGLE_STRIP] = _3DPRIM_TRISTRIP, + [MESA_PRIM_TRIANGLE_FAN] = _3DPRIM_TRIFAN, + [MESA_PRIM_QUADS] = _3DPRIM_QUADLIST, + [MESA_PRIM_QUAD_STRIP] = _3DPRIM_QUADSTRIP, + [MESA_PRIM_POLYGON] = _3DPRIM_POLYGON, + [MESA_PRIM_LINES_ADJACENCY] = _3DPRIM_LINELIST_ADJ, + [MESA_PRIM_LINE_STRIP_ADJACENCY] = _3DPRIM_LINESTRIP_ADJ, + [MESA_PRIM_TRIANGLES_ADJACENCY] = _3DPRIM_TRILIST_ADJ, + [MESA_PRIM_TRIANGLE_STRIP_ADJACENCY] = _3DPRIM_TRISTRIP_ADJ, }; } /* namespace brw */ @@ -635,7 +635,7 @@ brw_compile_gs(const struct brw_compiler *compiler, nir, &prog_data->static_vertex_count, nullptr, 1u); if (compiler->devinfo->ver >= 7) { - if (nir->info.gs.output_primitive == SHADER_PRIM_POINTS) { + if (nir->info.gs.output_primitive == MESA_PRIM_POINTS) { /* When the output type is points, the geometry shader may output data * to multiple streams, and EndPrimitive() has no effect. So we * configure the hardware to interpret the control data as stream ID. diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index dadfdbf89eb..81b2ba5451a 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -602,11 +602,11 @@ genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline, { if (anv_pipeline_is_mesh(pipeline)) { switch (get_mesh_prog_data(pipeline)->primitive_type) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return VK_POLYGON_MODE_POINT; - case SHADER_PRIM_LINES: + case MESA_PRIM_LINES: return VK_POLYGON_MODE_LINE; - case SHADER_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return polygon_mode; default: unreachable("invalid primitive type for mesh"); @@ -1782,8 +1782,8 @@ emit_mesh_state(struct anv_graphics_pipeline *pipeline) brw_cs_get_dispatch_info(devinfo, &mesh_prog_data->base, NULL); const unsigned output_topology = - mesh_prog_data->primitive_type == SHADER_PRIM_POINTS ? OUTPUT_POINT : - mesh_prog_data->primitive_type == SHADER_PRIM_LINES ? OUTPUT_LINE : + mesh_prog_data->primitive_type == MESA_PRIM_POINTS ? OUTPUT_POINT : + mesh_prog_data->primitive_type == MESA_PRIM_LINES ? OUTPUT_LINE : OUTPUT_TRI; uint32_t index_format; diff --git a/src/mesa/main/shader_types.h b/src/mesa/main/shader_types.h index 0f905042382..79995a4e3e1 100644 --- a/src/mesa/main/shader_types.h +++ b/src/mesa/main/shader_types.h @@ -90,12 +90,12 @@ struct gl_shader_info * GL_TRIANGLES_ADJACENCY, or PRIM_UNKNOWN if it's not set in this * shader. */ - enum shader_prim InputType; + enum mesa_prim InputType; /** * GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP, or PRIM_UNKNOWN if * it's not set in this shader. */ - enum shader_prim OutputType; + enum mesa_prim OutputType; } Geom; /** diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 5652f79cab4..12bc5d6c034 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -103,8 +103,8 @@ _mesa_init_shader(struct gl_shader *shader) { shader->RefCount = 1; shader->info.Geom.VerticesOut = -1; - shader->info.Geom.InputType = SHADER_PRIM_TRIANGLES; - shader->info.Geom.OutputType = SHADER_PRIM_TRIANGLE_STRIP; + shader->info.Geom.InputType = MESA_PRIM_TRIANGLES; + shader->info.Geom.OutputType = MESA_PRIM_TRIANGLE_STRIP; } /** diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index 1ea43748eb4..ce5423c2ba1 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -340,7 +340,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, util_draw_vertex_buffer(pipe, cso, vbuffer, 0, offset, /* offset */ - PIPE_PRIM_TRIANGLE_FAN, + MESA_PRIM_TRIANGLE_FAN, 4, /* verts */ numAttribs); /* attribs/vert */ st->last_num_vbuffers = MAX2(st->last_num_vbuffers, 1); diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 7a6d2217b25..542224e5c91 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -210,7 +210,7 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw) GL_RGBA, GL_FALSE, GL_FALSE, GL_FALSE, 0); _mesa_enable_vertex_array_attrib(ctx, rs->VAO, 0); - rs->info.mode = PIPE_PRIM_POINTS; + rs->info.mode = MESA_PRIM_POINTS; rs->info.instance_count = 1; rs->draw.count = 1; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 6402d915e8c..daf0161ea0f 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -808,7 +808,7 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, ctx->Const.DriverSupportedPrimMask = screen->get_param(screen, PIPE_CAP_SUPPORTED_PRIM_MODES) | /* patches is always supported */ - BITFIELD_BIT(PIPE_PRIM_PATCHES); + BITFIELD_BIT(MESA_PRIM_PATCHES); st->active_states = _mesa_get_active_states(ctx); return st; diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 3da818d0ac7..f22d3ca5223 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -68,10 +68,10 @@ #include "cso_cache/cso_context.h" /* GL prims should match Gallium prims, spot-check a few */ -static_assert(GL_POINTS == PIPE_PRIM_POINTS, "enum mismatch"); -static_assert(GL_QUADS == PIPE_PRIM_QUADS, "enum mismatch"); -static_assert(GL_TRIANGLE_STRIP_ADJACENCY == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY, "enum mismatch"); -static_assert(GL_PATCHES == PIPE_PRIM_PATCHES, "enum mismatch"); +static_assert(GL_POINTS == MESA_PRIM_POINTS, "enum mismatch"); +static_assert(GL_QUADS == MESA_PRIM_QUADS, "enum mismatch"); +static_assert(GL_TRIANGLE_STRIP_ADJACENCY == MESA_PRIM_TRIANGLE_STRIP_ADJACENCY, "enum mismatch"); +static_assert(GL_PATCHES == MESA_PRIM_PATCHES, "enum mismatch"); static inline void prepare_draw(struct st_context *st, struct gl_context *ctx, uint64_t state_mask) @@ -481,10 +481,10 @@ st_draw_quad(struct st_context *st, st->last_num_vbuffers = MAX2(st->last_num_vbuffers, 1); if (num_instances > 1) { - cso_draw_arrays_instanced(st->cso_context, PIPE_PRIM_TRIANGLE_FAN, 0, 4, + cso_draw_arrays_instanced(st->cso_context, MESA_PRIM_TRIANGLE_FAN, 0, 4, 0, num_instances); } else { - cso_draw_arrays(st->cso_context, PIPE_PRIM_TRIANGLE_FAN, 0, 4); + cso_draw_arrays(st->cso_context, MESA_PRIM_TRIANGLE_FAN, 0, 4); } pipe_resource_reference(&vb.buffer.resource, NULL); diff --git a/src/mesa/state_tracker/st_draw_hw_select.c b/src/mesa/state_tracker/st_draw_hw_select.c index ab9acd4e1a4..fc89309c7d5 100644 --- a/src/mesa/state_tracker/st_draw_hw_select.c +++ b/src/mesa/state_tracker/st_draw_hw_select.c @@ -617,7 +617,7 @@ hw_select_create_gs(struct st_context *st, union state_key state) nir->info.inputs_read = VARYING_BIT_POS; nir->num_uniforms = DIV_ROUND_UP(sizeof(struct geometry_constant), (4 * sizeof(float))); nir->info.num_ssbos = 1; - nir->info.gs.output_primitive = SHADER_PRIM_POINTS; + nir->info.gs.output_primitive = MESA_PRIM_POINTS; nir->info.gs.vertices_out = 1; nir->info.gs.invocations = 1; nir->info.gs.active_stream_mask = 1; @@ -629,23 +629,23 @@ hw_select_create_gs(struct st_context *st, union state_key state) switch (state.primitive) { case HW_SELECT_PRIM_POINTS: - nir->info.gs.input_primitive = SHADER_PRIM_POINTS; + nir->info.gs.input_primitive = MESA_PRIM_POINTS; nir->info.gs.vertices_in = 1; build_point_nir_shader(&b, state, packed); break; case HW_SELECT_PRIM_LINES: - nir->info.gs.input_primitive = SHADER_PRIM_LINES; + nir->info.gs.input_primitive = MESA_PRIM_LINES; nir->info.gs.vertices_in = 2; build_line_nir_shader(&b, state, packed); break; case HW_SELECT_PRIM_TRIANGLES: - nir->info.gs.input_primitive = SHADER_PRIM_TRIANGLES; + nir->info.gs.input_primitive = MESA_PRIM_TRIANGLES; nir->info.gs.vertices_in = 3; build_planar_primitive_nir_shader(&b, state, packed); break; case HW_SELECT_PRIM_QUADS: /* geometry shader has no quad primitive, use lines_adjacency instead */ - nir->info.gs.input_primitive = SHADER_PRIM_LINES_ADJACENCY; + nir->info.gs.input_primitive = MESA_PRIM_LINES_ADJACENCY; nir->info.gs.vertices_in = 4; build_planar_primitive_nir_shader(&b, state, packed); break; diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c index c9a2c9d5720..3b5f121e4c9 100644 --- a/src/mesa/state_tracker/st_pbo.c +++ b/src/mesa/state_tracker/st_pbo.c @@ -274,9 +274,9 @@ st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr, cso_set_stream_outputs(cso, 0, NULL, 0); if (addr->depth == 1) { - cso_draw_arrays(cso, PIPE_PRIM_TRIANGLE_STRIP, 0, 4); + cso_draw_arrays(cso, MESA_PRIM_TRIANGLE_STRIP, 0, 4); } else { - cso_draw_arrays_instanced(cso, PIPE_PRIM_TRIANGLE_STRIP, + cso_draw_arrays_instanced(cso, MESA_PRIM_TRIANGLE_STRIP, 0, 4, 0, addr->depth); } @@ -336,8 +336,8 @@ st_pbo_create_gs(struct st_context *st) if (!ureg) return NULL; - ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, PIPE_PRIM_TRIANGLES); - ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, PIPE_PRIM_TRIANGLE_STRIP); + ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, MESA_PRIM_TRIANGLES); + ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, MESA_PRIM_TRIANGLE_STRIP); ureg_property(ureg, TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES, 3); out_pos = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0); diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index a15c0d5c075..b609a262461 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -598,7 +598,7 @@ compile_vertex_list(struct gl_context *ctx) node->cold->max_index = end - 1; /* converting primitive types may result in many more indices */ - bool all_prims_supported = (ctx->Const.DriverSupportedPrimMask & BITFIELD_MASK(PIPE_PRIM_MAX)) == BITFIELD_MASK(PIPE_PRIM_MAX); + bool all_prims_supported = (ctx->Const.DriverSupportedPrimMask & BITFIELD_MASK(MESA_PRIM_COUNT)) == BITFIELD_MASK(MESA_PRIM_COUNT); int max_index_count = total_vert_count * (all_prims_supported ? 2 : 3); uint32_t* indices = (uint32_t*) malloc(max_index_count * sizeof(uint32_t)); void *tmp_indices = all_prims_supported ? NULL : malloc(max_index_count * sizeof(uint32_t)); @@ -626,7 +626,7 @@ compile_vertex_list(struct gl_context *ctx) bool converted_prim = false; unsigned index_size; bool outputting_quads = !!(ctx->Const.DriverSupportedPrimMask & - (BITFIELD_MASK(PIPE_PRIM_QUADS) | BITFIELD_MASK(PIPE_PRIM_QUAD_STRIP))); + (BITFIELD_MASK(MESA_PRIM_QUADS) | BITFIELD_MASK(MESA_PRIM_QUAD_STRIP))); unsigned verts_per_primitive = outputting_quads ? 4 : 3; int vertex_count = original_prims[i].count; @@ -648,7 +648,7 @@ compile_vertex_list(struct gl_context *ctx) if (!(ctx->Const.DriverSupportedPrimMask & BITFIELD_BIT(mode))) { unsigned new_count; u_generate_func trans_func; - enum pipe_prim_type pmode = (enum pipe_prim_type)mode; + enum mesa_prim pmode = (enum mesa_prim)mode; u_index_generator(ctx->Const.DriverSupportedPrimMask, pmode, original_prims[i].start, vertex_count, PV_LAST, PV_LAST, diff --git a/src/microsoft/compiler/dxil_enums.c b/src/microsoft/compiler/dxil_enums.c index 028a8488689..8f522389d28 100644 --- a/src/microsoft/compiler/dxil_enums.c +++ b/src/microsoft/compiler/dxil_enums.c @@ -125,15 +125,15 @@ enum dxil_resource_kind dxil_get_resource_kind(const struct glsl_type *type) enum dxil_input_primitive dxil_get_input_primitive(unsigned primitive) { switch (primitive) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return DXIL_INPUT_PRIMITIVE_POINT; - case SHADER_PRIM_LINES: + case MESA_PRIM_LINES: return DXIL_INPUT_PRIMITIVE_LINE; - case SHADER_PRIM_LINES_ADJACENCY: + case MESA_PRIM_LINES_ADJACENCY: return DXIL_INPUT_PRIMITIVE_LINES_ADJENCY; - case SHADER_PRIM_TRIANGLES: + case MESA_PRIM_TRIANGLES: return DXIL_INPUT_PRIMITIVE_TRIANGLE; - case SHADER_PRIM_TRIANGLES_ADJACENCY: + case MESA_PRIM_TRIANGLES_ADJACENCY: return DXIL_INPUT_PRIMITIVE_TRIANGLES_ADJENCY; default: unreachable("unhandled primitive topology"); @@ -143,13 +143,13 @@ enum dxil_input_primitive dxil_get_input_primitive(unsigned primitive) enum dxil_primitive_topology dxil_get_primitive_topology(unsigned topology) { switch (topology) { - case SHADER_PRIM_POINTS: + case MESA_PRIM_POINTS: return DXIL_PRIMITIVE_TOPOLOGY_POINT_LIST; - case SHADER_PRIM_LINES: + case MESA_PRIM_LINES: return DXIL_PRIMITIVE_TOPOLOGY_LINE_LIST; - case SHADER_PRIM_LINE_STRIP: + case MESA_PRIM_LINE_STRIP: return DXIL_PRIMITIVE_TOPOLOGY_LINE_STRIP; - case SHADER_PRIM_TRIANGLE_STRIP: + case MESA_PRIM_TRIANGLE_STRIP: return DXIL_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; default: unreachable("unhandled primitive topology"); diff --git a/src/microsoft/vulkan/dzn_nir.c b/src/microsoft/vulkan/dzn_nir.c index 013d22ccc1a..fdca6da1944 100644 --- a/src/microsoft/vulkan/dzn_nir.c +++ b/src/microsoft/vulkan/dzn_nir.c @@ -855,8 +855,8 @@ dzn_nir_polygon_point_mode_gs(const nir_shader *previous_shader, struct dzn_nir_ nir_shader *nir = b->shader; nir->info.inputs_read = nir->info.outputs_written = previous_shader->info.outputs_written; nir->info.outputs_written |= (1ull << VARYING_SLOT_VAR12); - nir->info.gs.input_primitive = PIPE_PRIM_TRIANGLES; - nir->info.gs.output_primitive = PIPE_PRIM_POINTS; + nir->info.gs.input_primitive = MESA_PRIM_TRIANGLES; + nir->info.gs.output_primitive = MESA_PRIM_POINTS; nir->info.gs.vertices_in = 3; nir->info.gs.vertices_out = 3; nir->info.gs.invocations = 1; diff --git a/src/nouveau/codegen/nv50_ir.cpp b/src/nouveau/codegen/nv50_ir.cpp index b26a72531fa..29bfcda01c4 100644 --- a/src/nouveau/codegen/nv50_ir.cpp +++ b/src/nouveau/codegen/nv50_ir.cpp @@ -1247,8 +1247,8 @@ nv50_ir_init_prog_info(struct nv50_ir_prog_info *info, info_out->target = info->target; info_out->type = info->type; if (info->type == PIPE_SHADER_TESS_CTRL || info->type == PIPE_SHADER_TESS_EVAL) { - info_out->prop.tp.domain = PIPE_PRIM_MAX; - info_out->prop.tp.outputPrim = PIPE_PRIM_MAX; + info_out->prop.tp.domain = MESA_PRIM_COUNT; + info_out->prop.tp.outputPrim = MESA_PRIM_COUNT; } if (info->type == PIPE_SHADER_GEOMETRY) { info_out->prop.gp.instanceCount = 1; diff --git a/src/nouveau/codegen/nv50_ir_driver.h b/src/nouveau/codegen/nv50_ir_driver.h index 4988de2b668..c19b60efed8 100644 --- a/src/nouveau/codegen/nv50_ir_driver.h +++ b/src/nouveau/codegen/nv50_ir_driver.h @@ -167,8 +167,8 @@ struct nv50_ir_prog_info_out uint8_t outputPatchSize; uint8_t partitioning; /* PIPE_TESS_PART */ int8_t winding; /* +1 (clockwise) / -1 (counter-clockwise) */ - uint8_t domain; /* PIPE_PRIM_{QUADS,TRIANGLES,LINES} */ - uint8_t outputPrim; /* PIPE_PRIM_{TRIANGLES,LINES,POINTS} */ + uint8_t domain; /* MESA_PRIM_{QUADS,TRIANGLES,LINES} */ + uint8_t outputPrim; /* MESA_PRIM_{TRIANGLES,LINES,POINTS} */ } tp; struct { uint8_t outputPrim; diff --git a/src/nouveau/codegen/nv50_ir_from_nir.cpp b/src/nouveau/codegen/nv50_ir_from_nir.cpp index 9ac2f59cdc9..023fed853ec 100644 --- a/src/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/src/nouveau/codegen/nv50_ir_from_nir.cpp @@ -1326,7 +1326,7 @@ Converter::parseNIR() info_out->prop.tp.domain = u_tess_prim_from_shader(nir->info.tess._primitive_mode); info_out->prop.tp.outputPatchSize = nir->info.tess.tcs_vertices_out; info_out->prop.tp.outputPrim = - nir->info.tess.point_mode ? PIPE_PRIM_POINTS : PIPE_PRIM_TRIANGLES; + nir->info.tess.point_mode ? MESA_PRIM_POINTS : MESA_PRIM_TRIANGLES; info_out->prop.tp.partitioning = (nir->info.tess.spacing + 1) % 3; info_out->prop.tp.winding = !nir->info.tess.ccw; break; diff --git a/src/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/nouveau/codegen/nv50_ir_from_tgsi.cpp index 154befdfabe..057d7f4e8e5 100644 --- a/src/nouveau/codegen/nv50_ir_from_tgsi.cpp +++ b/src/nouveau/codegen/nv50_ir_from_tgsi.cpp @@ -1205,9 +1205,9 @@ void Source::scanProperty(const struct tgsi_full_property *prop) break; case TGSI_PROPERTY_TES_POINT_MODE: if (prop->u[0].Data) - info_out->prop.tp.outputPrim = PIPE_PRIM_POINTS; + info_out->prop.tp.outputPrim = MESA_PRIM_POINTS; else - info_out->prop.tp.outputPrim = PIPE_PRIM_TRIANGLES; /* anything but points */ + info_out->prop.tp.outputPrim = MESA_PRIM_TRIANGLES; /* anything but points */ break; case TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH: info->prop.cp.numThreads[0] = prop->u[0].Data; diff --git a/src/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/nouveau/codegen/nv50_ir_lowering_nvc0.cpp index e333294f82a..6dae932dd4f 100644 --- a/src/nouveau/codegen/nv50_ir_lowering_nvc0.cpp +++ b/src/nouveau/codegen/nv50_ir_lowering_nvc0.cpp @@ -2930,7 +2930,7 @@ NVC0LoweringPass::readTessCoord(LValue *dst, int c) y = dst; } else { assert(c == 2); - if (prog->driver_out->prop.tp.domain != PIPE_PRIM_TRIANGLES) { + if (prog->driver_out->prop.tp.domain != MESA_PRIM_TRIANGLES) { bld.mkMov(dst, bld.loadImm(NULL, 0)); return; }