#include <GL/glext.h>
#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<std::string, std::set<unsigned> > resources;
std::map<GLenum, unsigned> texture_map;
- std::set<unsigned> required;
+ trace::FastCallSet required;
bool transformFeedbackActive;
bool framebufferObjectActive;
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);
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);
void requireDependencies(trace::Call *call);
public:
- TraceAnalyzer();
+ TraceAnalyzer(TrimFlags trimFlags = -1);
~TraceAnalyzer();
/* Analyze this call by tracking state and recording all the
/* Return a set of all the required calls, (both those calls added
* explicitly with require() and those implicitly depended
* upon. */
- std::set<unsigned> *get_required(void);
+ trace::FastCallSet *get_required(void);
};