compiler: Rename shader_prim to mesa_prim and replace all usage of pipe_prim_type with mesa_prim
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 <luoyonggang@gmail.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23369>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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.");
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
+22
-20
@@ -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),
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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: \
|
||||
|
||||
@@ -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), "");
|
||||
|
||||
@@ -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, \
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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: \
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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: \
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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<<prim)) && pv_matches)
|
||||
return prim;
|
||||
|
||||
switch (prim) {
|
||||
case PIPE_PRIM_POINTS:
|
||||
return PIPE_PRIM_POINTS;
|
||||
case PIPE_PRIM_LINES:
|
||||
case PIPE_PRIM_LINE_STRIP:
|
||||
case PIPE_PRIM_LINE_LOOP:
|
||||
return PIPE_PRIM_LINES;
|
||||
case PIPE_PRIM_TRIANGLES:
|
||||
case PIPE_PRIM_TRIANGLE_STRIP:
|
||||
case PIPE_PRIM_TRIANGLE_FAN:
|
||||
case PIPE_PRIM_QUADS:
|
||||
case PIPE_PRIM_QUAD_STRIP:
|
||||
if ((hw_mask & (1<<PIPE_PRIM_QUADS)) && pv_matches)
|
||||
return PIPE_PRIM_QUADS;
|
||||
case MESA_PRIM_POINTS:
|
||||
return MESA_PRIM_POINTS;
|
||||
case MESA_PRIM_LINES:
|
||||
case MESA_PRIM_LINE_STRIP:
|
||||
case MESA_PRIM_LINE_LOOP:
|
||||
return MESA_PRIM_LINES;
|
||||
case MESA_PRIM_TRIANGLES:
|
||||
case MESA_PRIM_TRIANGLE_STRIP:
|
||||
case MESA_PRIM_TRIANGLE_FAN:
|
||||
case MESA_PRIM_QUADS:
|
||||
case MESA_PRIM_QUAD_STRIP:
|
||||
if ((hw_mask & (1<<MESA_PRIM_QUADS)) && pv_matches)
|
||||
return MESA_PRIM_QUADS;
|
||||
else
|
||||
return PIPE_PRIM_TRIANGLES;
|
||||
case PIPE_PRIM_POLYGON:
|
||||
return PIPE_PRIM_TRIANGLES;
|
||||
case PIPE_PRIM_LINES_ADJACENCY:
|
||||
case PIPE_PRIM_LINE_STRIP_ADJACENCY:
|
||||
return PIPE_PRIM_LINES_ADJACENCY;
|
||||
case PIPE_PRIM_TRIANGLES_ADJACENCY:
|
||||
case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
|
||||
return PIPE_PRIM_TRIANGLES_ADJACENCY;
|
||||
case PIPE_PRIM_PATCHES:
|
||||
return PIPE_PRIM_PATCHES;
|
||||
return MESA_PRIM_TRIANGLES;
|
||||
case MESA_PRIM_POLYGON:
|
||||
return MESA_PRIM_TRIANGLES;
|
||||
case MESA_PRIM_LINES_ADJACENCY:
|
||||
case MESA_PRIM_LINE_STRIP_ADJACENCY:
|
||||
return MESA_PRIM_LINES_ADJACENCY;
|
||||
case MESA_PRIM_TRIANGLES_ADJACENCY:
|
||||
case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY:
|
||||
return MESA_PRIM_TRIANGLES_ADJACENCY;
|
||||
case MESA_PRIM_PATCHES:
|
||||
return MESA_PRIM_PATCHES;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
return PIPE_PRIM_POINTS;
|
||||
return MESA_PRIM_POINTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate indexes when a driver can't support certain types
|
||||
* of drawing. Example include:
|
||||
* - Translate 1-byte indexes into 2-byte indexes
|
||||
* - Translate PIPE_PRIM_QUADS into PIPE_PRIM_TRIANGLES when the hardware
|
||||
* - Translate MESA_PRIM_QUADS into MESA_PRIM_TRIANGLES when the hardware
|
||||
* doesn't support the former.
|
||||
* - Translate from first provoking vertex to last provoking vertex and
|
||||
* vice versa.
|
||||
*
|
||||
* Note that this function is used for indexed primitives.
|
||||
*
|
||||
* \param hw_mask mask of (1 << PIPE_PRIM_x) flags indicating which types
|
||||
* \param hw_mask mask of (1 << MESA_PRIM_x) flags indicating which types
|
||||
* of primitives are supported by the hardware.
|
||||
* \param prim incoming PIPE_PRIM_x
|
||||
* \param prim incoming MESA_PRIM_x
|
||||
* \param in_index_size bytes per index value (1, 2 or 4)
|
||||
* \param nr number of incoming vertices
|
||||
* \param in_pv incoming provoking vertex convention (PV_FIRST or PV_LAST)
|
||||
* \param out_pv desired provoking vertex convention (PV_FIRST or PV_LAST)
|
||||
* \param prim_restart whether primitive restart is disable or enabled
|
||||
* \param out_prim returns new PIPE_PRIM_x we'll translate to
|
||||
* \param out_prim returns new MESA_PRIM_x we'll translate to
|
||||
* \param out_index_size returns bytes per new index value (2 or 4)
|
||||
* \param out_nr returns number of new vertices
|
||||
* \param out_translate returns the translation function to use by the caller
|
||||
*/
|
||||
enum indices_mode
|
||||
u_index_translator(unsigned hw_mask,
|
||||
enum pipe_prim_type prim,
|
||||
enum mesa_prim prim,
|
||||
unsigned in_index_size,
|
||||
unsigned nr,
|
||||
unsigned in_pv,
|
||||
unsigned out_pv,
|
||||
unsigned prim_restart,
|
||||
enum pipe_prim_type *out_prim,
|
||||
enum mesa_prim *out_prim,
|
||||
unsigned *out_index_size,
|
||||
unsigned *out_nr,
|
||||
u_translate_func *out_translate)
|
||||
@@ -145,7 +145,7 @@ u_index_translator(unsigned hw_mask,
|
||||
return U_TRANSLATE_MEMCPY;
|
||||
}
|
||||
*out_prim = u_index_prim_type_convert(hw_mask, prim, in_pv == out_pv);
|
||||
*out_translate = (*out_prim == PIPE_PRIM_QUADS ? translate_quads : translate)
|
||||
*out_translate = (*out_prim == MESA_PRIM_QUADS ? translate_quads : translate)
|
||||
[in_idx][out_idx][in_pv][out_pv][prim_restart][prim];
|
||||
*out_nr = u_index_count_converted_indices(hw_mask, in_pv == out_pv, prim, nr);
|
||||
|
||||
@@ -153,40 +153,40 @@ u_index_translator(unsigned hw_mask,
|
||||
}
|
||||
|
||||
unsigned
|
||||
u_index_count_converted_indices(unsigned hw_mask, bool pv_matches, enum pipe_prim_type prim, unsigned nr)
|
||||
u_index_count_converted_indices(unsigned hw_mask, bool pv_matches, enum mesa_prim prim, unsigned nr)
|
||||
{
|
||||
if ((hw_mask & (1<<prim)) && pv_matches)
|
||||
return nr;
|
||||
|
||||
switch (prim) {
|
||||
case PIPE_PRIM_POINTS:
|
||||
case PIPE_PRIM_PATCHES:
|
||||
case MESA_PRIM_POINTS:
|
||||
case MESA_PRIM_PATCHES:
|
||||
return nr;
|
||||
case PIPE_PRIM_LINES:
|
||||
case MESA_PRIM_LINES:
|
||||
return nr;
|
||||
case PIPE_PRIM_LINE_STRIP:
|
||||
case MESA_PRIM_LINE_STRIP:
|
||||
return (nr - 1) * 2;
|
||||
case PIPE_PRIM_LINE_LOOP:
|
||||
case MESA_PRIM_LINE_LOOP:
|
||||
return nr * 2;
|
||||
case PIPE_PRIM_TRIANGLES:
|
||||
case MESA_PRIM_TRIANGLES:
|
||||
return nr;
|
||||
case PIPE_PRIM_TRIANGLE_STRIP:
|
||||
case MESA_PRIM_TRIANGLE_STRIP:
|
||||
return (nr - 2) * 3;
|
||||
case PIPE_PRIM_TRIANGLE_FAN:
|
||||
case MESA_PRIM_TRIANGLE_FAN:
|
||||
return (nr - 2) * 3;
|
||||
case PIPE_PRIM_QUADS:
|
||||
return ((hw_mask & (1<<PIPE_PRIM_QUADS)) && pv_matches) ? nr : (nr / 4) * 6;
|
||||
case PIPE_PRIM_QUAD_STRIP:
|
||||
return ((hw_mask & (1<<PIPE_PRIM_QUADS)) && pv_matches) ? (nr - 2) * 2 : (nr - 2) * 3;
|
||||
case PIPE_PRIM_POLYGON:
|
||||
case MESA_PRIM_QUADS:
|
||||
return ((hw_mask & (1<<MESA_PRIM_QUADS)) && pv_matches) ? nr : (nr / 4) * 6;
|
||||
case MESA_PRIM_QUAD_STRIP:
|
||||
return ((hw_mask & (1<<MESA_PRIM_QUADS)) && pv_matches) ? (nr - 2) * 2 : (nr - 2) * 3;
|
||||
case MESA_PRIM_POLYGON:
|
||||
return (nr - 2) * 3;
|
||||
case PIPE_PRIM_LINES_ADJACENCY:
|
||||
case MESA_PRIM_LINES_ADJACENCY:
|
||||
return nr;
|
||||
case PIPE_PRIM_LINE_STRIP_ADJACENCY:
|
||||
case MESA_PRIM_LINE_STRIP_ADJACENCY:
|
||||
return (nr - 3) * 4;
|
||||
case PIPE_PRIM_TRIANGLES_ADJACENCY:
|
||||
case MESA_PRIM_TRIANGLES_ADJACENCY:
|
||||
return nr;
|
||||
case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
|
||||
case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY:
|
||||
return ((nr - 4) / 2) * 6;
|
||||
default:
|
||||
assert(0);
|
||||
@@ -198,17 +198,17 @@ u_index_count_converted_indices(unsigned hw_mask, bool pv_matches, enum pipe_pri
|
||||
|
||||
/**
|
||||
* If a driver does not support a particular gallium primitive type
|
||||
* (such as PIPE_PRIM_QUAD_STRIP) this function can be used to help
|
||||
* convert the primitive into a simpler type (like PIPE_PRIM_TRIANGLES).
|
||||
* (such as MESA_PRIM_QUAD_STRIP) this function can be used to help
|
||||
* convert the primitive into a simpler type (like MESA_PRIM_TRIANGLES).
|
||||
*
|
||||
* The generator functions generates a number of ushort or uint indexes
|
||||
* for drawing the new type of primitive.
|
||||
*
|
||||
* Note that this function is used for non-indexed primitives.
|
||||
*
|
||||
* \param hw_mask a bitmask of (1 << PIPE_PRIM_x) values that indicates
|
||||
* \param hw_mask a bitmask of (1 << MESA_PRIM_x) values that indicates
|
||||
* kind of primitives are supported by the driver.
|
||||
* \param prim the PIPE_PRIM_x that the user wants to draw
|
||||
* \param prim the MESA_PRIM_x that the user wants to draw
|
||||
* \param start index of first vertex to draw
|
||||
* \param nr number of vertices to draw
|
||||
* \param in_pv user's provoking vertex (PV_FIRST/LAST)
|
||||
@@ -220,12 +220,12 @@ u_index_count_converted_indices(unsigned hw_mask, bool pv_matches, enum pipe_pri
|
||||
*/
|
||||
enum indices_mode
|
||||
u_index_generator(unsigned hw_mask,
|
||||
enum pipe_prim_type prim,
|
||||
enum mesa_prim prim,
|
||||
unsigned start,
|
||||
unsigned nr,
|
||||
unsigned in_pv,
|
||||
unsigned out_pv,
|
||||
enum pipe_prim_type *out_prim,
|
||||
enum mesa_prim *out_prim,
|
||||
unsigned *out_index_size,
|
||||
unsigned *out_nr,
|
||||
u_generate_func *out_generate)
|
||||
@@ -242,11 +242,11 @@ u_index_generator(unsigned hw_mask,
|
||||
if ((hw_mask & (1<<prim)) &&
|
||||
(in_pv == out_pv)) {
|
||||
|
||||
*out_generate = (*out_prim == PIPE_PRIM_QUADS ? generate_quads : generate)
|
||||
[out_idx][in_pv][out_pv][PIPE_PRIM_POINTS];
|
||||
*out_generate = (*out_prim == MESA_PRIM_QUADS ? generate_quads : generate)
|
||||
[out_idx][in_pv][out_pv][MESA_PRIM_POINTS];
|
||||
return U_GENERATE_LINEAR;
|
||||
}
|
||||
*out_generate = (*out_prim == PIPE_PRIM_QUADS ? generate_quads : generate)
|
||||
*out_generate = (*out_prim == MESA_PRIM_QUADS ? generate_quads : generate)
|
||||
[out_idx][in_pv][out_pv][prim];
|
||||
return prim == PIPE_PRIM_LINE_LOOP ? U_GENERATE_ONE_OFF : U_GENERATE_REUSABLE;
|
||||
return prim == MESA_PRIM_LINE_LOOP ? U_GENERATE_ONE_OFF : U_GENERATE_REUSABLE;
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ enum indices_mode {
|
||||
void u_index_init( void );
|
||||
|
||||
/* returns the primitive type resulting from index translation */
|
||||
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);
|
||||
|
||||
static inline unsigned
|
||||
u_index_size_convert(unsigned index_size)
|
||||
@@ -93,25 +93,25 @@ u_index_size_convert(unsigned index_size)
|
||||
}
|
||||
|
||||
unsigned
|
||||
u_index_count_converted_indices(unsigned hw_mask, bool pv_matches, enum pipe_prim_type prim, unsigned nr);
|
||||
u_index_count_converted_indices(unsigned hw_mask, bool pv_matches, enum mesa_prim prim, unsigned nr);
|
||||
|
||||
/**
|
||||
* For indexed drawing, this function determines what kind of primitive
|
||||
* transformation is needed (if any) for handling:
|
||||
* - unsupported primitive types (such as PIPE_PRIM_POLYGON)
|
||||
* - unsupported primitive types (such as MESA_PRIM_POLYGON)
|
||||
* - changing the provoking vertex
|
||||
* - primitive restart
|
||||
* - index size (1 byte, 2 byte or 4 byte indexes)
|
||||
*/
|
||||
enum indices_mode
|
||||
u_index_translator(unsigned hw_mask,
|
||||
enum pipe_prim_type prim,
|
||||
enum mesa_prim prim,
|
||||
unsigned in_index_size,
|
||||
unsigned nr,
|
||||
unsigned in_pv, /* API */
|
||||
unsigned out_pv, /* hardware */
|
||||
unsigned prim_restart,
|
||||
enum pipe_prim_type *out_prim,
|
||||
enum mesa_prim *out_prim,
|
||||
unsigned *out_index_size,
|
||||
unsigned *out_nr,
|
||||
u_translate_func *out_translate);
|
||||
@@ -128,12 +128,12 @@ u_index_translator(unsigned hw_mask,
|
||||
*/
|
||||
enum indices_mode
|
||||
u_index_generator(unsigned hw_mask,
|
||||
enum pipe_prim_type prim,
|
||||
enum mesa_prim prim,
|
||||
unsigned start,
|
||||
unsigned nr,
|
||||
unsigned in_pv, /* API */
|
||||
unsigned out_pv, /* hardware */
|
||||
enum pipe_prim_type *out_prim,
|
||||
enum mesa_prim *out_prim,
|
||||
unsigned *out_index_size,
|
||||
unsigned *out_nr,
|
||||
u_generate_func *out_generate);
|
||||
@@ -148,11 +148,11 @@ void u_unfilled_init( void );
|
||||
* points.
|
||||
*/
|
||||
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);
|
||||
@@ -161,11 +161,11 @@ u_unfilled_translator(enum pipe_prim_type prim,
|
||||
* As above, but for non-indexed (array) primitives.
|
||||
*/
|
||||
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);
|
||||
|
||||
@@ -53,20 +53,20 @@ PRIMS=('points',
|
||||
|
||||
OUT_TRIS, OUT_QUADS = 'tris', 'quads'
|
||||
|
||||
LONGPRIMS=('PIPE_PRIM_POINTS',
|
||||
'PIPE_PRIM_LINES',
|
||||
'PIPE_PRIM_LINE_STRIP',
|
||||
'PIPE_PRIM_LINE_LOOP',
|
||||
'PIPE_PRIM_TRIANGLES',
|
||||
'PIPE_PRIM_TRIANGLE_FAN',
|
||||
'PIPE_PRIM_TRIANGLE_STRIP',
|
||||
'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')
|
||||
LONGPRIMS=('MESA_PRIM_POINTS',
|
||||
'MESA_PRIM_LINES',
|
||||
'MESA_PRIM_LINE_STRIP',
|
||||
'MESA_PRIM_LINE_LOOP',
|
||||
'MESA_PRIM_TRIANGLES',
|
||||
'MESA_PRIM_TRIANGLE_FAN',
|
||||
'MESA_PRIM_TRIANGLE_STRIP',
|
||||
'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')
|
||||
|
||||
longprim = dict(zip(PRIMS, LONGPRIMS))
|
||||
intype_idx = dict(ubyte='IN_UBYTE', ushort='IN_USHORT', uint='IN_UINT')
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#define OUT_COUNT 2
|
||||
|
||||
|
||||
#define PRIM_COUNT (PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY + 1)
|
||||
#define PRIM_COUNT (MESA_PRIM_TRIANGLE_STRIP_ADJACENCY + 1)
|
||||
|
||||
static void translate_memcpy_uint( const void *in,
|
||||
unsigned start,
|
||||
|
||||
@@ -144,7 +144,7 @@ primconvert_init_draw(struct primconvert_context *pc,
|
||||
new_info->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);
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -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])) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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);
|
||||
|
||||
+122
-122
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user