X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=cli%2Ftrace_analyzer.hpp;h=3e4013bcd07fcfe6fd0806f936a22132508a3e06;hb=ec8f5a61f393e75e4c3e3e22f84c773af66810e9;hp=6619c5736e34b2cd1f193e147a23b58fdbb5e95f;hpb=8efbe01f8cbd25ee9a731fd1d61f61337a108195;p=apitrace diff --git a/cli/trace_analyzer.hpp b/cli/trace_analyzer.hpp index 6619c57..3e4013b 100644 --- a/cli/trace_analyzer.hpp +++ b/cli/trace_analyzer.hpp @@ -29,8 +29,29 @@ #include #include "trace_callset.hpp" +#include "trace_fast_callset.hpp" #include "trace_parser.hpp" +typedef unsigned TrimFlags; + +/** + * Trim flags + */ +enum { + + /* Whether to trim calls that have no side effects. */ + TRIM_FLAG_NO_SIDE_EFFECTS = (1 << 0), + + /* Whether to trim calls to setup textures that are never used. */ + TRIM_FLAG_TEXTURES = (1 << 1), + + /* Whether to trim calls to setup shaders that are never used. */ + TRIM_FLAG_SHADERS = (1 << 2), + + /* Whether to trim drawing operations outside of the desired call-set. */ + TRIM_FLAG_DRAWING = (1 << 3), +}; + class TraceAnalyzer { private: std::map > resources; @@ -38,7 +59,7 @@ private: std::map texture_map; - std::set required; + trace::FastCallSet required; bool transformFeedbackActive; bool framebufferObjectActive; @@ -46,6 +67,7 @@ private: GLuint insideNewEndList; GLenum activeTextureUnit; GLuint activeProgram; + unsigned int trimFlags; void provide(std::string resource, trace::CallNo call_no); void providef(std::string resource, int resource_no, trace::CallNo call_no); @@ -58,7 +80,13 @@ private: void unlinkAll(std::string resource); void stateTrackPreCall(trace::Call *call); + void recordSideEffects(trace::Call *call); + bool callHasNoSideEffects(trace::Call *call, const char *name); + bool recordTextureSideEffects(trace::Call *call, const char *name); + bool recordShaderSideEffects(trace::Call *call, const char *name); + bool recordDrawingSideEffects(trace::Call *call, const char *name); + void stateTrackPostCall(trace::Call *call); bool renderingHasSideEffect(void); @@ -68,7 +96,7 @@ private: void requireDependencies(trace::Call *call); public: - TraceAnalyzer(); + TraceAnalyzer(TrimFlags trimFlags); ~TraceAnalyzer(); /* Analyze this call by tracking state and recording all the @@ -82,5 +110,5 @@ public: /* Return a set of all the required calls, (both those calls added * explicitly with require() and those implicitly depended * upon. */ - std::set *get_required(void); + trace::FastCallSet *get_required(void); };