diff --git a/source/common/textures/hw_material.cpp b/source/common/textures/hw_material.cpp index dabe738da..f8d379cd4 100644 --- a/source/common/textures/hw_material.cpp +++ b/source/common/textures/hw_material.cpp @@ -49,7 +49,11 @@ FMaterial::FMaterial(FGameTexture * tx, int scaleflags) auto imgtex = tx->GetTexture(); mTextureLayers.Push({ imgtex, scaleflags, -1 }); - if ((tx->GetUseType() == ETextureType::SWCanvas && static_cast(imgtex)->GetColorFormat() == 0) || (scaleflags & CTF_Indexed)) + if (tx->GetUseType() == ETextureType::SWCanvas && static_cast(imgtex)->GetColorFormat() == 0) + { + mShaderIndex = SHADER_Paletted; + } + else if (scaleflags & CTF_Indexed) { mTextureLayers[0].scaleFlags |= CTF_Indexed; mShaderIndex = SHADER_Paletted; @@ -159,7 +163,7 @@ FMaterial::~FMaterial() IHardwareTexture* FMaterial::GetLayer(int i, int translation, MaterialLayerInfo** pLayer) const { - if (mShaderIndex == SHADER_Paletted && i > 0 && layercallback) + if ((mScaleFlags & CTF_Indexed) && i > 0 && layercallback) { static MaterialLayerInfo deflayer = { nullptr, 0, CLAMP_XY }; if (i == 1 || i == 2) @@ -173,7 +177,7 @@ IHardwareTexture* FMaterial::GetLayer(int i, int translation, MaterialLayerInfo* { auto& layer = mTextureLayers[i]; if (pLayer) *pLayer = &layer; - if (mShaderIndex == SHADER_Paletted) translation = -1; + if (mScaleFlags & CTF_Indexed) translation = -1; if (layer.layerTexture) return layer.layerTexture->GetHardwareTexture(translation, layer.scaleFlags); } return nullptr; diff --git a/source/common/textures/hw_texcontainer.h b/source/common/textures/hw_texcontainer.h index a29fc6396..c36eea38a 100644 --- a/source/common/textures/hw_texcontainer.h +++ b/source/common/textures/hw_texcontainer.h @@ -12,9 +12,9 @@ enum ECreateTexBufferFlags CTF_Expand = 1, // create buffer with a one-pixel wide border CTF_Upscale = 2, // Upscale the texture CTF_CreateMask = 3, // Flags that are relevant for hardware texture creation. - CTF_ProcessData = 4, // run postprocessing on the generated buffer. This is only needed when using the data for a hardware texture. + CTF_Indexed = 4, // Tell the backend to create an indexed texture. CTF_CheckOnly = 8, // Only runs the code to get a content ID but does not create a texture. Can be used to access a caching system for the hardware textures. - CTF_Indexed = 16 // Tell the backend to create an indexed texture. + CTF_ProcessData = 16, // run postprocessing on the generated buffer. This is only needed when using the data for a hardware texture. }; class FHardwareTextureContainer