mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 15:40:11 +01:00
mesa/nir: Add some perfetto traces
Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22646>
This commit is contained in:
parent
15499250f2
commit
f136f89487
12 changed files with 44 additions and 0 deletions
|
|
@ -33,6 +33,7 @@
|
|||
#include "main/mtypes.h"
|
||||
#include "util/hash_table.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
#include "nir.h"
|
||||
#include "nir_builder.h"
|
||||
|
|
@ -3154,6 +3155,8 @@ gl_nir_link_varyings(const struct gl_constants *consts,
|
|||
|
||||
unsigned first, last;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
first = MESA_SHADER_STAGES;
|
||||
last = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "main/shaderobj.h"
|
||||
#include "ir_uniform.h" /* for gl_uniform_storage */
|
||||
#include "util/glheader.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
/**
|
||||
* This file included general link methods, using NIR, instead of IR as
|
||||
|
|
@ -41,6 +42,8 @@ gl_nir_opts(nir_shader *nir)
|
|||
{
|
||||
bool progress;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
do {
|
||||
progress = false;
|
||||
|
||||
|
|
@ -122,6 +125,8 @@ gl_nir_opts(nir_shader *nir)
|
|||
static void
|
||||
gl_nir_link_opts(nir_shader *producer, nir_shader *consumer)
|
||||
{
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
if (producer->options->lower_to_scalar) {
|
||||
NIR_PASS_V(producer, nir_lower_io_to_scalar_early, nir_var_shader_out);
|
||||
NIR_PASS_V(consumer, nir_lower_io_to_scalar_early, nir_var_shader_in);
|
||||
|
|
@ -761,6 +766,8 @@ gl_nir_link_spirv(const struct gl_constants *consts,
|
|||
struct gl_linked_shader *linked_shader[MESA_SHADER_STAGES];
|
||||
unsigned num_shaders = 0;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
|
||||
if (prog->_LinkedShaders[i])
|
||||
linked_shader[num_shaders++] = prog->_LinkedShaders[i];
|
||||
|
|
@ -925,6 +932,8 @@ gl_nir_link_glsl(const struct gl_constants *consts,
|
|||
if (prog->NumShaders == 0)
|
||||
return true;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
if (!gl_nir_link_varyings(consts, exts, api, prog))
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "main/mtypes.h"
|
||||
#include "main/shaderobj.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
/*
|
||||
* pass to lower GLSL IR to NIR
|
||||
|
|
@ -207,6 +208,8 @@ glsl_to_nir(const struct gl_constants *consts,
|
|||
const struct gl_shader_compiler_options *gl_options =
|
||||
&consts->ShaderCompilerOptions[stage];
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
/* glsl_to_nir can only handle converting certain function paramaters
|
||||
* to NIR. If we find something we can't handle then we get the GLSL IR
|
||||
* opts to remove it before we continue on.
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "util/u_debug.h"
|
||||
#include "util/disk_cache.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
#include "util/ralloc.h"
|
||||
#include "pipe/p_screen.h"
|
||||
|
||||
|
|
@ -2575,6 +2576,8 @@ ttn_finalize_nir(struct ttn_compile *c, struct pipe_screen *screen)
|
|||
{
|
||||
struct nir_shader *nir = c->build.shader;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
NIR_PASS_V(nir, nir_lower_vars_to_ssa);
|
||||
NIR_PASS_V(nir, nir_lower_regs_to_ssa);
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@
|
|||
#include "util/crc32.h"
|
||||
#include "util/os_file.h"
|
||||
#include "util/list.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
#include "util/u_process.h"
|
||||
#include "util/u_string.h"
|
||||
#include "api_exec_decl.h"
|
||||
|
|
@ -1304,6 +1305,8 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg,
|
|||
if (!shProg)
|
||||
return;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
if (!no_error) {
|
||||
/* From the ARB_transform_feedback2 specification:
|
||||
* "The error INVALID_OPERATION is generated by LinkProgram if <program>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "compiler/glsl/linker.h"
|
||||
#include "compiler/glsl/program.h"
|
||||
#include "compiler/glsl/shader_cache.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
#include "state_tracker/st_glsl_to_ir.h"
|
||||
|
||||
|
|
@ -45,6 +46,8 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
|
|||
unsigned int i;
|
||||
bool spirv = false;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
_mesa_clear_shader_program_data(ctx, prog);
|
||||
|
||||
prog->data = _mesa_create_shader_program_data();
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
assert(prog->data->LinkStatus);
|
||||
|
||||
/* Skip the GLSL steps when using SPIR-V. */
|
||||
|
|
@ -103,6 +105,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
|
|||
{
|
||||
struct pipe_context *pctx = st_context(ctx)->pipe;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
GLboolean ret = link_shader(ctx, prog);
|
||||
|
||||
if (pctx->link_shader) {
|
||||
|
|
|
|||
|
|
@ -712,6 +712,8 @@ st_link_nir(struct gl_context *ctx,
|
|||
struct gl_linked_shader *linked_shader[MESA_SHADER_STAGES];
|
||||
unsigned num_shaders = 0;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
|
||||
if (shader_program->_LinkedShaders[i])
|
||||
linked_shader[num_shaders++] = shader_program->_LinkedShaders[i];
|
||||
|
|
@ -1056,6 +1058,8 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
|
|||
{
|
||||
struct pipe_screen *screen = st->screen;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
NIR_PASS_V(nir, nir_split_var_copies);
|
||||
NIR_PASS_V(nir, nir_lower_var_copies);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "st_context.h"
|
||||
#include "compiler/shader_enums.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ st_nir_finish_builtin_nir(struct st_context *st, nir_shader *nir)
|
|||
struct pipe_screen *screen = st->screen;
|
||||
gl_shader_stage stage = nir->info.stage;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
nir->info.separate_shader = true;
|
||||
if (stage == MESA_SHADER_FRAGMENT)
|
||||
nir->info.fs.untyped_color_outputs = true;
|
||||
|
|
|
|||
|
|
@ -684,6 +684,8 @@ st_create_common_variant(struct st_context *st,
|
|||
struct gl_program *prog,
|
||||
const struct st_common_variant_key *key)
|
||||
{
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
struct st_common_variant *v = CALLOC_STRUCT(st_common_variant);
|
||||
struct pipe_shader_state state = {0};
|
||||
|
||||
|
|
@ -896,6 +898,8 @@ st_create_fp_variant(struct st_context *st,
|
|||
if (!variant)
|
||||
return NULL;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
/* Translate ATI_fs to NIR at variant time because that's when we have the
|
||||
* texture types.
|
||||
*/
|
||||
|
|
@ -1329,6 +1333,8 @@ st_finalize_program(struct st_context *st, struct gl_program *prog)
|
|||
struct gl_context *ctx = st->ctx;
|
||||
bool is_bound = false;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
if (prog->info.stage == MESA_SHADER_VERTEX)
|
||||
is_bound = prog == ctx->VertexProgram._Current;
|
||||
else if (prog->info.stage == MESA_SHADER_TESS_CTRL)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "main/uniforms.h"
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
void
|
||||
st_get_program_binary_driver_sha1(struct gl_context *ctx, uint8_t *sha1)
|
||||
|
|
@ -146,6 +147,8 @@ st_deserialise_nir_program(struct gl_context *ctx,
|
|||
size_t size = prog->driver_cache_blob_size;
|
||||
uint8_t *buffer = (uint8_t *) prog->driver_cache_blob;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
st_set_prog_affected_state_flags(prog);
|
||||
|
||||
/* Avoid reallocation of the program parameter list, because the uniform
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue