mesa/*: use an internal enum for tessellation primitive types.
To avoid dragging gl.h into places it has no business being, defined tessellation primitive mode to an enum. This has a lot of fallout all over the place. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605>
This commit is contained in:
@@ -474,16 +474,16 @@ hs_emit_write_tess_factors(nir_shader *shader,
|
|||||||
unsigned outer_comps;
|
unsigned outer_comps;
|
||||||
unsigned inner_comps;
|
unsigned inner_comps;
|
||||||
|
|
||||||
switch (shader->info.tess.primitive_mode) {
|
switch (shader->info.tess._primitive_mode) {
|
||||||
case GL_ISOLINES:
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
outer_comps = 2;
|
outer_comps = 2;
|
||||||
inner_comps = 0;
|
inner_comps = 0;
|
||||||
break;
|
break;
|
||||||
case GL_TRIANGLES:
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
outer_comps = 3;
|
outer_comps = 3;
|
||||||
inner_comps = 1;
|
inner_comps = 1;
|
||||||
break;
|
break;
|
||||||
case GL_QUADS:
|
case TESS_PRIMITIVE_QUADS:
|
||||||
outer_comps = 4;
|
outer_comps = 4;
|
||||||
inner_comps = 2;
|
inner_comps = 2;
|
||||||
break;
|
break;
|
||||||
@@ -541,11 +541,11 @@ hs_emit_write_tess_factors(nir_shader *shader,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Store tess factors for the tessellator */
|
/* Store tess factors for the tessellator */
|
||||||
if (shader->info.tess.primitive_mode == GL_ISOLINES) {
|
if (shader->info.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES) {
|
||||||
/* LINES reversal */
|
/* LINES reversal */
|
||||||
nir_ssa_def *t = nir_vec2(b, nir_channel(b, tessfactors_outer, 1), nir_channel(b, tessfactors_outer, 0));
|
nir_ssa_def *t = nir_vec2(b, nir_channel(b, tessfactors_outer, 1), nir_channel(b, tessfactors_outer, 0));
|
||||||
nir_build_store_buffer_amd(b, t, tessfactor_ring, tess_factors_offset, tess_factors_base, .base = tess_factors_const_offset, .write_mask = 0x3);
|
nir_build_store_buffer_amd(b, t, tessfactor_ring, tess_factors_offset, tess_factors_base, .base = tess_factors_const_offset, .write_mask = 0x3);
|
||||||
} else if (shader->info.tess.primitive_mode == GL_TRIANGLES) {
|
} else if (shader->info.tess._primitive_mode == TESS_PRIMITIVE_TRIANGLES) {
|
||||||
nir_ssa_def *t = nir_vec4(b, nir_channel(b, tessfactors_outer, 0), nir_channel(b, tessfactors_outer, 1),
|
nir_ssa_def *t = nir_vec4(b, nir_channel(b, tessfactors_outer, 0), nir_channel(b, tessfactors_outer, 1),
|
||||||
nir_channel(b, tessfactors_outer, 2), nir_channel(b, tessfactors_inner, 0));
|
nir_channel(b, tessfactors_outer, 2), nir_channel(b, tessfactors_inner, 0));
|
||||||
nir_build_store_buffer_amd(b, t, tessfactor_ring, tess_factors_offset, tess_factors_base, .base = tess_factors_const_offset, .write_mask = 0xf);
|
nir_build_store_buffer_amd(b, t, tessfactor_ring, tess_factors_offset, tess_factors_base, .base = tess_factors_const_offset, .write_mask = 0xf);
|
||||||
|
@@ -5391,7 +5391,7 @@ visit_load_tess_coord(isel_context* ctx, nir_intrinsic_instr* instr)
|
|||||||
Operand tes_v(get_arg(ctx, ctx->args->ac.tes_v));
|
Operand tes_v(get_arg(ctx, ctx->args->ac.tes_v));
|
||||||
Operand tes_w = Operand::zero();
|
Operand tes_w = Operand::zero();
|
||||||
|
|
||||||
if (ctx->shader->info.tess.primitive_mode == GL_TRIANGLES) {
|
if (ctx->shader->info.tess._primitive_mode == TESS_PRIMITIVE_TRIANGLES) {
|
||||||
Temp tmp = bld.vop2(aco_opcode::v_add_f32, bld.def(v1), tes_u, tes_v);
|
Temp tmp = bld.vop2(aco_opcode::v_add_f32, bld.def(v1), tes_u, tes_v);
|
||||||
tmp = bld.vop2(aco_opcode::v_sub_f32, bld.def(v1), Operand::c32(0x3f800000u /* 1.0f */), tmp);
|
tmp = bld.vop2(aco_opcode::v_sub_f32, bld.def(v1), Operand::c32(0x3f800000u /* 1.0f */), tmp);
|
||||||
tes_w = Operand(tmp);
|
tes_w = Operand(tmp);
|
||||||
|
@@ -3963,7 +3963,7 @@ static void visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* For triangles, the vector should be (u, v, 1-u-v). */
|
/* For triangles, the vector should be (u, v, 1-u-v). */
|
||||||
if (ctx->info->tess.primitive_mode == GL_TRIANGLES) {
|
if (ctx->info->tess._primitive_mode == TESS_PRIMITIVE_TRIANGLES) {
|
||||||
coord[2] = LLVMBuildFSub(ctx->ac.builder, ctx->ac.f32_1,
|
coord[2] = LLVMBuildFSub(ctx->ac.builder, ctx->ac.f32_1,
|
||||||
LLVMBuildFAdd(ctx->ac.builder, coord[0], coord[1], ""), "");
|
LLVMBuildFAdd(ctx->ac.builder, coord[0], coord[1], ""), "");
|
||||||
}
|
}
|
||||||
|
@@ -1590,7 +1590,7 @@ handle_ngg_outputs_post_2(struct radv_shader_context *ctx)
|
|||||||
|
|
||||||
if (ctx->shader->info.tess.point_mode)
|
if (ctx->shader->info.tess.point_mode)
|
||||||
num_vertices = 1;
|
num_vertices = 1;
|
||||||
else if (ctx->shader->info.tess.primitive_mode == GL_ISOLINES)
|
else if (ctx->shader->info.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
num_vertices = 2;
|
num_vertices = 2;
|
||||||
else
|
else
|
||||||
num_vertices = 3;
|
num_vertices = 3;
|
||||||
|
@@ -1283,6 +1283,21 @@ radv_prim_can_use_guardband(enum VkPrimitiveTopology topology)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
si_conv_tess_prim_to_gs_out(enum tess_primitive_mode prim)
|
||||||
|
{
|
||||||
|
switch (prim) {
|
||||||
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
|
case TESS_PRIMITIVE_QUADS:
|
||||||
|
return V_028A6C_TRISTRIP;
|
||||||
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
|
return V_028A6C_LINESTRIP;
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
si_conv_gl_prim_to_gs_out(unsigned gl_prim)
|
si_conv_gl_prim_to_gs_out(unsigned gl_prim)
|
||||||
{
|
{
|
||||||
@@ -1566,7 +1581,7 @@ radv_pipeline_init_input_assembly_state(struct radv_pipeline *pipeline,
|
|||||||
pipeline->graphics.can_use_guardband = true;
|
pipeline->graphics.can_use_guardband = true;
|
||||||
} else if (radv_pipeline_has_tess(pipeline)) {
|
} else if (radv_pipeline_has_tess(pipeline)) {
|
||||||
if (!tes->info.tes.point_mode &&
|
if (!tes->info.tes.point_mode &&
|
||||||
si_conv_gl_prim_to_gs_out(tes->info.tes.primitive_mode) == V_028A6C_TRISTRIP)
|
tes->info.tes._primitive_mode != TESS_PRIMITIVE_ISOLINES)
|
||||||
pipeline->graphics.can_use_guardband = true;
|
pipeline->graphics.can_use_guardband = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2052,7 +2067,7 @@ radv_get_num_input_vertices(nir_shader **nir)
|
|||||||
|
|
||||||
if (tes->info.tess.point_mode)
|
if (tes->info.tess.point_mode)
|
||||||
return 1;
|
return 1;
|
||||||
if (tes->info.tess.primitive_mode == GL_ISOLINES)
|
if (tes->info.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
return 2;
|
return 2;
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
@@ -2988,7 +3003,7 @@ radv_determine_ngg_settings(struct radv_pipeline *pipeline,
|
|||||||
unsigned num_vertices_per_prim = si_conv_prim_to_gs_out(pipeline_key->vs.topology) + 1;
|
unsigned num_vertices_per_prim = si_conv_prim_to_gs_out(pipeline_key->vs.topology) + 1;
|
||||||
if (es_stage == MESA_SHADER_TESS_EVAL)
|
if (es_stage == MESA_SHADER_TESS_EVAL)
|
||||||
num_vertices_per_prim = nir[es_stage]->info.tess.point_mode ? 1
|
num_vertices_per_prim = nir[es_stage]->info.tess.point_mode ? 1
|
||||||
: nir[es_stage]->info.tess.primitive_mode == GL_ISOLINES ? 2
|
: nir[es_stage]->info.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES ? 2
|
||||||
: 3;
|
: 3;
|
||||||
|
|
||||||
infos[es_stage].has_ngg_culling = radv_consider_culling(
|
infos[es_stage].has_ngg_culling = radv_consider_culling(
|
||||||
@@ -3260,16 +3275,17 @@ merge_tess_info(struct shader_info *tes_info, struct shader_info *tcs_info)
|
|||||||
tcs_info->tess.spacing == tes_info->tess.spacing);
|
tcs_info->tess.spacing == tes_info->tess.spacing);
|
||||||
tes_info->tess.spacing |= tcs_info->tess.spacing;
|
tes_info->tess.spacing |= tcs_info->tess.spacing;
|
||||||
|
|
||||||
assert(tcs_info->tess.primitive_mode == 0 || tes_info->tess.primitive_mode == 0 ||
|
assert(tcs_info->tess._primitive_mode == TESS_PRIMITIVE_UNSPECIFIED ||
|
||||||
tcs_info->tess.primitive_mode == tes_info->tess.primitive_mode);
|
tes_info->tess._primitive_mode == TESS_PRIMITIVE_UNSPECIFIED ||
|
||||||
tes_info->tess.primitive_mode |= tcs_info->tess.primitive_mode;
|
tcs_info->tess._primitive_mode == tes_info->tess._primitive_mode);
|
||||||
|
tes_info->tess._primitive_mode |= tcs_info->tess._primitive_mode;
|
||||||
tes_info->tess.ccw |= tcs_info->tess.ccw;
|
tes_info->tess.ccw |= tcs_info->tess.ccw;
|
||||||
tes_info->tess.point_mode |= tcs_info->tess.point_mode;
|
tes_info->tess.point_mode |= tcs_info->tess.point_mode;
|
||||||
|
|
||||||
/* Copy the merged info back to the TCS */
|
/* Copy the merged info back to the TCS */
|
||||||
tcs_info->tess.tcs_vertices_out = tes_info->tess.tcs_vertices_out;
|
tcs_info->tess.tcs_vertices_out = tes_info->tess.tcs_vertices_out;
|
||||||
tcs_info->tess.spacing = tes_info->tess.spacing;
|
tcs_info->tess.spacing = tes_info->tess.spacing;
|
||||||
tcs_info->tess.primitive_mode = tes_info->tess.primitive_mode;
|
tcs_info->tess._primitive_mode = tes_info->tess._primitive_mode;
|
||||||
tcs_info->tess.ccw = tes_info->tess.ccw;
|
tcs_info->tess.ccw = tes_info->tess.ccw;
|
||||||
tcs_info->tess.point_mode = tes_info->tess.point_mode;
|
tcs_info->tess.point_mode = tes_info->tess.point_mode;
|
||||||
}
|
}
|
||||||
@@ -5077,16 +5093,18 @@ radv_pipeline_generate_tess_state(struct radeon_cmdbuf *ctx_cs,
|
|||||||
radeon_set_context_reg(ctx_cs, R_028B58_VGT_LS_HS_CONFIG, ls_hs_config);
|
radeon_set_context_reg(ctx_cs, R_028B58_VGT_LS_HS_CONFIG, ls_hs_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tes->info.tes.primitive_mode) {
|
switch (tes->info.tes._primitive_mode) {
|
||||||
case GL_TRIANGLES:
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
type = V_028B6C_TESS_TRIANGLE;
|
type = V_028B6C_TESS_TRIANGLE;
|
||||||
break;
|
break;
|
||||||
case GL_QUADS:
|
case TESS_PRIMITIVE_QUADS:
|
||||||
type = V_028B6C_TESS_QUAD;
|
type = V_028B6C_TESS_QUAD;
|
||||||
break;
|
break;
|
||||||
case GL_ISOLINES:
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
type = V_028B6C_TESS_ISOLINE;
|
type = V_028B6C_TESS_ISOLINE;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tes->info.tes.spacing) {
|
switch (tes->info.tes.spacing) {
|
||||||
@@ -5114,7 +5132,7 @@ radv_pipeline_generate_tess_state(struct radeon_cmdbuf *ctx_cs,
|
|||||||
|
|
||||||
if (tes->info.tes.point_mode)
|
if (tes->info.tes.point_mode)
|
||||||
topology = V_028B6C_OUTPUT_POINT;
|
topology = V_028B6C_OUTPUT_POINT;
|
||||||
else if (tes->info.tes.primitive_mode == GL_ISOLINES)
|
else if (tes->info.tes._primitive_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
topology = V_028B6C_OUTPUT_LINE;
|
topology = V_028B6C_OUTPUT_LINE;
|
||||||
else if (ccw)
|
else if (ccw)
|
||||||
topology = V_028B6C_OUTPUT_TRIANGLE_CCW;
|
topology = V_028B6C_OUTPUT_TRIANGLE_CCW;
|
||||||
@@ -5630,8 +5648,8 @@ radv_pipeline_generate_vgt_gs_out(struct radeon_cmdbuf *ctx_cs,
|
|||||||
if (pipeline->shaders[MESA_SHADER_TESS_EVAL]->info.tes.point_mode) {
|
if (pipeline->shaders[MESA_SHADER_TESS_EVAL]->info.tes.point_mode) {
|
||||||
gs_out = V_028A6C_POINTLIST;
|
gs_out = V_028A6C_POINTLIST;
|
||||||
} else {
|
} else {
|
||||||
gs_out = si_conv_gl_prim_to_gs_out(
|
gs_out = si_conv_tess_prim_to_gs_out(
|
||||||
pipeline->shaders[MESA_SHADER_TESS_EVAL]->info.tes.primitive_mode);
|
pipeline->shaders[MESA_SHADER_TESS_EVAL]->info.tes._primitive_mode);
|
||||||
}
|
}
|
||||||
} else if (radv_pipeline_has_mesh(pipeline)) {
|
} else if (radv_pipeline_has_mesh(pipeline)) {
|
||||||
gs_out =
|
gs_out =
|
||||||
|
@@ -1021,7 +1021,7 @@ void radv_lower_ngg(struct radv_device *device, struct nir_shader *nir,
|
|||||||
if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
|
if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
|
||||||
if (nir->info.tess.point_mode)
|
if (nir->info.tess.point_mode)
|
||||||
num_vertices_per_prim = 1;
|
num_vertices_per_prim = 1;
|
||||||
else if (nir->info.tess.primitive_mode == GL_ISOLINES)
|
else if (nir->info.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
num_vertices_per_prim = 2;
|
num_vertices_per_prim = 2;
|
||||||
|
|
||||||
/* Manually mark the primitive ID used, so the shader can repack it. */
|
/* Manually mark the primitive ID used, so the shader can repack it. */
|
||||||
@@ -1566,7 +1566,7 @@ radv_postprocess_config(const struct radv_device *device, const struct ac_shader
|
|||||||
|
|
||||||
bool nggc = info->has_ngg_culling; /* Culling uses GS vertex offsets 0, 1, 2. */
|
bool nggc = info->has_ngg_culling; /* Culling uses GS vertex offsets 0, 1, 2. */
|
||||||
bool tes_triangles =
|
bool tes_triangles =
|
||||||
stage == MESA_SHADER_TESS_EVAL && info->tes.primitive_mode >= 4; /* GL_TRIANGLES */
|
stage == MESA_SHADER_TESS_EVAL && info->tes._primitive_mode != TESS_PRIMITIVE_ISOLINES;
|
||||||
if (info->uses_invocation_id) {
|
if (info->uses_invocation_id) {
|
||||||
gs_vgpr_comp_cnt = 3; /* VGPR3 contains InvocationID. */
|
gs_vgpr_comp_cnt = 3; /* VGPR3 contains InvocationID. */
|
||||||
} else if (info->uses_prim_id || (es_stage == MESA_SHADER_VERTEX &&
|
} else if (info->uses_prim_id || (es_stage == MESA_SHADER_VERTEX &&
|
||||||
|
@@ -287,7 +287,7 @@ struct radv_shader_info {
|
|||||||
struct radv_vs_output_info outinfo;
|
struct radv_vs_output_info outinfo;
|
||||||
struct radv_es_output_info es_info;
|
struct radv_es_output_info es_info;
|
||||||
bool as_es;
|
bool as_es;
|
||||||
unsigned primitive_mode;
|
enum tess_primitive_mode _primitive_mode;
|
||||||
enum gl_tess_spacing spacing;
|
enum gl_tess_spacing spacing;
|
||||||
bool ccw;
|
bool ccw;
|
||||||
bool point_mode;
|
bool point_mode;
|
||||||
|
@@ -759,7 +759,7 @@ radv_nir_shader_info_pass(struct radv_device *device, const struct nir_shader *n
|
|||||||
info->gs.invocations = nir->info.gs.invocations;
|
info->gs.invocations = nir->info.gs.invocations;
|
||||||
break;
|
break;
|
||||||
case MESA_SHADER_TESS_EVAL:
|
case MESA_SHADER_TESS_EVAL:
|
||||||
info->tes.primitive_mode = nir->info.tess.primitive_mode;
|
info->tes._primitive_mode = nir->info.tess._primitive_mode;
|
||||||
info->tes.spacing = nir->info.tess.spacing;
|
info->tes.spacing = nir->info.tess.spacing;
|
||||||
info->tes.ccw = nir->info.tess.ccw;
|
info->tes.ccw = nir->info.tess.ccw;
|
||||||
info->tes.point_mode = nir->info.tess.point_mode;
|
info->tes.point_mode = nir->info.tess.point_mode;
|
||||||
|
@@ -1829,9 +1829,20 @@ set_shader_inout_layout(struct gl_shader *shader,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MESA_SHADER_TESS_EVAL:
|
case MESA_SHADER_TESS_EVAL:
|
||||||
shader->info.TessEval.PrimitiveMode = PRIM_UNKNOWN;
|
shader->info.TessEval._PrimitiveMode = TESS_PRIMITIVE_UNSPECIFIED;
|
||||||
if (state->in_qualifier->flags.q.prim_type)
|
if (state->in_qualifier->flags.q.prim_type) {
|
||||||
shader->info.TessEval.PrimitiveMode = state->in_qualifier->prim_type;
|
switch (state->in_qualifier->prim_type) {
|
||||||
|
case GL_TRIANGLES:
|
||||||
|
shader->info.TessEval._PrimitiveMode = TESS_PRIMITIVE_TRIANGLES;
|
||||||
|
break;
|
||||||
|
case GL_QUADS:
|
||||||
|
shader->info.TessEval._PrimitiveMode = TESS_PRIMITIVE_QUADS;
|
||||||
|
break;
|
||||||
|
case GL_ISOLINES:
|
||||||
|
shader->info.TessEval._PrimitiveMode = TESS_PRIMITIVE_ISOLINES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
shader->info.TessEval.Spacing = TESS_SPACING_UNSPECIFIED;
|
shader->info.TessEval.Spacing = TESS_SPACING_UNSPECIFIED;
|
||||||
if (state->in_qualifier->flags.q.vertex_spacing)
|
if (state->in_qualifier->flags.q.vertex_spacing)
|
||||||
|
@@ -1971,7 +1971,7 @@ link_tes_in_layout_qualifiers(struct gl_shader_program *prog,
|
|||||||
int point_mode = -1;
|
int point_mode = -1;
|
||||||
unsigned vertex_order = 0;
|
unsigned vertex_order = 0;
|
||||||
|
|
||||||
gl_prog->info.tess.primitive_mode = PRIM_UNKNOWN;
|
gl_prog->info.tess._primitive_mode = TESS_PRIMITIVE_UNSPECIFIED;
|
||||||
gl_prog->info.tess.spacing = TESS_SPACING_UNSPECIFIED;
|
gl_prog->info.tess.spacing = TESS_SPACING_UNSPECIFIED;
|
||||||
|
|
||||||
/* From the GLSL 4.0 spec (chapter 4.3.8.1):
|
/* From the GLSL 4.0 spec (chapter 4.3.8.1):
|
||||||
@@ -1991,16 +1991,16 @@ link_tes_in_layout_qualifiers(struct gl_shader_program *prog,
|
|||||||
for (unsigned i = 0; i < num_shaders; i++) {
|
for (unsigned i = 0; i < num_shaders; i++) {
|
||||||
struct gl_shader *shader = shader_list[i];
|
struct gl_shader *shader = shader_list[i];
|
||||||
|
|
||||||
if (shader->info.TessEval.PrimitiveMode != PRIM_UNKNOWN) {
|
if (shader->info.TessEval._PrimitiveMode != TESS_PRIMITIVE_UNSPECIFIED) {
|
||||||
if (gl_prog->info.tess.primitive_mode != PRIM_UNKNOWN &&
|
if (gl_prog->info.tess._primitive_mode != TESS_PRIMITIVE_UNSPECIFIED &&
|
||||||
gl_prog->info.tess.primitive_mode !=
|
gl_prog->info.tess._primitive_mode !=
|
||||||
shader->info.TessEval.PrimitiveMode) {
|
shader->info.TessEval._PrimitiveMode) {
|
||||||
linker_error(prog, "tessellation evaluation shader defined with "
|
linker_error(prog, "tessellation evaluation shader defined with "
|
||||||
"conflicting input primitive modes.\n");
|
"conflicting input primitive modes.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gl_prog->info.tess.primitive_mode =
|
gl_prog->info.tess._primitive_mode =
|
||||||
shader->info.TessEval.PrimitiveMode;
|
shader->info.TessEval._PrimitiveMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shader->info.TessEval.Spacing != 0) {
|
if (shader->info.TessEval.Spacing != 0) {
|
||||||
@@ -2039,7 +2039,7 @@ link_tes_in_layout_qualifiers(struct gl_shader_program *prog,
|
|||||||
* since we already know we're in the right type of shader program
|
* since we already know we're in the right type of shader program
|
||||||
* for doing it.
|
* for doing it.
|
||||||
*/
|
*/
|
||||||
if (gl_prog->info.tess.primitive_mode == PRIM_UNKNOWN) {
|
if (gl_prog->info.tess._primitive_mode == TESS_PRIMITIVE_UNSPECIFIED) {
|
||||||
linker_error(prog,
|
linker_error(prog,
|
||||||
"tessellation evaluation shader didn't declare input "
|
"tessellation evaluation shader didn't declare input "
|
||||||
"primitive modes.\n");
|
"primitive modes.\n");
|
||||||
|
@@ -994,6 +994,14 @@ enum gl_tess_spacing
|
|||||||
TESS_SPACING_FRACTIONAL_EVEN,
|
TESS_SPACING_FRACTIONAL_EVEN,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum tess_primitive_mode
|
||||||
|
{
|
||||||
|
TESS_PRIMITIVE_UNSPECIFIED,
|
||||||
|
TESS_PRIMITIVE_TRIANGLES,
|
||||||
|
TESS_PRIMITIVE_QUADS,
|
||||||
|
TESS_PRIMITIVE_ISOLINES,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A compare function enum for use in compiler lowering passes. This is in
|
* A compare function enum for use in compiler lowering passes. This is in
|
||||||
* the same order as GL's compare functions (shifted down by GL_NEVER), and is
|
* the same order as GL's compare functions (shifted down by GL_NEVER), and is
|
||||||
|
@@ -466,7 +466,7 @@ typedef struct shader_info {
|
|||||||
|
|
||||||
/* Applies to both TCS and TES. */
|
/* Applies to both TCS and TES. */
|
||||||
struct {
|
struct {
|
||||||
uint16_t primitive_mode; /* GL_TRIANGLES, GL_QUADS or GL_ISOLINES */
|
enum tess_primitive_mode _primitive_mode;
|
||||||
|
|
||||||
/** The number of vertices in the TCS output patch. */
|
/** The number of vertices in the TCS output patch. */
|
||||||
uint8_t tcs_vertices_out;
|
uint8_t tcs_vertices_out;
|
||||||
|
@@ -4265,6 +4265,23 @@ vtn_handle_barrier(struct vtn_builder *b, SpvOp opcode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum tess_primitive_mode
|
||||||
|
tess_primitive_mode_from_spv_execution_mode(struct vtn_builder *b,
|
||||||
|
SpvExecutionMode mode)
|
||||||
|
{
|
||||||
|
switch (mode) {
|
||||||
|
case SpvExecutionModeTriangles:
|
||||||
|
return TESS_PRIMITIVE_TRIANGLES;
|
||||||
|
case SpvExecutionModeQuads:
|
||||||
|
return TESS_PRIMITIVE_QUADS;
|
||||||
|
case SpvExecutionModeIsolines:
|
||||||
|
return TESS_PRIMITIVE_ISOLINES;
|
||||||
|
default:
|
||||||
|
vtn_fail("Invalid tess primitive type: %s (%u)",
|
||||||
|
spirv_executionmode_to_string(mode), mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
gl_primitive_from_spv_execution_mode(struct vtn_builder *b,
|
gl_primitive_from_spv_execution_mode(struct vtn_builder *b,
|
||||||
SpvExecutionMode mode)
|
SpvExecutionMode mode)
|
||||||
@@ -5016,8 +5033,8 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
|
|||||||
case SpvExecutionModeIsolines:
|
case SpvExecutionModeIsolines:
|
||||||
if (b->shader->info.stage == MESA_SHADER_TESS_CTRL ||
|
if (b->shader->info.stage == MESA_SHADER_TESS_CTRL ||
|
||||||
b->shader->info.stage == MESA_SHADER_TESS_EVAL) {
|
b->shader->info.stage == MESA_SHADER_TESS_EVAL) {
|
||||||
b->shader->info.tess.primitive_mode =
|
b->shader->info.tess._primitive_mode =
|
||||||
gl_primitive_from_spv_execution_mode(b, mode->exec_mode);
|
tess_primitive_mode_from_spv_execution_mode(b, mode->exec_mode);
|
||||||
} else {
|
} else {
|
||||||
vtn_assert(b->shader->info.stage == MESA_SHADER_GEOMETRY);
|
vtn_assert(b->shader->info.stage == MESA_SHADER_GEOMETRY);
|
||||||
b->shader->info.gs.vertices_in =
|
b->shader->info.gs.vertices_in =
|
||||||
|
@@ -345,14 +345,14 @@ struct ir3_shader_key {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static inline unsigned
|
static inline unsigned
|
||||||
ir3_tess_mode(unsigned gl_tess_mode)
|
ir3_tess_mode(enum tess_primitive_mode tess_mode)
|
||||||
{
|
{
|
||||||
switch (gl_tess_mode) {
|
switch (tess_mode) {
|
||||||
case GL_ISOLINES:
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
return IR3_TESS_ISOLINES;
|
return IR3_TESS_ISOLINES;
|
||||||
case GL_TRIANGLES:
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
return IR3_TESS_TRIANGLES;
|
return IR3_TESS_TRIANGLES;
|
||||||
case GL_QUADS:
|
case TESS_PRIMITIVE_QUADS:
|
||||||
return IR3_TESS_QUADS;
|
return IR3_TESS_QUADS;
|
||||||
default:
|
default:
|
||||||
unreachable("bad tessmode");
|
unreachable("bad tessmode");
|
||||||
|
@@ -1202,7 +1202,7 @@ tu6_emit_vpc(struct tu_cs *cs,
|
|||||||
uint32_t output;
|
uint32_t output;
|
||||||
if (tess_info->tess.point_mode)
|
if (tess_info->tess.point_mode)
|
||||||
output = TESS_POINTS;
|
output = TESS_POINTS;
|
||||||
else if (tess_info->tess.primitive_mode == GL_ISOLINES)
|
else if (tess_info->tess._primitive_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
output = TESS_LINES;
|
output = TESS_LINES;
|
||||||
else if (tess_info->tess.ccw)
|
else if (tess_info->tess.ccw)
|
||||||
output = TESS_CCW_TRIS;
|
output = TESS_CCW_TRIS;
|
||||||
@@ -2309,15 +2309,15 @@ tu_pipeline_shader_key_init(struct ir3_shader_key *key,
|
|||||||
static uint32_t
|
static uint32_t
|
||||||
tu6_get_tessmode(struct tu_shader* shader)
|
tu6_get_tessmode(struct tu_shader* shader)
|
||||||
{
|
{
|
||||||
uint32_t primitive_mode = shader->ir3_shader->nir->info.tess.primitive_mode;
|
enum tess_primitive_mode primitive_mode = shader->ir3_shader->nir->info.tess._primitive_mode;
|
||||||
switch (primitive_mode) {
|
switch (primitive_mode) {
|
||||||
case GL_ISOLINES:
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
return IR3_TESS_ISOLINES;
|
return IR3_TESS_ISOLINES;
|
||||||
case GL_TRIANGLES:
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
return IR3_TESS_TRIANGLES;
|
return IR3_TESS_TRIANGLES;
|
||||||
case GL_QUADS:
|
case TESS_PRIMITIVE_QUADS:
|
||||||
return IR3_TESS_QUADS;
|
return IR3_TESS_QUADS;
|
||||||
case GL_NONE:
|
case TESS_PRIMITIVE_UNSPECIFIED:
|
||||||
return IR3_TESS_NONE;
|
return IR3_TESS_NONE;
|
||||||
default:
|
default:
|
||||||
unreachable("bad tessmode");
|
unreachable("bad tessmode");
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "nir_to_tgsi_info.h"
|
#include "nir_to_tgsi_info.h"
|
||||||
#include "util/u_math.h"
|
#include "util/u_math.h"
|
||||||
|
#include "util/u_prim.h"
|
||||||
#include "nir.h"
|
#include "nir.h"
|
||||||
#include "nir_deref.h"
|
#include "nir_deref.h"
|
||||||
#include "tgsi/tgsi_scan.h"
|
#include "tgsi/tgsi_scan.h"
|
||||||
@@ -433,10 +434,7 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
|
if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
|
||||||
if (nir->info.tess.primitive_mode == GL_ISOLINES)
|
info->properties[TGSI_PROPERTY_TES_PRIM_MODE] = u_tess_prim_from_shader(nir->info.tess._primitive_mode);
|
||||||
info->properties[TGSI_PROPERTY_TES_PRIM_MODE] = PIPE_PRIM_LINES;
|
|
||||||
else
|
|
||||||
info->properties[TGSI_PROPERTY_TES_PRIM_MODE] = nir->info.tess.primitive_mode;
|
|
||||||
|
|
||||||
STATIC_ASSERT((TESS_SPACING_EQUAL + 1) % 3 == PIPE_TESS_SPACING_EQUAL);
|
STATIC_ASSERT((TESS_SPACING_EQUAL + 1) % 3 == PIPE_TESS_SPACING_EQUAL);
|
||||||
STATIC_ASSERT((TESS_SPACING_FRACTIONAL_ODD + 1) % 3 ==
|
STATIC_ASSERT((TESS_SPACING_FRACTIONAL_ODD + 1) % 3 ==
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include "util/u_inlines.h"
|
#include "util/u_inlines.h"
|
||||||
#include "util/u_memory.h"
|
#include "util/u_memory.h"
|
||||||
#include "util/u_math.h"
|
#include "util/u_math.h"
|
||||||
|
#include "util/u_prim.h"
|
||||||
#include "util/u_bitmask.h"
|
#include "util/u_bitmask.h"
|
||||||
#include "GL/gl.h"
|
#include "GL/gl.h"
|
||||||
#include "compiler/shader_info.h"
|
#include "compiler/shader_info.h"
|
||||||
@@ -2297,11 +2298,7 @@ static void
|
|||||||
ureg_setup_tess_eval_shader(struct ureg_program *ureg,
|
ureg_setup_tess_eval_shader(struct ureg_program *ureg,
|
||||||
const struct shader_info *info)
|
const struct shader_info *info)
|
||||||
{
|
{
|
||||||
if (info->tess.primitive_mode == GL_ISOLINES)
|
ureg_property(ureg, TGSI_PROPERTY_TES_PRIM_MODE, u_tess_prim_from_shader(info->tess._primitive_mode));
|
||||||
ureg_property(ureg, TGSI_PROPERTY_TES_PRIM_MODE, GL_LINES);
|
|
||||||
else
|
|
||||||
ureg_property(ureg, TGSI_PROPERTY_TES_PRIM_MODE,
|
|
||||||
info->tess.primitive_mode);
|
|
||||||
|
|
||||||
STATIC_ASSERT((TESS_SPACING_EQUAL + 1) % 3 == PIPE_TESS_SPACING_EQUAL);
|
STATIC_ASSERT((TESS_SPACING_EQUAL + 1) % 3 == PIPE_TESS_SPACING_EQUAL);
|
||||||
STATIC_ASSERT((TESS_SPACING_FRACTIONAL_ODD + 1) % 3 ==
|
STATIC_ASSERT((TESS_SPACING_FRACTIONAL_ODD + 1) % 3 ==
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "util/compiler.h"
|
#include "util/compiler.h"
|
||||||
#include "util/u_debug.h"
|
#include "util/u_debug.h"
|
||||||
|
#include "compiler/shader_enums.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -314,6 +315,21 @@ u_base_prim_type(enum pipe_prim_type prim_type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline enum pipe_prim_type
|
||||||
|
u_tess_prim_from_shader(enum tess_primitive_mode shader_mode)
|
||||||
|
{
|
||||||
|
switch (shader_mode) {
|
||||||
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
|
return PIPE_PRIM_TRIANGLES;
|
||||||
|
case TESS_PRIMITIVE_QUADS:
|
||||||
|
return PIPE_PRIM_QUADS;
|
||||||
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
|
return PIPE_PRIM_LINES;
|
||||||
|
default:
|
||||||
|
return PIPE_PRIM_POINTS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline unsigned
|
static inline unsigned
|
||||||
u_vertices_for_prims(enum pipe_prim_type prim_type, int count)
|
u_vertices_for_prims(enum pipe_prim_type prim_type, int count)
|
||||||
{
|
{
|
||||||
|
@@ -1436,19 +1436,19 @@ crocus_compile_tcs(struct crocus_context *ice,
|
|||||||
prog_data->param = rzalloc_array(mem_ctx, uint32_t, num_system_values);
|
prog_data->param = rzalloc_array(mem_ctx, uint32_t, num_system_values);
|
||||||
prog_data->nr_params = num_system_values;
|
prog_data->nr_params = num_system_values;
|
||||||
|
|
||||||
if (key->tes_primitive_mode == GL_QUADS) {
|
if (key->_tes_primitive_mode == TESS_PRIMITIVE_QUADS) {
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
system_values[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i;
|
system_values[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i;
|
||||||
|
|
||||||
system_values[3] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X;
|
system_values[3] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X;
|
||||||
system_values[2] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_Y;
|
system_values[2] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_Y;
|
||||||
} else if (key->tes_primitive_mode == GL_TRIANGLES) {
|
} else if (key->_tes_primitive_mode == TESS_PRIMITIVE_TRIANGLES) {
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
system_values[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i;
|
system_values[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i;
|
||||||
|
|
||||||
system_values[4] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X;
|
system_values[4] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X;
|
||||||
} else {
|
} else {
|
||||||
assert(key->tes_primitive_mode == GL_ISOLINES);
|
assert(key->_tes_primitive_mode == TESS_PRIMITIVE_ISOLINES);
|
||||||
system_values[7] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_Y;
|
system_values[7] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_Y;
|
||||||
system_values[6] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X;
|
system_values[6] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X;
|
||||||
}
|
}
|
||||||
@@ -1522,9 +1522,9 @@ crocus_update_compiled_tcs(struct crocus_context *ice)
|
|||||||
struct brw_tcs_prog_key key = {
|
struct brw_tcs_prog_key key = {
|
||||||
KEY_INIT_NO_ID(),
|
KEY_INIT_NO_ID(),
|
||||||
.base.program_string_id = tcs ? tcs->program_id : 0,
|
.base.program_string_id = tcs ? tcs->program_id : 0,
|
||||||
.tes_primitive_mode = tes_info->tess.primitive_mode,
|
._tes_primitive_mode = tes_info->tess._primitive_mode,
|
||||||
.input_vertices = ice->state.vertices_per_patch,
|
.input_vertices = ice->state.vertices_per_patch,
|
||||||
.quads_workaround = tes_info->tess.primitive_mode == GL_QUADS &&
|
.quads_workaround = tes_info->tess._primitive_mode == TESS_PRIMITIVE_QUADS &&
|
||||||
tes_info->tess.spacing == TESS_SPACING_EQUAL,
|
tes_info->tess.spacing == TESS_SPACING_EQUAL,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2787,13 +2787,12 @@ crocus_create_tcs_state(struct pipe_context *ctx,
|
|||||||
|
|
||||||
ish->nos |= (1ull << CROCUS_NOS_TEXTURES);
|
ish->nos |= (1ull << CROCUS_NOS_TEXTURES);
|
||||||
if (screen->precompile) {
|
if (screen->precompile) {
|
||||||
const unsigned _GL_TRIANGLES = 0x0004;
|
|
||||||
struct brw_tcs_prog_key key = {
|
struct brw_tcs_prog_key key = {
|
||||||
KEY_INIT(),
|
KEY_INIT(),
|
||||||
// XXX: make sure the linker fills this out from the TES...
|
// XXX: make sure the linker fills this out from the TES...
|
||||||
.tes_primitive_mode =
|
._tes_primitive_mode =
|
||||||
info->tess.primitive_mode ? info->tess.primitive_mode
|
info->tess._primitive_mode ? info->tess._primitive_mode
|
||||||
: _GL_TRIANGLES,
|
: TESS_PRIMITIVE_TRIANGLES,
|
||||||
.outputs_written = info->outputs_written,
|
.outputs_written = info->outputs_written,
|
||||||
.patch_outputs_written = info->patch_outputs_written,
|
.patch_outputs_written = info->patch_outputs_written,
|
||||||
};
|
};
|
||||||
|
@@ -175,7 +175,7 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
struct shader_info *ds_info = ir3_get_shader_info(emit.key.ds);
|
struct shader_info *ds_info = ir3_get_shader_info(emit.key.ds);
|
||||||
emit.key.key.tessellation = ir3_tess_mode(ds_info->tess.primitive_mode);
|
emit.key.key.tessellation = ir3_tess_mode(ds_info->tess._primitive_mode);
|
||||||
ctx->gen_dirty |= BIT(FD6_GROUP_PRIMITIVE_PARAMS);
|
ctx->gen_dirty |= BIT(FD6_GROUP_PRIMITIVE_PARAMS);
|
||||||
|
|
||||||
struct shader_info *fs_info = ir3_get_shader_info(emit.key.fs);
|
struct shader_info *fs_info = ir3_get_shader_info(emit.key.fs);
|
||||||
|
@@ -765,7 +765,7 @@ setup_stateobj(struct fd_ringbuffer *ring, struct fd_context *ctx,
|
|||||||
uint32_t output;
|
uint32_t output;
|
||||||
if (ds_info->tess.point_mode)
|
if (ds_info->tess.point_mode)
|
||||||
output = TESS_POINTS;
|
output = TESS_POINTS;
|
||||||
else if (ds_info->tess.primitive_mode == GL_ISOLINES)
|
else if (ds_info->tess._primitive_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
output = TESS_LINES;
|
output = TESS_LINES;
|
||||||
else if (ds_info->tess.ccw)
|
else if (ds_info->tess.ccw)
|
||||||
output = TESS_CCW_TRIS;
|
output = TESS_CCW_TRIS;
|
||||||
|
@@ -193,7 +193,7 @@ create_initial_variants(struct ir3_shader_state *hwcso,
|
|||||||
|
|
||||||
switch (nir->info.stage) {
|
switch (nir->info.stage) {
|
||||||
case MESA_SHADER_TESS_EVAL:
|
case MESA_SHADER_TESS_EVAL:
|
||||||
key.tessellation = ir3_tess_mode(nir->info.tess.primitive_mode);
|
key.tessellation = ir3_tess_mode(nir->info.tess._primitive_mode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MESA_SHADER_TESS_CTRL:
|
case MESA_SHADER_TESS_CTRL:
|
||||||
|
@@ -228,7 +228,7 @@ struct iris_vs_prog_key {
|
|||||||
struct iris_tcs_prog_key {
|
struct iris_tcs_prog_key {
|
||||||
struct iris_vue_prog_key vue;
|
struct iris_vue_prog_key vue;
|
||||||
|
|
||||||
uint16_t tes_primitive_mode;
|
enum tess_primitive_mode _tes_primitive_mode;
|
||||||
|
|
||||||
uint8_t input_vertices;
|
uint8_t input_vertices;
|
||||||
|
|
||||||
|
@@ -114,7 +114,7 @@ iris_to_brw_tcs_key(const struct intel_device_info *devinfo,
|
|||||||
{
|
{
|
||||||
return (struct brw_tcs_prog_key) {
|
return (struct brw_tcs_prog_key) {
|
||||||
BRW_KEY_INIT(devinfo->ver, key->vue.base.program_string_id),
|
BRW_KEY_INIT(devinfo->ver, key->vue.base.program_string_id),
|
||||||
.tes_primitive_mode = key->tes_primitive_mode,
|
._tes_primitive_mode = key->_tes_primitive_mode,
|
||||||
.input_vertices = key->input_vertices,
|
.input_vertices = key->input_vertices,
|
||||||
.patch_outputs_written = key->patch_outputs_written,
|
.patch_outputs_written = key->patch_outputs_written,
|
||||||
.outputs_written = key->outputs_written,
|
.outputs_written = key->outputs_written,
|
||||||
@@ -1523,19 +1523,19 @@ iris_compile_tcs(struct iris_screen *screen,
|
|||||||
prog_data->param = rzalloc_array(mem_ctx, uint32_t, num_system_values);
|
prog_data->param = rzalloc_array(mem_ctx, uint32_t, num_system_values);
|
||||||
prog_data->nr_params = num_system_values;
|
prog_data->nr_params = num_system_values;
|
||||||
|
|
||||||
if (key->tes_primitive_mode == GL_QUADS) {
|
if (key->_tes_primitive_mode == TESS_PRIMITIVE_QUADS) {
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
system_values[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i;
|
system_values[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i;
|
||||||
|
|
||||||
system_values[3] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X;
|
system_values[3] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X;
|
||||||
system_values[2] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_Y;
|
system_values[2] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_Y;
|
||||||
} else if (key->tes_primitive_mode == GL_TRIANGLES) {
|
} else if (key->_tes_primitive_mode == TESS_PRIMITIVE_TRIANGLES) {
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
system_values[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i;
|
system_values[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i;
|
||||||
|
|
||||||
system_values[4] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X;
|
system_values[4] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X;
|
||||||
} else {
|
} else {
|
||||||
assert(key->tes_primitive_mode == GL_ISOLINES);
|
assert(key->_tes_primitive_mode == TESS_PRIMITIVE_ISOLINES);
|
||||||
system_values[7] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_Y;
|
system_values[7] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_Y;
|
||||||
system_values[6] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X;
|
system_values[6] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X;
|
||||||
}
|
}
|
||||||
@@ -1603,11 +1603,11 @@ iris_update_compiled_tcs(struct iris_context *ice)
|
|||||||
iris_get_shader_info(ice, MESA_SHADER_TESS_EVAL);
|
iris_get_shader_info(ice, MESA_SHADER_TESS_EVAL);
|
||||||
struct iris_tcs_prog_key key = {
|
struct iris_tcs_prog_key key = {
|
||||||
.vue.base.program_string_id = tcs ? tcs->program_id : 0,
|
.vue.base.program_string_id = tcs ? tcs->program_id : 0,
|
||||||
.tes_primitive_mode = tes_info->tess.primitive_mode,
|
._tes_primitive_mode = tes_info->tess._primitive_mode,
|
||||||
.input_vertices =
|
.input_vertices =
|
||||||
!tcs || compiler->use_tcs_8_patch ? ice->state.vertices_per_patch : 0,
|
!tcs || compiler->use_tcs_8_patch ? ice->state.vertices_per_patch : 0,
|
||||||
.quads_workaround = devinfo->ver < 9 &&
|
.quads_workaround = devinfo->ver < 9 &&
|
||||||
tes_info->tess.primitive_mode == GL_QUADS &&
|
tes_info->tess._primitive_mode == TESS_PRIMITIVE_QUADS &&
|
||||||
tes_info->tess.spacing == TESS_SPACING_EQUAL,
|
tes_info->tess.spacing == TESS_SPACING_EQUAL,
|
||||||
};
|
};
|
||||||
get_unified_tess_slots(ice, &key.outputs_written,
|
get_unified_tess_slots(ice, &key.outputs_written,
|
||||||
@@ -2604,14 +2604,12 @@ iris_create_shader_state(struct pipe_context *ctx,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MESA_SHADER_TESS_CTRL: {
|
case MESA_SHADER_TESS_CTRL: {
|
||||||
const unsigned _GL_TRIANGLES = 0x0004;
|
|
||||||
|
|
||||||
key.tcs = (struct iris_tcs_prog_key) {
|
key.tcs = (struct iris_tcs_prog_key) {
|
||||||
KEY_ID(vue.base),
|
KEY_ID(vue.base),
|
||||||
// XXX: make sure the linker fills this out from the TES...
|
// XXX: make sure the linker fills this out from the TES...
|
||||||
.tes_primitive_mode =
|
._tes_primitive_mode =
|
||||||
info->tess.primitive_mode ? info->tess.primitive_mode
|
info->tess._primitive_mode ? info->tess._primitive_mode
|
||||||
: _GL_TRIANGLES,
|
: TESS_PRIMITIVE_TRIANGLES,
|
||||||
.outputs_written = info->outputs_written,
|
.outputs_written = info->outputs_written,
|
||||||
.patch_outputs_written = info->patch_outputs_written,
|
.patch_outputs_written = info->patch_outputs_written,
|
||||||
};
|
};
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "compiler/nir/nir.h"
|
#include "compiler/nir/nir.h"
|
||||||
|
|
||||||
#include "util/u_debug.h"
|
#include "util/u_debug.h"
|
||||||
|
#include "util/u_prim.h"
|
||||||
|
|
||||||
#include "codegen/nv50_ir.h"
|
#include "codegen/nv50_ir.h"
|
||||||
#include "codegen/nv50_ir_from_common.h"
|
#include "codegen/nv50_ir_from_common.h"
|
||||||
@@ -1325,10 +1326,7 @@ Converter::parseNIR()
|
|||||||
break;
|
break;
|
||||||
case Program::TYPE_TESSELLATION_CONTROL:
|
case Program::TYPE_TESSELLATION_CONTROL:
|
||||||
case Program::TYPE_TESSELLATION_EVAL:
|
case Program::TYPE_TESSELLATION_EVAL:
|
||||||
if (nir->info.tess.primitive_mode == GL_ISOLINES)
|
info_out->prop.tp.domain = u_tess_prim_from_shader(nir->info.tess._primitive_mode);
|
||||||
info_out->prop.tp.domain = GL_LINES;
|
|
||||||
else
|
|
||||||
info_out->prop.tp.domain = nir->info.tess.primitive_mode;
|
|
||||||
info_out->prop.tp.outputPatchSize = nir->info.tess.tcs_vertices_out;
|
info_out->prop.tp.outputPatchSize = nir->info.tess.tcs_vertices_out;
|
||||||
info_out->prop.tp.outputPrim =
|
info_out->prop.tp.outputPrim =
|
||||||
nir->info.tess.point_mode ? PIPE_PRIM_POINTS : PIPE_PRIM_TRIANGLES;
|
nir->info.tess.point_mode ? PIPE_PRIM_POINTS : PIPE_PRIM_TRIANGLES;
|
||||||
|
@@ -30,6 +30,8 @@
|
|||||||
#include "../r600_pipe.h"
|
#include "../r600_pipe.h"
|
||||||
#include "../r600_shader.h"
|
#include "../r600_shader.h"
|
||||||
|
|
||||||
|
#include "util/u_prim.h"
|
||||||
|
|
||||||
#include "sfn_instruction_tex.h"
|
#include "sfn_instruction_tex.h"
|
||||||
|
|
||||||
#include "sfn_shader_vertex.h"
|
#include "sfn_shader_vertex.h"
|
||||||
@@ -901,7 +903,7 @@ int r600_shader_from_nir(struct r600_context *rctx,
|
|||||||
sh->info.stage == MESA_SHADER_TESS_EVAL ||
|
sh->info.stage == MESA_SHADER_TESS_EVAL ||
|
||||||
(sh->info.stage == MESA_SHADER_VERTEX && key->vs.as_ls)) {
|
(sh->info.stage == MESA_SHADER_VERTEX && key->vs.as_ls)) {
|
||||||
auto prim_type = sh->info.stage == MESA_SHADER_TESS_EVAL ?
|
auto prim_type = sh->info.stage == MESA_SHADER_TESS_EVAL ?
|
||||||
sh->info.tess.primitive_mode: key->tcs.prim_mode;
|
u_tess_prim_from_shader(sh->info.tess._primitive_mode) : key->tcs.prim_mode;
|
||||||
NIR_PASS_V(sh, r600_lower_tess_io, static_cast<pipe_prim_type>(prim_type));
|
NIR_PASS_V(sh, r600_lower_tess_io, static_cast<pipe_prim_type>(prim_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -909,9 +911,9 @@ int r600_shader_from_nir(struct r600_context *rctx,
|
|||||||
NIR_PASS_V(sh, r600_append_tcs_TF_emission,
|
NIR_PASS_V(sh, r600_append_tcs_TF_emission,
|
||||||
(pipe_prim_type)key->tcs.prim_mode);
|
(pipe_prim_type)key->tcs.prim_mode);
|
||||||
|
|
||||||
if (sh->info.stage == MESA_SHADER_TESS_EVAL)
|
if (sh->info.stage == MESA_SHADER_TESS_EVAL) {
|
||||||
NIR_PASS_V(sh, r600_lower_tess_coord,
|
NIR_PASS_V(sh, r600_lower_tess_coord, u_tess_prim_from_shader(sh->info.tess._primitive_mode));
|
||||||
static_cast<pipe_prim_type>(sh->info.tess.primitive_mode));
|
}
|
||||||
|
|
||||||
NIR_PASS_V(sh, nir_lower_ubo_vec4);
|
NIR_PASS_V(sh, nir_lower_ubo_vec4);
|
||||||
if (lower_64bit)
|
if (lower_64bit)
|
||||||
|
@@ -105,7 +105,7 @@ static LLVMValueRef ngg_get_vertices_per_prim(struct si_shader_context *ctx, uns
|
|||||||
|
|
||||||
if (info->base.tess.point_mode)
|
if (info->base.tess.point_mode)
|
||||||
*num_vertices = 1;
|
*num_vertices = 1;
|
||||||
else if (info->base.tess.primitive_mode == GL_LINES)
|
else if (info->base.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
*num_vertices = 2;
|
*num_vertices = 2;
|
||||||
else
|
else
|
||||||
*num_vertices = 3;
|
*num_vertices = 3;
|
||||||
|
@@ -579,11 +579,6 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
|
|
||||||
if (info->base.tess.primitive_mode == GL_ISOLINES)
|
|
||||||
info->base.tess.primitive_mode = GL_LINES;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
|
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
|
||||||
/* post_depth_coverage implies early_fragment_tests */
|
/* post_depth_coverage implies early_fragment_tests */
|
||||||
info->base.fs.early_fragment_tests |= info->base.fs.post_depth_coverage;
|
info->base.fs.early_fragment_tests |= info->base.fs.post_depth_coverage;
|
||||||
|
@@ -693,17 +693,17 @@ static void si_write_tess_factors(struct si_shader_context *ctx, LLVMValueRef re
|
|||||||
|
|
||||||
/* Determine the layout of one tess factor element in the buffer. */
|
/* Determine the layout of one tess factor element in the buffer. */
|
||||||
switch (shader->key.ge.part.tcs.epilog.prim_mode) {
|
switch (shader->key.ge.part.tcs.epilog.prim_mode) {
|
||||||
case GL_LINES:
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
stride = 2; /* 2 dwords, 1 vec2 store */
|
stride = 2; /* 2 dwords, 1 vec2 store */
|
||||||
outer_comps = 2;
|
outer_comps = 2;
|
||||||
inner_comps = 0;
|
inner_comps = 0;
|
||||||
break;
|
break;
|
||||||
case GL_TRIANGLES:
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
stride = 4; /* 4 dwords, 1 vec4 store */
|
stride = 4; /* 4 dwords, 1 vec4 store */
|
||||||
outer_comps = 3;
|
outer_comps = 3;
|
||||||
inner_comps = 1;
|
inner_comps = 1;
|
||||||
break;
|
break;
|
||||||
case GL_QUADS:
|
case TESS_PRIMITIVE_QUADS:
|
||||||
stride = 6; /* 6 dwords, 2 stores (vec4 + vec2) */
|
stride = 6; /* 6 dwords, 2 stores (vec4 + vec2) */
|
||||||
outer_comps = 4;
|
outer_comps = 4;
|
||||||
inner_comps = 2;
|
inner_comps = 2;
|
||||||
@@ -745,7 +745,7 @@ static void si_write_tess_factors(struct si_shader_context *ctx, LLVMValueRef re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shader->key.ge.part.tcs.epilog.prim_mode == GL_LINES) {
|
if (shader->key.ge.part.tcs.epilog.prim_mode == TESS_PRIMITIVE_ISOLINES) {
|
||||||
/* For isolines, the hardware expects tess factors in the
|
/* For isolines, the hardware expects tess factors in the
|
||||||
* reverse order from what NIR specifies.
|
* reverse order from what NIR specifies.
|
||||||
*/
|
*/
|
||||||
|
@@ -515,20 +515,20 @@ static void si_set_tesseval_regs(struct si_screen *sscreen, const struct si_shad
|
|||||||
struct si_shader *shader)
|
struct si_shader *shader)
|
||||||
{
|
{
|
||||||
const struct si_shader_info *info = &tes->info;
|
const struct si_shader_info *info = &tes->info;
|
||||||
unsigned tes_prim_mode = info->base.tess.primitive_mode;
|
enum tess_primitive_mode tes_prim_mode = info->base.tess._primitive_mode;
|
||||||
unsigned tes_spacing = info->base.tess.spacing;
|
unsigned tes_spacing = info->base.tess.spacing;
|
||||||
bool tes_vertex_order_cw = !info->base.tess.ccw;
|
bool tes_vertex_order_cw = !info->base.tess.ccw;
|
||||||
bool tes_point_mode = info->base.tess.point_mode;
|
bool tes_point_mode = info->base.tess.point_mode;
|
||||||
unsigned type, partitioning, topology, distribution_mode;
|
unsigned type, partitioning, topology, distribution_mode;
|
||||||
|
|
||||||
switch (tes_prim_mode) {
|
switch (tes_prim_mode) {
|
||||||
case GL_LINES:
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
type = V_028B6C_TESS_ISOLINE;
|
type = V_028B6C_TESS_ISOLINE;
|
||||||
break;
|
break;
|
||||||
case GL_TRIANGLES:
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
type = V_028B6C_TESS_TRIANGLE;
|
type = V_028B6C_TESS_TRIANGLE;
|
||||||
break;
|
break;
|
||||||
case GL_QUADS:
|
case TESS_PRIMITIVE_QUADS:
|
||||||
type = V_028B6C_TESS_QUAD;
|
type = V_028B6C_TESS_QUAD;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -553,7 +553,7 @@ static void si_set_tesseval_regs(struct si_screen *sscreen, const struct si_shad
|
|||||||
|
|
||||||
if (tes_point_mode)
|
if (tes_point_mode)
|
||||||
topology = V_028B6C_OUTPUT_POINT;
|
topology = V_028B6C_OUTPUT_POINT;
|
||||||
else if (tes_prim_mode == GL_LINES)
|
else if (tes_prim_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
topology = V_028B6C_OUTPUT_LINE;
|
topology = V_028B6C_OUTPUT_LINE;
|
||||||
else if (tes_vertex_order_cw)
|
else if (tes_vertex_order_cw)
|
||||||
/* for some reason, this must be the other way around */
|
/* for some reason, this must be the other way around */
|
||||||
@@ -1272,7 +1272,7 @@ unsigned si_get_input_prim(const struct si_shader_selector *gs, const union si_s
|
|||||||
if (gs->info.stage == MESA_SHADER_TESS_EVAL) {
|
if (gs->info.stage == MESA_SHADER_TESS_EVAL) {
|
||||||
if (gs->info.base.tess.point_mode)
|
if (gs->info.base.tess.point_mode)
|
||||||
return PIPE_PRIM_POINTS;
|
return PIPE_PRIM_POINTS;
|
||||||
if (gs->info.base.tess.primitive_mode == GL_LINES)
|
if (gs->info.base.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
return PIPE_PRIM_LINES;
|
return PIPE_PRIM_LINES;
|
||||||
return PIPE_PRIM_TRIANGLES;
|
return PIPE_PRIM_TRIANGLES;
|
||||||
}
|
}
|
||||||
@@ -3151,7 +3151,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
|
|||||||
if (sel->info.stage == MESA_SHADER_TESS_EVAL) {
|
if (sel->info.stage == MESA_SHADER_TESS_EVAL) {
|
||||||
if (sel->info.base.tess.point_mode)
|
if (sel->info.base.tess.point_mode)
|
||||||
sel->rast_prim = PIPE_PRIM_POINTS;
|
sel->rast_prim = PIPE_PRIM_POINTS;
|
||||||
else if (sel->info.base.tess.primitive_mode == GL_LINES)
|
else if (sel->info.base.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
sel->rast_prim = PIPE_PRIM_LINE_STRIP;
|
sel->rast_prim = PIPE_PRIM_LINE_STRIP;
|
||||||
else
|
else
|
||||||
sel->rast_prim = PIPE_PRIM_TRIANGLES;
|
sel->rast_prim = PIPE_PRIM_TRIANGLES;
|
||||||
@@ -3532,7 +3532,7 @@ static void si_bind_tes_shader(struct pipe_context *ctx, void *state)
|
|||||||
|
|
||||||
sctx->shader.tcs.key.ge.part.tcs.epilog.prim_mode =
|
sctx->shader.tcs.key.ge.part.tcs.epilog.prim_mode =
|
||||||
sctx->fixed_func_tcs_shader.key.ge.part.tcs.epilog.prim_mode =
|
sctx->fixed_func_tcs_shader.key.ge.part.tcs.epilog.prim_mode =
|
||||||
sel ? sel->info.base.tess.primitive_mode : 0;
|
sel ? sel->info.base.tess._primitive_mode : 0;
|
||||||
|
|
||||||
sctx->shader.tcs.key.ge.part.tcs.epilog.tes_reads_tess_factors =
|
sctx->shader.tcs.key.ge.part.tcs.epilog.tes_reads_tess_factors =
|
||||||
sctx->fixed_func_tcs_shader.key.ge.part.tcs.epilog.tes_reads_tess_factors =
|
sctx->fixed_func_tcs_shader.key.ge.part.tcs.epilog.tes_reads_tess_factors =
|
||||||
|
@@ -3529,12 +3529,12 @@ get_depth_layout_mode(enum gl_frag_depth_layout depth_layout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static SpvExecutionMode
|
static SpvExecutionMode
|
||||||
get_primitive_mode(uint16_t primitive_mode)
|
get_primitive_mode(enum tess_primitive_mode primitive_mode)
|
||||||
{
|
{
|
||||||
switch (primitive_mode) {
|
switch (primitive_mode) {
|
||||||
case GL_TRIANGLES: return SpvExecutionModeTriangles;
|
case TESS_PRIMITIVE_TRIANGLES: return SpvExecutionModeTriangles;
|
||||||
case GL_QUADS: return SpvExecutionModeQuads;
|
case TESS_PRIMITIVE_QUADS: return SpvExecutionModeQuads;
|
||||||
case GL_ISOLINES: return SpvExecutionModeIsolines;
|
case TESS_PRIMITIVE_ISOLINES: return SpvExecutionModeIsolines;
|
||||||
default:
|
default:
|
||||||
unreachable("unknown tess prim type!");
|
unreachable("unknown tess prim type!");
|
||||||
}
|
}
|
||||||
@@ -3781,7 +3781,7 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info, uint32_t
|
|||||||
break;
|
break;
|
||||||
case MESA_SHADER_TESS_EVAL:
|
case MESA_SHADER_TESS_EVAL:
|
||||||
spirv_builder_emit_exec_mode(&ctx.builder, entry_point,
|
spirv_builder_emit_exec_mode(&ctx.builder, entry_point,
|
||||||
get_primitive_mode(s->info.tess.primitive_mode));
|
get_primitive_mode(s->info.tess._primitive_mode));
|
||||||
spirv_builder_emit_exec_mode(&ctx.builder, entry_point,
|
spirv_builder_emit_exec_mode(&ctx.builder, entry_point,
|
||||||
s->info.tess.ccw ? SpvExecutionModeVertexOrderCcw
|
s->info.tess.ccw ? SpvExecutionModeVertexOrderCcw
|
||||||
: SpvExecutionModeVertexOrderCw);
|
: SpvExecutionModeVertexOrderCw);
|
||||||
|
@@ -1623,6 +1623,17 @@ gl_prim_to_pipe(unsigned primitive_type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum pipe_prim_type
|
||||||
|
tess_prim_to_pipe(enum tess_primitive_mode prim_mode)
|
||||||
|
{
|
||||||
|
switch (prim_mode) {
|
||||||
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
|
return PIPE_PRIM_LINES;
|
||||||
|
default:
|
||||||
|
return PIPE_PRIM_TRIANGLES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static enum pipe_prim_type
|
static enum pipe_prim_type
|
||||||
get_shader_base_prim_type(struct nir_shader *nir)
|
get_shader_base_prim_type(struct nir_shader *nir)
|
||||||
{
|
{
|
||||||
@@ -1630,7 +1641,7 @@ get_shader_base_prim_type(struct nir_shader *nir)
|
|||||||
case MESA_SHADER_GEOMETRY:
|
case MESA_SHADER_GEOMETRY:
|
||||||
return gl_prim_to_pipe(nir->info.gs.output_primitive);
|
return gl_prim_to_pipe(nir->info.gs.output_primitive);
|
||||||
case MESA_SHADER_TESS_EVAL:
|
case MESA_SHADER_TESS_EVAL:
|
||||||
return nir->info.tess.point_mode ? PIPE_PRIM_POINTS : gl_prim_to_pipe(nir->info.tess.primitive_mode);
|
return nir->info.tess.point_mode ? PIPE_PRIM_POINTS : tess_prim_to_pipe(nir->info.tess._primitive_mode);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -694,10 +694,10 @@ merge_tess_info(struct shader_info *tes_info,
|
|||||||
tcs_info->tess.spacing == tes_info->tess.spacing);
|
tcs_info->tess.spacing == tes_info->tess.spacing);
|
||||||
tes_info->tess.spacing |= tcs_info->tess.spacing;
|
tes_info->tess.spacing |= tcs_info->tess.spacing;
|
||||||
|
|
||||||
assert(tcs_info->tess.primitive_mode == 0 ||
|
assert(tcs_info->tess._primitive_mode == 0 ||
|
||||||
tes_info->tess.primitive_mode == 0 ||
|
tes_info->tess._primitive_mode == 0 ||
|
||||||
tcs_info->tess.primitive_mode == tes_info->tess.primitive_mode);
|
tcs_info->tess._primitive_mode == tes_info->tess._primitive_mode);
|
||||||
tes_info->tess.primitive_mode |= tcs_info->tess.primitive_mode;
|
tes_info->tess._primitive_mode |= tcs_info->tess._primitive_mode;
|
||||||
tes_info->tess.ccw |= tcs_info->tess.ccw;
|
tes_info->tess.ccw |= tcs_info->tess.ccw;
|
||||||
tes_info->tess.point_mode |= tcs_info->tess.point_mode;
|
tes_info->tess.point_mode |= tcs_info->tess.point_mode;
|
||||||
}
|
}
|
||||||
|
@@ -336,7 +336,7 @@ struct brw_tcs_prog_key
|
|||||||
{
|
{
|
||||||
struct brw_base_prog_key base;
|
struct brw_base_prog_key base;
|
||||||
|
|
||||||
GLenum tes_primitive_mode;
|
enum tess_primitive_mode _tes_primitive_mode;
|
||||||
|
|
||||||
unsigned input_vertices;
|
unsigned input_vertices;
|
||||||
|
|
||||||
|
@@ -125,7 +125,7 @@ debug_tcs_recompile(const struct brw_compiler *c, void *log,
|
|||||||
found |= check("input vertices", input_vertices);
|
found |= check("input vertices", input_vertices);
|
||||||
found |= check("outputs written", outputs_written);
|
found |= check("outputs written", outputs_written);
|
||||||
found |= check("patch outputs written", patch_outputs_written);
|
found |= check("patch outputs written", patch_outputs_written);
|
||||||
found |= check("tes primitive mode", tes_primitive_mode);
|
found |= check("tes primitive mode", _tes_primitive_mode);
|
||||||
found |= check("quads and equal_spacing workaround", quads_workaround);
|
found |= check("quads and equal_spacing workaround", quads_workaround);
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
|
@@ -30,33 +30,33 @@
|
|||||||
|
|
||||||
static bool
|
static bool
|
||||||
remap_tess_levels(nir_builder *b, nir_intrinsic_instr *intr,
|
remap_tess_levels(nir_builder *b, nir_intrinsic_instr *intr,
|
||||||
GLenum primitive_mode)
|
enum tess_primitive_mode _primitive_mode)
|
||||||
{
|
{
|
||||||
const int location = nir_intrinsic_base(intr);
|
const int location = nir_intrinsic_base(intr);
|
||||||
const unsigned component = nir_intrinsic_component(intr);
|
const unsigned component = nir_intrinsic_component(intr);
|
||||||
bool out_of_bounds;
|
bool out_of_bounds;
|
||||||
|
|
||||||
if (location == VARYING_SLOT_TESS_LEVEL_INNER) {
|
if (location == VARYING_SLOT_TESS_LEVEL_INNER) {
|
||||||
switch (primitive_mode) {
|
switch (_primitive_mode) {
|
||||||
case GL_QUADS:
|
case TESS_PRIMITIVE_QUADS:
|
||||||
/* gl_TessLevelInner[0..1] lives at DWords 3-2 (reversed). */
|
/* gl_TessLevelInner[0..1] lives at DWords 3-2 (reversed). */
|
||||||
nir_intrinsic_set_base(intr, 0);
|
nir_intrinsic_set_base(intr, 0);
|
||||||
nir_intrinsic_set_component(intr, 3 - component);
|
nir_intrinsic_set_component(intr, 3 - component);
|
||||||
out_of_bounds = false;
|
out_of_bounds = false;
|
||||||
break;
|
break;
|
||||||
case GL_TRIANGLES:
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
/* gl_TessLevelInner[0] lives at DWord 4. */
|
/* gl_TessLevelInner[0] lives at DWord 4. */
|
||||||
nir_intrinsic_set_base(intr, 1);
|
nir_intrinsic_set_base(intr, 1);
|
||||||
out_of_bounds = component > 0;
|
out_of_bounds = component > 0;
|
||||||
break;
|
break;
|
||||||
case GL_ISOLINES:
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
out_of_bounds = true;
|
out_of_bounds = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
unreachable("Bogus tessellation domain");
|
unreachable("Bogus tessellation domain");
|
||||||
}
|
}
|
||||||
} else if (location == VARYING_SLOT_TESS_LEVEL_OUTER) {
|
} else if (location == VARYING_SLOT_TESS_LEVEL_OUTER) {
|
||||||
if (primitive_mode == GL_ISOLINES) {
|
if (_primitive_mode == TESS_PRIMITIVE_ISOLINES) {
|
||||||
/* gl_TessLevelOuter[0..1] lives at DWords 6-7 (in order). */
|
/* gl_TessLevelOuter[0..1] lives at DWords 6-7 (in order). */
|
||||||
nir_intrinsic_set_base(intr, 1);
|
nir_intrinsic_set_base(intr, 1);
|
||||||
nir_intrinsic_set_component(intr, 2 + nir_intrinsic_component(intr));
|
nir_intrinsic_set_component(intr, 2 + nir_intrinsic_component(intr));
|
||||||
@@ -65,7 +65,7 @@ remap_tess_levels(nir_builder *b, nir_intrinsic_instr *intr,
|
|||||||
/* Triangles use DWords 7-5 (reversed); Quads use 7-4 (reversed) */
|
/* Triangles use DWords 7-5 (reversed); Quads use 7-4 (reversed) */
|
||||||
nir_intrinsic_set_base(intr, 1);
|
nir_intrinsic_set_base(intr, 1);
|
||||||
nir_intrinsic_set_component(intr, 3 - nir_intrinsic_component(intr));
|
nir_intrinsic_set_component(intr, 3 - nir_intrinsic_component(intr));
|
||||||
out_of_bounds = component == 3 && primitive_mode == GL_TRIANGLES;
|
out_of_bounds = component == 3 && _primitive_mode == TESS_PRIMITIVE_TRIANGLES;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -104,7 +104,7 @@ is_output(nir_intrinsic_instr *intrin)
|
|||||||
static bool
|
static bool
|
||||||
remap_patch_urb_offsets(nir_block *block, nir_builder *b,
|
remap_patch_urb_offsets(nir_block *block, nir_builder *b,
|
||||||
const struct brw_vue_map *vue_map,
|
const struct brw_vue_map *vue_map,
|
||||||
GLenum tes_primitive_mode)
|
enum tess_primitive_mode tes_primitive_mode)
|
||||||
{
|
{
|
||||||
const bool is_passthrough_tcs = b->shader->info.name &&
|
const bool is_passthrough_tcs = b->shader->info.name &&
|
||||||
strcmp(b->shader->info.name, "passthrough TCS") == 0;
|
strcmp(b->shader->info.name, "passthrough TCS") == 0;
|
||||||
@@ -366,7 +366,7 @@ brw_nir_lower_tes_inputs(nir_shader *nir, const struct brw_vue_map *vue_map)
|
|||||||
nir_builder_init(&b, function->impl);
|
nir_builder_init(&b, function->impl);
|
||||||
nir_foreach_block(block, function->impl) {
|
nir_foreach_block(block, function->impl) {
|
||||||
remap_patch_urb_offsets(block, &b, vue_map,
|
remap_patch_urb_offsets(block, &b, vue_map,
|
||||||
nir->info.tess.primitive_mode);
|
nir->info.tess._primitive_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -475,7 +475,7 @@ brw_nir_lower_vue_outputs(nir_shader *nir)
|
|||||||
|
|
||||||
void
|
void
|
||||||
brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map *vue_map,
|
brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map *vue_map,
|
||||||
GLenum tes_primitive_mode)
|
enum tess_primitive_mode tes_primitive_mode)
|
||||||
{
|
{
|
||||||
nir_foreach_shader_out_variable(var, nir) {
|
nir_foreach_shader_out_variable(var, nir) {
|
||||||
var->data.driver_location = var->data.location;
|
var->data.driver_location = var->data.location;
|
||||||
|
@@ -113,7 +113,7 @@ void brw_nir_lower_fs_inputs(nir_shader *nir,
|
|||||||
const struct brw_wm_prog_key *key);
|
const struct brw_wm_prog_key *key);
|
||||||
void brw_nir_lower_vue_outputs(nir_shader *nir);
|
void brw_nir_lower_vue_outputs(nir_shader *nir);
|
||||||
void brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map *vue,
|
void brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map *vue,
|
||||||
GLenum tes_primitive_mode);
|
enum tess_primitive_mode tes_primitive_mode);
|
||||||
void brw_nir_lower_fs_outputs(nir_shader *nir);
|
void brw_nir_lower_fs_outputs(nir_shader *nir);
|
||||||
|
|
||||||
bool brw_nir_lower_conversions(nir_shader *nir);
|
bool brw_nir_lower_conversions(nir_shader *nir);
|
||||||
|
@@ -1387,14 +1387,14 @@ brw_compile_tes(const struct brw_compiler *compiler,
|
|||||||
prog_data->partitioning =
|
prog_data->partitioning =
|
||||||
(enum brw_tess_partitioning) (nir->info.tess.spacing - 1);
|
(enum brw_tess_partitioning) (nir->info.tess.spacing - 1);
|
||||||
|
|
||||||
switch (nir->info.tess.primitive_mode) {
|
switch (nir->info.tess._primitive_mode) {
|
||||||
case GL_QUADS:
|
case TESS_PRIMITIVE_QUADS:
|
||||||
prog_data->domain = BRW_TESS_DOMAIN_QUAD;
|
prog_data->domain = BRW_TESS_DOMAIN_QUAD;
|
||||||
break;
|
break;
|
||||||
case GL_TRIANGLES:
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
prog_data->domain = BRW_TESS_DOMAIN_TRI;
|
prog_data->domain = BRW_TESS_DOMAIN_TRI;
|
||||||
break;
|
break;
|
||||||
case GL_ISOLINES:
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
prog_data->domain = BRW_TESS_DOMAIN_ISOLINE;
|
prog_data->domain = BRW_TESS_DOMAIN_ISOLINE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -1403,7 +1403,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
|
|||||||
|
|
||||||
if (nir->info.tess.point_mode) {
|
if (nir->info.tess.point_mode) {
|
||||||
prog_data->output_topology = BRW_TESS_OUTPUT_TOPOLOGY_POINT;
|
prog_data->output_topology = BRW_TESS_OUTPUT_TOPOLOGY_POINT;
|
||||||
} else if (nir->info.tess.primitive_mode == GL_ISOLINES) {
|
} else if (nir->info.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES) {
|
||||||
prog_data->output_topology = BRW_TESS_OUTPUT_TOPOLOGY_LINE;
|
prog_data->output_topology = BRW_TESS_OUTPUT_TOPOLOGY_LINE;
|
||||||
} else {
|
} else {
|
||||||
/* Hardware winding order is backwards from OpenGL */
|
/* Hardware winding order is backwards from OpenGL */
|
||||||
|
@@ -380,7 +380,7 @@ brw_compile_tcs(const struct brw_compiler *compiler,
|
|||||||
brw_nir_apply_key(nir, compiler, &key->base, 8, is_scalar);
|
brw_nir_apply_key(nir, compiler, &key->base, 8, is_scalar);
|
||||||
brw_nir_lower_vue_inputs(nir, &input_vue_map);
|
brw_nir_lower_vue_inputs(nir, &input_vue_map);
|
||||||
brw_nir_lower_tcs_outputs(nir, &vue_prog_data->vue_map,
|
brw_nir_lower_tcs_outputs(nir, &vue_prog_data->vue_map,
|
||||||
key->tes_primitive_mode);
|
key->_tes_primitive_mode);
|
||||||
if (key->quads_workaround)
|
if (key->quads_workaround)
|
||||||
brw_nir_apply_tcs_quads_workaround(nir);
|
brw_nir_apply_tcs_quads_workaround(nir);
|
||||||
|
|
||||||
|
@@ -983,10 +983,10 @@ merge_tess_info(struct shader_info *tes_info,
|
|||||||
tcs_info->tess.spacing == tes_info->tess.spacing);
|
tcs_info->tess.spacing == tes_info->tess.spacing);
|
||||||
tes_info->tess.spacing |= tcs_info->tess.spacing;
|
tes_info->tess.spacing |= tcs_info->tess.spacing;
|
||||||
|
|
||||||
assert(tcs_info->tess.primitive_mode == 0 ||
|
assert(tcs_info->tess._primitive_mode == 0 ||
|
||||||
tes_info->tess.primitive_mode == 0 ||
|
tes_info->tess._primitive_mode == 0 ||
|
||||||
tcs_info->tess.primitive_mode == tes_info->tess.primitive_mode);
|
tcs_info->tess._primitive_mode == tes_info->tess._primitive_mode);
|
||||||
tes_info->tess.primitive_mode |= tcs_info->tess.primitive_mode;
|
tes_info->tess._primitive_mode |= tcs_info->tess._primitive_mode;
|
||||||
tes_info->tess.ccw |= tcs_info->tess.ccw;
|
tes_info->tess.ccw |= tcs_info->tess.ccw;
|
||||||
tes_info->tess.point_mode |= tcs_info->tess.point_mode;
|
tes_info->tess.point_mode |= tcs_info->tess.point_mode;
|
||||||
}
|
}
|
||||||
@@ -1011,11 +1011,11 @@ anv_pipeline_link_tcs(const struct brw_compiler *compiler,
|
|||||||
* this comes from the SPIR-V, which is part of the hash used for the
|
* this comes from the SPIR-V, which is part of the hash used for the
|
||||||
* pipeline cache. So it should be safe.
|
* pipeline cache. So it should be safe.
|
||||||
*/
|
*/
|
||||||
tcs_stage->key.tcs.tes_primitive_mode =
|
tcs_stage->key.tcs._tes_primitive_mode =
|
||||||
tes_stage->nir->info.tess.primitive_mode;
|
tes_stage->nir->info.tess._primitive_mode;
|
||||||
tcs_stage->key.tcs.quads_workaround =
|
tcs_stage->key.tcs.quads_workaround =
|
||||||
compiler->devinfo->ver < 9 &&
|
compiler->devinfo->ver < 9 &&
|
||||||
tes_stage->nir->info.tess.primitive_mode == 7 /* GL_QUADS */ &&
|
tes_stage->nir->info.tess._primitive_mode == TESS_PRIMITIVE_QUADS &&
|
||||||
tes_stage->nir->info.tess.spacing == TESS_SPACING_EQUAL;
|
tes_stage->nir->info.tess.spacing == TESS_SPACING_EQUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -316,7 +316,7 @@ _mesa_update_valid_to_render_state(struct gl_context *ctx)
|
|||||||
if (tes->info.tess.point_mode) {
|
if (tes->info.tess.point_mode) {
|
||||||
if (ctx->TransformFeedback.Mode != GL_POINTS)
|
if (ctx->TransformFeedback.Mode != GL_POINTS)
|
||||||
mask = 0;
|
mask = 0;
|
||||||
} else if (tes->info.tess.primitive_mode == GL_ISOLINES) {
|
} else if (tes->info.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES) {
|
||||||
if (ctx->TransformFeedback.Mode != GL_LINES)
|
if (ctx->TransformFeedback.Mode != GL_LINES)
|
||||||
mask = 0;
|
mask = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -388,7 +388,7 @@ _mesa_update_valid_to_render_state(struct gl_context *ctx)
|
|||||||
|
|
||||||
if (tes->info.tess.point_mode)
|
if (tes->info.tess.point_mode)
|
||||||
valid = geom_mode == GL_POINTS;
|
valid = geom_mode == GL_POINTS;
|
||||||
else if (tes->info.tess.primitive_mode == GL_ISOLINES)
|
else if (tes->info.tess._primitive_mode == TESS_PRIMITIVE_ISOLINES)
|
||||||
valid = geom_mode == GL_LINES;
|
valid = geom_mode == GL_LINES;
|
||||||
else
|
else
|
||||||
/* the GL_QUADS mode generates triangles too */
|
/* the GL_QUADS mode generates triangles too */
|
||||||
|
@@ -2531,11 +2531,7 @@ struct gl_shader_info
|
|||||||
* Tessellation Evaluation shader state from layout qualifiers.
|
* Tessellation Evaluation shader state from layout qualifiers.
|
||||||
*/
|
*/
|
||||||
struct {
|
struct {
|
||||||
/**
|
enum tess_primitive_mode _PrimitiveMode;
|
||||||
* GL_TRIANGLES, GL_QUADS, GL_ISOLINES or PRIM_UNKNOWN if it's not set
|
|
||||||
* in this shader.
|
|
||||||
*/
|
|
||||||
GLenum16 PrimitiveMode;
|
|
||||||
|
|
||||||
enum gl_tess_spacing Spacing;
|
enum gl_tess_spacing Spacing;
|
||||||
|
|
||||||
|
@@ -1007,8 +1007,22 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
|
|||||||
if (!has_tess)
|
if (!has_tess)
|
||||||
break;
|
break;
|
||||||
if (check_tes_query(ctx, shProg)) {
|
if (check_tes_query(ctx, shProg)) {
|
||||||
*params = shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]->
|
const struct gl_linked_shader *tes =
|
||||||
Program->info.tess.primitive_mode;
|
shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL];
|
||||||
|
switch (tes->Program->info.tess._primitive_mode) {
|
||||||
|
case TESS_PRIMITIVE_TRIANGLES:
|
||||||
|
*params = GL_TRIANGLES;
|
||||||
|
break;
|
||||||
|
case TESS_PRIMITIVE_QUADS:
|
||||||
|
*params = GL_QUADS;
|
||||||
|
break;
|
||||||
|
case TESS_PRIMITIVE_ISOLINES:
|
||||||
|
*params = GL_ISOLINES;
|
||||||
|
break;
|
||||||
|
case TESS_PRIMITIVE_UNSPECIFIED:
|
||||||
|
*params = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case GL_TESS_GEN_SPACING:
|
case GL_TESS_GEN_SPACING:
|
||||||
|
Reference in New Issue
Block a user