v3d/clif: add support for dumping GS shader state
The basic vertex+fragment shader state uses the packet GL_SHADER_STATE, but when geometry shader are involved, the packet used is GL_SHADER_STATE_INCLUDING_GS. Without this commit any program using a geometry shader would dump their shader state (and their shader state record and attribues) as binaries. Reviewed-by: Juan A. Suarez <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13269>
This commit is contained in:
parent
19894bec1f
commit
ec51c8774d
|
@ -160,7 +160,8 @@ clif_dump_cl(struct clif_dump *clif, uint32_t start, uint32_t end,
|
|||
static uint32_t
|
||||
clif_dump_gl_shader_state_record(struct clif_dump *clif,
|
||||
struct reloc_worklist_entry *reloc,
|
||||
void *vaddr)
|
||||
void *vaddr,
|
||||
bool including_gs)
|
||||
{
|
||||
struct v3d_group *state = v3d_spec_find_struct(clif->spec,
|
||||
"GL Shader State Record");
|
||||
|
@ -170,6 +171,16 @@ clif_dump_gl_shader_state_record(struct clif_dump *clif,
|
|||
assert(attr);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if (including_gs) {
|
||||
struct v3d_group *gs_state = v3d_spec_find_struct(clif->spec,
|
||||
"Geometry Shader State Record");
|
||||
assert(gs_state);
|
||||
out(clif, "@format shadrec_gl_geom\n");
|
||||
v3d_print_group(clif, gs_state, 0, vaddr + offset);
|
||||
offset += v3d_group_get_length(gs_state);
|
||||
/* Extra pad when geometry/tessellation shader is present */
|
||||
offset += 20;
|
||||
}
|
||||
out(clif, "@format shadrec_gl_main\n");
|
||||
v3d_print_group(clif, state, 0, vaddr + offset);
|
||||
offset += v3d_group_get_length(state);
|
||||
|
@ -201,6 +212,7 @@ clif_process_worklist(struct clif_dump *clif)
|
|||
break;
|
||||
|
||||
case reloc_gl_shader_state:
|
||||
case reloc_gl_including_gs_shader_state:
|
||||
break;
|
||||
case reloc_generic_tile_list:
|
||||
clif_dump_cl(clif, reloc->addr,
|
||||
|
@ -336,10 +348,12 @@ clif_dump_buffers(struct clif_dump *clif)
|
|||
break;
|
||||
|
||||
case reloc_gl_shader_state:
|
||||
case reloc_gl_including_gs_shader_state:
|
||||
offset += clif_dump_gl_shader_state_record(clif,
|
||||
reloc,
|
||||
bo->vaddr +
|
||||
offset);
|
||||
offset,
|
||||
reloc->type == reloc_gl_including_gs_shader_state);
|
||||
break;
|
||||
case reloc_generic_tile_list:
|
||||
offset = clif_dump_cl(clif, reloc->addr,
|
||||
|
|
|
@ -64,6 +64,7 @@ struct clif_dump {
|
|||
enum reloc_worklist_type {
|
||||
reloc_cl,
|
||||
reloc_gl_shader_state,
|
||||
reloc_gl_including_gs_shader_state,
|
||||
reloc_generic_tile_list,
|
||||
};
|
||||
|
||||
|
|
|
@ -94,6 +94,25 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
|
|||
return true;
|
||||
}
|
||||
|
||||
#if V3D_VERSION >= 41
|
||||
case V3DX(GL_SHADER_STATE_INCLUDING_GS_opcode): {
|
||||
struct V3DX(GL_SHADER_STATE_INCLUDING_GS) values;
|
||||
V3DX(GL_SHADER_STATE_INCLUDING_GS_unpack)(cl, &values);
|
||||
|
||||
if (reloc_mode) {
|
||||
struct reloc_worklist_entry *reloc =
|
||||
clif_dump_add_address_to_worklist(clif,
|
||||
reloc_gl_including_gs_shader_state,
|
||||
values.address);
|
||||
if (reloc) {
|
||||
reloc->shader_state.num_attrs =
|
||||
values.number_of_attribute_arrays;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif /* V3D_VERSION >= 41 */
|
||||
|
||||
#if V3D_VERSION < 40
|
||||
case V3DX(STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED_opcode): {
|
||||
struct V3DX(STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED) values;
|
||||
|
|
Loading…
Reference in New Issue