mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- let GLInstance::Draw set the palette indexing mode.
This can be trivially decided based on the texture type, so there's really no need to let the higher level code deal with this.
This commit is contained in:
parent
36ca38258e
commit
c588cd499a
6 changed files with 11 additions and 39 deletions
|
@ -1845,7 +1845,6 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
|
|||
|
||||
int prevClamp = GLInterface.GetClamp();
|
||||
GLInterface.SetClamp(0);
|
||||
GLInterface.UsePaletteIndexing(false);
|
||||
|
||||
for (surfi=0; surfi<m->head.numsurfs; surfi++)
|
||||
{
|
||||
|
@ -2012,7 +2011,6 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
|
|||
|
||||
GLInterface.SetTinting(0, 0);
|
||||
GLInterface.SetClamp(prevClamp);
|
||||
GLInterface.UsePaletteIndexing(true);
|
||||
GLInterface.SetPolymostShader();
|
||||
|
||||
globalnoeffect=0;
|
||||
|
|
|
@ -926,10 +926,6 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
|||
if (videoGetRenderMode() == REND_POLYMOST)
|
||||
{
|
||||
|
||||
//POGOTODO: I could move this into bindPth
|
||||
if (!(pth->flags & PTH_INDEXED))
|
||||
GLInterface.UsePaletteIndexing(false);
|
||||
|
||||
// The entire logic here is just one lousy hack.
|
||||
int mSampler = NoSampler;
|
||||
if (pth->glpic->GetSampler() != SamplerRepeat)
|
||||
|
@ -1250,12 +1246,6 @@ do
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(pth->flags & PTH_INDEXED))
|
||||
{
|
||||
// restore palette usage if we were just rendering a non-indexed color texture
|
||||
GLInterface.UsePaletteIndexing(true);
|
||||
}
|
||||
|
||||
if (skyzbufferhack && skyzbufferhack_pass == 0)
|
||||
{
|
||||
vec3d_t const bxtex = xtex, bytex = ytex, botex = otex;
|
||||
|
@ -6005,9 +5995,6 @@ void polymost_fillpolygon(int32_t npoints)
|
|||
if (pth)
|
||||
{
|
||||
polymost_bindPth(pth, -1);
|
||||
|
||||
if (!(pth->flags & PTH_INDEXED))
|
||||
GLInterface.UsePaletteIndexing(false);
|
||||
}
|
||||
|
||||
polymost_updatePalette();
|
||||
|
@ -6026,12 +6013,6 @@ void polymost_fillpolygon(int32_t npoints)
|
|||
}
|
||||
|
||||
tessectrap((float *)rx1,(float *)ry1,xb1,npoints);
|
||||
|
||||
if (pth && !(pth->flags & PTH_INDEXED))
|
||||
{
|
||||
// restore palette usage if we were just rendering a non-indexed color texture
|
||||
GLInterface.UsePaletteIndexing(true);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t gen_font_glyph_tex(void)
|
||||
|
@ -6121,8 +6102,6 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
|
|||
|
||||
GLInterface.BindTexture(0, polymosttext);
|
||||
|
||||
GLInterface.UsePaletteIndexing(false);
|
||||
|
||||
polymostSet2dView(); // disables blending, texturing, and depth testing
|
||||
|
||||
GLInterface.EnableAlphaTest(false);
|
||||
|
@ -6219,8 +6198,6 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
|
|||
|
||||
if (!nofog) GLInterface.SetFogEnabled(true);
|
||||
|
||||
GLInterface.UsePaletteIndexing(true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1333,7 +1333,11 @@ void sdlayer_setvideomode_opengl(void)
|
|||
GLInterface.Deinit();
|
||||
GLInterface.Init();
|
||||
GLInterface.InitGLState(4, glmultisample);
|
||||
#if 1
|
||||
GLInterface.mSamplers->SetTextureFilterMode(0, 1);
|
||||
#else
|
||||
GLInterface.mSamplers->SetTextureFilterMode(gltexfiltermode, glanisotropy);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1136,8 +1136,6 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr)
|
|||
|
||||
GLInterface.BindTexture(0, m->texid[globalpal]);
|
||||
|
||||
GLInterface.UsePaletteIndexing(false);
|
||||
|
||||
auto data = GLInterface.AllocVertices(m->qcnt * 4);
|
||||
auto vt = data.second;
|
||||
|
||||
|
|
|
@ -180,7 +180,11 @@ void GLInstance::Draw(EDrawType type, size_t start, size_t count)
|
|||
{
|
||||
// Todo: Based on the current tinting flags and the texture type (indexed texture and APPLYOVERPALSWAP not set) this may have to reset the palette for the draw call / texture creation.
|
||||
|
||||
if (activeShader == polymostShader) renderState.Apply(polymostShader);
|
||||
if (activeShader == polymostShader)
|
||||
{
|
||||
renderState.UsePalette = texv && texv->isIndexed();
|
||||
renderState.Apply(polymostShader);
|
||||
}
|
||||
glBegin(primtypes[type]);
|
||||
auto p = &Buffer[start];
|
||||
for (size_t i = 0; i < count; i++, p++)
|
||||
|
@ -209,21 +213,16 @@ FHardwareTexture* GLInstance::NewTexture()
|
|||
return new FHardwareTexture;
|
||||
}
|
||||
|
||||
FHardwareTexture* texv;
|
||||
|
||||
void GLInstance::BindTexture(int texunit, FHardwareTexture *tex, int sampler)
|
||||
{
|
||||
if (!tex) return;
|
||||
if (texunit != 0) glActiveTexture(GL_TEXTURE0 + texunit);
|
||||
glBindTexture(GL_TEXTURE_2D, tex->GetTextureHandle());
|
||||
if (tex->isIndexed() && sampler > NoSampler && sampler < Sampler2D)
|
||||
{
|
||||
sampler = sampler == SamplerRepeat ? SamplerNoFilter : Sampler2DNoFilter;
|
||||
}
|
||||
mSamplers->Bind(texunit, sampler == NoSampler? tex->GetSampler() : sampler, 0);
|
||||
if (texunit != 0) glActiveTexture(GL_TEXTURE0);
|
||||
LastBoundTextures[texunit] = tex->GetTextureHandle();
|
||||
texv = tex;
|
||||
if (texunit == 0) texv = tex;
|
||||
}
|
||||
|
||||
void GLInstance::UnbindTexture(int texunit)
|
||||
|
|
|
@ -199,6 +199,7 @@ class GLInstance
|
|||
int maxTextureSize;
|
||||
PaletteManager palmanager;
|
||||
int lastPalswapIndex = -1;
|
||||
FHardwareTexture* texv;
|
||||
|
||||
|
||||
VSMatrix matrices[NUMMATRICES];
|
||||
|
@ -323,11 +324,6 @@ public:
|
|||
renderState.UseColorOnly = useColorOnly;
|
||||
}
|
||||
|
||||
void UsePaletteIndexing(bool usePaletteIndexing)
|
||||
{
|
||||
renderState.UsePalette = usePaletteIndexing;
|
||||
}
|
||||
|
||||
void UseDetailMapping(bool useDetailMapping)
|
||||
{
|
||||
renderState.UseDetailMapping = useDetailMapping;
|
||||
|
|
Loading…
Reference in a new issue