- fixed size of texture arrays.

We need 6 slots, not 5.
This commit is contained in:
Christoph Oelckers 2020-01-05 12:56:32 +01:00
parent b6862cfd70
commit 9e7f91b5ac
4 changed files with 9 additions and 8 deletions

View file

@ -479,7 +479,7 @@ bool M_SetMenu(FName menu, int param, FName caller)
return false;
case NAME_CustomSubMenu1:
menu = ENamedName(menu + param);
menu = ENamedName(menu.GetIndex() + param);
break;
#if 0

View file

@ -75,7 +75,7 @@ struct PolymostRenderState
PalEntry ClearColor = 0;
short vp_x, vp_y, vp_w, vp_h;
short sc_x = SHRT_MIN, sc_y, sc_w, sc_h;
int texIds[5], samplerIds[5];
int texIds[6], samplerIds[6];
PalEntry FogColor;

View file

@ -349,7 +349,7 @@ void GLInstance::DrawImGui(ImDrawData* data)
void PolymostRenderState::Apply(PolymostShader* shader, GLState &oldState)
{
bool reset = false;
for (int i = 0; i < 5; i++)
for (int i = 0; i < MAX_TEXTURES; i++)
{
if (texIds[i] != oldState.TexId[i] || samplerIds[i] != oldState.SamplerId[i])
{

View file

@ -165,20 +165,21 @@ struct ImDrawData;
struct palette_t;
extern float shadediv[256];
enum
{
MAX_TEXTURES = 6, /*15*/ // slot 15 is used internally and not available. - The renderer uses only 5, though.
};
struct GLState
{
int Flags = STF_COLORMASK | STF_DEPTHMASK;
FRenderStyle Style{};
int DepthFunc = -1;
int TexId[5] = {}, SamplerId[5] = {};
int TexId[MAX_TEXTURES] = {}, SamplerId[MAX_TEXTURES] = {};
};
class GLInstance
{
enum
{
MAX_TEXTURES = 5, /*15*/ // slot 15 is used internally and not available. - The renderer uses only 5, though.
};
std::vector<BaseVertex> Buffer; // cheap-ass implementation. The primary purpose is to get the GL accesses out of polymost.cpp, not writing something performant right away.
int maxTextureSize;
PaletteManager palmanager;