}
}
+static const GLuint drawbuffers[6] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3, GL_STENCIL_ATTACHMENT, GL_DEPTH_ATTACHMENT};
void R_ClearScreen(qboolean fogcolor)
{
float clearcolor[4];
+ qboolean invalidated = false;
if (scr_screenshot_alpha.integer)
// clear to transparency (so png screenshots can contain alpha channel, useful for building model pictures)
Vector4Set(clearcolor, 0.0f, 0.0f, 0.0f, 0.0f);
// to avoid clamping interfering with strange shadow volume
// drawing orders
// clear the screen
- GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | (vid.stencil ? GL_STENCIL_BUFFER_BIT : 0), clearcolor, 1.0f, 128);
+ if(r_sky.integer && !r_refdef.view.isoverlay && r_fbdiscard.integer && qglInvalidateFramebuffer) {
+ invalidated = true;
+ qglInvalidateFramebuffer(GL_FRAMEBUFFER, 6, drawbuffers);
+ }
+ GL_Clear((invalidated ? 0 : GL_COLOR_BUFFER_BIT) | GL_DEPTH_BUFFER_BIT | (vid.stencil ? GL_STENCIL_BUFFER_BIT : 0), clearcolor, 1.0f, 128);
}
int r_stereo_side;
cvar_t r_depthfirst = {CVAR_SAVE, "r_depthfirst", "0", "renders a depth-only version of the scene before normal rendering begins to eliminate overdraw, values: 0 = off, 1 = world depth, 2 = world and model depth"};
cvar_t r_skylast = {CVAR_SAVE, "r_skylast", "0", "renders sky after normal rendering ends to eliminate overdraw, values: 0 = nodepth sky first, 1 = sky after depth pass(if enabled), 2 = sky after world, 3 = sky after entities"};
+cvar_t r_fbdiscard = {CVAR_SAVE, "r_fbdiscard", "0", "Discard color buffer, increases performance, but creates visual glitches in menu"};
cvar_t r_useinfinitefarclip = {CVAR_SAVE, "r_useinfinitefarclip", "1", "enables use of a special kind of projection matrix that has an extremely large farclip"};
cvar_t r_farclip_base = {0, "r_farclip_base", "65536", "farclip (furthest visible distance) for rendering when r_useinfinitefarclip is 0"};
cvar_t r_farclip_world = {0, "r_farclip_world", "2", "adds map size to farclip multiplied by this value"};
Cvar_RegisterVariable(&r_equalize_entities_to);
Cvar_RegisterVariable(&r_depthfirst);
Cvar_RegisterVariable(&r_skylast);
+ Cvar_RegisterVariable(&r_fbdiscard);
Cvar_RegisterVariable(&r_useinfinitefarclip);
Cvar_RegisterVariable(&r_farclip_base);
Cvar_RegisterVariable(&r_farclip_world);
extern void (GLAPIENTRY *qglPointSize)(GLfloat size);
+extern void (GLAPIENTRY *qglInvalidateFramebuffer)(GLenum target, GLsizei numAttachments, const GLenum *attachments);
+
//GL_EXT_packed_depth_stencil
#define GL_DEPTH_STENCIL_EXT 0x84F9
#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
cvar_t r_skyscroll1 = {CVAR_SAVE, "r_skyscroll1", "1", "speed at which upper clouds layer scrolls in quake sky"};
cvar_t r_skyscroll2 = {CVAR_SAVE, "r_skyscroll2", "2", "speed at which lower clouds layer scrolls in quake sky"};
cvar_t r_sky_scissor = {0, "r_sky_scissor", "1", "limit rendering of sky to approximately the area of the sky surfaces"};
-extern cvar_t r_skylast;
int skyrenderlater;
int skyrendermasked;
int skyscissor[4];
extern cvar_t r_skyscroll1;
extern cvar_t r_skyscroll2;
extern cvar_t r_sky_scissor;
+extern cvar_t r_skylast;
extern cvar_t r_q3bsp_renderskydepth;
extern int skyrenderlater, skyrendermasked;
extern int skyscissor[4];
extern cvar_t r_render;
extern cvar_t r_renderview;
extern cvar_t r_waterwarp;
+extern cvar_t r_fbdiscard;
extern cvar_t r_textureunits;
void (GLAPIENTRY *qglLineWidth)(GLfloat width);
void (GLAPIENTRY *qglPointSize)(GLfloat size);
+void (GLAPIENTRY *qglInvalidateFramebuffer)(GLenum target, GLsizei numAttachments, const GLenum *attachments);
+
void (GLAPIENTRY *qglBlendEquationEXT)(GLenum);
void (GLAPIENTRY *qglStencilOpSeparate)(GLenum, GLenum, GLenum, GLenum);
{NULL, NULL}
};
+static dllfunction_t invalidatesubdatafuncs[] =
+{
+ {"glInvalidateFramebuffer", (void**) &qglInvalidateFramebuffer},
+ {NULL, NULL}
+};
static dllfunction_t gl20shaderfuncs[] =
{
{"glDeleteShader", (void **) &qglDeleteShader},
vid.support.ati_separate_stencil = GL_CheckExtension("separatestencil", gl2separatestencilfuncs, "-noseparatestencil", true) || GL_CheckExtension("GL_ATI_separate_stencil", atiseparatestencilfuncs, "-noseparatestencil", false);
vid.support.ext_blend_minmax = GL_CheckExtension("GL_EXT_blend_minmax", blendequationfuncs, "-noblendminmax", false);
vid.support.ext_blend_subtract = GL_CheckExtension("GL_EXT_blend_subtract", blendequationfuncs, "-noblendsubtract", false);
+ GL_CheckExtension("GL_ARB_invalidate_subdata", invalidatesubdatafuncs, "-noinvalidate", false);
vid.support.ext_blend_func_separate = GL_CheckExtension("GL_EXT_blend_func_separate", blendfuncseparatefuncs, "-noblendfuncseparate", false);
vid.support.ext_draw_range_elements = GL_CheckExtension("drawrangeelements", drawrangeelementsfuncs, "-nodrawrangeelements", true) || GL_CheckExtension("GL_EXT_draw_range_elements", drawrangeelementsextfuncs, "-nodrawrangeelements", false);
vid.support.arb_framebuffer_object = GL_CheckExtension("GL_ARB_framebuffer_object", arbfbofuncs, "-nofbo", false);