Generate a texture name even for fbo textures.

Otherwise, when it stops being a render-to-texture, we won't have a
texture name and we'll get confused.  A texture name shouldn't be
expensive to generate in this case anyway.
This commit is contained in:
Unknown W. Brackets 2013-10-26 08:37:52 -07:00
parent 453be5530e
commit 30bf067787

View File

@ -1008,6 +1008,11 @@ void TextureCache::SetTexture(bool force) {
gstate_c.curTextureWidth = w;
gstate_c.curTextureHeight = h;
// Always generate a texture name, we might need it if the texture is replaced later.
if (!replaceImages) {
glGenTextures(1, &entry->texture);
}
// Before we go reading the texture from memory, let's check for render-to-texture.
for (size_t i = 0, n = fbCache_.size(); i < n; ++i) {
auto framebuffer = fbCache_[i];
@ -1032,10 +1037,6 @@ void TextureCache::SetTexture(bool force) {
entry->lastFrame = gpuStats.numFlips;
return;
}
if (!replaceImages) {
glGenTextures(1, &entry->texture);
}
glBindTexture(GL_TEXTURE_2D, entry->texture);
lastBoundTexture = entry->texture;