- use GZDoom's gl_samplers.cpp

This commit is contained in:
Christoph Oelckers 2020-05-28 23:48:50 +02:00
parent 362be65060
commit 72889540a5
28 changed files with 160 additions and 156 deletions

View file

@ -713,7 +713,7 @@ set( FASTMATH_SOURCES
set (PCH_SOURCES
glbackend/gl_hwtexture.cpp
glbackend/gl_samplers.cpp
#glbackend/gl_samplers.cpp
glbackend/gl_shader.cpp
glbackend/glbackend.cpp
glbackend/gl_palmanager.cpp
@ -866,6 +866,8 @@ set (PCH_SOURCES
common/objects/dobjgc.cpp
common/objects/dobjtype.cpp
common/rendering/gl_load/gl_interface.cpp
common/rendering/gl/gl_debug.cpp
common/rendering/gl/gl_samplers.cpp
common/scripting/core/dictionary.cpp
common/scripting/core/dynarrays.cpp
common/scripting/core/symbols.cpp
@ -914,7 +916,6 @@ set (PCH_SOURCES
core/rendering/gl/renderer/gl_renderbuffers.cpp
core/rendering/gl/shaders/gl_shaderprogram.cpp
core/rendering/gl/system/gl_buffers.cpp
core/rendering/gl/system/gl_debug.cpp
core/rendering/gl/system/gl_framebuffer.cpp
core/rendering/hwrenderer/data/flatvertices.cpp
core/rendering/hwrenderer/postprocessing/hw_postprocess.cpp
@ -1036,6 +1037,7 @@ include_directories(
common/objects
common/rendering
common/rendering/gl_load
common/rendering/gl
common/scripting/vm
common/scripting/jit
common/scripting/core

View file

@ -1087,7 +1087,6 @@ void renderSetRollAngle(float rolla);
// clamping is for sprites, repeating is for walls
void tileInvalidate(int tilenume, int32_t pal, int32_t how);
void polymost_glreset(void);
void PrecacheHardwareTextures(int nTile);
void Polymost_Startup();
@ -1114,8 +1113,8 @@ EXTERN_CVAR(Bool, hw_animsmoothing)
EXTERN_CVAR(Bool, hw_hightile)
EXTERN_CVAR(Bool, hw_models)
EXTERN_CVAR(Float, hw_shadescale)
EXTERN_CVAR(Int, hw_anisotropy)
EXTERN_CVAR(Int, hw_texfilter)
EXTERN_CVAR(Float, gl_texture_filter_anisotropic)
EXTERN_CVAR(Int, gl_texture_filter)
extern bool hw_int_useindexedcolortextures;
EXTERN_CVAR(Bool, hw_useindexedcolortextures)
EXTERN_CVAR(Bool, hw_parallaxskypanning)

View file

@ -421,7 +421,7 @@ void animvpx_setup_glstate(int32_t animvpx_flags)
vpxtex[0] = MakeGameTexture(new VPXTexture, nullptr, ETextureType::Special);
vpxtex[1] = MakeGameTexture(new VPXTexture, nullptr, ETextureType::Special);
if ((animvpx_flags & CUTSCENE_TEXTUREFILTER && hw_texfilter == TEXFILTER_ON) || animvpx_flags & CUTSCENE_FORCEFILTER ||
if ((animvpx_flags & CUTSCENE_TEXTUREFILTER && gl_texture_filter == TEXFILTER_ON) || animvpx_flags & CUTSCENE_FORCEFILTER ||
(!(animvpx_flags & CUTSCENE_TEXTUREFILTER) && !(animvpx_flags & CUTSCENE_FORCENOFILTER))) // if no flags, then use filter for IVFs
{
sampler = CLAMP_XY;

View file

@ -37,7 +37,7 @@ CUSTOM_CVARD(Bool, hw_useindexedcolortextures, false, CVAR_ARCHIVE | CVAR_GLOBAL
}
CUSTOM_CVARD(Int, hw_texfilter, TEXFILTER_ON, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "changes the texture filtering settings")
CUSTOM_CVARD(Int, gl_texture_filter, TEXFILTER_ON, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL, "changes the texture filtering settings")
{
static const char* const glfiltermodes[] =
{
@ -54,11 +54,11 @@ CUSTOM_CVARD(Int, hw_texfilter, TEXFILTER_ON, CVAR_ARCHIVE | CVAR_GLOBALCONFIG,
else
{
gltexapplyprops();
Printf("Texture filtering mode changed to %s\n", glfiltermodes[hw_texfilter]);
Printf("Texture filtering mode changed to %s\n", glfiltermodes[gl_texture_filter]);
}
}
CUSTOM_CVARD(Int, hw_anisotropy, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "changes the OpenGL texture anisotropy setting")
CUSTOM_CVARD(Float, gl_texture_filter_anisotropic, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL, "changes the OpenGL texture anisotropy setting")
{
gltexapplyprops();
}
@ -116,8 +116,6 @@ static int32_t drawpoly_srepeat = 0, drawpoly_trepeat = 0;
static int32_t lastglpolygonmode = 0; //FUK
static FHardwareTexture *polymosttext = 0;
static int32_t r_yshearing = 0;
// used for fogcalc
@ -145,23 +143,18 @@ void polymost_outputGLDebugMessage(uint8_t severity, const char* format, ...)
void gltexapplyprops(void)
{
if (videoGetRenderMode() == REND_CLASSIC)
return;
if (GLInterface.glinfo.maxanisotropy > 1.f)
{
if (hw_anisotropy <= 0 || hw_anisotropy > GLInterface.glinfo.maxanisotropy)
hw_anisotropy = (int32_t)GLInterface.glinfo.maxanisotropy;
if (gl_texture_filter_anisotropic <= 0 || gl_texture_filter_anisotropic > GLInterface.glinfo.maxanisotropy)
gl_texture_filter_anisotropic = (int32_t)GLInterface.glinfo.maxanisotropy;
}
GLInterface.mSamplers->SetTextureFilterMode(hw_texfilter, hw_anisotropy);
// do not force switch indexed textures with the filter.
GLInterface.mSamplers->SetTextureFilterMode();
}
//--------------------------------------------------------------------------------------------------
//Use this for both initialization and uninitialization of OpenGL.
static int32_t gltexcacnum = -1;
//in-place multiply m0=m0*m1
static float* multiplyMatrix4f(float m0[4*4], const float m1[4*4])
@ -201,26 +194,8 @@ static float* multiplyMatrix4f(float m0[4*4], const float m1[4*4])
void polymost_glreset()
{
//Reset if this is -1 (meaning 1st texture call ever), or > 0 (textures in memory)
if (gltexcacnum < 0)
{
gltexcacnum = 0;
//For 2D calls before 1st polymost_drawrooms()
gcosang = gcosang2 = 16384.f/262144.f;
gsinang = gsinang2 = 0.f;
}
else
{
TexMan.FlushAll();
}
if (polymosttext)
delete polymosttext;
polymosttext=nullptr;
#ifdef DEBUGGINGAIDS
Printf("polymost_glreset()\n");
#endif
gcosang = gcosang2 = 16384.f/262144.f;
gsinang = gsinang2 = 0.f;
}
FileReader GetBaseResource(const char* fn);

View file

@ -20,8 +20,8 @@
*/
#include "templates.h"
#include "gl_load/gl_system.h"
#include "gl/system/gl_debug.h"
#include "gl_system.h"
#include "gl_debug.h"
#include "stats.h"
#include "printf.h"
#include <set>

View file

@ -2,7 +2,7 @@
#define __GL_DEBUG_H
#include <string.h>
#include "gl_load/gl_interface.h"
#include "gl_interface.h"
#include "c_cvars.h"
#include "v_video.h"

View file

@ -32,63 +32,68 @@
**---------------------------------------------------------------------------
**
*/
#include "gl_system.h"
#include "c_cvars.h"
#include "gl_load.h"
#include "glbackend.h"
#include "gl_interface.h"
#include "hw_cvars.h"
#include "gl_debug.h"
#include "gl_renderer.h"
#include "gl_samplers.h"
#include "hw_material.h"
#include "i_interface.h"
struct TexFilter_s
namespace OpenGLRenderer
{
int minfilter;
int magfilter;
bool mipmapping;
} ;
TexFilter_s TexFilter[]={
{GL_NEAREST, GL_NEAREST, false},
{GL_LINEAR, GL_LINEAR, false},
{GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST, true},
{GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, true},
{GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST, true},
{GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, true},
{GL_LINEAR_MIPMAP_LINEAR, GL_NEAREST, true},
};
extern TexFilter_s TexFilter[];
FSamplerManager::FSamplerManager()
{
glGenSamplers(NumSamplers, mSamplers);
glGenSamplers(NUMSAMPLERS, mSamplers);
for (int i = SamplerNoFilterRepeat; i <= SamplerNoFilterClampXY; i++)
glSamplerParameteri(mSamplers[CLAMP_X], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[CLAMP_Y], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[CLAMP_XY], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[CLAMP_XY], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[CLAMP_NOFILTER_X], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[CLAMP_NOFILTER_Y], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[CLAMP_NOFILTER_XY], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[CLAMP_NOFILTER_XY], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
for (int i = CLAMP_NOFILTER; i <= CLAMP_NOFILTER_XY; i++)
{
glSamplerParameteri(mSamplers[i], GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glSamplerParameteri(mSamplers[i], GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glSamplerParameterf(mSamplers[i], GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.f);
}
glSamplerParameteri(mSamplers[SamplerClampX], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[SamplerClampY], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[SamplerClampXY], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[SamplerClampXY], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[CLAMP_XY_NOMIP], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[CLAMP_XY_NOMIP], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glSamplerParameterf(mSamplers[CLAMP_XY_NOMIP], GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.f);
glSamplerParameterf(mSamplers[CLAMP_CAMTEX], GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.f);
glSamplerParameteri(mSamplers[SamplerNoFilterClampX], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[SamplerNoFilterClampY], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[SamplerNoFilterClampXY], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[SamplerNoFilterClampXY], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
SetTextureFilterMode();
glSamplerParameteri(mSamplers[Sampler2DFiltered], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(mSamplers[Sampler2DFiltered], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
for (int i = 0; i < NUMSAMPLERS; i++)
{
FString name;
name.Format("mSamplers[%d]", i);
FGLDebug::LabelObject(GL_SAMPLER, mSamplers[i], name.GetChars());
}
}
FSamplerManager::~FSamplerManager()
{
UnbindAll();
glDeleteSamplers(NumSamplers, mSamplers);
glDeleteSamplers(NUMSAMPLERS, mSamplers);
}
void FSamplerManager::UnbindAll()
{
for (int i = 0; i < 16 /* fixme */; i++)
for (int i = 0; i < IHardwareTexture::MAX_TEXTURES; i++)
{
glBindSampler(i, 0);
}
@ -102,16 +107,22 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
}
void FSamplerManager::SetTextureFilterMode(int filter, int anisotropy)
void FSamplerManager::SetTextureFilterMode()
{
UnbindAll();
int filter = sysCallbacks && sysCallbacks->DisableTextureFilter && sysCallbacks->DisableTextureFilter() ? 0 : gl_texture_filter;
for (int i = SamplerRepeat; i <= SamplerClampXY; i++)
for (int i = 0; i < 4; i++)
{
glSamplerParameteri(mSamplers[i], GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
glSamplerParameteri(mSamplers[i], GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
glSamplerParameterf(mSamplers[i], GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy);
glSamplerParameterf(mSamplers[i], GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
}
glSamplerParameteri(mSamplers[Sampler2DFiltered], GL_TEXTURE_MIN_FILTER, TexFilter[filter].magfilter);
glSamplerParameteri(mSamplers[Sampler2DFiltered], GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
glSamplerParameteri(mSamplers[CLAMP_XY_NOMIP], GL_TEXTURE_MIN_FILTER, TexFilter[filter].magfilter);
glSamplerParameteri(mSamplers[CLAMP_XY_NOMIP], GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
glSamplerParameteri(mSamplers[CLAMP_CAMTEX], GL_TEXTURE_MIN_FILTER, TexFilter[filter].magfilter);
glSamplerParameteri(mSamplers[CLAMP_CAMTEX], GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
}
}

View file

@ -0,0 +1,29 @@
#ifndef __GL_SAMPLERS_H
#define __GL_SAMPLERS_H
#include "textures.h"
namespace OpenGLRenderer
{
class FSamplerManager
{
unsigned int mSamplers[NUMSAMPLERS];
void UnbindAll();
public:
FSamplerManager();
~FSamplerManager();
uint8_t Bind(int texunit, int num, int lastval);
void SetTextureFilterMode();
};
}
#endif

View file

@ -29,8 +29,6 @@
#include "c_cvars.h"
#include "v_video.h"
IHardwareTexture* CreateHardwareTexture();
//===========================================================================
//
// Constructor

View file

@ -50,7 +50,7 @@
#include "c_cvars.h"
// Wrappers to keep the definitions of these classes out of here.
IHardwareTexture* CreateHardwareTexture();
IHardwareTexture* CreateHardwareTexture(int numchannels);
// Make sprite offset adjustment user-configurable per renderer.
int r_spriteadjustSW, r_spriteadjustHW;
@ -514,7 +514,7 @@ IHardwareTexture* FTexture::GetHardwareTexture(int translation, int scaleflags)
IHardwareTexture* hwtex = SystemTextures.GetHardwareTexture(translation, scaleflags);
if (hwtex == nullptr)
{
hwtex = CreateHardwareTexture();
hwtex = CreateHardwareTexture(4);
SystemTextures.AddHardwareTexture(translation, scaleflags, hwtex);
}
return hwtex;
@ -535,7 +535,7 @@ FWrapperTexture::FWrapperTexture(int w, int h, int bits)
Height = h;
Format = bits;
//bNoCompress = true;
auto hwtex = CreateHardwareTexture();
auto hwtex = CreateHardwareTexture(4);
// todo: Initialize here.
SystemTextures.AddHardwareTexture(0, false, hwtex);
}

View file

@ -54,12 +54,16 @@ class IHardwareTexture;
enum
{
CLAMP_NONE = 0,
CLAMP_X = 1,
CLAMP_Y = 2,
CLAMP_XY = 3,
CLAMP_XY_NOMIP = 4,
CLAMP_NOFILTER = 5,
CLAMP_CAMTEX = 6,
CLAMP_X,
CLAMP_Y,
CLAMP_XY,
CLAMP_XY_NOMIP,
CLAMP_NOFILTER,
CLAMP_NOFILTER_X,
CLAMP_NOFILTER_Y,
CLAMP_NOFILTER_XY,
CLAMP_CAMTEX,
NUMSAMPLERS
};
enum MaterialShaderIndex

View file

@ -24,7 +24,7 @@
#include "gl/system/gl_buffers.h"
#include "gl/system/gl_framebuffer.h"
#include "gamecvars.h"
#include "gl/system/gl_debug.h"
#include "gl_debug.h"
//#include "gl/renderer/gl_renderstate.h"
#include "gl/renderer/gl_renderbuffers.h"
#include "gl/renderer/gl_renderer.h"

View file

@ -24,7 +24,7 @@
#include "printf.h"
#include "gl_load/gl_interface.h"
#include "gamecvars.h"
#include "gl/system/gl_debug.h"
#include "gl_debug.h"
#include "gl/renderer/gl_renderer.h"
#include "gl/renderer/gl_renderbuffers.h"
#include "gl/renderer/gl_postprocessstate.h"

View file

@ -46,7 +46,7 @@
#include "gl_load/gl_interface.h"
#include "gl/system/gl_framebuffer.h"
#include "gamecvars.h"
#include "gl/system/gl_debug.h"
#include "gl_debug.h"
#include "gl/renderer/gl_renderer.h"
//#include "gl/renderer/gl_renderstate.h"
#include "gl/renderer/gl_renderbuffers.h"

View file

@ -23,7 +23,7 @@
#include "v_video.h"
#include "gl_load/gl_interface.h"
#include "gamecvars.h"
#include "gl/system/gl_debug.h"
#include "gl_debug.h"
#include "gl/shaders/gl_shaderprogram.h"
#include "hwrenderer/utility/hw_shaderpatcher.h"
#include "filesystem.h"

View file

@ -288,7 +288,7 @@ void OpenGLFrameBuffer::SetTextureFilterMode()
//if (GLRenderer != nullptr && GLRenderer->mSamplerManager != nullptr) GLRenderer->mSamplerManager->SetTextureFilterMode();
}
IHardwareTexture *OpenGLFrameBuffer::CreateHardwareTexture()
IHardwareTexture *OpenGLFrameBuffer::CreateHardwareTexture(int numchannels)
{
return nullptr;// new FHardwareTexture(true/*tex->bNoCompress*/);
}

View file

@ -29,7 +29,7 @@ public:
void WriteSavePic(FileWriter* file, int width, int height) override;
#ifdef IMPLEMENT_IT
void SetTextureFilterMode() override;
IHardwareTexture *CreateHardwareTexture() override;
IHardwareTexture *CreateHardwareTexture(int numchannels) override;
void PrecacheMaterial(FMaterial *mat, int translation) override;
FModelRenderer *CreateModelRenderer(int mli) override;
void TextureFilterChanged() override;

View file

@ -399,7 +399,7 @@ void DFrameBuffer::FinishScene()
}
}
IHardwareTexture* CreateHardwareTexture()
IHardwareTexture* CreateHardwareTexture(int numchannels)
{
return screen->CreateHardwareTexture();
return screen->CreateHardwareTexture(numchannels);
}

View file

@ -396,7 +396,7 @@ void V_Init2()
Polymost_Startup();
GLInterface.Init(SCREENHEIGHT);
GLInterface.InitGLState(4, 4/*glmultisample*/);
GLInterface.mSamplers->SetTextureFilterMode(hw_texfilter, hw_anisotropy);
GLInterface.mSamplers->SetTextureFilterMode();
//setsizeneeded = true;
}

View file

@ -230,7 +230,7 @@ public:
// Delete any resources that need to be deleted after restarting with a different IWAD
virtual void CleanForRestart() {}
virtual void SetTextureFilterMode() {}
virtual IHardwareTexture *CreateHardwareTexture() { return nullptr; }
virtual IHardwareTexture *CreateHardwareTexture(int numchannels) { return nullptr; }
virtual void PrecacheMaterial(FMaterial *mat, int translation) {}
virtual FModelRenderer *CreateModelRenderer(int mli) { return nullptr; }
virtual void TextureFilterChanged() {}

View file

@ -403,7 +403,7 @@ int32_t Anim_Play(const char *fn)
#endif
// ANM playback --- v v v ---
int32_t ogltexfiltermode = hw_texfilter;
int32_t ogltexfiltermode = gl_texture_filter;
TArray<uint8_t> buffer;
auto fr = fileSystem.OpenFileReader(fn);
@ -435,8 +435,8 @@ int32_t Anim_Play(const char *fn)
goto end_anim;
}
if ((anim->frameflags & CUTSCENE_TEXTUREFILTER && hw_texfilter == TEXFILTER_ON) || anim->frameflags & CUTSCENE_FORCEFILTER)
hw_texfilter = TEXFILTER_ON;
if ((anim->frameflags & CUTSCENE_TEXTUREFILTER && gl_texture_filter == TEXFILTER_ON) || anim->frameflags & CUTSCENE_FORCEFILTER)
gl_texture_filter = TEXFILTER_ON;
ototalclock = totalclock;
@ -522,7 +522,7 @@ int32_t Anim_Play(const char *fn)
}
end_anim_restore_gl:
hw_texfilter = ogltexfiltermode;
gl_texture_filter = ogltexfiltermode;
gltexapplyprops();
end_anim:
inputState.ClearAllInput();

View file

@ -1,43 +0,0 @@
#ifndef __GL_SAMPLERS_H
#define __GL_SAMPLERS_H
#include <stdint.h>
enum ESampler
{
NoSampler = -1,
SamplerRepeat,
SamplerClampX,
SamplerClampY,
SamplerClampXY,
SamplerNoFilterRepeat,
SamplerNoFilterClampX,
SamplerNoFilterClampY,
SamplerNoFilterClampXY,
Sampler2DFiltered, // Currently unused shpuld be used for 2D content
NumSamplers
};
class FSamplerManager
{
// We need 6 different samplers: 4 for the different clamping modes,
// one for 2D-textures and one for voxel textures
unsigned int mSamplers[NumSamplers];
void UnbindAll();
void CreateSamplers();
public:
FSamplerManager();
~FSamplerManager();
uint8_t Bind(int texunit, int num, int lastval);
void SetTextureFilterMode(int mode, int aniso);
};
#endif

View file

@ -274,6 +274,10 @@ bool GLInstance::SetTextureInternal(int picnum, FGameTexture* tex, int palette,
{
sampler = sampler + SamplerNoFilterRepeat - SamplerRepeat;
}
else if (tex->isHardwareCanvas())
{
sampler = CLAMP_CAMTEX;
}
UseDetailMapping(false);
UseGlowMapping(false);
UseBrightmaps(false);

View file

@ -52,6 +52,22 @@
float shadediv[MAXPALOOKUPS];
namespace OpenGLRenderer
{
TexFilter_s TexFilter[] = {
{GL_NEAREST, GL_NEAREST, false},
{GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST, true},
{GL_LINEAR, GL_LINEAR, false},
{GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, true},
{GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, true},
{GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST, true},
{GL_LINEAR_MIPMAP_LINEAR, GL_NEAREST, true},
};
}
static int blendstyles[] = { GL_ZERO, GL_ONE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA };
static int renderops[] = { GL_FUNC_ADD, GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT };
int depthf[] = { GL_ALWAYS, GL_LESS, GL_EQUAL, GL_LEQUAL };
@ -85,7 +101,7 @@ void GLInstance::Init(int ydim)
{
if (!mSamplers)
{
mSamplers = new FSamplerManager;
mSamplers = new OpenGLRenderer::FSamplerManager;
}
//glinfo.bufferstorage = !!strstr(glinfo.extensions, "GL_ARB_buffer_storage");

View file

@ -20,6 +20,19 @@ class F2DDrawer;
struct palette_t;
extern int xdim, ydim;
enum ESampler
{
NoSampler = -1,
SamplerRepeat = CLAMP_NONE,
SamplerClampX = CLAMP_X,
SamplerClampY = CLAMP_Y,
SamplerClampXY = CLAMP_XY,
Sampler2DFiltered = CLAMP_XY_NOMIP, // Currently unused shpuld be used for 2D content
SamplerNoFilterRepeat = CLAMP_NOFILTER,
SamplerNoFilterClampX = CLAMP_NOFILTER_X,
SamplerNoFilterClampY = CLAMP_NOFILTER_Y,
SamplerNoFilterClampXY = CLAMP_NOFILTER_XY,
};
enum
{
PALSWAP_TEXTURE_SIZE = 2048
@ -131,7 +144,7 @@ class GLInstance
public:
glinfo_t glinfo;
FSamplerManager *mSamplers;
OpenGLRenderer::FSamplerManager *mSamplers;
void Init(int y);
void InitGLState(int fogmode, int multisample);

View file

@ -436,7 +436,7 @@ int32_t Anim_Play(const char *fn)
#endif
// ANM playback --- v v v ---
int32_t ogltexfiltermode = hw_texfilter;
int32_t ogltexfiltermode = gl_texture_filter;
auto fr = fileSystem.OpenFileReader(fn);
if (!fr.isOpen())
@ -561,7 +561,7 @@ int32_t Anim_Play(const char *fn)
}
end_anim_restore_gl:
hw_texfilter = ogltexfiltermode;
gl_texture_filter = ogltexfiltermode;
gltexapplyprops();
end_anim:
inputState.ClearAllInput();

View file

@ -573,10 +573,6 @@ void G_CacheMapData(void)
S_TryPlaySpecialMusic(MUS_LOADING);
#if defined EDUKE32_TOUCH_DEVICES && defined USE_OPENGL
polymost_glreset();
#endif
starttime = timerGetTicks();
cacheAllSounds();

View file

@ -1231,8 +1231,8 @@ OptionMenu "VideoOptions" //protected
Slider "$DSPLYMNU_FOV", "r_fov", 60, 130, 10, 1
StaticText ""
Option "$GLTEXMNU_TEXFILTER", hw_texfilter, "FilterModes"
Option "$GLTEXMNU_ANISOTROPIC", hw_anisotropy, "Anisotropy"
Option "$GLTEXMNU_TEXFILTER", gl_texture_filter, "FilterModes"
Option "$GLTEXMNU_ANISOTROPIC", gl_texture_filter_anisotropic, "Anisotropy"
}