- removed the code for hardware alpha testing again because it didn't work anymore with how things are set up now.

- we need to check all GL versions when trying to get a context because some drivers only give us the version we request, leaving out newer features that are not exposed via extension.
- added some status info about uniform blocks.
This commit is contained in:
Christoph Oelckers 2014-07-30 23:13:16 +02:00
parent beabfad293
commit ef8f66c9a1
7 changed files with 17 additions and 51 deletions

View file

@ -138,29 +138,7 @@ bool FRenderState::ApplyShader()
activeShader->muClipHeightTop.Set(mClipHeightTop);
activeShader->muClipHeightBottom.Set(mClipHeightBottom);
activeShader->muTimer.Set(gl_frameMS * mShaderTimer / 1000.f);
#ifndef CORE_PROFILE
if (!(gl.flags & RFL_COREPROFILE))
{
if (mAlphaThreshold != stAlphaThreshold)
{
stAlphaThreshold = mAlphaThreshold;
if (mAlphaThreshold < 0.f)
{
glDisable(GL_ALPHA_TEST);
}
else
{
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, mAlphaThreshold * mColor.vec[3]);
}
}
}
else
#endif
{
activeShader->muAlphaThreshold.Set(mAlphaThreshold);
}
if (mGlowEnabled)
{

View file

@ -175,6 +175,9 @@ void gl_PrintStartupLog()
gl.maxuniforms = v;
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &v);
Printf ("Max. vertex uniforms: %d\n", v);
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &v);
Printf ("Max. uniform block size: %d\n", v);
gl.maxuniformblock = v;
glGetIntegerv(GL_MAX_VARYING_FLOATS, &v);
Printf ("Max. varying: %d\n", v);
glGetIntegerv(GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS, &v);
@ -182,5 +185,6 @@ void gl_PrintStartupLog()
glGetIntegerv(GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS, &v);
Printf("Max. vertex shader storage blocks: %d\n", v);
}

View file

@ -29,6 +29,7 @@ struct RenderContext
{
unsigned int flags;
unsigned int maxuniforms;
unsigned int maxuniformblock;
float version;
float glslversion;
int max_texturesize;

View file

@ -192,6 +192,8 @@ void FHardwareTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned i
if (alphatexture)
{
// thanks to deprecation and delayed introduction of a suitable replacement feature this has become a bit messy...
// Of all the targeted hardware, the Intel GMA 2000 and 3000 are the only ones not supporting texture swizzle, and they
// are also the only ones not supoorting GL 3.3. On those we are forced to use a full RGBA texture here.
if (gl.version >= 3.3f)
{
texformat = GL_R8;

View file

@ -745,10 +745,9 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
#else
bool core = true;
#endif
if (core)
{
// let's try to get the best version possible.
static int versions[] = { 44, 43, 42, 41, 40, 33, 32, -1 };
// let's try to get the best version possible. Some drivers only give us the version we request
// which breaks all version checks for feature support. The highest used features we use are from version 4.4, and 3.0 is a requirement.
static int versions[] = { 44, 43, 42, 41, 40, 33, 32, 30, -1 };
for (int i = 0; versions[i] > 0; i++)
{
@ -756,7 +755,7 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
WGL_CONTEXT_MAJOR_VERSION_ARB, versions[i] / 10,
WGL_CONTEXT_MINOR_VERSION_ARB, versions[i] % 10,
WGL_CONTEXT_FLAGS_ARB, gl_debug ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
WGL_CONTEXT_PROFILE_MASK_ARB, core? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
0
};
@ -764,20 +763,6 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
if (m_hRC != NULL) break;
}
}
else
{
int ctxAttribs[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
WGL_CONTEXT_MINOR_VERSION_ARB, 0,
WGL_CONTEXT_FLAGS_ARB, gl_debug ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
0
};
m_hRC = myWglCreateContextAttribsARB(m_hDC, 0, ctxAttribs);
}
}
if (m_hRC == 0)
{
// If we are unable to get a core context, let's try whatever the system gives us.

View file

@ -222,12 +222,10 @@ void main()
{
vec4 frag = ProcessTexel();
#ifdef CORE_PROFILE
// alpha testing - only for the core profile, in compatibility mode we use the alpha test.
#ifndef NO_ALPHATEST
if (frag.a <= uAlphaThreshold) discard;
#endif
switch (uFixedColormap)
{
case 0:

View file

@ -8,9 +8,7 @@ uniform vec4 uCameraPos;
uniform int uTextureMode;
uniform float uClipHeightTop, uClipHeightBottom;
#ifdef CORE_PROFILE
uniform float uAlphaThreshold;
#endif
// colors