Permalink
Browse files

Make extension GL_ARB_framebuffer_object mandatory.

  • Loading branch information...
1 parent fdd40f0 commit f2229b1138289747d80ef4bc1c40c23bfc1d747a @gimhael gimhael committed Feb 1, 2016
@@ -484,7 +484,7 @@ std::string GLShaderManager::BuildGPUShaderText( Str::StringRef mainShaderNa
break;
}
- if ( r_shadows->integer >= Util::ordinal(shadowingMode_t::SHADOWING_ESM16) && glConfig2.textureFloatAvailable && glConfig2.framebufferObjectAvailable )
+ if ( r_shadows->integer >= Util::ordinal(shadowingMode_t::SHADOWING_ESM16) && glConfig2.textureFloatAvailable )
{
if ( r_shadows->integer == Util::ordinal(shadowingMode_t::SHADOWING_ESM16) || r_shadows->integer == Util::ordinal(shadowingMode_t::SHADOWING_ESM32) )
{
@@ -796,10 +796,7 @@ static void RB_SetGL2D()
GLimp_LogComment( "--- RB_SetGL2D ---\n" );
// disable offscreen rendering
- if ( glConfig2.framebufferObjectAvailable )
- {
- R_BindNullFBO();
- }
+ R_BindNullFBO();
backEnd.projection2D = true;
@@ -2080,7 +2077,7 @@ static void RB_RenderInteractionsShadowMapped()
0.5, 0.5, 0.5, 1.0
};
- if ( !glConfig2.framebufferObjectAvailable || !glConfig2.textureFloatAvailable )
+ if ( !glConfig2.textureFloatAvailable )
{
RB_RenderInteractions();
return;
@@ -2748,7 +2745,7 @@ void RB_RenderBloom()
GLimp_LogComment( "--- RB_RenderBloom ---\n" );
- if ( ( backEnd.refdef.rdflags & ( RDF_NOWORLDMODEL | RDF_NOBLOOM ) ) || !r_bloom->integer || backEnd.viewParms.isPortal || !glConfig2.framebufferObjectAvailable )
+ if ( ( backEnd.refdef.rdflags & ( RDF_NOWORLDMODEL | RDF_NOBLOOM ) ) || !r_bloom->integer || backEnd.viewParms.isPortal )
{
return;
}
@@ -2870,7 +2867,7 @@ void RB_RenderMotionBlur()
GLimp_LogComment( "--- RB_RenderMotionBlur ---\n" );
- if ( ( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) || backEnd.viewParms.isPortal || !glConfig2.framebufferObjectAvailable )
+ if ( ( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) || backEnd.viewParms.isPortal )
{
return;
}
@@ -2920,7 +2917,7 @@ void RB_RenderSSAO()
return;
}
- if ( ( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) || backEnd.viewParms.isPortal || !glConfig2.framebufferObjectAvailable )
+ if ( ( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) || backEnd.viewParms.isPortal )
{
return;
}
@@ -4421,10 +4418,7 @@ static void RB_RenderView()
}
// disable offscreen rendering
- if ( glConfig2.framebufferObjectAvailable )
- {
- R_BindNullFBO();
- }
+ R_BindNullFBO();
// we will need to change the projection matrix before drawing
// 2D images again
@@ -4477,7 +4477,7 @@ void R_LoadEntities( lump_t *l )
vec_t rad_y, rad_z;
sscanf( value, "%f %f %f", &light->l.radius, &rad_y, &rad_z );
if( rad_y != light->l.radius || rad_z != light->l.radius )
- ri.Printf( PRINT_WARNING, "WARNING: non-spherical light\n" );
+ Log::Warn( "non-spherical light\n" );
s = &value[ 0 ];
}
// check for light_target
@@ -402,11 +402,6 @@ void R_InitFBOs()
Log::Debug("------- R_InitFBOs -------" );
- if ( !glConfig2.framebufferObjectAvailable )
- {
- return;
- }
-
tr.numFBOs = 0;
GL_CheckErrors();
@@ -588,11 +583,6 @@ void R_ShutdownFBOs()
Log::Debug("------- R_ShutdownFBOs -------" );
- if ( !glConfig2.framebufferObjectAvailable )
- {
- return;
- }
-
R_BindNullFBO();
for ( i = 0; i < tr.numFBOs; i++ )
@@ -634,12 +624,6 @@ void R_FBOList_f()
int i;
FBO_t *fbo;
- if ( !glConfig2.framebufferObjectAvailable )
- {
- Log::Notice("GL_ARB_framebuffer_object is not available." );
- return;
- }
-
Log::Notice(" size name" );
Log::Notice("----------------------------------------------------------" );
@@ -1430,77 +1430,11 @@ void R_UploadImage( const byte **dataArray, int numLayers, int numMips,
if ( image->filterType == filterType_t::FT_DEFAULT )
{
- if ( glConfig.driverType == glDriverType_t::GLDRV_OPENGL3 || glConfig2.framebufferObjectAvailable )
- {
- if( image->type != GL_TEXTURE_CUBE_MAP || i == 5 ) {
- glGenerateMipmap( image->type );
- glTexParameteri( image->type, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); // default to trilinear
- }
- }
- else if ( glConfig2.generateMipmapAvailable )
- {
- glTexParameteri( image->type, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );
+ if( image->type != GL_TEXTURE_CUBE_MAP || i == 5 ) {
+ glGenerateMipmap( image->type );
glTexParameteri( image->type, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); // default to trilinear
}
}
-
- if ( glConfig.driverType != glDriverType_t::GLDRV_OPENGL3 && !glConfig2.framebufferObjectAvailable && !glConfig2.generateMipmapAvailable )
- {
- if ( image->filterType == filterType_t::FT_DEFAULT && !( image->bits & ( IF_DEPTH16 | IF_DEPTH24 | IF_DEPTH32 | IF_PACKED_DEPTH24_STENCIL8 ) ) )
- {
- int mipLevel;
- int mipWidth, mipHeight;
-
- mipLevel = 0;
- mipWidth = scaledWidth;
- mipHeight = scaledHeight;
-
- while ( mipWidth > 1 || mipHeight > 1 )
- {
- if ( image->bits & IF_NORMALMAP )
- {
- R_MipNormalMap( scaledBuffer, mipWidth, mipHeight );
- }
- else
- {
- R_MipMap( scaledBuffer, mipWidth, mipHeight );
- }
-
- mipWidth >>= 1;
- mipHeight >>= 1;
-
- if ( mipWidth < 1 )
- {
- mipWidth = 1;
- }
-
- if ( mipHeight < 1 )
- {
- mipHeight = 1;
- }
-
- mipLevel++;
-
- if ( r_colorMipLevels->integer && !( image->bits & IF_NORMALMAP ) )
- {
- R_BlendOverTexture( scaledBuffer, mipWidth * mipHeight, mipBlendColors[ mipLevel ] );
- }
-
- switch ( image->type )
- {
- case GL_TEXTURE_CUBE_MAP:
- glTexImage2D( target + i, mipLevel, internalFormat, mipWidth, mipHeight, 0, format, GL_UNSIGNED_BYTE,
- scaledBuffer );
- break;
-
- default:
- glTexImage2D( target, mipLevel, internalFormat, mipWidth, mipHeight, 0, format, GL_UNSIGNED_BYTE,
- scaledBuffer );
- break;
- }
- }
- }
- }
}
} else {
// already compressed texture data, precomputed mipmaps must be
@@ -100,7 +100,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
cvar_t *r_ext_texture_float;
cvar_t *r_ext_texture_rg;
cvar_t *r_ext_texture_filter_anisotropic;
- cvar_t *r_arb_framebuffer_object;
cvar_t *r_ext_packed_depth_stencil;
cvar_t *r_ext_generate_mipmap;
cvar_t *r_arb_buffer_storage;
@@ -886,12 +885,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
bound.
*/
- if ( glConfig2.framebufferObjectAvailable )
- {
- glBindFramebuffer( GL_FRAMEBUFFER, 0 );
- glBindRenderbuffer( GL_RENDERBUFFER, 0 );
- glState.currentFBO = nullptr;
- }
+ glBindFramebuffer( GL_FRAMEBUFFER, 0 );
+ glBindRenderbuffer( GL_RENDERBUFFER, 0 );
+ glState.currentFBO = nullptr;
GL_PolygonMode( GL_FRONT_AND_BACK, GL_FILL );
GL_DepthMask( GL_TRUE );
@@ -957,11 +953,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Log::Debug("GL_TEXTURE_MAX_ANISOTROPY_EXT: %f", glConfig2.maxTextureAnisotropy );
}
- if ( glConfig2.framebufferObjectAvailable )
- {
- Log::Debug("GL_MAX_RENDERBUFFER_SIZE: %d", glConfig2.maxRenderbufferSize );
- Log::Debug("GL_MAX_COLOR_ATTACHMENTS: %d", glConfig2.maxColorAttachments );
- }
+ Log::Debug("GL_MAX_RENDERBUFFER_SIZE: %d", glConfig2.maxRenderbufferSize );
+ Log::Debug("GL_MAX_COLOR_ATTACHMENTS: %d", glConfig2.maxColorAttachments );
Log::Debug("\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)", glConfig.colorBits,
glConfig.depthBits, glConfig.stencilBits );
@@ -1081,7 +1074,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
r_ext_texture_float = ri.Cvar_Get( "r_ext_texture_float", "1", CVAR_CHEAT | CVAR_LATCH );
r_ext_texture_rg = ri.Cvar_Get( "r_ext_texture_rg", "1", CVAR_CHEAT | CVAR_LATCH );
r_ext_texture_filter_anisotropic = ri.Cvar_Get( "r_ext_texture_filter_anisotropic", "4", CVAR_LATCH | CVAR_ARCHIVE );
- r_arb_framebuffer_object = ri.Cvar_Get( "r_arb_framebuffer_object", "1", CVAR_LATCH );
r_ext_packed_depth_stencil = ri.Cvar_Get( "r_ext_packed_depth_stencil", "1", CVAR_CHEAT | CVAR_LATCH );
r_ext_generate_mipmap = ri.Cvar_Get( "r_ext_generate_mipmap", "1", CVAR_CHEAT | CVAR_LATCH );
r_arb_buffer_storage = ri.Cvar_Get( "r_arb_buffer_storage", "1", CVAR_CHEAT | CVAR_LATCH );
@@ -2833,7 +2833,6 @@ static inline void halfToFloat( const f16vec4_t in, vec4_t out )
extern cvar_t *r_ext_texture_float;
extern cvar_t *r_ext_texture_rg;
extern cvar_t *r_ext_texture_filter_anisotropic;
- extern cvar_t *r_arb_framebuffer_object;
extern cvar_t *r_ext_packed_depth_stencil;
extern cvar_t *r_ext_generate_mipmap;
extern cvar_t *r_arb_buffer_storage;
@@ -201,7 +201,7 @@ static float GetOpValue( const expOperation_t *op )
break;
case opcode_t::OP_FRAMEBUFFEROBJECTS:
- value = glConfig2.framebufferObjectAvailable;
+ value = 1.0f;
break;
case opcode_t::OP_SOUND:
@@ -399,7 +399,6 @@ struct glconfig2_t
float maxTextureAnisotropy;
bool textureAnisotropyAvailable;
- bool framebufferObjectAvailable;
int maxRenderbufferSize;
int maxColorAttachments;
bool framebufferPackedDepthStencilAvailable;
@@ -1118,15 +1118,11 @@ static void GLimp_InitExtensions()
//REQUIRE_EXTENSION( ARB_vertex_array_object );
REQUIRE_EXTENSION( ARB_vertex_buffer_object );
REQUIRE_EXTENSION( ARB_half_float_vertex );
+ REQUIRE_EXTENSION( ARB_framebuffer_object );
// FBO
- glConfig2.framebufferObjectAvailable = false;
- if ( LOAD_EXTENSION_WITH_CVAR(ARB_framebuffer_object, r_arb_framebuffer_object) )
- {
- glGetIntegerv( GL_MAX_RENDERBUFFER_SIZE, &glConfig2.maxRenderbufferSize );
- glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS, &glConfig2.maxColorAttachments );
- glConfig2.framebufferObjectAvailable = true;
- }
+ glGetIntegerv( GL_MAX_RENDERBUFFER_SIZE, &glConfig2.maxRenderbufferSize );
+ glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS, &glConfig2.maxColorAttachments );
// Other
REQUIRE_EXTENSION( ARB_shader_objects );

0 comments on commit f2229b1

Please sign in to comment.