1 parent
e00f8f6cee
commit
94f1ec18de
8 files changed
+18
-76
No files matched your search
@@ -287,9 +287,7 @@ typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
#ifdef GL_VERSION_3_0
|
||||
HWD_SET_FRAMEBUFFER,
|
||||
#endif
|
||||
HWD_SET_SHADERS,
|
||||
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
|
||||
+9
-19
@@ -70,9 +70,7 @@ static boolean gr_palette_rendering_state = false;
|
||||
// Commands and console variables
|
||||
// ==========================================================================
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
static void CV_grframebuffer_OnChange(void);
|
||||
#endif
|
||||
static void CV_filtermode_ONChange(void);
|
||||
static void CV_anisotropic_ONChange(void);
|
||||
static void CV_screentextures_ONChange(void);
|
||||
@@ -100,9 +98,7 @@ consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL,
|
||||
|
||||
consvar_t cv_grbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
consvar_t cv_grframebuffer = {"gr_framebuffer", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, CV_grframebuffer_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
consvar_t cv_grfofcut = {"gr_fofcut", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -170,6 +166,14 @@ consvar_t cv_grhorizonlines = {"gr_horizonlines", "On", CV_SAVE, CV_OnOff, NULL,
|
||||
|
||||
#define ONLY_IF_GL_LOADED if (vid.glstate != VID_GL_LIBRARY_LOADED) return;
|
||||
|
||||
static void CV_grframebuffer_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_grframebuffer.value);
|
||||
I_DownSample();
|
||||
RefreshSDLSurface();
|
||||
}
|
||||
|
||||
static void CV_filtermode_ONChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
@@ -216,16 +220,6 @@ static void CV_grpalettedepth_OnChange(void)
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
}
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
static void CV_grframebuffer_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_grframebuffer.value);
|
||||
I_DownSample();
|
||||
RefreshSDLSurface();
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Sets the shader state.
|
||||
//
|
||||
@@ -5954,9 +5948,7 @@ void HWR_TogglePaletteRendering(void)
|
||||
//added by Hurdler: console varibale that are saved
|
||||
void HWR_AddCommands(void)
|
||||
{
|
||||
#ifdef GL_VERSION_3_0
|
||||
CV_RegisterVar(&cv_grframebuffer);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_grfiltermode);
|
||||
CV_RegisterVar(&cv_granisotropicmode);
|
||||
CV_RegisterVar(&cv_grsolvetjoin);
|
||||
@@ -6019,10 +6011,8 @@ void HWR_Startup(void)
|
||||
HWR_LoadAllCustomShaders();
|
||||
|
||||
HWR_TogglePaletteRendering();
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
|
||||
HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_grframebuffer.value);
|
||||
#endif
|
||||
|
||||
if (msaa)
|
||||
{
|
||||
|
||||
@@ -150,9 +150,7 @@ void HWR_SetShaderState(void);
|
||||
|
||||
// Console variables
|
||||
extern consvar_t cv_grshaders;
|
||||
#ifdef GL_VERSION_3_0
|
||||
extern consvar_t cv_grframebuffer;
|
||||
#endif
|
||||
extern consvar_t cv_grfofcut;
|
||||
extern consvar_t cv_fofzfightfix;
|
||||
extern consvar_t cv_splitwallfix;
|
||||
|
||||
@@ -119,12 +119,11 @@ static GLfloat modelMatrix[16];
|
||||
GLfloat projMatrix[16];
|
||||
static GLint viewport[4];
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
static boolean GLFramebuffer_IsFuncAvailible(void);
|
||||
|
||||
|
||||
GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
|
||||
GLboolean FrameBufferEnabled = GL_FALSE, RenderToFramebuffer = GL_FALSE;
|
||||
#endif
|
||||
|
||||
// Sryder: NextTexAvail is broken for these because palette changes or changes to the texture filter or antialiasing
|
||||
// flush all of the stored textures, leaving them unavailable at times such as between levels
|
||||
@@ -457,7 +456,6 @@ static PFNglRenderbufferStorage pglRenderbufferStorage;
|
||||
typedef void (APIENTRY * PFNglFramebufferRenderbuffer) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLenum renderbuffer);
|
||||
static PFNglFramebufferRenderbuffer pglFramebufferRenderbuffer;
|
||||
#endif
|
||||
#endif //!STATIC_OPENGL
|
||||
|
||||
/* 1.2 functions for 3D textures */
|
||||
typedef void (APIENTRY * PFNglTexImage3D) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
@@ -742,7 +740,6 @@ void SetupGLFunc4(void)
|
||||
pglUniform3fv = GetGLFunc("glUniform3fv");
|
||||
pglGetUniformLocation = GetGLFunc("glGetUniformLocation");
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
if (GLFramebuffer_IsFuncAvailible())
|
||||
{
|
||||
pglGenFramebuffers = GetGLFunc("glGenFramebuffers");
|
||||
@@ -758,14 +755,12 @@ void SetupGLFunc4(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
static boolean GLFramebuffer_IsFuncAvailible(void)
|
||||
{
|
||||
return((isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions)) &&
|
||||
(isExtAvailable("GL_ARB_framebuffer_object",gl_extensions)) &&
|
||||
(isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions)));
|
||||
}
|
||||
#endif
|
||||
|
||||
EXPORT boolean HWRAPI(InitShaders) (void)
|
||||
{
|
||||
@@ -1102,7 +1097,6 @@ void GLFramebuffer_Disable(void)
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
// -----------------+
|
||||
// DeleteTexture : Deletes a texture from the GPU and frees its data
|
||||
@@ -2314,14 +2308,14 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
case HWD_SET_SHADERS:
|
||||
gl_allowshaders = Value;
|
||||
break;
|
||||
#ifdef GL_VERSION_3_0
|
||||
|
||||
case HWD_SET_FRAMEBUFFER:
|
||||
FrameBufferEnabled = Value ? GL_TRUE : GL_FALSE;
|
||||
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
FrameBufferEnabled = GL_FALSE;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case HWD_SET_TEXTUREFILTERMODE:
|
||||
switch (Value)
|
||||
{
|
||||
|
||||
@@ -104,7 +104,6 @@ static PFNglEnableClientState pglEnableClientState;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
void GLFramebuffer_Generate(void);
|
||||
void GLFramebuffer_Delete(void);
|
||||
|
||||
@@ -116,7 +115,6 @@ void GLFramebuffer_Disable(void);
|
||||
|
||||
extern GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
|
||||
extern GLboolean FrameBufferEnabled, RenderToFramebuffer;
|
||||
#endif
|
||||
|
||||
// ==========================================================================
|
||||
// GLOBAL
|
||||
|
||||
@@ -141,12 +141,7 @@ void RefreshSDLSurface(void);
|
||||
|
||||
boolean I_UseNativeKeyboard(void);
|
||||
|
||||
#ifdef HWRENDER
|
||||
#ifdef GL_VERSION_3_0
|
||||
void RefreshSDLSurface(void);
|
||||
void I_DownSample(void);
|
||||
extern boolean downsample;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+2
-23
@@ -215,15 +215,14 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
|
||||
//static void Impl_SetWindowName(const char *title);
|
||||
static void Impl_SetWindowIcon(void);
|
||||
|
||||
#ifdef HWRENDER
|
||||
#ifdef GL_VERSION_3_0
|
||||
boolean downsample = false;
|
||||
|
||||
#ifdef HWRENDER
|
||||
void RefreshSDLSurface(void)
|
||||
{
|
||||
OglSdlSurface(vid.width, vid.height);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||
{
|
||||
@@ -746,8 +745,6 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
|
||||
return raxis;
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
#ifdef GL_VERSION_3_0
|
||||
void I_DownSample(void)
|
||||
{
|
||||
if (!cv_grframebuffer.value)
|
||||
@@ -772,19 +769,13 @@ void I_DownSample(void)
|
||||
else
|
||||
downsample = false; // couldnt get display info so turn the thing off
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
{
|
||||
static SDL_bool firsttimeonmouse = SDL_TRUE;
|
||||
static SDL_bool mousefocus = SDL_TRUE;
|
||||
static SDL_bool kbfocus = SDL_TRUE;
|
||||
#ifdef HWRENDER
|
||||
#ifdef GL_VERSION_3_0
|
||||
static SDL_bool windowmoved = SDL_FALSE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
switch (evt.event)
|
||||
{
|
||||
@@ -804,13 +795,9 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
break;
|
||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
||||
break;
|
||||
#ifdef HWRENDER
|
||||
#ifdef GL_VERSION_3_0
|
||||
case SDL_WINDOWEVENT_MOVED:
|
||||
windowmoved = SDL_TRUE;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
if (mousefocus && kbfocus)
|
||||
@@ -850,14 +837,10 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
#ifdef GL_VERSION_3_0
|
||||
if (windowmoved)
|
||||
{
|
||||
I_DownSample();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
|
||||
@@ -1936,11 +1919,7 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||
}
|
||||
//Impl_SetWindowName("SRB2Kart "VERSIONSTRING);
|
||||
|
||||
#ifdef HWRENDER
|
||||
#ifdef GL_VERSION_3_0
|
||||
I_DownSample();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
|
||||
Impl_VideoSetupBuffer();
|
||||
|
||||
+4
-14
@@ -171,10 +171,8 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
supportMipMap = true;
|
||||
|
||||
granisotropicmode_cons_t[1].value = maximumAnisotropy;
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
|
||||
I_DownSample();
|
||||
#endif
|
||||
}
|
||||
first_init = true;
|
||||
|
||||
@@ -192,9 +190,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
if (screen_width != w || screen_height != h)
|
||||
{
|
||||
FlushScreenTextures();
|
||||
#ifdef GL_VERSION_3_0
|
||||
GLFramebuffer_DeleteAttachments();
|
||||
#endif
|
||||
}
|
||||
|
||||
screen_width = (GLint)w;
|
||||
@@ -203,14 +199,12 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
SetModelView(w, h);
|
||||
SetStates();
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
|
||||
RenderToFramebuffer = FrameBufferEnabled;
|
||||
GLFramebuffer_Disable();
|
||||
|
||||
if (RenderToFramebuffer && downsample)
|
||||
GLFramebuffer_Enable();
|
||||
#endif
|
||||
|
||||
HWR_Startup();
|
||||
textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
|
||||
@@ -245,18 +239,14 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
|
||||
SDL_GetWindowSize(window, &sdlw, &sdlh);
|
||||
HWR_MakeScreenFinalTexture();
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
|
||||
GLFramebuffer_Disable();
|
||||
RenderToFramebuffer = FrameBufferEnabled;
|
||||
#endif
|
||||
|
||||
HWR_DrawScreenFinalTexture(sdlw, sdlh);
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
|
||||
if (RenderToFramebuffer && downsample)
|
||||
GLFramebuffer_Enable();
|
||||
#endif
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
|
||||
|
||||
Reference in new issue
Block a user