GL render manager: Fix bug when setting texture sampler if the wrong GL texture slot is active. Will likely help #10583

This commit is contained in:
Henrik Rydgård committed 2018-02-07 19:49:58 +01:00
1 parent b7dfc743f9
commit ce16547854
7 files changed
+30 -14

No files matched your search

+15 -3
View File
@@ -816,7 +816,12 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
break;
case GLRRenderCommand::TEXTURESAMPLER:
{
GLRTexture *tex = curTex[activeSlot];
GLint slot = c.textureSampler.slot;
if (slot != activeSlot) {
glActiveTexture(GL_TEXTURE0 + slot);
activeSlot = slot;
}
GLRTexture *tex = curTex[slot];
if (!tex) {
break;
}
@@ -846,7 +851,12 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
}
case GLRRenderCommand::TEXTURELOD:
{
GLRTexture *tex = curTex[activeSlot];
GLint slot = c.textureSampler.slot;
if (slot != activeSlot) {
glActiveTexture(GL_TEXTURE0 + slot);
activeSlot = slot;
}
GLRTexture *tex = curTex[slot];
if (!tex) {
break;
}
@@ -900,8 +910,10 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
}
}
if (activeSlot != 0)
if (activeSlot != 0) {
glActiveTexture(GL_TEXTURE0);
activeSlot = 0; // doesn't matter, just nice.
}
// Wipe out the current state.
glBindBuffer(GL_ARRAY_BUFFER, 0);