diff --git a/src/gl/renderer/gl_renderstate.cpp b/src/gl/renderer/gl_renderstate.cpp index bee49cd96..24492c495 100644 --- a/src/gl/renderer/gl_renderstate.cpp +++ b/src/gl/renderer/gl_renderstate.cpp @@ -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); - } + activeShader->muAlphaThreshold.Set(mAlphaThreshold); if (mGlowEnabled) { diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index ca40bc60e..404c068d7 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -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); + } diff --git a/src/gl/system/gl_interface.h b/src/gl/system/gl_interface.h index d33ce77fc..a88133929 100644 --- a/src/gl/system/gl_interface.h +++ b/src/gl/system/gl_interface.h @@ -29,6 +29,7 @@ struct RenderContext { unsigned int flags; unsigned int maxuniforms; + unsigned int maxuniformblock; float version; float glslversion; int max_texturesize; diff --git a/src/gl/textures/gl_hwtexture.cpp b/src/gl/textures/gl_hwtexture.cpp index 516b5aaf5..98229a1ca 100644 --- a/src/gl/textures/gl_hwtexture.cpp +++ b/src/gl/textures/gl_hwtexture.cpp @@ -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; diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 3b630177a..a0e55d673 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -745,37 +745,22 @@ 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++) - { - int ctxAttribs[] = { - 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, - 0 - }; - - m_hRC = myWglCreateContextAttribsARB(m_hDC, 0, ctxAttribs); - if (m_hRC != NULL) break; - } - } - else + for (int i = 0; versions[i] > 0; i++) { int ctxAttribs[] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, 3, - WGL_CONTEXT_MINOR_VERSION_ARB, 0, + 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_COMPATIBILITY_PROFILE_BIT_ARB, + WGL_CONTEXT_PROFILE_MASK_ARB, core? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, 0 }; m_hRC = myWglCreateContextAttribsARB(m_hDC, 0, ctxAttribs); - + if (m_hRC != NULL) break; } } if (m_hRC == 0) diff --git a/wadsrc/static/shaders/glsl/main.fp b/wadsrc/static/shaders/glsl/main.fp index a4e4d782b..482afc0ca 100644 --- a/wadsrc/static/shaders/glsl/main.fp +++ b/wadsrc/static/shaders/glsl/main.fp @@ -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: diff --git a/wadsrc/static/shaders/glsl/shaderdefs.i b/wadsrc/static/shaders/glsl/shaderdefs.i index 242b7244b..d310126ab 100644 --- a/wadsrc/static/shaders/glsl/shaderdefs.i +++ b/wadsrc/static/shaders/glsl/shaderdefs.i @@ -8,9 +8,7 @@ uniform vec4 uCameraPos; uniform int uTextureMode; uniform float uClipHeightTop, uClipHeightBottom; -#ifdef CORE_PROFILE uniform float uAlphaThreshold; -#endif // colors