Not all glBindTexture calls are created equal. With calls to
glActiveTexture intervening, calls to glBindTexture are actually
operating on indenpendent texture units.
It's actually quite easy to simple insert the number of the currently
active texture unit into the name of the texture target resource.
bool framebufferObjectActive;
bool insideBeginEnd;
GLuint activeProgram;
bool framebufferObjectActive;
bool insideBeginEnd;
GLuint activeProgram;
+ GLenum activeTextureUnit;
/* Rendering often has no side effects, but it can in some cases,
* (such as when transform feedback is active, or when rendering
/* Rendering often has no side effects, but it can in some cases,
* (such as when transform feedback is active, or when rendering
+ if (strcmp(name, "glActiveTexture") == 0) {
+ activeTextureUnit = static_cast<GLenum>(call->arg(0).toSInt());
+ return;
+ }
+
if (strcmp(name, "glBindTexture") == 0) {
GLenum target;
GLuint texture;
if (strcmp(name, "glBindTexture") == 0) {
GLenum target;
GLuint texture;
target = static_cast<GLenum>(call->arg(0).toSInt());
texture = call->arg(1).toUInt();
target = static_cast<GLenum>(call->arg(0).toSInt());
texture = call->arg(1).toUInt();
- ss_target << "texture-target-" << target;
+ ss_target << "texture-unit-" << activeTextureUnit << "-target-" << target;
ss_texture << "texture-" << texture;
resources.erase(ss_target.str());
ss_texture << "texture-" << texture;
resources.erase(ss_target.str());
GLenum target = static_cast<GLenum>(call->arg(0).toSInt());
GLenum target = static_cast<GLenum>(call->arg(0).toSInt());
- ss_target << "texture-target-" << target;
+ ss_target << "texture-unit-" << activeTextureUnit << "-target-" << target;
ss_texture << "texture-" << texture_map[target];
/* The texture resource depends on this call and any calls
ss_texture << "texture-" << texture_map[target];
/* The texture resource depends on this call and any calls
cap == GL_TEXTURE_3D ||
cap == GL_TEXTURE_CUBE_MAP)
{
cap == GL_TEXTURE_3D ||
cap == GL_TEXTURE_CUBE_MAP)
{
- linkf("render-state", "texture-target-", cap);
+ std::stringstream ss;
+
+ ss << "texture-unit-" << activeTextureUnit << "-target-" << cap;
+
+ link("render-state", ss.str());
}
provide("state", call->no);
}
provide("state", call->no);
cap == GL_TEXTURE_3D ||
cap == GL_TEXTURE_CUBE_MAP)
{
cap == GL_TEXTURE_3D ||
cap == GL_TEXTURE_CUBE_MAP)
{
- unlinkf("render-state", "texture-target-", cap);
+ std::stringstream ss;
+
+ ss << "texture-unit-" << activeTextureUnit << "-target-" << cap;
+
+ unlink("render-state", ss.str());
}
provide("state", call->no);
}
provide("state", call->no);
public:
TraceAnalyzer(): transformFeedbackActive(false),
framebufferObjectActive(false),
public:
TraceAnalyzer(): transformFeedbackActive(false),
framebufferObjectActive(false),
+ insideBeginEnd(false),
+ activeTextureUnit(GL_TEXTURE0)