- major dependency reduction of the texture system.

This commit is contained in:
Christoph Oelckers 2020-04-11 19:00:07 +02:00
commit f8e9cb8fbc
103 changed files with 820 additions and 712 deletions

View file

@ -49,6 +49,7 @@
#include "g_levellocals.h"
#include "vm.h"
#include "hwrenderer/utility/hw_cvars.h"
#include "texturemanager.h"
CVAR(Float, underwater_fade_scalar, 1.0f, CVAR_ARCHIVE) // [Nash] user-settable underwater blend intensity

View file

@ -59,6 +59,7 @@
#include "r_data/models/models.h"
#include "gl/renderer/gl_postprocessstate.h"
#include "gl/system/gl_buffers.h"
#include "texturemanager.h"
EXTERN_CVAR(Int, screenblocks)
EXTERN_CVAR(Bool, cl_capfps)

View file

@ -25,6 +25,7 @@
#include "hwrenderer/postprocessing/hw_postprocess_cvars.h"
#include "hwrenderer/postprocessing/hw_postprocessshader.h"
#include <random>
#include "texturemanager.h"
Postprocess hw_postprocess;

View file

@ -33,6 +33,7 @@
#include "po_man.h"
#include "m_fixed.h"
#include "ctpl.h"
#include "texturemanager.h"
#include "hwrenderer/scene/hw_fakeflat.h"
#include "hwrenderer/scene/hw_clipper.h"
#include "hwrenderer/scene/hw_drawstructs.h"

View file

@ -37,6 +37,7 @@
#include "hwrenderer/utility/hw_clock.h"
#include "hwrenderer/data/flatvertices.h"
#include "hw_renderstate.h"
#include "texturemanager.h"
//==========================================================================
//

View file

@ -35,6 +35,7 @@
#include "hw_drawinfo.h"
#include "hwrenderer/utility/hw_cvars.h"
#include "r_utility.h"
#include "texturemanager.h"
static sector_t **fakesectorbuffer;

View file

@ -30,6 +30,7 @@
#include "r_sky.h"
#include "g_levellocals.h"
#include "a_dynlight.h"
#include "texturemanager.h"
#include "hw_drawinfo.h"
#include "hw_drawstructs.h"

View file

@ -27,6 +27,7 @@
#include "doomdata.h"
#include "g_levellocals.h"
#include "p_lnspec.h"
#include "texturemanager.h"
#include "hwrenderer/scene/hw_drawinfo.h"
#include "hwrenderer/scene/hw_drawstructs.h"
#include "hwrenderer/scene/hw_portal.h"

View file

@ -41,6 +41,7 @@
#include "matrix.h"
#include "r_data/models/models.h"
#include "vectors.h"
#include "texturemanager.h"
#include "hwrenderer/models/hw_models.h"
#include "hwrenderer/scene/hw_drawstructs.h"

View file

@ -30,6 +30,7 @@
#include "doomdata.h"
#include "g_levellocals.h"
#include "actorinlines.h"
#include "texturemanager.h"
#include "hwrenderer/dynlights/hw_dynlightdata.h"
#include "hwrenderer/textures/hw_material.h"
#include "hwrenderer/utility/hw_cvars.h"

View file

@ -34,6 +34,7 @@
#include "r_data/models/models.h"
#include "hw_weapon.h"
#include "hw_fakeflat.h"
#include "texturemanager.h"
#include "hwrenderer/models/hw_models.h"
#include "hwrenderer/dynlights/hw_dynlightdata.h"

View file

@ -29,6 +29,7 @@
#include "v_video.h"
#include "hw_ihwtexture.h"
#include "hw_material.h"
#include "texturemanager.h"
//===========================================================================
//
@ -493,3 +494,54 @@ FMaterial * FMaterial::ValidateTexture(FTextureID no, bool expand, bool translat
{
return ValidateTexture(TexMan.GetTexture(no, translate), expand, create);
}
//-----------------------------------------------------------------------------
//
// Make sprite offset adjustment user-configurable per renderer.
//
//-----------------------------------------------------------------------------
extern int r_spriteadjustSW, r_spriteadjustHW;
CUSTOM_CVAR(Int, r_spriteadjust, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
r_spriteadjustHW = !!(self & 2);
r_spriteadjustSW = !!(self & 1);
for (int i = 0; i < TexMan.NumTextures(); i++)
{
auto tex = TexMan.GetTexture(FSetTextureID(i));
if (tex->GetTexelLeftOffset(0) != tex->GetTexelLeftOffset(1) || tex->GetTexelTopOffset(0) != tex->GetTexelTopOffset(1))
{
for (int i = 0; i < 2; i++)
{
auto mat = tex->GetMaterial(i);
if (mat != nullptr) mat->SetSpriteRect();
}
}
}
}
//==========================================================================
//
// this must be copied back to textures.cpp later.
//
//==========================================================================
FWrapperTexture::FWrapperTexture(int w, int h, int bits)
{
Width = w;
Height = h;
Format = bits;
UseType = ETextureType::SWCanvas;
bNoCompress = true;
auto hwtex = screen->CreateHardwareTexture();
// todo: Initialize here.
SystemTextures.AddHardwareTexture(0, false, hwtex);
}
void DeleteMaterial(FMaterial* mat)
{
delete mat;
}

View file

@ -7,8 +7,6 @@
#include "r_defs.h"
EXTERN_CVAR(Bool, gl_precache)
struct FRemapTable;
class FTextureShader;
class IHardwareTexture;

View file

@ -36,7 +36,9 @@
#include "image.h"
#include "v_video.h"
#include "v_font.h"
#include "texturemanager.h"
EXTERN_CVAR(Bool, gl_precache)
//==========================================================================
//
@ -238,14 +240,14 @@ void hw_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
{
if (tex->GetImage() && tex->SystemTextures.GetHardwareTexture(0, false) == nullptr)
{
FImageSource::RegisterForPrecache(tex->GetImage());
FImageSource::RegisterForPrecache(tex->GetImage(), V_IsTrueColor());
}
}
// Only register untranslated sprites. Translated ones are very unlikely to require data that can be reused.
if (spritehitlist[i] != nullptr && (*spritehitlist[i]).CheckKey(0))
{
FImageSource::RegisterForPrecache(tex->GetImage());
FImageSource::RegisterForPrecache(tex->GetImage(), V_IsTrueColor());
}
}
}

