Class GpuContext

java.lang.Object
com.mojang.jtracy.GpuContext

public class GpuContext extends Object
  • Method Details

    • setName

      public GpuContext setName(String name)
      Sets a name of this context.
      Parameters:
      name - Name of this context
      Returns:
      This context, for builder-style creation
    • beginZone

      public void beginZone(int query, String name, String function, String file, int line)
      Marks the beginning of a GPU zone.

      Query is an arbitrary value that must be unique per frame. You are not permitted to reuse a query ID until it is later freed with submitQueryTimestamp(int, long).

      You are expected to record a GPU timestamp as close as possible to this function, and then call submitQueryTimestamp(int, long).

      Unlike with CPU Zones, GPU zones are started and ended as a stack. You do not explicitly mark _which_ zone you're ending, so calling this and endZone(int) correctly is vitally important and errors will not be caught for you.

      Parameters:
      query - A unique ID to associate the start of this zone with a gpu timestamp later
      name - Name of the zone to display
      function - Name of the function that this zone belongs to
      file - Name of the file that this zone belongs to
      line - Line number of the file that this zone belongs to
    • endZone

      public void endZone(int query)
      Marks the end of a GPU zone.

      Query is an arbitrary value that must be unique per frame. You are not permitted to reuse a query ID until it is later freed with submitQueryTimestamp(int, long).

      You are expected to record a GPU timestamp as close as possible to this function, and then call submitQueryTimestamp(int, long).

      Unlike with CPU Zones, GPU zones are started and ended as a stack. You do not explicitly mark _which_ zone you're ending, so calling this and beginZone(int, String, String, String, int) correctly is vitally important and errors will not be caught for you.

      Parameters:
      query - A unique ID to associate the end of a zone with a gpu timestamp later
    • submitQueryTimestamp

      public void submitQueryTimestamp(int query, long timestamp)
      Submits a timestamp for a query, freeing the ID for reuse.
      Parameters:
      query - Query ID previously generated for a zone's start or end.
      timestamp - GPU timestamp corresponding to that query ID.