freedreno/ir3: Make a shared helper for the tess factor stride.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6089>
This commit is contained in:
@@ -299,8 +299,8 @@ struct ir3_shader_key {
|
|||||||
* topology the TES uses, which the TCS needs to know.
|
* topology the TES uses, which the TCS needs to know.
|
||||||
*/
|
*/
|
||||||
#define IR3_TESS_NONE 0
|
#define IR3_TESS_NONE 0
|
||||||
#define IR3_TESS_TRIANGLES 1
|
#define IR3_TESS_QUADS 1
|
||||||
#define IR3_TESS_QUADS 2
|
#define IR3_TESS_TRIANGLES 2
|
||||||
#define IR3_TESS_ISOLINES 3
|
#define IR3_TESS_ISOLINES 3
|
||||||
unsigned tessellation : 2;
|
unsigned tessellation : 2;
|
||||||
|
|
||||||
@@ -349,6 +349,22 @@ ir3_tess_mode(unsigned gl_tess_mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
ir3_tess_factor_stride(unsigned patch_type)
|
||||||
|
{
|
||||||
|
/* note: this matches the stride used by ir3's build_tessfactor_base */
|
||||||
|
switch (patch_type) {
|
||||||
|
case IR3_TESS_ISOLINES:
|
||||||
|
return 12;
|
||||||
|
case IR3_TESS_TRIANGLES:
|
||||||
|
return 20;
|
||||||
|
case IR3_TESS_QUADS:
|
||||||
|
return 28;
|
||||||
|
default:
|
||||||
|
unreachable("bad tessmode");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
ir3_shader_key_equal(const struct ir3_shader_key *a,
|
ir3_shader_key_equal(const struct ir3_shader_key *a,
|
||||||
const struct ir3_shader_key *b)
|
const struct ir3_shader_key *b)
|
||||||
|
@@ -3509,20 +3509,7 @@ get_tess_factor_bo_size(const struct tu_pipeline *pipeline,
|
|||||||
/* Each distinct patch gets its own tess factor output. */
|
/* Each distinct patch gets its own tess factor output. */
|
||||||
uint32_t verts_per_patch = pipeline->ia.primtype - DI_PT_PATCHES0;
|
uint32_t verts_per_patch = pipeline->ia.primtype - DI_PT_PATCHES0;
|
||||||
uint32_t num_patches = draw_count / verts_per_patch;
|
uint32_t num_patches = draw_count / verts_per_patch;
|
||||||
uint32_t factor_stride;
|
uint32_t factor_stride = ir3_tess_factor_stride(pipeline->tess.patch_type);
|
||||||
switch (pipeline->tess.patch_type) {
|
|
||||||
case IR3_TESS_ISOLINES:
|
|
||||||
factor_stride = 12;
|
|
||||||
break;
|
|
||||||
case IR3_TESS_TRIANGLES:
|
|
||||||
factor_stride = 20;
|
|
||||||
break;
|
|
||||||
case IR3_TESS_QUADS:
|
|
||||||
factor_stride = 28;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
unreachable("bad tessmode");
|
|
||||||
}
|
|
||||||
return factor_stride * num_patches;
|
return factor_stride * num_patches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -251,25 +251,12 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (info->mode == PIPE_PRIM_PATCHES) {
|
if (info->mode == PIPE_PRIM_PATCHES) {
|
||||||
shader_info *ds_info = &emit.ds->shader->nir->info;
|
uint32_t factor_stride = ir3_tess_factor_stride(emit.key.key.tessellation);
|
||||||
uint32_t factor_stride;
|
|
||||||
|
|
||||||
switch (ds_info->tess.primitive_mode) {
|
STATIC_ASSERT(IR3_TESS_ISOLINES == TESS_ISOLINES + 1);
|
||||||
case GL_ISOLINES:
|
STATIC_ASSERT(IR3_TESS_TRIANGLES == TESS_TRIANGLES + 1);
|
||||||
draw0.patch_type = TESS_ISOLINES;
|
STATIC_ASSERT(IR3_TESS_QUADS == TESS_QUADS + 1);
|
||||||
factor_stride = 12;
|
draw0.patch_type = emit.key.key.tessellation - 1;
|
||||||
break;
|
|
||||||
case GL_TRIANGLES:
|
|
||||||
draw0.patch_type = TESS_TRIANGLES;
|
|
||||||
factor_stride = 20;
|
|
||||||
break;
|
|
||||||
case GL_QUADS:
|
|
||||||
draw0.patch_type = TESS_QUADS;
|
|
||||||
factor_stride = 28;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
unreachable("bad tessmode");
|
|
||||||
}
|
|
||||||
|
|
||||||
draw0.prim_type = DI_PT_PATCHES0 + ctx->patch_vertices;
|
draw0.prim_type = DI_PT_PATCHES0 + ctx->patch_vertices;
|
||||||
draw0.tess_enable = true;
|
draw0.tess_enable = true;
|
||||||
|
Reference in New Issue
Block a user