View file

@ -2,6 +2,7 @@
#include "tarray.h"
#include "hwrenderer/textures/hw_ihwtexture.h"
#include "palettecontainer.h"
struct FTextureBuffer;
class IHardwareTexture;

View file

@ -27,6 +27,7 @@
#include "hw_cvars.h"
#include "hwrenderer/textures/hw_material.h"
#include "menu/menu.h"
#include "texturemanager.h"

View file

@ -38,6 +38,7 @@
#include "r_utility.h"
#include "v_text.h"
#include "g_levellocals.h"
#include "texturemanager.h"
//
// sky mapping

View file

@ -42,6 +42,7 @@
#include "v_palette.h"
#include "r_utility.h"
#include "r_data/colormaps.h"
#include "texturemanager.h"
#include "swrenderer/r_memory.h"
#include "swrenderer/scene/r_opaque_pass.h"
#include "swrenderer/scene/r_3dfloors.h"

View file

@ -38,6 +38,7 @@
#include "po_man.h"
#include "r_data/colormaps.h"
#include "d_net.h"
#include "texturemanager.h"
#include "swrenderer/r_memory.h"
#include "swrenderer/r_renderthread.h"
#include "swrenderer/drawers/r_draw.h"

View file

@ -35,6 +35,7 @@
#include "cmdlib.h"
#include "d_net.h"
#include "g_level.h"
#include "texturemanager.h"
#include "swrenderer/scene/r_opaque_pass.h"
#include "r_skyplane.h"
#include "swrenderer/scene/r_3dfloors.h"

View file

@ -37,6 +37,7 @@
#include "d_net.h"
#include "g_level.h"
#include "a_dynlight.h"
#include "texturemanager.h"
#include "swrenderer/r_memory.h"
#include "swrenderer/r_renderthread.h"
#include "swrenderer/scene/r_opaque_pass.h"

View file

@ -52,6 +52,7 @@
#include "g_levellocals.h"
#include "image.h"
#include "imagehelpers.h"
#include "texturemanager.h"
// [BB] Use ZDoom's freelook limit for the sotfware renderer.
// Note: ZDoom's limit is chosen such that the sky is rendered properly.
@ -95,7 +96,7 @@ void FSoftwareRenderer::PreparePrecache(FTexture *ttex, int cache)
}
else if (cache != 0)
{
FImageSource::RegisterForPrecache(ttex->GetImage());
FImageSource::RegisterForPrecache(ttex->GetImage(), V_IsTrueColor());
}
}
}

View file

@ -35,6 +35,7 @@
#include "swrenderer/scene/r_light.h"
#include "image.h"
#include "engineerrors.h"
#include "texturemanager.h"
// [RH] Base blending values (for e.g. underwater)
int BaseBlendR, BaseBlendG, BaseBlendB;

View file

@ -37,6 +37,7 @@
#include "engineerrors.h"
#include "p_lnspec.h"
#include "p_setup.h"
#include "texturemanager.h"
#include "swrenderer/drawers/r_draw.h"
#include "swrenderer/plane/r_visibleplane.h"

View file

@ -598,3 +598,8 @@ void FSoftwareTexture::FreeAllSpans()
}
}
void DeleteSoftwareTexture(FSoftwareTexture* swtex)
{
delete swtex;
}

View file

@ -32,7 +32,8 @@
**
*/
#include "textures/textures.h"
#include "textures.h"
#include "texturemanager.h"
template<class TYPE>
void WarpBuffer(TYPE *Pixels, const TYPE *source, int width, int height, int xmul, int ymul, uint64_t time, float Speed, int warptype)

View file

@ -41,6 +41,7 @@
#include "swrenderer/drawers/r_draw.h"
#include "v_palette.h"
#include "r_data/colormaps.h"
#include "texturemanager.h"
#include "swrenderer/line/r_wallsetup.h"
#include "swrenderer/line/r_walldraw.h"
#include "swrenderer/segments/r_drawsegment.h"

View file

@ -29,6 +29,7 @@
#include "r_data/r_vanillatrans.h"
#include "actorinlines.h"
#include "i_time.h"
#include "texturemanager.h"
#include "swrenderer/r_memory.h"
#include "swrenderer/r_swcolormaps.h"
#include "swrenderer/viewport/r_viewport.h"

View file

@ -56,6 +56,7 @@
#include "p_local.h"
#include "p_maputl.h"
#include "r_voxel.h"
#include "texturemanager.h"
#include "swrenderer/segments/r_drawsegment.h"
#include "swrenderer/scene/r_portal.h"
#include "swrenderer/scene/r_scene.h"