- removed the unused feature to allow animated material layers.

This was a relic from trying to support ZDoomGL's texture shader system but would make texture management with Vulkan significantly more complicated because it would require dynamic descriptor set management for textures which can cause a lot of overhead.
This commit is contained in:
Christoph Oelckers 2018-07-14 12:10:41 +02:00
parent 7de9e1f097
commit 69a3271440
2 changed files with 7 additions and 24 deletions

View File

@ -158,7 +158,7 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
{ {
if(texture == nullptr) continue; if(texture == nullptr) continue;
ValidateSysTexture(texture, expanded); ValidateSysTexture(texture, expanded);
mTextureLayers.Push({ texture, false }); mTextureLayers.Push(texture);
} }
mShaderIndex = tx->shaderindex; mShaderIndex = tx->shaderindex;
} }
@ -169,7 +169,7 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
for (auto &texture : { tx->Normal, tx->Specular }) for (auto &texture : { tx->Normal, tx->Specular })
{ {
ValidateSysTexture(texture, expanded); ValidateSysTexture(texture, expanded);
mTextureLayers.Push({ texture, false }); mTextureLayers.Push(texture);
} }
mShaderIndex = SHADER_Specular; mShaderIndex = SHADER_Specular;
} }
@ -178,7 +178,7 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
for (auto &texture : { tx->Normal, tx->Metallic, tx->Roughness, tx->AmbientOcclusion }) for (auto &texture : { tx->Normal, tx->Metallic, tx->Roughness, tx->AmbientOcclusion })
{ {
ValidateSysTexture(texture, expanded); ValidateSysTexture(texture, expanded);
mTextureLayers.Push({ texture, false }); mTextureLayers.Push(texture);
} }
mShaderIndex = SHADER_PBR; mShaderIndex = SHADER_PBR;
} }
@ -187,8 +187,7 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
if (tx->Brightmap != NULL) if (tx->Brightmap != NULL)
{ {
ValidateSysTexture(tx->Brightmap, expanded); ValidateSysTexture(tx->Brightmap, expanded);
FTextureLayer layer = {tx->Brightmap, false}; mTextureLayers.Push(tx->Brightmap);
mTextureLayers.Push(layer);
if (mShaderIndex == SHADER_Specular) if (mShaderIndex == SHADER_Specular)
mShaderIndex = SHADER_SpecularBrightmap; mShaderIndex = SHADER_SpecularBrightmap;
else if (mShaderIndex == SHADER_PBR) else if (mShaderIndex == SHADER_PBR)
@ -448,16 +447,7 @@ void FMaterial::Bind(int clampmode, int translation)
{ {
for(unsigned i=0;i<mTextureLayers.Size();i++) for(unsigned i=0;i<mTextureLayers.Size();i++)
{ {
FTexture *layer; FTexture *layer = mTextureLayers[i];
if (mTextureLayers[i].animated)
{
FTextureID id = mTextureLayers[i].texture->id;
layer = TexMan(id);
}
else
{
layer = mTextureLayers[i].texture;
}
auto systex = ValidateSysTexture(layer, mExpanded); auto systex = ValidateSysTexture(layer, mExpanded);
systex->BindOrCreate(layer, i+1, clampmode, 0, mExpanded ? CTF_Expand : 0); systex->BindOrCreate(layer, i+1, clampmode, 0, mExpanded ? CTF_Expand : 0);
maxbound = i+1; maxbound = i+1;

View File

@ -52,12 +52,6 @@ class FMaterial
{ {
friend class FRenderState; friend class FRenderState;
struct FTextureLayer
{
FTexture *texture;
bool animated;
};
// This array is needed because not all textures are managed by the texture manager // This array is needed because not all textures are managed by the texture manager
// but some code needs to discard all hardware dependent data attached to any created texture. // but some code needs to discard all hardware dependent data attached to any created texture.
// Font characters are not, for example. // Font characters are not, for example.
@ -65,7 +59,7 @@ class FMaterial
static int mMaxBound; static int mMaxBound;
IHardwareTexture *mBaseLayer; IHardwareTexture *mBaseLayer;
TArray<FTextureLayer> mTextureLayers; TArray<FTexture*> mTextureLayers;
int mShaderIndex; int mShaderIndex;
short mLeftOffset; short mLeftOffset;
@ -95,9 +89,8 @@ public:
void PrecacheList(SpriteHits &translations); void PrecacheList(SpriteHits &translations);
void AddTextureLayer(FTexture *tex) void AddTextureLayer(FTexture *tex)
{ {
FTextureLayer layer = { tex, false };
ValidateTexture(tex, false); ValidateTexture(tex, false);
mTextureLayers.Push(layer); mTextureLayers.Push(tex);
} }
bool isMasked() const bool isMasked() const
{ {