mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- fixed layer creation.
This commit is contained in:
parent
173b8beb33
commit
7ea1e8acee
2 changed files with 21 additions and 16 deletions
|
@ -404,17 +404,21 @@ outl:
|
||||||
|
|
||||||
IHardwareTexture *FMaterial::GetLayer(int i, int translation, FTexture **pLayer)
|
IHardwareTexture *FMaterial::GetLayer(int i, int translation, FTexture **pLayer)
|
||||||
{
|
{
|
||||||
FTexture *texture = i == 0 ? tex : mTextureLayers[i - 1];
|
FTexture *layer = i == 0 ? tex : mTextureLayers[i - 1];
|
||||||
if (pLayer) *pLayer = tex;
|
if (pLayer) *pLayer = layer;
|
||||||
|
|
||||||
auto hwtex = tex->SystemTextures.GetHardwareTexture(translation, mExpanded);
|
if (layer && layer->UseType!=ETextureType::Null)
|
||||||
if (hwtex == nullptr)
|
|
||||||
{
|
{
|
||||||
hwtex = screen->CreateHardwareTexture();
|
IHardwareTexture *hwtex = layer->SystemTextures.GetHardwareTexture(0, mExpanded);
|
||||||
// Fixme: This needs to create the texture here and not implicitly in BindOrCreate!
|
if (hwtex == nullptr)
|
||||||
tex->SystemTextures.AddHardwareTexture(translation, mExpanded, hwtex);
|
{
|
||||||
|
hwtex = screen->CreateHardwareTexture();
|
||||||
|
layer->SystemTextures.AddHardwareTexture(0, mExpanded, hwtex);
|
||||||
|
hwtex = tex->SystemTextures.GetHardwareTexture(0, mExpanded);
|
||||||
|
}
|
||||||
|
return hwtex;
|
||||||
}
|
}
|
||||||
return hwtex;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -473,8 +477,8 @@ again:
|
||||||
{
|
{
|
||||||
if (tex->bNoExpand) expand = false;
|
if (tex->bNoExpand) expand = false;
|
||||||
|
|
||||||
FMaterial *gltex = tex->Material[expand];
|
FMaterial *hwtex = tex->Material[expand];
|
||||||
if (gltex == NULL && create)
|
if (hwtex == NULL && create)
|
||||||
{
|
{
|
||||||
if (expand)
|
if (expand)
|
||||||
{
|
{
|
||||||
|
@ -493,9 +497,9 @@ again:
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gltex = new FMaterial(tex, expand);
|
hwtex = new FMaterial(tex, expand);
|
||||||
}
|
}
|
||||||
return gltex;
|
return hwtex;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "formats/multipatchtexture.h"
|
#include "formats/multipatchtexture.h"
|
||||||
|
#include "swrenderer/textures/r_swtexture.h"
|
||||||
|
|
||||||
FTextureManager TexMan;
|
FTextureManager TexMan;
|
||||||
|
|
||||||
|
@ -159,11 +160,11 @@ void FTextureManager::FlushAll()
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 2; j++)
|
for (int j = 0; j < 2; j++)
|
||||||
{
|
{
|
||||||
TexMan.ByIndex(i)->SystemTextures.Clean(true, true);
|
Textures[i].Texture->SystemTextures.Clean(true, true);
|
||||||
delete TexMan.ByIndex(i)->SoftwareTexture;
|
delete Textures[i].Texture->SoftwareTexture;
|
||||||
|
Textures[i].Texture->SoftwareTexture = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This must also delete the software renderer's canvas.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue