From 721b857e5e2fd903a1863a954a60da66d8f0240f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Apr 2020 18:20:23 +0200 Subject: [PATCH] - minor FTexture cleanup. --- src/common/engine/palettecontainer.cpp | 57 +++++++++++++++--- src/common/engine/palettecontainer.h | 7 ++- src/common/utility/colormatcher.h | 1 + src/gamedata/fonts/font.cpp | 6 +- src/gamedata/textures/texture.cpp | 22 +++---- src/gamedata/textures/textures.h | 35 +++++------ src/maploader/maploader.cpp | 59 ++++--------------- src/maploader/maploader.h | 1 - src/r_data/sprites.cpp | 12 ++-- src/rendering/gl/textures/gl_hwtexture.cpp | 4 +- .../hwrenderer/textures/hw_material.cpp | 8 +-- .../polyrenderer/backend/poly_hwtexture.cpp | 8 +-- .../swrenderer/textures/r_swtexture.h | 4 +- .../vulkan/textures/vk_hwtexture.cpp | 8 +-- 14 files changed, 120 insertions(+), 112 deletions(-) diff --git a/src/common/engine/palettecontainer.cpp b/src/common/engine/palettecontainer.cpp index 33214f223..41e9a01ba 100644 --- a/src/common/engine/palettecontainer.cpp +++ b/src/common/engine/palettecontainer.cpp @@ -39,6 +39,7 @@ #include "colormatcher.h" #include "templates.h" #include "palettecontainer.h" +#include "files.h" PaletteContainer GPalette; FColorMatcher ColorMatcher; @@ -58,18 +59,31 @@ void PaletteContainer::Init(int numslots) // This cannot be a constructor!!! remap.Inactive = true; AddRemap(&remap); TranslationTables.Resize(numslots); + ColorMatcher.SetPalette(BaseColors); } -void PaletteContainer::SetPalette(const uint8_t* colors) +void PaletteContainer::SetPalette(const uint8_t* colors, int transparent_index) { + // At this point we do not care about the transparent index yet. for (int i = 0; i < 256; i++, colors += 3) { - BaseColors[i] = PalEntry(colors[0], colors[1], colors[2]); + BaseColors[i] = PalEntry(255, colors[0], colors[1], colors[2]); Remap[i] = i; } + uniqueRemaps[0]->MakeIdentity(); // update the identity remap. + + if (transparent_index >= 0 && transparent_index <= 255) + { + BaseColors[transparent_index] = 0; + uniqueRemaps[0]->Palette[transparent_index] = 0; + } + + uniqueRemaps[0]->crc32 = CalcCRC32((uint8_t*)uniqueRemaps[0]->Palette, sizeof(uniqueRemaps[0]->Palette)); + + // Find white and black from the original palette so that they can be - // used to make an educated guess of the translucency % for a BOOM + // used to make an educated guess of the translucency % for a // translucency map. WhiteIndex = BestColor((uint32_t*)BaseColors, 255, 255, 255, 0, 255); BlackIndex = BestColor((uint32_t*)BaseColors, 0, 0, 0, 0, 255); @@ -89,6 +103,35 @@ void PaletteContainer::Clear() TranslationTables.Reset(); } +//=========================================================================== +// +// +// +//=========================================================================== + +int PaletteContainer::DetermineTranslucency(FileReader& tranmap) +{ + uint8_t index; + PalEntry newcolor; + PalEntry newcolor2; + + if (!tranmap.isOpen()) return 255; + tranmap.Seek(GPalette.BlackIndex * 256 + GPalette.WhiteIndex, FileReader::SeekSet); + tranmap.Read(&index, 1); + + newcolor = GPalette.BaseColors[GPalette.Remap[index]]; + + tranmap.Seek(GPalette.WhiteIndex * 256 + GPalette.BlackIndex, FileReader::SeekSet); + tranmap.Read(&index, 1); + newcolor2 = GPalette.BaseColors[GPalette.Remap[index]]; + if (newcolor2.r == 255) // if black on white results in white it's either + // fully transparent or additive + { + return -newcolor.r; + } + return newcolor.r; +} + //---------------------------------------------------------------------------- // // @@ -166,7 +209,7 @@ FRemapTable *PaletteContainer::TranslationToTable(int translation) if (type <= 0 || type >= TranslationTables.Size() || index >= NumTranslations(type)) { - return NULL; + return uniqueRemaps[0]; // this is the identity table. } return GetTranslation(type, index); } @@ -664,10 +707,10 @@ bool FRemapTable::AddToTranslation(const char *range) // //---------------------------------------------------------------------------- -bool FRemapTable::AddColors(int start, int count, const uint8_t*colors) +bool FRemapTable::AddColors(int start, int count, const uint8_t*colors, int trans_color) { int end = start + count; - if (IndexOutOfRange(start, end)) + if (IndexOutOfRange(start, end-1)) { return false; } @@ -680,7 +723,7 @@ bool FRemapTable::AddColors(int start, int count, const uint8_t*colors) colors += 3; int j = GPalette.Remap[i]; - Palette[j] = PalEntry(j == 0 ? 0 : 255, br, bg, bb); + Palette[j] = PalEntry(j == trans_color ? 0 : 255, br, bg, bb); Remap[j] = ColorMatcher.Pick(Palette[j]); } return true; diff --git a/src/common/engine/palettecontainer.h b/src/common/engine/palettecontainer.h index 86c87cd5e..7b7143bae 100644 --- a/src/common/engine/palettecontainer.h +++ b/src/common/engine/palettecontainer.h @@ -4,6 +4,8 @@ #include "memarena.h" #include "palentry.h" +class FileReader; + struct FRemapTable { FRemapTable(int count = 256) { NumEntries = count; } @@ -18,7 +20,7 @@ struct FRemapTable bool AddColourisation(int start, int end, int r, int g, int b); bool AddTint(int start, int end, int r, int g, int b, int amount); bool AddToTranslation(const char* range); - bool AddColors(int start, int count, const uint8_t*); + bool AddColors(int start, int count, const uint8_t*, int trans_color = 0); uint8_t Remap[256]; // For the software renderer PalEntry Palette[256]; // The ideal palette this maps to @@ -79,8 +81,9 @@ private: TArray> TranslationTables; public: void Init(int numslots); // This cannot be a constructor!!! - void SetPalette(const uint8_t* colors); + void SetPalette(const uint8_t* colors, int transparent_index = -1); void Clear(); + int DetermineTranslucency(FileReader& file); FRemapTable* AddRemap(FRemapTable* remap); void UpdateTranslation(int trans, FRemapTable* remap); int AddTranslation(int slot, FRemapTable* remap, int count = 1); diff --git a/src/common/utility/colormatcher.h b/src/common/utility/colormatcher.h index 9d0826ea4..e17db4b5b 100644 --- a/src/common/utility/colormatcher.h +++ b/src/common/utility/colormatcher.h @@ -51,6 +51,7 @@ public: FColorMatcher (const uint32_t *palette) { Pal = reinterpret_cast(palette); } FColorMatcher (const FColorMatcher &other) = default; + void SetPalette(PalEntry* palette) { Pal = palette; } void SetPalette (const uint32_t *palette) { Pal = reinterpret_cast(palette); } uint8_t Pick (int r, int g, int b) { diff --git a/src/gamedata/fonts/font.cpp b/src/gamedata/fonts/font.cpp index 04ec748dd..ee856befa 100644 --- a/src/gamedata/fonts/font.cpp +++ b/src/gamedata/fonts/font.cpp @@ -234,7 +234,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla for (auto entry : array) { FTexture *tex = TexMan.GetTexture(entry, false); - if (tex && tex->SourceLump >= 0 && fileSystem.GetFileContainer(tex->SourceLump) <= fileSystem.GetMaxIwadNum() && tex->UseType == ETextureType::MiscPatch) + if (tex && tex->GetSourceLump() >= 0 && fileSystem.GetFileContainer(tex->GetSourceLump()) <= fileSystem.GetMaxIwadNum() && tex->GetUseType() == ETextureType::MiscPatch) { texs[i] = tex; } @@ -389,8 +389,8 @@ void FFont::ReadSheetFont(TArray &folderdata, int width, int height if (lump.isValid()) { auto tex = TexMan.GetTexture(lump); - int numtex_x = tex->GetWidth() / width; - int numtex_y = tex->GetHeight() / height; + int numtex_x = tex->GetTexelWidth() / width; + int numtex_y = tex->GetTexelHeight() / height; int maxinsheet = int(position) + numtex_x * numtex_y - 1; if (minchar > position) minchar = int(position); if (maxchar < maxinsheet) maxchar = maxinsheet; diff --git a/src/gamedata/textures/texture.cpp b/src/gamedata/textures/texture.cpp index 0a2012e9d..567ab1630 100644 --- a/src/gamedata/textures/texture.cpp +++ b/src/gamedata/textures/texture.cpp @@ -103,8 +103,8 @@ FTexture * FTexture::CreateTexture(const char *name, int lumpnum, ETextureType u tex->UseType = usetype; if (usetype == ETextureType::Flat) { - int w = tex->GetWidth(); - int h = tex->GetHeight(); + int w = tex->GetTexelWidth(); + int h = tex->GetTexelHeight(); // Auto-scale flats with dimensions 128x128 and 256x256. // In hindsight, a bad idea, but RandomLag made it sound better than it really is. @@ -333,11 +333,11 @@ int FTexture::CheckRealHeight() { auto pixels = Get8BitPixels(false); - for(int h = GetHeight()-1; h>= 0; h--) + for(int h = GetTexelHeight()-1; h>= 0; h--) { - for(int w = 0; w < GetWidth(); w++) + for(int w = 0; w < GetTexelWidth(); w++) { - if (pixels[h + w * GetHeight()] != 0) + if (pixels[h + w * GetTexelHeight()] != 0) { // Scale maxy before returning it h = int((h * 2) / Scale.Y); @@ -423,7 +423,7 @@ void FTexture::CreateDefaultBrightmap() auto texbuf = Get8BitPixels(false); const int white = ColorMatcher.Pick(255, 255, 255); - int size = GetWidth() * GetHeight(); + int size = GetTexelWidth() * GetTexelHeight(); for (int i = 0; iScale.X; - mRenderWidth = xs_CeilToInt(tex->GetWidth() / scale_x); + mRenderWidth = xs_CeilToInt(tex->GetTexelWidth() / scale_x); mScale.X = scale_x; mTempScale.X = x; } @@ -899,7 +899,7 @@ void FTexCoordInfo::GetFromTexture(FTexture *tex, float x, float y, bool forcewo else { float scale_y = y * (float)tex->Scale.Y; - mRenderHeight = xs_CeilToInt(tex->GetHeight() / scale_y); + mRenderHeight = xs_CeilToInt(tex->GetTexelHeight() / scale_y); mScale.Y = scale_y; mTempScale.Y = y; } @@ -909,7 +909,7 @@ void FTexCoordInfo::GetFromTexture(FTexture *tex, float x, float y, bool forcewo mRenderHeight = -mRenderHeight; } mWorldPanning = tex->bWorldPanning || forceworldpanning; - mWidth = tex->GetWidth(); + mWidth = tex->GetTexelWidth(); } diff --git a/src/gamedata/textures/textures.h b/src/gamedata/textures/textures.h index 4978ad811..aa024cbe5 100644 --- a/src/gamedata/textures/textures.h +++ b/src/gamedata/textures/textures.h @@ -278,9 +278,6 @@ struct FTextureBuffer // Base texture class class FTexture { - // This is initialization code that is allowed to have full access. - friend void R_InitSpriteDefs (); - friend void R_InstallSprite (int num, spriteframewithrotate *sprtemp, int &maxframe); friend class GLDefsParser; friend class FMultipatchTextureBuilder; @@ -302,7 +299,6 @@ class FTexture friend class FSkyBox; friend class FBrightmapTexture; friend class FFont; - friend class FSpecialFont; public: @@ -322,6 +318,9 @@ public: double GetDisplayLeftOffsetDouble() { return GetScaledLeftOffsetDouble(0); } double GetDisplayTopOffsetDouble() { return GetScaledTopOffsetDouble(0); } + int GetTexelWidth() { return Width; } + int GetTexelHeight() { return Height; } + bool isValid() const { return UseType != ETextureType::Null; } bool isSWCanvas() const { return UseType == ETextureType::SWCanvas; } @@ -352,13 +351,25 @@ public: void CreateDefaultBrightmap(); bool FindHoles(const unsigned char * buffer, int w, int h); void SetUseType(ETextureType type) { UseType = type; } + int GetSourceLump() const { return SourceLump; } ETextureType GetUseType() const { return UseType; } + void CopySize(FTexture* BaseTexture) + { + Width = BaseTexture->GetTexelWidth(); + Height = BaseTexture->GetTexelHeight(); + _TopOffset[0] = BaseTexture->_TopOffset[0]; + _TopOffset[1] = BaseTexture->_TopOffset[1]; + _LeftOffset[0] = BaseTexture->_LeftOffset[0]; + _LeftOffset[1] = BaseTexture->_LeftOffset[1]; + Scale = BaseTexture->Scale; + } + + // Returns the whole texture, stored in column-major order virtual TArray Get8BitPixels(bool alphatex); virtual FBitmap GetBgraBitmap(PalEntry *remap, int *trans = nullptr); -public: static bool SmoothEdges(unsigned char * buffer,int w, int h); static PalEntry averageColor(const uint32_t *data, int size, int maxout); @@ -441,9 +452,6 @@ protected: void SetSpeed(float fac) { shaderspeed = fac; } - int GetWidth () { return Width; } - int GetHeight () { return Height; } - int GetScaledWidth () { int foo = int((Width * 2) / Scale.X); return (foo >> 1) + (foo & 1); } int GetScaledHeight () { int foo = int((Height * 2) / Scale.Y); return (foo >> 1) + (foo & 1); } double GetScaledWidthDouble () { return Width / Scale.X; } @@ -471,17 +479,6 @@ protected: static void InitGrayMap(); - void CopySize(FTexture *BaseTexture) - { - Width = BaseTexture->GetWidth(); - Height = BaseTexture->GetHeight(); - _TopOffset[0] = BaseTexture->_TopOffset[0]; - _TopOffset[1] = BaseTexture->_TopOffset[1]; - _LeftOffset[0] = BaseTexture->_LeftOffset[0]; - _LeftOffset[1] = BaseTexture->_LeftOffset[1]; - Scale = BaseTexture->Scale; - } - void SetScaledSize(int fitwidth, int fitheight); void SetScale(const DVector2 &scale) { diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 5255f1ff8..98cc79bdc 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -2032,52 +2032,6 @@ void MapLoader::LoopSidedefs (bool firstloop) // //=========================================================================== -int MapLoader::DetermineTranslucency (int lumpnum) -{ - auto tranmap = fileSystem.OpenFileReader (lumpnum); - uint8_t index; - PalEntry newcolor; - PalEntry newcolor2; - - tranmap.Seek (GPalette.BlackIndex * 256 + GPalette.WhiteIndex, FileReader::SeekSet); - tranmap.Read (&index, 1); - - newcolor = GPalette.BaseColors[GPalette.Remap[index]]; - - tranmap.Seek (GPalette.WhiteIndex * 256 + GPalette.BlackIndex, FileReader::SeekSet); - tranmap.Read (&index, 1); - newcolor2 = GPalette.BaseColors[GPalette.Remap[index]]; - if (newcolor2.r == 255) // if black on white results in white it's either - // fully transparent or additive - { - if (developer >= DMSG_NOTIFY) - { - char lumpname[9]; - lumpname[8] = 0; - fileSystem.GetFileShortName (lumpname, lumpnum); - Printf ("%s appears to be additive translucency %d (%d%%)\n", lumpname, newcolor.r, - newcolor.r*100/255); - } - return -newcolor.r; - } - - if (developer >= DMSG_NOTIFY) - { - char lumpname[9]; - lumpname[8] = 0; - fileSystem.GetFileShortName (lumpname, lumpnum); - Printf ("%s appears to be translucency %d (%d%%)\n", lumpname, newcolor.r, - newcolor.r*100/255); - } - return newcolor.r; -} - -//=========================================================================== -// -// -// -//=========================================================================== - void MapLoader::ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &missingtex) { switch (special) @@ -2153,7 +2107,18 @@ void MapLoader::ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec else if ((lumpnum = fileSystem.CheckNumForName (msd->midtexture)) > 0 && fileSystem.FileLength (lumpnum) == 65536) { - *alpha = (short)DetermineTranslucency (lumpnum); + auto fr = fileSystem.OpenFileReader(lumpnum); + *alpha = (short)GPalette.DetermineTranslucency (fr); + + if (developer >= DMSG_NOTIFY) + { + char lumpname[9]; + lumpname[8] = 0; + fileSystem.GetFileShortName(lumpname, lumpnum); + if (*alpha < 0) Printf("%s appears to be additive translucency %d (%d%%)\n", lumpname, -*alpha, -*alpha * 100 / 255); + else Printf("%s appears to be translucency %d (%d%%)\n", lumpname, *alpha, *alpha * 100 / 255); + } + sd->SetTexture(side_t::mid, FNullTextureID()); } else diff --git a/src/maploader/maploader.h b/src/maploader/maploader.h index 6932b8aa0..4330b9309 100644 --- a/src/maploader/maploader.h +++ b/src/maploader/maploader.h @@ -221,7 +221,6 @@ private: void LoadZSegs(FileReader &data); void LoadZNodes(FileReader &data, int glnodes); - int DetermineTranslucency(int lumpnum); void SetLineID(int i, line_t *ld); void SaveLineSpecial(line_t *ld); void FinishLoadingLineDef(line_t *ld, int alpha); diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index 712ad9651..7bbe733cd 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -286,7 +286,7 @@ void R_InstallSprite (int num, spriteframewithrotate *sprtemp, int &maxframe) { for (int rot = 0; rot < 16; ++rot) { - TexMan.GetTexture(sprtemp[frame].Texture[rot])->Rotations = framestart + frame; + TexMan.GetTexture(sprtemp[frame].Texture[rot])->SetRotations(framestart + frame); } } } @@ -308,7 +308,7 @@ void R_InstallSprite (int num, spriteframewithrotate *sprtemp, int &maxframe) // letter/number appended. // The rotation character can be 0 to signify no rotations. // -#define TEX_DWNAME(tex) MAKE_ID(tex->Name[0], tex->Name[1], tex->Name[2], tex->Name[3]) +#define TEX_DWNAME(tex) MAKE_ID(tex->GetName()[0], tex->GetName()[1], tex->GetName()[2], tex->GetName()[3]) void R_InitSpriteDefs () { @@ -333,7 +333,7 @@ void R_InitSpriteDefs () for (i = 0; i < smax; ++i) { FTexture *tex = TexMan.ByIndex(i); - if (tex->UseType == ETextureType::Sprite && strlen(tex->Name) >= 6) + if (tex->GetUseType() == ETextureType::Sprite && strlen(tex->GetName()) >= 6) { size_t bucket = TEX_DWNAME(tex) % smax; hashes[i].Next = hashes[bucket].Head; @@ -417,10 +417,10 @@ void R_InitSpriteDefs () FTexture *tex = TexMan.GetTexture(hash); if (TEX_DWNAME(tex) == intname) { - bool res = R_InstallSpriteLump (FTextureID(hash), tex->Name[4] - 'A', tex->Name[5], false, sprtemp, maxframe); + bool res = R_InstallSpriteLump (FTextureID(hash), tex->GetName()[4] - 'A', tex->GetName()[5], false, sprtemp, maxframe); - if (tex->Name[6] && res) - R_InstallSpriteLump (FTextureID(hash), tex->Name[6] - 'A', tex->Name[7], true, sprtemp, maxframe); + if (tex->GetName()[6] && res) + R_InstallSpriteLump (FTextureID(hash), tex->GetName()[6] - 'A', tex->GetName()[7], true, sprtemp, maxframe); } hash = hashes[hash].Next; } diff --git a/src/rendering/gl/textures/gl_hwtexture.cpp b/src/rendering/gl/textures/gl_hwtexture.cpp index 177e35057..0d2ec2fc6 100644 --- a/src/rendering/gl/textures/gl_hwtexture.cpp +++ b/src/rendering/gl/textures/gl_hwtexture.cpp @@ -337,8 +337,8 @@ bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, i } else { - w = tex->GetWidth(); - h = tex->GetHeight(); + w = tex->GetTexelWidth(); + h = tex->GetTexelHeight(); } if (!CreateTexture(texbuffer.mBuffer, w, h, texunit, needmipmap, "FHardwareTexture.BindOrCreate")) { diff --git a/src/rendering/hwrenderer/textures/hw_material.cpp b/src/rendering/hwrenderer/textures/hw_material.cpp index 774807779..dafb4ba98 100644 --- a/src/rendering/hwrenderer/textures/hw_material.cpp +++ b/src/rendering/hwrenderer/textures/hw_material.cpp @@ -199,8 +199,8 @@ FMaterial::FMaterial(FTexture * tx, bool expanded) } } } - mWidth = tx->GetWidth(); - mHeight = tx->GetHeight(); + mWidth = tx->GetTexelWidth(); + mHeight = tx->GetTexelHeight(); mLeftOffset = tx->GetLeftOffset(0); // These only get used by decals and decals should not use renderer-specific offsets. mTopOffset = tx->GetTopOffset(0); mRenderWidth = tx->GetScaledWidth(); @@ -473,8 +473,8 @@ again: goto again; } if (tex->Brightmap != NULL && - (tex->GetWidth() != tex->Brightmap->GetWidth() || - tex->GetHeight() != tex->Brightmap->GetHeight()) + (tex->GetTexelWidth() != tex->Brightmap->GetTexelWidth() || + tex->GetTexelHeight() != tex->Brightmap->GetTexelHeight()) ) { // do not expand if the brightmap's size differs. diff --git a/src/rendering/polyrenderer/backend/poly_hwtexture.cpp b/src/rendering/polyrenderer/backend/poly_hwtexture.cpp index 17d162405..44dc2429a 100644 --- a/src/rendering/polyrenderer/backend/poly_hwtexture.cpp +++ b/src/rendering/polyrenderer/backend/poly_hwtexture.cpp @@ -108,8 +108,8 @@ PolyDepthStencil *PolyHardwareTexture::GetDepthStencil(FTexture *tex) { if (!mDepthStencil) { - int w = tex->GetWidth(); - int h = tex->GetHeight(); + int w = tex->GetTexelWidth(); + int h = tex->GetTexelHeight(); mDepthStencil.reset(new PolyDepthStencil(w, h)); } return mDepthStencil.get(); @@ -172,8 +172,8 @@ void PolyHardwareTexture::CreateImage(FTexture *tex, int translation, int flags) } else { - int w = tex->GetWidth(); - int h = tex->GetHeight(); + int w = tex->GetTexelWidth(); + int h = tex->GetTexelHeight(); mCanvas->Resize(w, h, false); } } diff --git a/src/rendering/swrenderer/textures/r_swtexture.h b/src/rendering/swrenderer/textures/r_swtexture.h index d01ee6f02..181465561 100644 --- a/src/rendering/swrenderer/textures/r_swtexture.h +++ b/src/rendering/swrenderer/textures/r_swtexture.h @@ -58,8 +58,8 @@ public: int GetSkyOffset() const { return mTexture->GetSkyOffset(); } PalEntry GetSkyCapColor(bool bottom) const { return mTexture->GetSkyCapColor(bottom); } - int GetWidth () { return mTexture->GetWidth(); } - int GetHeight () { return mTexture->GetHeight(); } + int GetWidth () { return mTexture->GetTexelWidth(); } + int GetHeight () { return mTexture->GetTexelHeight(); } int GetWidthBits() { return WidthBits; } int GetHeightBits() { return HeightBits; } diff --git a/src/rendering/vulkan/textures/vk_hwtexture.cpp b/src/rendering/vulkan/textures/vk_hwtexture.cpp index 49771cdba..6b4ff976b 100644 --- a/src/rendering/vulkan/textures/vk_hwtexture.cpp +++ b/src/rendering/vulkan/textures/vk_hwtexture.cpp @@ -179,8 +179,8 @@ VkTextureImage *VkHardwareTexture::GetDepthStencil(FTexture *tex) auto fb = GetVulkanFrameBuffer(); VkFormat format = fb->GetBuffers()->SceneDepthStencilFormat; - int w = tex->GetWidth(); - int h = tex->GetHeight(); + int w = tex->GetTexelWidth(); + int h = tex->GetTexelHeight(); ImageBuilder builder; builder.setSize(w, h); @@ -215,8 +215,8 @@ void VkHardwareTexture::CreateImage(FTexture *tex, int translation, int flags) auto fb = GetVulkanFrameBuffer(); VkFormat format = VK_FORMAT_R8G8B8A8_UNORM; - int w = tex->GetWidth(); - int h = tex->GetHeight(); + int w = tex->GetTexelWidth(); + int h = tex->GetTexelHeight(); ImageBuilder imgbuilder; imgbuilder.setFormat(format);