Force gl_customshader = false, some fixes to shader code.

This commit is contained in:
Emile Belanger 2021-05-24 20:44:57 +01:00 committed by Rachael Alexanderson
parent 80717c237c
commit a9db983383
5 changed files with 17 additions and 6 deletions

View file

@ -63,7 +63,6 @@ EXTERN_CVAR (Bool, vid_vsync)
EXTERN_CVAR(Bool, r_drawvoxels)
EXTERN_CVAR(Int, gl_tonemap)
EXTERN_CVAR(Bool, cl_capfps)
EXTERN_CVAR(Bool, gl_customshader)
EXTERN_CVAR(Int, gl_pipeline_depth);
EXTERN_CVAR(Bool, gl_sort_textures);

View file

@ -128,6 +128,9 @@ bool FGLRenderState::ApplyShader()
ShaderFlavourData flavour;
flavour.textureMode = (mTextureMode == TM_NORMAL && mTempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode);
if (flavour.textureMode == -1)
flavour.textureMode = 0;
flavour.texFlags = mTextureModeFlags; if (!mBrightmapEnabled) flavour.texFlags &= ~(TEXF_Brightmap | TEXF_Glowmap);
flavour.texFlags >>= 16; //Move flags to start of word

View file

@ -690,10 +690,9 @@ bool FShader::Bind(ShaderFlavourData& flavour)
{
uint32_t tag = CreateShaderTag(flavour);
auto pos = variants.find(tag);
cur = variants[tag];
if (!cur)
if (pos == variants.end())
{
FString variantConfig = "\n";
@ -731,7 +730,14 @@ bool FShader::Bind(ShaderFlavourData& flavour)
Load(mName.GetChars(), mVertProg, mFragProg, mFragProg2, mLightProg, mDefinesBase + variantConfig);
variants[tag] = cur;
if (variants.insert(std::make_pair(tag, cur)).second == false)
{
Printf("ERROR INSERTING");
}
}
else
{
cur = pos->second;
}
GLRenderer->mShaderManager->SetActiveShader(this->cur);

View file

@ -8,6 +8,7 @@
CVAR(Bool, gles_use_mapped_buffer, false, 0);
CVAR(Bool, gles_force_glsl_v100, false, 0);
CVAR(Int, gles_max_lights_per_surface, 32, 0);
CVAR(Bool, gl_customshader, true, 0)
#if USE_GLES2
@ -164,6 +165,8 @@ namespace OpenGLESRenderer
gles.modelstring = (char*)glGetString(GL_RENDERER);
gles.vendorstring = (char*)glGetString(GL_VENDOR);
gl_customshader = false;
#if USE_GLES2
gles.depthStencilAvailable = CheckExtension("GL_OES_packed_depth_stencil");

View file

@ -29,7 +29,7 @@
#include "c_cvars.h"
#include "v_video.h"
CVAR(Bool, gl_customshader, true, 0)
EXTERN_CVAR(Bool, gl_customshader)
static IHardwareTexture* (*layercallback)(int layer, int translation);