diff --git a/Source/Render/DX7/TextureBindingDX7.cpp b/Source/Render/DX7/TextureBindingDX7.cpp index 50b74b762..10561874c 100644 --- a/Source/Render/DX7/TextureBindingDX7.cpp +++ b/Source/Render/DX7/TextureBindingDX7.cpp @@ -8,17 +8,29 @@ void CRendererDX7::SetTexture(unsigned stage, CTextureDX7* texture) { switch (stage) { case 0: if (this->boundTexture != texture) { - this->device->SetTexture(0, texture ? texture->NativeSurface() : nullptr); + if (texture == nullptr) { + this->device->SetTexture(0, nullptr); + } else { + this->device->SetTexture(0, texture->NativeSurface()); + } this->boundTexture = texture; } break; case 1: if (this->boundLightmap != texture) { - this->device->SetTexture(1, texture ? texture->NativeSurface() : nullptr); + if (texture == nullptr) { + this->device->SetTexture(1, nullptr); + } else { + this->device->SetTexture(1, texture->NativeSurface()); + } this->boundLightmap = texture; } break; default: - this->device->SetTexture(stage, texture ? texture->NativeSurface() : nullptr); + if (texture != nullptr) { + this->device->SetTexture(stage, texture->NativeSurface()); + } else { + this->device->SetTexture(stage, nullptr); + } } }